summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkwilliams <kwilliams@13f79535-47bb-0310-9956-ffa450edef68>2008-07-03 15:33:26 +0000
committerkwilliams <kwilliams@13f79535-47bb-0310-9956-ffa450edef68>2008-07-03 15:33:26 +0000
commit15edefdfc3b87b4af8734566c3e4530ab9e0d8f6 (patch)
tree42fed161056338d26ec9432edccb64259db9335e
parentbba3304f3fa20b4323340ac6fc925434255b21f3 (diff)
Test for duplicate component names
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@673710 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/sca/vtest/assembly/component/src/main/resources/nonuniquename.composite33
-rw-r--r--java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java39
2 files changed, 62 insertions, 10 deletions
diff --git a/java/sca/vtest/assembly/component/src/main/resources/nonuniquename.composite b/java/sca/vtest/assembly/component/src/main/resources/nonuniquename.composite
new file mode 100644
index 0000000000..d53e2ba776
--- /dev/null
+++ b/java/sca/vtest/assembly/component/src/main/resources/nonuniquename.composite
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://assembly-tests"
+ name="Assemby-non-unique-name--Composite">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.assembly.component.impl.AServiceImpl"/>
+ </component>
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.assembly.component.impl.BServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java b/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java
index 84e141c031..379a19b238 100644
--- a/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java
+++ b/java/sca/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java
@@ -22,15 +22,25 @@ package org.apache.tuscany.sca.vtest.assembly.component;
import junit.framework.Assert;
import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.junit.Ignore;
import org.junit.Test;
+import org.osoa.sca.ConversationEndedException;
/**
*
*/
public class ComponentTestCase {
+ private void initDomain(String compositePath) {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositePath);
+ }
+
+ private void cleanupDomain() {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+
/**
* Lines 92-96:
* <p>
@@ -41,13 +51,11 @@ public class ComponentTestCase {
*/
@Test
public void components1() throws Exception {
- System.out.println("Setting up");
- ServiceFinder.init("component.composite");
+ initDomain("component.composite");
AService service = ServiceFinder.getService(AService.class, "AComponent/AService");
Assert.assertEquals("some b component value", service.getBProperty());
Assert.assertEquals("some b2 component value", service.getB2Property());
- System.out.println("Cleaning up");
- ServiceFinder.cleanup();
+ cleanupDomain();
}
/**
@@ -57,10 +65,21 @@ public class ComponentTestCase {
*/
@Test
public void components2() throws Exception {
- System.out.println("Setting up");
- ServiceFinder.init("zerocomponents.composite");
- System.out.println("Cleaning up");
- ServiceFinder.cleanup();
+ initDomain("zerocomponents.composite");
+ cleanupDomain();
+ }
+
+ /**
+ * Lines 142-143:
+ * <p>
+ * name (required) – the name of the component. The name must be unique
+ * across all the components in the composite.
+ */
+ @Test(expected = RuntimeException.class)
+ @Ignore("TUSCANY-2455")
+ public void components3() throws Exception {
+ initDomain("nonuniquename.composite");
+ cleanupDomain();
}
}