summaryrefslogtreecommitdiffstats
path: root/sandbox/sebastien/java/vhost/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/EmbedTestCase.java
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-03-07 01:05:00 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-03-07 01:05:00 +0000
commitd621604a7732497afcb0378c61ac5614a014a01d (patch)
tree17628cf68438c9338a92a9f7bb94800e7fa63836 /sandbox/sebastien/java/vhost/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/EmbedTestCase.java
parent3e6e2864fabaf5fba77a0e51f0319d10e3debb35 (diff)
Show how NodeFactory and Node can be replaced by finer grain deploy, build, activate and start methods. This would enable an SCA runtime virtual hosting environment to build a composite model, cache it, and only activate / start its components on demand when a request hits them.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1078641 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sandbox/sebastien/java/vhost/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/EmbedTestCase.java21
1 files changed, 10 insertions, 11 deletions
diff --git a/sandbox/sebastien/java/vhost/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/EmbedTestCase.java b/sandbox/sebastien/java/vhost/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/EmbedTestCase.java
index c7e7ef1574..2da547726a 100644
--- a/sandbox/sebastien/java/vhost/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/EmbedTestCase.java
+++ b/sandbox/sebastien/java/vhost/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/EmbedTestCase.java
@@ -21,26 +21,28 @@ package sample.impl;
import static java.lang.System.out;
import static org.junit.Assert.assertEquals;
+import static sample.impl.EmbedUtil.activate;
import static sample.impl.EmbedUtil.build;
import static sample.impl.EmbedUtil.component;
import static sample.impl.EmbedUtil.composite;
import static sample.impl.EmbedUtil.contrib;
+import static sample.impl.EmbedUtil.deactivate;
import static sample.impl.EmbedUtil.deploy;
import static sample.impl.EmbedUtil.embedContext;
import static sample.impl.EmbedUtil.extensionPoints;
import static sample.impl.EmbedUtil.implementation;
-import static sample.impl.EmbedUtil.node;
import static sample.impl.EmbedUtil.providerFactories;
import static sample.impl.EmbedUtil.reference;
import static sample.impl.EmbedUtil.service;
+import static sample.impl.EmbedUtil.start;
+import static sample.impl.EmbedUtil.stop;
import static sample.impl.EmbedUtil.wsdli;
import static sample.impl.TestUtil.here;
import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.context.CompositeContext;
import org.apache.tuscany.sca.contribution.Contribution;
import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
import org.apache.tuscany.sca.provider.ImplementationProvider;
import org.apache.tuscany.sca.provider.ProviderFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
@@ -64,15 +66,13 @@ import sample.WelloTest;
* @version $Rev$ $Date$
*/
public class EmbedTestCase {
- static NodeFactory nf;
static EmbedUtil.Context ec;
- static Node node;
+ static CompositeContext cc;
@SuppressWarnings("unchecked")
@BeforeClass
public static void setUp() throws Exception {
- nf = NodeFactory.newInstance();
- ec = embedContext(nf);
+ ec = embedContext();
// Load the test WSDL definitions (could also construct the WSDL
// and XSD models in code but that'd be quite painful, so just
@@ -114,8 +114,7 @@ public class EmbedTestCase {
providerFactories(ec).addProviderFactory(testProviderFactory());
// Run with it
- node = node(nf, deploy(contrib, comp));
- node.start();
+ cc = start(activate(build(deploy(contrib, comp), ec), ec), ec);
}
static ProviderFactory<SampleImplementation> testProviderFactory() {
@@ -129,7 +128,7 @@ public class EmbedTestCase {
@AfterClass
public static void tearDown() throws Exception {
- node.stop();
+ deactivate(stop(cc, ec), ec);
}
@Test
@@ -149,6 +148,6 @@ public class EmbedTestCase {
}
static Client client() {
- return node.getService(Client.class, "client-test/Client");
+ return service(Client.class, "client-test/Client", cc);
}
}