From f1622acd69ebe014017e878805ece9a936e5026f Mon Sep 17 00:00:00 2001 From: slaws Date: Mon, 26 Jan 2009 13:01:49 +0000 Subject: Add some exception handling so that the JUnit test takes account of exceptions thrown in the "in-composite" client. Also exploit the common ant script. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@737683 13f79535-47bb-0310-9956-ffa450edef68 --- .../implementation-java-calculator/build.xml | 21 +++++---------------- .../samples/implementation-java-calculator/pom.xml | 8 -------- .../src/main/java/calculator/CalculatorClient.java | 1 + .../test/java/calculator/CalculatorTestCase.java | 16 ++++++++++++---- 4 files changed, 18 insertions(+), 28 deletions(-) (limited to 'java/sca/samples') diff --git a/java/sca/samples/implementation-java-calculator/build.xml b/java/sca/samples/implementation-java-calculator/build.xml index 513d8cdecd..5d38aa7441 100644 --- a/java/sca/samples/implementation-java-calculator/build.xml +++ b/java/sca/samples/implementation-java-calculator/build.xml @@ -16,26 +16,15 @@ * specific language governing permissions and limitations * under the License. --> + + + - - - - - - - - - - - - - - - + - + diff --git a/java/sca/samples/implementation-java-calculator/pom.xml b/java/sca/samples/implementation-java-calculator/pom.xml index 41a64174e7..be2d3a8012 100644 --- a/java/sca/samples/implementation-java-calculator/pom.xml +++ b/java/sca/samples/implementation-java-calculator/pom.xml @@ -62,14 +62,6 @@ ${artifactId} - - org.apache.maven.plugins - maven-surefire-plugin - - true - - - org.apache.maven.plugins maven-antrun-plugin diff --git a/java/sca/samples/implementation-java-calculator/src/main/java/calculator/CalculatorClient.java b/java/sca/samples/implementation-java-calculator/src/main/java/calculator/CalculatorClient.java index c193b2ce66..b7d035af7d 100644 --- a/java/sca/samples/implementation-java-calculator/src/main/java/calculator/CalculatorClient.java +++ b/java/sca/samples/implementation-java-calculator/src/main/java/calculator/CalculatorClient.java @@ -19,6 +19,7 @@ package calculator; +import org.osoa.sca.ServiceRuntimeException; import org.osoa.sca.annotations.EagerInit; import org.osoa.sca.annotations.Init; import org.osoa.sca.annotations.Reference; diff --git a/java/sca/samples/implementation-java-calculator/src/test/java/calculator/CalculatorTestCase.java b/java/sca/samples/implementation-java-calculator/src/test/java/calculator/CalculatorTestCase.java index b49e1da130..461c970373 100644 --- a/java/sca/samples/implementation-java-calculator/src/test/java/calculator/CalculatorTestCase.java +++ b/java/sca/samples/implementation-java-calculator/src/test/java/calculator/CalculatorTestCase.java @@ -23,6 +23,7 @@ import org.apache.tuscany.sca.node.equinox.launcher.Contribution; import org.apache.tuscany.sca.node.equinox.launcher.ContributionLocationHelper; import org.apache.tuscany.sca.node.equinox.launcher.NodeLauncher; import org.junit.AfterClass; +import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; @@ -32,7 +33,8 @@ import org.junit.Test; public class CalculatorTestCase { private static NodeLauncher launcher; - private static Node node; + private static Node node; + private static String status = "Sample Success"; public static void main(String[] args) throws Exception { setUpBeforeClass(); @@ -44,8 +46,13 @@ public class CalculatorTestCase { launcher = NodeLauncher.newInstance(); String location = ContributionLocationHelper.getContributionLocation(CalculatorClient.class); node = launcher.createNode("Calculator.composite", new Contribution("test", location)); - System.out.println("SCA Node API ClassLoader: " + node.getClass().getClassLoader()); - node.start(); + + try { + node.start(); + } catch (Exception ex) { + status = ex.toString(); + System.out.println(status); + } } @AfterClass @@ -60,6 +67,7 @@ public class CalculatorTestCase { } @Test - public void testDummy() throws Exception { + public void testSample() throws Exception { + Assert.assertEquals("Sample Success", status); } } -- cgit v1.2.3