summaryrefslogtreecommitdiffstats
path: root/java/sca/itest/operation-overloading
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-12-05 00:48:31 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-12-05 00:48:31 +0000
commitf44c07576a61f6f4915ea8fd2aa5af9fee71745f (patch)
treeda023390d4bb97f353cdff9e6ca11a3f2eb9236b /java/sca/itest/operation-overloading
parent10a9f2e5c0be26d6a44f1f90b677b9c5b7f985a9 (diff)
Convert, clean and bring up a set of itests
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@723537 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/itest/operation-overloading')
-rw-r--r--java/sca/itest/operation-overloading/pom.xml12
-rw-r--r--java/sca/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java44
2 files changed, 39 insertions, 17 deletions
diff --git a/java/sca/itest/operation-overloading/pom.xml b/java/sca/itest/operation-overloading/pom.xml
index 9cfa1e6318..7092f47984 100644
--- a/java/sca/itest/operation-overloading/pom.xml
+++ b/java/sca/itest/operation-overloading/pom.xml
@@ -31,15 +31,23 @@
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
+ <artifactId>tuscany-node-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-SNAPSHOT</version>
- <scope>runtime</scope>
+ <scope>test</scope>
</dependency>
+
</dependencies>
</project>
diff --git a/java/sca/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java b/java/sca/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java
index 0b3b12c762..62e5c14ce2 100644
--- a/java/sca/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java
+++ b/java/sca/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java
@@ -18,20 +18,26 @@
*/
package org.apache.tuscany.sca.test.opoverload.impl;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
import org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+public class OverloadATestCase {
-public class OverloadATestCase extends TestCase {
-
- private SCADomain domain;
- private OverloadASourceTarget overloadA;
+ private static Node node;
+ private static OverloadASourceTarget overloadA;
/**
* Method prefixed with 'test' is a test method where testing logic is written using various assert methods. This
* test verifies the values compared are same as the values retrieved from the SCA runtime.
*/
+ @Test
public void testOperationAall() {
String[] result = overloadA.operationAall();
assertEquals(5, result.length);
@@ -42,21 +48,25 @@ public class OverloadATestCase extends TestCase {
assertEquals(OverloadASourceTarget.opName + "four" + 4, result[4]);
}
+ @Test
public void testOperationAInt() {
String result = overloadA.operationA(29);
assertEquals(OverloadASourceTarget.opName + 29, result);
}
+ @Test
public void testOperationAString() {
String result = overloadA.operationA("rick:-)");
assertEquals(OverloadASourceTarget.opName + "rick:-)", result);
}
+ @Test
public void testOperationAIntString() {
String result = overloadA.operationA(123, "Tuscany");
assertEquals(OverloadASourceTarget.opName + 123 + "Tuscany", result);
}
+ @Test
public void testOperationStringInt() {
String result = overloadA.operationA("StringInt", 77);
assertEquals(OverloadASourceTarget.opName + "StringInt" + 77, result);
@@ -64,21 +74,25 @@ public class OverloadATestCase extends TestCase {
/**
* setUp() is a method in JUnit Frame Work which is executed before all others methods in the class extending
- * unit.framework.TestCase. So this method is used to create a test Embedded SCA Domain, to start the SCA Domain and
+ * unit.framework.TestCase. So this method is used to create a test Embedded SCA node, to start the SCA node and
* to get a reference to the contribution service
*/
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("OperationOverload.composite");
- overloadA = domain.getService(OverloadASourceTarget.class, "OverloadASourceComponent");
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ String location = ContributionLocationHelper.getContributionLocation("OperationOverload.composite");
+ node = NodeFactory.newInstance().createNode("OperationOverload.composite", new Contribution("c1", location));
+ node.start();
+ overloadA = node.getService(OverloadASourceTarget.class, "OverloadASourceComponent");
}
/**
* tearDown() is a method in JUnit Frame Work which is executed after all other methods in the class extending
- * unit.framework.TestCase. So this method is used to close the SCA domain.
+ * unit.framework.TestCase. So this method is used to close the SCA node.
*/
- @Override
- protected void tearDown() throws Exception {
- domain.close();
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.stop();
}
}