diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-09 06:33:54 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-09 06:33:54 +0000 |
commit | efe3363a815a777ecd283928900404dea84a7e1f (patch) | |
tree | 42522fd01e6af981f8ff94663d911d56744154d5 /branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache | |
parent | aacabe1650e380595a8d701123394d791656d17d (diff) |
Work in progress. Fixed implementation of NodeImpl, now working without dependencies on implementations from other bundles (except RuntimeAssemblyFactory, which will need to be cleaned up too). Started to remove dependencies on host-embedded and port code to NodeFactory and Node, as an interim step to bring them up, before porting them to the OSGi-enabled node launcher.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@703068 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache')
4 files changed, 57 insertions, 28 deletions
diff --git a/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/calendarconsumer/CalendarConsumer.java b/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/calendarconsumer/CalendarConsumer.java index 35a692ac67..07cb62f410 100644 --- a/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/calendarconsumer/CalendarConsumer.java +++ b/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/calendarconsumer/CalendarConsumer.java @@ -18,6 +18,11 @@ */ package org.apache.tuscany.sca.binding.gdata.calendarconsumer; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; + import com.google.gdata.data.BaseEntry; import com.google.gdata.data.DateTime; import com.google.gdata.data.Entry; @@ -26,18 +31,20 @@ import com.google.gdata.data.Person; import com.google.gdata.data.PlainTextConstruct; import com.google.gdata.data.extensions.EventEntry; import com.google.gdata.data.extensions.When; -import org.apache.tuscany.sca.host.embedded.SCADomain; public class CalendarConsumer { public static void main(String... args) throws Exception { - SCADomain scaDomain; + Node node; CalendarConsumerImpl resourceCollection; //init - scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/CalendarConsumer.composite"); - resourceCollection = scaDomain.getService(CalendarConsumerImpl.class, "CalendarConsumer"); + String contribution = ContributionLocationHelper.getContributionLocation(CalendarConsumer.class); + node = NodeFactory.newInstance().createNode( + "org/apache/tuscany/sca/binding/gdata/CalendarConsumer.composite", new Contribution("consumer", contribution)); + node.start(); + resourceCollection = node.getService(CalendarConsumerImpl.class, "CalendarConsumer"); //test methods System.out.println( @@ -115,7 +122,8 @@ public class CalendarConsumer { } //close - scaDomain.close(); + node.stop(); + node.destroy(); } } diff --git a/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/calendarconsumer/CalendarConsumerTest.java b/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/calendarconsumer/CalendarConsumerTest.java index 211ae51ba2..15a9eea934 100644 --- a/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/calendarconsumer/CalendarConsumerTest.java +++ b/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/calendarconsumer/CalendarConsumerTest.java @@ -18,6 +18,20 @@ */ package org.apache.tuscany.sca.binding.gdata.calendarconsumer; +import static org.junit.Assert.assertNotNull; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.apache.tuscany.sca.data.collection.NotFoundException; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + import com.google.gdata.data.BaseEntry; import com.google.gdata.data.DateTime; import com.google.gdata.data.Feed; @@ -25,20 +39,11 @@ import com.google.gdata.data.Person; import com.google.gdata.data.PlainTextConstruct; import com.google.gdata.data.extensions.EventEntry; import com.google.gdata.data.extensions.When; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.apache.tuscany.sca.data.collection.NotFoundException; - -import org.junit.Test; -import org.junit.BeforeClass; -import org.junit.AfterClass; -import static org.junit.Assert.assertNotNull; //FIX-ME: the tests are executed in an incorrect order public class CalendarConsumerTest { - private static SCADomain scaDomain; + private static Node node; private Feed feed; private BaseEntry returnedEntry; private BaseEntry searchedEntry; @@ -47,13 +52,17 @@ public class CalendarConsumerTest { @BeforeClass public static void init() { - scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/CalendarConsumer.composite"); - consumer = scaDomain.getService(CalendarConsumerImpl.class, "CalendarConsumer"); + String contribution = ContributionLocationHelper.getContributionLocation(CalendarConsumer.class); + node = NodeFactory.newInstance().createNode( + "org/apache/tuscany/sca/binding/gdata/CalendarConsumer.composite", new Contribution("consumer", contribution)); + node.start(); + consumer = node.getService(CalendarConsumerImpl.class, "CalendarConsumer"); } @AfterClass public static void close() { - scaDomain.close(); + node.stop(); + node.destroy(); } @Test diff --git a/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/consumerprovider/Consumer.java b/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/consumerprovider/Consumer.java index 00055f28b2..f6c5f65358 100644 --- a/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/consumerprovider/Consumer.java +++ b/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/consumerprovider/Consumer.java @@ -19,18 +19,24 @@ package org.apache.tuscany.sca.binding.gdata.consumerprovider; -import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; public class Consumer { public static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/Consumer.composite"); + String contribution = ContributionLocationHelper.getContributionLocation(Consumer.class); + Node node = NodeFactory.newInstance().createNode( + "org/apache/tuscany/sca/binding/gdata/Consumer.composite", new Contribution("consumer", contribution)); + node.start(); + CustomerClient testService = node.getService(CustomerClient.class, "CustomerClient"); - CustomerClient testService = scaDomain.getService(CustomerClient.class, "CustomerClient"); + testService.testCustomerCollection(); - testService.testCustomerCollection(); - - scaDomain.close(); + node.stop(); + node.destroy(); } } diff --git a/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/consumerprovider/Provider.java b/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/consumerprovider/Provider.java index 9beca538df..1d7d3f908e 100644 --- a/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/consumerprovider/Provider.java +++ b/branches/sca-equinox/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/consumerprovider/Provider.java @@ -18,17 +18,23 @@ */ package org.apache.tuscany.sca.binding.gdata.consumerprovider; -import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; public class Provider { public static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/Provider.composite"); - + String contribution = ContributionLocationHelper.getContributionLocation(Provider.class); + Node node = NodeFactory.newInstance().createNode( + "org/apache/tuscany/sca/binding/gdata/Provider.composite", new Contribution("provider", contribution)); + node.start(); System.out.println("Ready for consultings..."); System.in.read(); - scaDomain.close(); + node.stop(); + node.destroy(); } } |