summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/vtest/assembly/ctypefile/src/test/java/org
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-12-03 10:17:21 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-12-03 10:17:21 +0000
commitb8d68b1f47a347d50dbe50ef2bad0ddb1d99d59d (patch)
tree48549d880b605d5132fc01d5201cc706c4c6ed25 /branches/sca-java-1.x/vtest/assembly/ctypefile/src/test/java/org
parent276f27b818ca77211642f5eb96e635d4f78f92ef (diff)
TUSCANY-2686 - Thanks for the patch Yiwen. Constraining type vtests. I don;t believe we exploit constraining type information just yet but the tests are inplace in the case that we decide to implement this feature.The negative test needs a little work still.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@722833 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/vtest/assembly/ctypefile/src/test/java/org')
-rw-r--r--branches/sca-java-1.x/vtest/assembly/ctypefile/src/test/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/CompomnentTypeFileTestCase.java84
1 files changed, 78 insertions, 6 deletions
diff --git a/branches/sca-java-1.x/vtest/assembly/ctypefile/src/test/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/CompomnentTypeFileTestCase.java b/branches/sca-java-1.x/vtest/assembly/ctypefile/src/test/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/CompomnentTypeFileTestCase.java
index f8f7e45f61..d2d2257277 100644
--- a/branches/sca-java-1.x/vtest/assembly/ctypefile/src/test/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/CompomnentTypeFileTestCase.java
+++ b/branches/sca-java-1.x/vtest/assembly/ctypefile/src/test/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/CompomnentTypeFileTestCase.java
@@ -31,23 +31,25 @@ import org.junit.Test;
*/
public class CompomnentTypeFileTestCase {
- protected static String compositeName = "typefile.composite";
+ //protected static String compositeName = "typefile.composite";
protected static AService aService = null;
protected static BService bService2 = null;
+ protected static CService cService = null;
+ protected static DService dService = null;
- @BeforeClass
- public static void init() throws Exception {
+ //@BeforeClass
+ public static void init(String compositeName) throws Exception {
try {
System.out.println("Setting up");
ServiceFinder.init(compositeName);
- aService = ServiceFinder.getService(AService.class, "AComponent/AService");
- bService2 = ServiceFinder.getService(BService.class, "BComponent2/BService");
+ //aService = ServiceFinder.getService(AService.class, "AComponent/AService");
+ //bService2 = ServiceFinder.getService(BService.class, "BComponent2/BService");
} catch (Exception ex) {
ex.printStackTrace();
}
}
- @AfterClass
+ //@AfterClass
public static void destroy() throws Exception {
System.out.println("Cleaning up");
@@ -74,7 +76,11 @@ public class CompomnentTypeFileTestCase {
*/
@Test
public void typeFile1() throws Exception {
+ init("typefile.composite");
+ aService = ServiceFinder.getService(AService.class, "AComponent/AService");
+ bService2 = ServiceFinder.getService(BService.class, "BComponent2/BService");
Assert.assertSame("SomeStateFromB", aService.getState());
+ destroy();
}
/**
@@ -89,8 +95,12 @@ public class CompomnentTypeFileTestCase {
*/
@Test
public void typeFile2() throws Exception {
+ init("typefile.composite");
+ aService = ServiceFinder.getService(AService.class, "AComponent/AService");
+ bService2 = ServiceFinder.getService(BService.class, "BComponent2/BService");
Assert.assertSame("SomeStateFromB", aService.getState());
Assert.assertSame("SomeStateFromB", aService.getState2());
+ destroy();
}
/**
@@ -101,11 +111,73 @@ public class CompomnentTypeFileTestCase {
*/
@Test
public void typeFile3() throws Exception {
+ init("typefile.composite");
+ aService = ServiceFinder.getService(AService.class, "AComponent/AService");
+ bService2 = ServiceFinder.getService(BService.class, "BComponent2/BService");
Assert.assertEquals("compositeValue", aService.getBProperty());
+ destroy();
}
public void typeFile31() throws Exception {
+ init("typefile.composite");
+ aService = ServiceFinder.getService(AService.class, "AComponent/AService");
+ bService2 = ServiceFinder.getService(BService.class, "BComponent2/BService");
Assert.assertEquals("componentTypeValue", bService2.getSomeProperty());
+ destroy();
}
+
+ /**
+ * Lines 2204-2205:
+ * <p>
+ * A constrainingType can be applied to an implementation. In this case,
+ * the implementation's componentType has a constrainingType attribute set to
+ * the QName of the constrainingType.
+ * <p>
+ * ASM40002
+ * <p>
+ * If present, the @constrainingType attribute of a <componentType/> element
+ * MUST reference a <constrainingType/> element in the Domain through its QName.
+ * <p>
+ * Description of how the OSOA function differs from the OASIS function:
+ * <p>
+ * The OASIS spec explicitly requires the <constrainingType/> element,
+ * whereas the OSOA spec implies the <constrainingType/> element is needed.
+ * <p>
+ */
+ @Test
+ public void ASM40002_positive() throws Exception {
+ System.out.println("Running ASM40002 positive test");
+ init("constrainingtype.composite");
+ cService = ServiceFinder.getService(CService.class, "CComponent/CService");
+ cService.getSomeProperty();
+ destroy();
+ }
+
+ /**
+ * Lines 2204-2205:
+ * <p>
+ * A constrainingType can be applied to an implementation. In this case,
+ * the implementation's componentType has a constrainingType attribute set to
+ * the QName of the constrainingType.
+ * <p>
+ * ASM40002
+ * <p>
+ * If present, the @constrainingType attribute of a <componentType/> element
+ * MUST reference a <constrainingType/> element in the Domain through its QName.
+ * <p>
+ * Description of how the OSOA function differs from the OASIS function:
+ * <p>
+ * The OASIS spec explicitly requires the <constrainingType/> element,
+ * whereas the OSOA spec implies the <constrainingType/> element is needed.
+ * <p>
+ */
+ @Test
+ public void ASM40002_negative() throws Exception {
+ System.out.println("Running ASM40002 negative test");
+ init("noconstrainingtype.composite");
+ dService = ServiceFinder.getService(DService.class, "DComponent/DService");
+ dService.getSomeProperty();
+ destroy();
+ }
}