diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-07-09 22:51:48 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-07-09 22:51:48 +0000 |
commit | 212e0b44dac194a5fa9a37c386985fa43bbf016b (patch) | |
tree | 960a4a5b4df1176baf7740b6cb256bc90c1a3603 /branches/sca-java-1.3/samples | |
parent | e7bad91576a64b9116cd04504df80639333b5be5 (diff) |
Merge fix for TUSCANY-2409 from trunk
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@675373 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
5 files changed, 33 insertions, 34 deletions
diff --git a/branches/sca-java-1.3/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java b/branches/sca-java-1.3/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java index 03826da49f..9c3f06ee53 100644 --- a/branches/sca-java-1.3/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java +++ b/branches/sca-java-1.3/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java @@ -54,9 +54,9 @@ public class CalculatorDistributedTestCase { manager.start();
SCANode2Factory nodeFactory = SCANode2Factory.newInstance();
- nodeC = nodeFactory.createSCANode("http://localhost:9990/node-config/NodeC");
- nodeB = nodeFactory.createSCANode("http://localhost:9990/node-config/NodeB");
- nodeA = nodeFactory.createSCANode("http://localhost:9990/node-config/NodeA");
+ nodeC = nodeFactory.createSCANodeFromURL("http://localhost:9990/node-config/NodeC");
+ nodeB = nodeFactory.createSCANodeFromURL("http://localhost:9990/node-config/NodeB");
+ nodeA = nodeFactory.createSCANodeFromURL("http://localhost:9990/node-config/NodeA");
nodeC.start();
nodeB.start();
diff --git a/branches/sca-java-1.3/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java b/branches/sca-java-1.3/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java index 5b1e4961ed..3d94973880 100644 --- a/branches/sca-java-1.3/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java +++ b/branches/sca-java-1.3/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java @@ -21,11 +21,9 @@ package myapp; import myserver.MyService;
import myserver.MyServiceCallback;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
import org.apache.tuscany.sca.node.SCAClient;
import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Scope;
import org.osoa.sca.annotations.Service;
@@ -51,12 +49,16 @@ public class MyClientImpl implements MyClient, MyServiceCallback { }
public static void main(String[] args) throws Exception {
- SCANode2 node = SCANode2Factory.newInstance().createSCANode("target/classes/myapp.composite", new SCAContribution("test", "target/classes"));
+ SCANode2 node = SCANode2Factory.newInstance().createSCANodeFromClassLoader("myapp.composite", MyClientImpl.class.getClassLoader());
node.start();
+ run(node);
+ System.out.println("Closing the domain");
+ node.stop();
+ }
+
+ public static void run(SCANode2 node) throws InterruptedException {
MyClient myClient = ((SCAClient)node).getService(MyClient.class, "MyClientComponent");
myClient.aClientMethod();
Thread.sleep(5000); // don't exit before callback arrives
- System.out.println("Closing the domain");
- node.stop();
}
}
diff --git a/branches/sca-java-1.3/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java b/branches/sca-java-1.3/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java index b0ed72e664..f11b0adfe4 100644 --- a/branches/sca-java-1.3/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java +++ b/branches/sca-java-1.3/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java @@ -20,7 +20,6 @@ package myapp; import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -33,22 +32,22 @@ public class CallbackClientTestCase { private SCANode2 node;
@Before
- public void startServer() throws Exception {
+ public void startServer() throws Exception {
try {
- node = SCANode2Factory.newInstance().createSCANode("jar:file:../callback-ws-service/target/sample-callback-ws-service.jar!/callbackws.composite", new SCAContribution("server", "../callback-ws-service/target/sample-callback-ws-service.jar"));
+ node = SCANode2Factory.newInstance().createSCANodeFromClassLoader(null, getClass().getClassLoader());
node.start();
} catch (Exception ex) {
System.out.println(ex.toString());
}
- }
+ }
- @Test
- public void testClient() throws Exception {
- MyClientImpl.main(null);
- }
-
- @After
- public void stopServer() throws Exception {
+ @Test
+ public void testClient() throws Exception {
+ MyClientImpl.run(node);
+ }
+
+ @After
+ public void stopServer() throws Exception {
node.stop();
- }
+ }
}
diff --git a/branches/sca-java-1.3/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java b/branches/sca-java-1.3/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java index b201777e69..9dfead61db 100644 --- a/branches/sca-java-1.3/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java +++ b/branches/sca-java-1.3/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java @@ -22,7 +22,6 @@ import java.io.IOException; import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
/**
* This server program shows how to create and start an SCA runtime that
@@ -32,7 +31,7 @@ public class CallbackServer { public static void main(String[] args) throws Exception {
- SCANode2 node = SCANode2Factory.newInstance().createSCANode("target/classes/callbackws.composite", new SCAContribution("test", "target/classes"));
+ SCANode2 node = SCANode2Factory.newInstance().createSCANodeFromClassLoader("callbackws.composite", null);
node.start();
try {
diff --git a/branches/sca-java-1.3/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java b/branches/sca-java-1.3/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java index c04365d01f..4208f7f6b5 100644 --- a/branches/sca-java-1.3/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java +++ b/branches/sca-java-1.3/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java @@ -23,7 +23,6 @@ import java.net.Socket; import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -36,18 +35,18 @@ public class CallbackServerTestCase { private SCANode2 node;
@Before
- public void startServer() throws Exception {
- node = SCANode2Factory.newInstance().createSCANode("target/classes/callbackws.composite", new SCAContribution("test", "target/classes"));
+ public void startServer() throws Exception {
+ node = SCANode2Factory.newInstance().createSCANodeFromClassLoader("callbackws.composite", null);
node.start();
- }
+ }
- @Test
- public void testPing() throws IOException {
- new Socket("127.0.0.1", 8086);
- }
-
- @After
- public void stopServer() throws Exception {
+ @Test
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8086);
+ }
+
+ @After
+ public void stopServer() throws Exception {
node.stop();
- }
+ }
}
|