Author: antelder
Date: Wed Nov 25 11:12:03 2009
New Revision: 884043
URL: http://svn.apache.org/viewvc?rev=884043&view=rev
Log:
Remove SCAClient as its not in the latest spec and update all the places it was
used to use SCAClientFactory.
Removed:
tuscany/sca-java-2.x/trunk/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClient.java
Modified:
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java
tuscany/sca-java-2.x/trunk/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java
tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/domain/node/DomainNode.java
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/MultipleNodesPerJVMTestCase.java
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/OneNodeTestCase.java
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/StopStartNodesTestCase.java
tuscany/sca-java-2.x/trunk/modules/sca-client-rmi/src/main/java/org/apache/tuscany/sca/client/rmi/SCAClientFactoryImpl.java
Modified:
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java?rev=884043&r1=884042&r2=884043&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java
(original)
+++
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java
Wed Nov 25 11:12:03 2009
@@ -24,6 +24,7 @@
import itest.nodes.Helloworld;
import java.io.File;
+import java.net.URI;
import javax.xml.namespace.QName;
@@ -34,7 +35,7 @@
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
-import org.oasisopen.sca.client.SCAClient;
+import org.oasisopen.sca.client.SCAClientFactory;
/**
* This shows how to test the Calculator service component.
@@ -71,11 +72,11 @@
@Test
@Ignore("SCAClient needs to leverage the EndpointRegistry to invoke
services that are not hosted on the local node")
public void testCalculatorClientAPI() throws Exception {
- Helloworld service = SCAClient.getService(Helloworld.class,
"HelloworldService");
+ Helloworld service =
SCAClientFactory.newInstance(URI.create("http://tuscany.apache.org/sca/1.1/domains/default")).getService(Helloworld.class,
"HelloworldService");
assertNotNull(service);
assertEquals("Hello Petra", service.sayHello("Petra"));
- Helloworld client = SCAClient.getService(Helloworld.class,
"HelloworldClient");
+ Helloworld client =
SCAClientFactory.newInstance(URI.create("http://tuscany.apache.org/sca/1.1/domains/default")).getService(Helloworld.class,
"HelloworldClient");
assertNotNull(client);
assertEquals("Hi Hello Petra", client.sayHello("Petra"));
}
Modified:
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java?rev=884043&r1=884042&r2=884043&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java
(original)
+++
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java
Wed Nov 25 11:12:03 2009
@@ -24,6 +24,7 @@
import itest.nodes.Helloworld;
import java.io.File;
+import java.net.URI;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
@@ -31,7 +32,7 @@
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.oasisopen.sca.client.SCAClient;
+import org.oasisopen.sca.client.SCAClientFactory;
/**
* This shows how to test the Calculator service component.
@@ -84,11 +85,11 @@
@Test
public void testCalculatorClientAPI() throws Exception {
- Helloworld service = SCAClient.getService(Helloworld.class,
"HelloworldService");
+ Helloworld service =
SCAClientFactory.newInstance(URI.create("http://tuscany.apache.org/sca/1.1/domains/default")).getService(Helloworld.class,
"HelloworldService");
assertNotNull(service);
assertEquals("Hello Petra", service.sayHello("Petra"));
- Helloworld client = SCAClient.getService(Helloworld.class,
"HelloworldClient");
+ Helloworld client =
SCAClientFactory.newInstance(URI.create("http://tuscany.apache.org/sca/1.1/domains/default")).getService(Helloworld.class,
"HelloworldClient");
assertNotNull(client);
assertEquals("Hi Hello Petra", client.sayHello("Petra"));
}
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=884043&r1=884042&r2=884043&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
Wed Nov 25 11:12:03 2009
@@ -24,7 +24,6 @@
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
-import org.oasisopen.sca.client.SCAClient;
import org.oasisopen.sca.client.SCAClientFactory;
/**
@@ -48,11 +47,6 @@
assertEquals("Hello petra", service.sayHello("petra"));
}
- public void testSimpleAPI() throws Exception {
- HelloworldService service =
SCAClient.getService(HelloworldService.class, "/HelloworldComponent");
- assertEquals("Hello petra", service.sayHello("petra"));
- }
-
@Override
protected void tearDown() throws Exception {
node.stop();
Modified:
tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/domain/node/DomainNode.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/domain/node/DomainNode.java?rev=884043&r1=884042&r2=884043&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/domain/node/DomainNode.java
(original)
+++
tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/domain/node/DomainNode.java
Wed Nov 25 11:12:03 2009
@@ -35,7 +35,7 @@
import org.apache.tuscany.sca.runtime.EndpointRegistry;
import org.oasisopen.sca.NoSuchDomainException;
import org.oasisopen.sca.NoSuchServiceException;
-import org.oasisopen.sca.client.SCAClient;
+import org.oasisopen.sca.client.SCAClientFactory;
public class DomainNode {
@@ -60,7 +60,7 @@
public DomainNode(String configURI, String[] contributionLocations) {
this.domainRegistryURI = configURI;
initDomainName(configURI);
- nodeFactory = NodeFactory.getInstance(domainName);
+ nodeFactory = NodeFactory.getInstance(domainRegistryURI);
for (String loc : contributionLocations) {
addContribution(loc);
}
@@ -127,7 +127,7 @@
public <T> T getService(Class<T> interfaze, String uri) throws
NoSuchServiceException {
try {
- return SCAClient.getService(interfaze, getDomainName() + "/" +
uri);
+ return
SCAClientFactory.newInstance(URI.create(getDomainConfigURI())).getService(interfaze,
uri);
} catch (NoSuchDomainException e) {
throw new IllegalStateException(e);
}
Modified:
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/MultipleNodesPerJVMTestCase.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/MultipleNodesPerJVMTestCase.java?rev=884043&r1=884042&r2=884043&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/MultipleNodesPerJVMTestCase.java
(original)
+++
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/MultipleNodesPerJVMTestCase.java
Wed Nov 25 11:12:03 2009
@@ -21,14 +21,15 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import itest.nodes.Helloworld;
import static org.junit.Assert.fail;
+import itest.nodes.Helloworld;
+
+import java.net.URI;
-import org.apache.tuscany.sca.domain.node.DomainNode;
import org.junit.After;
import org.junit.Test;
import org.oasisopen.sca.SCARuntimeException;
-import org.oasisopen.sca.client.SCAClient;
+import org.oasisopen.sca.client.SCAClientFactory;
/**
* This shows how to test the Calculator service component.
@@ -43,11 +44,11 @@
serviceNode = new
DomainNode("target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar");
clientNode = new
DomainNode("target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar");
- Helloworld service = SCAClient.getService(Helloworld.class,
"defaultDomain/HelloworldService");
+ Helloworld service =
SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class,
"HelloworldService");
assertNotNull(service);
assertEquals("Hello Petra", service.sayHello("Petra"));
- Helloworld client = SCAClient.getService(Helloworld.class,
"defaultDomain/HelloworldClient");
+ Helloworld client =
SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class,
"HelloworldClient");
assertNotNull(client);
assertEquals("Hi Hello Petra", client.sayHello("Petra"));
}
@@ -55,12 +56,12 @@
@Test
public void testTwoNodesDifferentDomains() throws Exception {
serviceNode = new DomainNode("vm://fooDomain", new
String[]{"target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar"});
- Helloworld service = SCAClient.getService(Helloworld.class,
"fooDomain/HelloworldService");
+ Helloworld service =
SCAClientFactory.newInstance(URI.create("vm://fooDomain")).getService(Helloworld.class,
"HelloworldService");
assertNotNull(service);
assertEquals("Hello Petra", service.sayHello("Petra"));
clientNode = new DomainNode("vm://barDomain", new
String[]{"target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar"});
- Helloworld client = SCAClient.getService(Helloworld.class,
"barDomain/HelloworldClient");
+ Helloworld client =
SCAClientFactory.newInstance(URI.create("vm://barDomain")).getService(Helloworld.class,
"HelloworldClient");
assertNotNull(client);
try {
Modified:
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/OneNodeTestCase.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/OneNodeTestCase.java?rev=884043&r1=884042&r2=884043&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/OneNodeTestCase.java
(original)
+++
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/OneNodeTestCase.java
Wed Nov 25 11:12:03 2009
@@ -24,13 +24,14 @@
import static org.junit.Assert.fail;
import itest.nodes.Helloworld;
-import org.apache.tuscany.sca.domain.node.DomainNode;
+import java.net.URI;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.oasisopen.sca.NoSuchDomainException;
import org.oasisopen.sca.NoSuchServiceException;
-import org.oasisopen.sca.client.SCAClient;
+import org.oasisopen.sca.client.SCAClientFactory;
/**
* This shows how to test the Calculator service component.
@@ -49,14 +50,14 @@
@Test
public void testService() throws Exception {
- Helloworld service = SCAClient.getService(Helloworld.class,
"defaultDomain/HelloworldService");
+ Helloworld service =
SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class,
"HelloworldService");
assertNotNull(service);
assertEquals("Hello Petra", service.sayHello("Petra"));
}
@Test
public void testClient() throws Exception {
- Helloworld client = SCAClient.getService(Helloworld.class,
"defaultDomain/HelloworldClient");
+ Helloworld client =
SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class,
"HelloworldClient");
assertNotNull(client);
assertEquals("Hi Hello Petra", client.sayHello("Petra"));
}
@@ -65,13 +66,13 @@
public void testRemovingServiceContribution() throws Exception {
domain.removeContribution(serviceContributionUri);
try {
- SCAClient.getService(Helloworld.class,
"defaultDomain/HelloworldService");
+
SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class,
"HelloworldService");
// FIXME: should this be NoSuchServiceException or
ServiceNotFoundException?
} catch (NoSuchServiceException e) {
// expected
}
- Helloworld client = SCAClient.getService(Helloworld.class,
"defaultDomain/HelloworldClient");
+ Helloworld client =
SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class,
"HelloworldClient");
assertNotNull(client);
try {
assertEquals("Hi Hello Petra", client.sayHello("Petra"));
@@ -86,7 +87,7 @@
public void testStoppingDomainNode() throws Exception {
domain.stop();
try {
- SCAClient.getService(Helloworld.class,
"defaultDomain/HelloworldClient");
+
SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class,
"HelloworldClient");
fail();
} catch (NoSuchDomainException e) {
// expected
Modified:
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/StopStartNodesTestCase.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/StopStartNodesTestCase.java?rev=884043&r1=884042&r2=884043&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/StopStartNodesTestCase.java
(original)
+++
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/StopStartNodesTestCase.java
Wed Nov 25 11:12:03 2009
@@ -24,9 +24,11 @@
import static org.junit.Assert.fail;
import itest.nodes.Helloworld;
+import java.net.URI;
+
import org.junit.After;
import org.junit.Test;
-import org.oasisopen.sca.client.SCAClient;
+import org.oasisopen.sca.client.SCAClientFactory;
/**
* This shows how to test the Calculator service component.
@@ -41,17 +43,17 @@
serviceNode = new DomainNode("vm://fooDomain", new
String[]{"target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar"});
clientNode = new DomainNode("vm://fooDomain", new
String[]{"target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar"});
- Helloworld service = SCAClient.getService(Helloworld.class,
"fooDomain/HelloworldService");
+ Helloworld service =
SCAClientFactory.newInstance(URI.create("vm://fooDomain")).getService(Helloworld.class,
"HelloworldService");
assertNotNull(service);
assertEquals("Hello Petra", service.sayHello("Petra"));
- Helloworld client = SCAClient.getService(Helloworld.class,
"fooDomain/HelloworldClient");
+ Helloworld client =
SCAClientFactory.newInstance(URI.create("vm://fooDomain")).getService(Helloworld.class,
"HelloworldClient");
assertNotNull(client);
assertEquals("Hi Hello Petra", client.sayHello("Petra"));
serviceNode.stop();
- client = SCAClient.getService(Helloworld.class,
"fooDomain/HelloworldClient");
+ client =
SCAClientFactory.newInstance(URI.create("vm://fooDomain")).getService(Helloworld.class,
"HelloworldClient");
assertNotNull(client);
try {
assertEquals("Hi Hello Petra", client.sayHello("Petra"));
@@ -61,7 +63,7 @@
}
serviceNode = new DomainNode("vm://fooDomain", new
String[]{"target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar"});
- client = SCAClient.getService(Helloworld.class,
"fooDomain/HelloworldClient");
+ client =
SCAClientFactory.newInstance(URI.create("vm://fooDomain")).getService(Helloworld.class,
"HelloworldClient");
assertNotNull(client);
assertEquals("Hi Hello Petra", client.sayHello("Petra"));
}
Modified:
tuscany/sca-java-2.x/trunk/modules/sca-client-rmi/src/main/java/org/apache/tuscany/sca/client/rmi/SCAClientFactoryImpl.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/sca-client-rmi/src/main/java/org/apache/tuscany/sca/client/rmi/SCAClientFactoryImpl.java?rev=884043&r1=884042&r2=884043&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/modules/sca-client-rmi/src/main/java/org/apache/tuscany/sca/client/rmi/SCAClientFactoryImpl.java
(original)
+++
tuscany/sca-java-2.x/trunk/modules/sca-client-rmi/src/main/java/org/apache/tuscany/sca/client/rmi/SCAClientFactoryImpl.java
Wed Nov 25 11:12:03 2009
@@ -68,7 +68,11 @@
if (i > -1 && uri.charAt(i+2) != '/') {
uri = uri.replaceFirst(":/", "://");
}
- return URI.create(uri).getHost();
+ if (i < 0) {
+ return uri;
+ } else {
+ return URI.create(uri).getHost();
+ }
}
public void stop() {