tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r943891 - /tuscany/sca-java-2.x/trunk/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java
Date Thu, 13 May 2010 14:06:05 GMT
Author: antelder
Date: Thu May 13 14:06:05 2010
New Revision: 943891

URL: http://svn.apache.org/viewvc?rev=943891&view=rev
Log:
Add some more sca clinet api tests

Modified:
    tuscany/sca-java-2.x/trunk/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java

Modified: tuscany/sca-java-2.x/trunk/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java?rev=943891&r1=943890&r2=943891&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java
Thu May 13 14:06:05 2010
@@ -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 T
         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();



Mime
View raw message