diff options
Diffstat (limited to 'sca-java-2.x/trunk/itest/scaclient-api')
-rw-r--r-- | sca-java-2.x/trunk/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java b/sca-java-2.x/trunk/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java index ccd25ea8cd..6a639661cf 100644 --- a/sca-java-2.x/trunk/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java +++ b/sca-java-2.x/trunk/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java @@ -29,6 +29,8 @@ import junit.framework.TestCase; import org.apache.tuscany.sca.node.Node; 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.client.SCAClientFactory; /** @@ -69,7 +71,48 @@ public class SCAClientTestCase extends TestCase { assertEquals("Hello petra", service.sayHello("petra")); } -// @Test @Ignore +// @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 testWithBadServiceName() 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/foo"); + fail(); + } catch (NoSuchServiceException e) { + // expected + } + } + + @Test + public void testWithBadDomainName() throws Exception { + node = NodeFactory.getInstance().createNode(URI.create("myFooDomain"), new String[] {"target/classes"}); + node.start(); + + SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("someBadDomainName")); + try { + HelloworldService service = clientFactory.getService(HelloworldService.class, "HelloworldComponent/foo"); + service.sayHello("petra"); + fail(); + } catch (Exception e) { + if (!(e.getCause() instanceof NoSuchDomainException)) { + throw e; + } + } + } + + // @Test @Ignore // public void testHTTPURI() throws Exception { // node = NodeFactory.getInstance().createNode(URI.create("http://defaultDomain"), new String[] {"target/classes"}); // node.start(); |