You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2011/04/21 15:28:05 UTC
svn commit: r1095697 - in
/tuscany/sca-java-2.x/trunk/testing/itest/scaclient-remote: ./ pom.xml
src/test/java/test/scaclient/SCAClientTestCase.java
Author: antelder
Date: Thu Apr 21 13:28:05 2011
New Revision: 1095697
URL: http://svn.apache.org/viewvc?rev=1095697&view=rev
Log:
Add start of a test that uses the tuscany plugin to run the service which the client can call
Added:
tuscany/sca-java-2.x/trunk/testing/itest/scaclient-remote/
- copied from r1095625, tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/
Modified:
tuscany/sca-java-2.x/trunk/testing/itest/scaclient-remote/pom.xml
tuscany/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/test/java/test/scaclient/SCAClientTestCase.java
Modified: tuscany/sca-java-2.x/trunk/testing/itest/scaclient-remote/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/scaclient-remote/pom.xml?rev=1095697&r1=1095625&r2=1095697&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/scaclient-remote/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/scaclient-remote/pom.xml Thu Apr 21 13:28:05 2011
@@ -25,15 +25,47 @@
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>itest-scaclient-api</artifactId>
- <name>Apache Tuscany SCA iTest SCAClient API</name>
+ <artifactId>itest-scaclient-remote</artifactId>
+ <name>Apache Tuscany SCA iTest SCAClient Remote</name>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-base-runtime-pom</artifactId>
- <type>pom</type>
+ <artifactId>tuscany-base-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-hazelcast</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.maven.plugins</groupId>
+ <artifactId>maven-tuscany-plugin</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <configuration>
+ <domainURI>uri:default?bind=127.0.0.1:9876</domainURI>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
Modified: tuscany/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/test/java/test/scaclient/SCAClientTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/test/java/test/scaclient/SCAClientTestCase.java?rev=1095697&r1=1095625&r2=1095697&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/test/java/test/scaclient/SCAClientTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/scaclient-remote/src/test/java/test/scaclient/SCAClientTestCase.java Thu Apr 21 13:28:05 2011
@@ -19,18 +19,13 @@
package test.scaclient;
-import itest.HelloworldService;
import itest.RemoteHelloworldService;
import java.net.URI;
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;
/**
@@ -40,86 +35,11 @@ import org.oasisopen.sca.client.SCAClien
*/
public class SCAClientTestCase extends TestCase {
- private Node node;
-
@Test
public void testDefault() throws Exception {
-
- node = NodeFactory.getInstance().createNode((String)null, new String[] {"target/classes"});
- node.start();
-
- SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("default"));
- HelloworldService service = clientFactory.getService(HelloworldService.class, "HelloworldComponent/HelloworldService");
- assertEquals("Hello petra", service.sayHello("petra"));
-
- RemoteHelloworldService remoteService = clientFactory.getService(RemoteHelloworldService.class, "HelloworldComponent/RemoteHelloworldService");
- assertEquals("Hello petra", remoteService.sayHelloRemote("petra"));
-
- }
-
- @Test
- public void testExplicit() 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/HelloworldService");
- assertEquals("Hello petra", service.sayHello("petra"));
-
- RemoteHelloworldService remoteService = clientFactory.getService(RemoteHelloworldService.class, "HelloworldComponent/RemoteHelloworldService");
- assertEquals("Hello petra", remoteService.sayHelloRemote("petra"));
- assertEquals("Hello petra", service.sayHello("petra"));
- }
-
-// @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();
-
- try {
- SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("someBadDomainName"));
- fail();
- } catch (NoSuchDomainException e) {
- // expected
- }
- }
-
- // @Test @Ignore
-// public void testHTTPURI() throws Exception {
-// node = NodeFactory.getInstance().createNode(URI.create("http://defaultDomain"), new String[] {"target/classes"});
-// node.start();
-//
-// HelloworldService service = SCAClientFactory.newInstance(URI.create("http://defaultDomain")).getService(HelloworldService.class, "HelloworldComponent");
-// assertEquals("Hello petra", service.sayHello("petra"));
-// }
-
- @Override
- protected void tearDown() throws Exception {
- node.stop();
+ SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("uri:default?wka=127.0.0.1:9876"));
+ RemoteHelloworldService service = clientFactory.getService(RemoteHelloworldService.class, "HelloworldComponent/HelloworldService");
+ assertEquals("Hello petra", service.sayHelloRemote("petra"));
}
}