summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/samples
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-05-18 12:50:07 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-05-18 12:50:07 +0000
commit807edeace85749e290c430537ad9bb8dc89714ab (patch)
tree6aba4a9b97fa7965cdb7d9cf4024db74b5938475 /sca-java-2.x/trunk/samples
parenteceba3a4ec3ada82b978352a934bb9eca019c6ba (diff)
Add the binding-rmi contribution into the jse launcher
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@945630 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/samples')
-rw-r--r--sca-java-2.x/trunk/samples/launcher-embedded-jse/build.xml14
-rw-r--r--sca-java-2.x/trunk/samples/launcher-embedded-jse/src/main/java/calculator/CalculatorService.java3
-rw-r--r--sca-java-2.x/trunk/samples/launcher-embedded-jse/src/main/java/launcher/SampleJSELauncher.java21
3 files changed, 38 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/samples/launcher-embedded-jse/build.xml b/sca-java-2.x/trunk/samples/launcher-embedded-jse/build.xml
index 74f613109f..62cb57704d 100644
--- a/sca-java-2.x/trunk/samples/launcher-embedded-jse/build.xml
+++ b/sca-java-2.x/trunk/samples/launcher-embedded-jse/build.xml
@@ -81,5 +81,19 @@
<arg value="contribution-binding-ws-calculator"/>
</java>
</target>
+
+ <target name="run-contribution-binding-rmi-calculator" depends="compile">
+ <java classname="${main.class}"
+ fork="true"
+ failonerror="true">
+ <classpath>
+ <pathelement location="target/${jar.name}"/>
+ <fileset dir="${tuscany.home}/features">
+ <include name="tuscany-sca-manifest.jar" />
+ </fileset>
+ </classpath>
+ <arg value="contribution-binding-rmi-calculator"/>
+ </java>
+ </target>
</project>
diff --git a/sca-java-2.x/trunk/samples/launcher-embedded-jse/src/main/java/calculator/CalculatorService.java b/sca-java-2.x/trunk/samples/launcher-embedded-jse/src/main/java/calculator/CalculatorService.java
index ad87375529..12d80ffd1c 100644
--- a/sca-java-2.x/trunk/samples/launcher-embedded-jse/src/main/java/calculator/CalculatorService.java
+++ b/sca-java-2.x/trunk/samples/launcher-embedded-jse/src/main/java/calculator/CalculatorService.java
@@ -18,10 +18,13 @@
*/
package calculator;
+import org.oasisopen.sca.annotation.Remotable;
+
/**
* The Calculator service interface.
*/
+@Remotable
public interface CalculatorService {
double add(double n1, double n2);
diff --git a/sca-java-2.x/trunk/samples/launcher-embedded-jse/src/main/java/launcher/SampleJSELauncher.java b/sca-java-2.x/trunk/samples/launcher-embedded-jse/src/main/java/launcher/SampleJSELauncher.java
index 79bd8403e6..a4f9247503 100644
--- a/sca-java-2.x/trunk/samples/launcher-embedded-jse/src/main/java/launcher/SampleJSELauncher.java
+++ b/sca-java-2.x/trunk/samples/launcher-embedded-jse/src/main/java/launcher/SampleJSELauncher.java
@@ -48,6 +48,8 @@ public class SampleJSELauncher extends RuntimeIntegration {
launcher.launchBindingSCACalculator();
} else if (contribution.equals("contribution-binding-ws-calculator")){
launcher.launchBindingWSCalculator();
+ } else if (contribution.equals("contribution-binding-rmi-calculator")){
+ launcher.launchBindingRMICalculator();
} else {
System.out.println("Sample contribution " + contribution + "not found");
}
@@ -87,4 +89,23 @@ public class SampleJSELauncher extends RuntimeIntegration {
stopNode(node);
}
+ /*
+ * Using a Tuscany specific mechanism for getting at local service proxies
+ */
+ public void launchBindingRMICalculator(){
+ Node node1 = startNode(new Contribution("c1", "../binding-rmi/contribution-calculator-service/target/classes"));
+ Node node2 = startNode(new Contribution("c1", "../binding-rmi/contribution-calculator-reference/target/classes"));
+
+ CalculatorService calculator = node2.getService(CalculatorService.class, "CalculatorServiceComponent");
+ // TODO - could use JUnit assertions but don't want to have to handle JUnit dependency from Ant script
+ double result = calculator.add(3, 2);
+ System.out.println("3 + 2 = " + result);
+ if (result != 5.0){
+ throw new SampleLauncherException();
+ }
+
+ stopNode(node2);
+ stopNode(node1);
+ }
+
}