summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/itest
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-05-13 14:06:05 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-05-13 14:06:05 +0000
commit576a612ac87a8da8a434156127b90d1ca5090bad (patch)
tree12d6cd71460591ca6794f9cef983b1a1659b3e19 /sca-java-2.x/trunk/itest
parent8a532888d0433a9f680270011174b7b768d107de (diff)
Add some more sca clinet api tests
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@943891 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/itest')
-rw-r--r--sca-java-2.x/trunk/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java45
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();