summaryrefslogtreecommitdiffstats
path: root/java/sca/itest/exceptions/src/test
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/exceptions/src/test
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/exceptions/src/test')
-rw-r--r--java/sca/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/ExceptionsTestCase.java58
1 files changed, 35 insertions, 23 deletions
diff --git a/java/sca/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/ExceptionsTestCase.java b/java/sca/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/ExceptionsTestCase.java
index f84205c096..7794348476 100644
--- a/java/sca/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/ExceptionsTestCase.java
+++ b/java/sca/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/ExceptionsTestCase.java
@@ -18,56 +18,68 @@
*/
package org.apache.tuscany.sca.test.exceptions;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
-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.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
-public class ExceptionsTestCase extends TestCase {
+public class ExceptionsTestCase {
- private SCADomain domain;
+ private static Node node;
/**
* Test exception handling over a local interface
*/
+ @Test
public void testLocal() {
- ExceptionHandler exceptionHandler = domain.getService(ExceptionHandler.class, "main");
+ ExceptionHandler exceptionHandler = node.getService(ExceptionHandler.class, "main");
exceptionHandler.testing();
- assertEquals(ExceptionThrower.SO_THEY_SAY, exceptionHandler.getTheGood() );
+ assertEquals(ExceptionThrower.SO_THEY_SAY, exceptionHandler.getTheGood());
assertNotNull(exceptionHandler.getTheBad());
- assertEquals( Checked.class, exceptionHandler.getTheBad().getClass());
+ assertEquals(Checked.class, exceptionHandler.getTheBad().getClass());
assertSame(ExceptionThrower.BAD, exceptionHandler.getTheBad());
assertNotNull(exceptionHandler.getTheUgly());
- assertEquals( UnChecked.class, exceptionHandler.getTheUgly().getClass());
+ assertEquals(UnChecked.class, exceptionHandler.getTheUgly().getClass());
assertSame(ExceptionThrower.UGLY, exceptionHandler.getTheUgly());
}
-
+
/**
* Test exception handling over a remotable interface
*/
+ @Test
public void testRemote() {
- ExceptionHandler exceptionHandler = domain.getService(ExceptionHandler.class, "mainRemote");
+ ExceptionHandler exceptionHandler = node.getService(ExceptionHandler.class, "mainRemote");
exceptionHandler.testing();
- assertEquals(ExceptionThrower.SO_THEY_SAY, exceptionHandler.getTheGood() );
+ assertEquals(ExceptionThrower.SO_THEY_SAY, exceptionHandler.getTheGood());
assertNotNull(exceptionHandler.getTheBad());
- assertEquals( Checked.class, exceptionHandler.getTheBad().getClass());
+ assertEquals(Checked.class, exceptionHandler.getTheBad().getClass());
assertNotSame(ExceptionThrower.BAD, exceptionHandler.getTheBad());
assertNotNull(exceptionHandler.getTheUgly());
- assertEquals( UnChecked.class, exceptionHandler.getTheUgly().getClass());
-
+ assertEquals(UnChecked.class, exceptionHandler.getTheUgly().getClass());
+
// [rfeng] We're not in a position to copy non business exceptions
// assertNotSame(ExceptionThrower.UGLY, exceptionHandler.getTheUgly());
}
-
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("ExceptionTest.composite");
+ @BeforeClass
+ public static void setUp() throws Exception {
+ String location = ContributionLocationHelper.getContributionLocation("ExceptionTest.composite");
+ node = NodeFactory.newInstance().createNode("ExceptionTest.composite", new Contribution("c1", location));
+ node.start();
}
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.stop();
}
-
+
}