summaryrefslogtreecommitdiffstats
path: root/java/sca/samples
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-01-26 13:01:49 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-01-26 13:01:49 +0000
commitf1622acd69ebe014017e878805ece9a936e5026f (patch)
tree9555c394dafd1ea28bf0cbefe14378b3256b9bc9 /java/sca/samples
parentc503623822a97e10354923ac8d3fa790bff67960 (diff)
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
Diffstat (limited to 'java/sca/samples')
-rw-r--r--java/sca/samples/implementation-java-calculator/build.xml21
-rw-r--r--java/sca/samples/implementation-java-calculator/pom.xml8
-rw-r--r--java/sca/samples/implementation-java-calculator/src/main/java/calculator/CalculatorClient.java1
-rw-r--r--java/sca/samples/implementation-java-calculator/src/test/java/calculator/CalculatorTestCase.java16
4 files changed, 18 insertions, 28 deletions
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.
-->
+
<project name="implementation-java-calculator" default="run-jse"> <!-- could dertmine the same name autmatically -->
+ <import file="../build-common.xml"/>
+
<property name="sample.name" value="${ant.project.name}"/>
<property name="sample.root" value="."/>
<property name="sample.jar" value="${sample.root}/target/sample-${sample.name}.jar" />
- <available file="../../distribution/pom.xml" property="running.in.development"/>
-
- <target name="set-development" if="running.in.development">
- <property name="distro.root" value="../../distribution/all/target"/>
- </target>
- <target name="set-distribution" unless="running.in.development">
- <property name="distro.root" value="../.."/>
- </target>
-
- <target name="init" depends="set-development, set-distribution" >
-
- <mkdir dir="${sample.root}/target/classes"/>
- </target>
-
- <target name="compile" depends="init">
+ <target name="compile" depends="common-init">
<javac srcdir="${sample.root}/src/main/java"
destdir="${sample.root}/target/classes"
debug="on"
@@ -60,7 +49,7 @@
<java jar="${distro.root}/modules/tuscany-node-launcher-2.0-SNAPSHOT.jar"
fork="true"
inputstring="q">
- <jvmarg value="-Djava.util.logging.config.file=${sample.root}../../logging.properties"/>
+ <jvmarg value="-Djava.util.logging.config.file=${sample.root}/../../logging.properties"/>
<arg value="Calculator.composite"/>
<!-- would be good to have the node launcher run the first deployable
composite if this is not specified so I don't have to put it here -->
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 @@
<build>
<finalName>${artifactId}</finalName>
<plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
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);
}
}