diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2012-01-31 15:26:35 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2012-01-31 15:26:35 +0000 |
commit | 3400d2e1e16f6d8af44f0d5481208dd7aef165a8 (patch) | |
tree | 11daa69995cabc48927562ca692819ed10da7152 /sca-java-2.x/trunk/testing/itest/scaclient-api/src/test | |
parent | 74cdb705845c4dcc748706eb94d2476b01146e8e (diff) |
Add a few more tests for components with multiple services or bindings
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1238664 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/testing/itest/scaclient-api/src/test')
-rw-r--r-- | sca-java-2.x/trunk/testing/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java | 53 |
1 files changed, 44 insertions, 9 deletions
diff --git a/sca-java-2.x/trunk/testing/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java b/sca-java-2.x/trunk/testing/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java index c64350eb2a..ac3f3fd5a5 100644 --- a/sca-java-2.x/trunk/testing/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java +++ b/sca-java-2.x/trunk/testing/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java @@ -31,6 +31,7 @@ import org.apache.tuscany.sca.node.NodeFactory; import org.junit.Test; import org.oasisopen.sca.NoSuchDomainException; import org.oasisopen.sca.NoSuchServiceException; +import org.oasisopen.sca.ServiceRuntimeException; import org.oasisopen.sca.client.SCAClientFactory; /** @@ -71,15 +72,29 @@ public class SCAClientTestCase extends TestCase { assertEquals("Hello petra", service.sayHello("petra")); } -// @Test -// public void testWithoutServiceName() throws Exception { -// node = NodeFactory.getInstance().createNode(URI.create("myFooDomain"), new String[] {"target/classes"}); -// node.start(); -// -// SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("myFooDomain")); -// HelloworldService service = clientFactory.getService(HelloworldService.class, "HelloworldComponent"); -// assertEquals("Hello petra", service.sayHello("petra")); -// } + @Test + public void testWithoutServiceName() throws Exception { + node = NodeFactory.getInstance().createNode(URI.create("myFooDomain"), new String[] {"target/classes"}); + node.start(); + + SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("myFooDomain")); + try { + clientFactory.getService(HelloworldService.class, "HelloworldComponent"); + fail("expecting ServiceRuntimeException"); + } catch (ServiceRuntimeException e) { + assertTrue(e.getMessage().contains("More than one service is declared on component")); + } + } + + @Test + public void testWithoutServiceNameSingleService() throws Exception { + node = NodeFactory.getInstance().createNode(URI.create("myFooDomain"), new String[] {"target/classes"}); + node.start(); + + SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("myFooDomain")); + HelloworldService service = clientFactory.getService(HelloworldService.class, "SingleServiceComponent"); + assertEquals("Hello petra", service.sayHello("petra")); + } @Test public void testWithBadServiceName() throws Exception { @@ -108,6 +123,26 @@ public class SCAClientTestCase extends TestCase { } } + @Test + public void testOnlyWSBinding() throws Exception { + node = NodeFactory.getInstance().createNode(URI.create("myFooDomain"), new String[] {"target/classes"}); + node.start(); + + SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("myFooDomain")); + RemoteHelloworldService service = clientFactory.getService(RemoteHelloworldService.class, "OnlyWSBindingComponent/RemoteHelloworldService"); + assertEquals("Hello petra", service.sayHelloRemote("petra")); + } + + @Test + public void testMultipleBindings() throws Exception { + node = NodeFactory.getInstance().createNode(URI.create("myFooDomain"), new String[] {"target/classes"}); + node.start(); + + SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("myFooDomain")); + RemoteHelloworldService service = clientFactory.getService(RemoteHelloworldService.class, "MultipleBindingsComponent/RemoteHelloworldService"); + assertEquals("Hello petra", service.sayHelloRemote("petra")); + } + // @Test @Ignore // public void testHTTPURI() throws Exception { // node = NodeFactory.getInstance().createNode(URI.create("http://defaultDomain"), new String[] {"target/classes"}); |