Author: antelder
Date: Sat May 7 07:32:55 2011
New Revision: 1100473
URL: http://svn.apache.org/viewvc?rev=1100473&view=rev
Log:
Update to support setting the domain uri in the runComposite method
Modified:
tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TuscanyRuntimeTestCase.java
Modified:
tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java?rev=1100473&r1=1100472&r2=1100473&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java
(original)
+++
tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java
Sat May 7 07:32:55 2011
@@ -22,6 +22,7 @@ package org.apache.tuscany.sca;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.net.URI;
import java.net.URL;
import java.util.Properties;
@@ -79,7 +80,7 @@ public class TuscanyRuntime {
}
/**
- * A helper method to run a standalone SCA composite
+ * A helper method to run a standalone SCA composite in the default
standalone SCA domain.
* @param compositeURI URI within the contribution of a composite to run
* if compositeURI is null then all deployable composites in the
contribution will be run
* @param contributionURL URL of the contribution
@@ -91,9 +92,8 @@ public class TuscanyRuntime {
}
/**
- * A helper method to run a standalone SCA composite
- * @param runtime a TuscanyRuntime instance which will be used to run the
composite
- * this allows sharing a runtime instance to run multiple
composites
+ * A helper method to run a standalone SCA composite in a SCA domain
+ * @param domainURI the URI of the SCA domain
* @param compositeURI URI within the contribution of a composite to run
* if compositeURI is null then all deployable composites in the
contribution will be run
* @param contributionURL URL of the contribution
@@ -101,14 +101,12 @@ public class TuscanyRuntime {
* @return a Node with installed contributions
* TODO: keep this helper method? Maybe say you should just create/use
Node directly
*/
- public static Node runComposite(TuscanyRuntime runtime, String
compositeURI, String contributionURL, String... dependentContributionURLs) {
+ public static Node runComposite(URI domainURI, String compositeURI, String
contributionURL, String... dependentContributionURLs) {
try {
- boolean sharedRuntime = runtime != null;
- if (runtime == null) {
- runtime = newInstance();
- }
+ TuscanyRuntime runtime = newInstance();
+ String domain = domainURI == null ? "default" :
domainURI.toString();
EndpointRegistry endpointRegistry = new
EndpointRegistryImpl(runtime.extensionPointRegistry, null, null);
- NodeImpl node = new NodeImpl("default", runtime.deployer,
runtime.compositeActivator, endpointRegistry, runtime.extensionPointRegistry,
sharedRuntime? null : runtime);
+ NodeImpl node = new NodeImpl(domain, runtime.deployer,
runtime.compositeActivator, endpointRegistry, runtime.extensionPointRegistry,
runtime);
if (dependentContributionURLs != null) {
for (int i=dependentContributionURLs.length-1; i>-1; i--) {
Modified:
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TuscanyRuntimeTestCase.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TuscanyRuntimeTestCase.java?rev=1100473&r1=1100472&r2=1100473&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TuscanyRuntimeTestCase.java
(original)
+++
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TuscanyRuntimeTestCase.java
Sat May 7 07:32:55 2011
@@ -19,6 +19,7 @@
package org.apache.tuscany.sca.runtime;
import java.net.MalformedURLException;
+import java.net.URI;
import java.util.List;
import junit.framework.Assert;
@@ -175,14 +176,12 @@ public class TuscanyRuntimeTestCase {
@Test
public void testRunCompositeSharedRuntime() throws NoSuchServiceException {
- TuscanyRuntime runtime = TuscanyRuntime.newInstance();
- Node node = TuscanyRuntime.runComposite(runtime,
"helloworld.composite", "src/test/resources/sample-helloworld.jar");
+ Node node = TuscanyRuntime.runComposite(URI.create("default"),
"helloworld.composite", "src/test/resources/sample-helloworld.jar");
try {
Helloworld helloworldService = node.getService(Helloworld.class,
"HelloworldComponent");
Assert.assertEquals("Hello petra",
helloworldService.sayHello("petra"));
} finally {
node.stop();
}
- runtime.stop();
}
}