diff options
Diffstat (limited to 'sca-java-2.x/trunk/samples')
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);
+ }
+
}
|