Add some more sca clinet api tests
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@943891 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8a532888d0
commit
576a612ac8
1 changed files with 44 additions and 1 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue