diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-05-13 14:05:00 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-05-13 14:05:00 +0000 |
commit | 8a532888d0433a9f680270011174b7b768d107de (patch) | |
tree | e3fd7eb52115a25a20ed51bd7a90079bc3d8c792 /sca-java-2.x/trunk/itest/scaclient-api-remote/src | |
parent | e96e508eed9636903d2e76d2ce6020856f7f3333 (diff) |
Add some tests to the sca client tests
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@943888 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/itest/scaclient-api-remote/src')
-rw-r--r-- | sca-java-2.x/trunk/itest/scaclient-api-remote/src/test/java/test/scaclient/SCAClientTestCase.java | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/sca-java-2.x/trunk/itest/scaclient-api-remote/src/test/java/test/scaclient/SCAClientTestCase.java b/sca-java-2.x/trunk/itest/scaclient-api-remote/src/test/java/test/scaclient/SCAClientTestCase.java index b61ae890bc..0ae70d6c3f 100644 --- a/sca-java-2.x/trunk/itest/scaclient-api-remote/src/test/java/test/scaclient/SCAClientTestCase.java +++ b/sca-java-2.x/trunk/itest/scaclient-api-remote/src/test/java/test/scaclient/SCAClientTestCase.java @@ -20,6 +20,7 @@ package test.scaclient;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
import itest.HelloworldService;
import java.net.URI;
@@ -30,6 +31,7 @@ import org.junit.After; import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.oasisopen.sca.NoSuchDomainException;
import org.oasisopen.sca.client.SCAClientFactory;
/**
@@ -52,7 +54,7 @@ public class SCAClientTestCase { @Test
public void testDefault() throws Exception {
- node = NodeFactory.getInstance().createNode(URI.create("SCAClientTestCaseDomain"),(String)null, new String[] {"target/classes"});
+ node = NodeFactory.newInstance().createNode((String)null, new String[] {"target/classes"});
node.start();
HelloworldService service = SCAClientFactory.newInstance(URI.create("default")).getService(HelloworldService.class, "HelloworldComponent");
@@ -60,30 +62,48 @@ public class SCAClientTestCase { }
@Test
+ public void testURIconfig() throws Exception {
+
+ node = NodeFactory.newInstance("uri:somedomain").createNode((String)null, new String[] {"target/classes"});
+ node.start();
+
+ HelloworldService service = SCAClientFactory.newInstance(URI.create("somedomain")).getService(HelloworldService.class, "HelloworldComponent");
+ assertEquals("Hello petra", service.sayHello("petra"));
+ try {
+ service = SCAClientFactory.newInstance(URI.create("nosuchdomain")).getService(HelloworldService.class, "HelloworldComponent");
+ service.sayHello("petra");
+ fail();
+ } catch (Exception e) {
+ if (!(e.getCause() instanceof NoSuchDomainException)) {
+ throw e;
+ }
+ }
+ }
+
+ @Test
public void testExplicit() throws Exception {
- node = NodeFactory.getInstance().createNode(URI.create("myFooDomain"), new String[] {"target/classes"});
+ node = NodeFactory.newInstance().createNode(URI.create("myFooDomain"), new String[] {"target/classes"});
node.start();
HelloworldService service = SCAClientFactory.newInstance(URI.create("myFooDomain")).getService(HelloworldService.class, "HelloworldComponent");
- String s= service.sayHello("petra");
assertEquals("Hello petra", service.sayHello("petra"));
}
@Test
public void testExplicitRemote() throws Exception {
- node = NodeFactory.newInstance().createNode(URI.create("tuscany:myFooDomain?listen=127.0.0.1:14821"), new String[] {"target/classes"});
+ node = NodeFactory.newInstance("uri:myFooDomain?bind=127.0.0.1:14821").createNode((String)null, new String[] {"target/classes"});
node.start();
- HelloworldService service = SCAClientFactory.newInstance(URI.create("tuscany:myFooDomain?remotes=127.0.0.1:14821")).getService(HelloworldService.class, "HelloworldComponent");
+ HelloworldService service = SCAClientFactory.newInstance(URI.create("uri:myFooDomain?wka=127.0.0.1:14821")).getService(HelloworldService.class, "HelloworldComponent");
assertEquals("Hello petra", service.sayHello("petra"));
}
@Test
public void testExplicitRemote2() throws Exception {
- node = NodeFactory.getInstance().createNode(URI.create("tuscany:myFooDomain?listen=127.0.0.1:14821"), new String[] {"target/classes"});
+ node = NodeFactory.newInstance("uri:myFooDomain?bind=127.0.0.1:14821").createNode((String)null, new String[] {"target/classes"});
node.start();
- HelloworldService service = SCAClientFactory.newInstance(URI.create("tuscany:myFooDomain?remotes=127.0.0.1:14821")).getService(HelloworldService.class, "HelloworldComponent");
+ HelloworldService service = SCAClientFactory.newInstance(URI.create("uri:myFooDomain?wka=127.0.0.1:14821")).getService(HelloworldService.class, "HelloworldComponent");
assertEquals("Hello petra", service.sayHello("petra"));
}
|