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/callback-ws-client | |
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 'branches/sca-java-1.3/samples/callback-ws-client')
2 files changed, 18 insertions, 17 deletions
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();
- }
+ }
}
|