From 8a532888d0433a9f680270011174b7b768d107de Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 13 May 2010 14:05:00 +0000 Subject: Add some tests to the sca client tests git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@943888 13f79535-47bb-0310-9956-ffa450edef68 --- .../trunk/itest/scaclient-api-remote/pom.xml | 7 +---- .../java/test/scaclient/SCAClientTestCase.java | 34 +++++++++++++++++----- 2 files changed, 28 insertions(+), 13 deletions(-) (limited to 'sca-java-2.x/trunk/itest/scaclient-api-remote') diff --git a/sca-java-2.x/trunk/itest/scaclient-api-remote/pom.xml b/sca-java-2.x/trunk/itest/scaclient-api-remote/pom.xml index 905c6309be..f807c9883f 100644 --- a/sca-java-2.x/trunk/itest/scaclient-api-remote/pom.xml +++ b/sca-java-2.x/trunk/itest/scaclient-api-remote/pom.xml @@ -37,12 +37,7 @@ org.apache.tuscany.sca - tuscany-binding-ws-runtime-axis2 - 2.0-SNAPSHOT - - - org.apache.tuscany.sca - tuscany-host-jetty + tuscany-binding-hazelcast-runtime 2.0-SNAPSHOT diff --git a/sca-java-2.x/trunk/itest/scaclient-api-remote/src/test/java/test/scaclient/SCAClientTestCase.java b/sca-java-2.x/trunk/itest/scaclient-api-remote/src/test/java/test/scaclient/SCAClientTestCase.java index b61ae890bc..0ae70d6c3f 100644 --- a/sca-java-2.x/trunk/itest/scaclient-api-remote/src/test/java/test/scaclient/SCAClientTestCase.java +++ b/sca-java-2.x/trunk/itest/scaclient-api-remote/src/test/java/test/scaclient/SCAClientTestCase.java @@ -20,6 +20,7 @@ package test.scaclient; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; import itest.HelloworldService; import java.net.URI; @@ -30,6 +31,7 @@ import org.junit.After; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import org.oasisopen.sca.NoSuchDomainException; import org.oasisopen.sca.client.SCAClientFactory; /** @@ -52,38 +54,56 @@ public class SCAClientTestCase { @Test public void testDefault() throws Exception { - node = NodeFactory.getInstance().createNode(URI.create("SCAClientTestCaseDomain"),(String)null, new String[] {"target/classes"}); + node = NodeFactory.newInstance().createNode((String)null, new String[] {"target/classes"}); node.start(); HelloworldService service = SCAClientFactory.newInstance(URI.create("default")).getService(HelloworldService.class, "HelloworldComponent"); assertEquals("Hello petra", service.sayHello("petra")); } + @Test + public void testURIconfig() throws Exception { + + node = NodeFactory.newInstance("uri:somedomain").createNode((String)null, new String[] {"target/classes"}); + node.start(); + + HelloworldService service = SCAClientFactory.newInstance(URI.create("somedomain")).getService(HelloworldService.class, "HelloworldComponent"); + assertEquals("Hello petra", service.sayHello("petra")); + try { + service = SCAClientFactory.newInstance(URI.create("nosuchdomain")).getService(HelloworldService.class, "HelloworldComponent"); + service.sayHello("petra"); + fail(); + } catch (Exception e) { + if (!(e.getCause() instanceof NoSuchDomainException)) { + throw e; + } + } + } + @Test public void testExplicit() throws Exception { - node = NodeFactory.getInstance().createNode(URI.create("myFooDomain"), new String[] {"target/classes"}); + node = NodeFactory.newInstance().createNode(URI.create("myFooDomain"), new String[] {"target/classes"}); node.start(); HelloworldService service = SCAClientFactory.newInstance(URI.create("myFooDomain")).getService(HelloworldService.class, "HelloworldComponent"); - String s= service.sayHello("petra"); assertEquals("Hello petra", service.sayHello("petra")); } @Test public void testExplicitRemote() throws Exception { - node = NodeFactory.newInstance().createNode(URI.create("tuscany:myFooDomain?listen=127.0.0.1:14821"), new String[] {"target/classes"}); + node = NodeFactory.newInstance("uri:myFooDomain?bind=127.0.0.1:14821").createNode((String)null, new String[] {"target/classes"}); node.start(); - HelloworldService service = SCAClientFactory.newInstance(URI.create("tuscany:myFooDomain?remotes=127.0.0.1:14821")).getService(HelloworldService.class, "HelloworldComponent"); + HelloworldService service = SCAClientFactory.newInstance(URI.create("uri:myFooDomain?wka=127.0.0.1:14821")).getService(HelloworldService.class, "HelloworldComponent"); assertEquals("Hello petra", service.sayHello("petra")); } @Test public void testExplicitRemote2() throws Exception { - node = NodeFactory.getInstance().createNode(URI.create("tuscany:myFooDomain?listen=127.0.0.1:14821"), new String[] {"target/classes"}); + node = NodeFactory.newInstance("uri:myFooDomain?bind=127.0.0.1:14821").createNode((String)null, new String[] {"target/classes"}); node.start(); - HelloworldService service = SCAClientFactory.newInstance(URI.create("tuscany:myFooDomain?remotes=127.0.0.1:14821")).getService(HelloworldService.class, "HelloworldComponent"); + HelloworldService service = SCAClientFactory.newInstance(URI.create("uri:myFooDomain?wka=127.0.0.1:14821")).getService(HelloworldService.class, "HelloworldComponent"); assertEquals("Hello petra", service.sayHello("petra")); } -- cgit v1.2.3