From c68bbb72e51dae88191c60f437fe673ef54a0f4c Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Fri, 10 Oct 2008 00:16:53 +0000 Subject: Fixed compile errors. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@703296 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/binding/sca/axis2/AsynchTestCase.java | 25 ++- .../sca/binding/sca/axis2/CallbackTestCase.java | 27 ++- .../sca/binding/sca/axis2/PromotionTestCase.java | 25 ++- .../sca/binding/sca/axis2/SimpleTestCase.java | 15 +- .../tuscany/sca/binding/sca/axis2/TestNode.java | 232 --------------------- .../ws/axis2/itests/HelloWorldNoWSDLTestCase.java | 18 +- .../ws/axis2/itests/HelloWorldOMTestCase.java | 16 +- .../ws/axis2/itests/HelloWorldTestCase.java | 15 +- .../axis2/itests/HelloWorldWSDLMergedTestCase.java | 15 +- .../itests/QuestionMarkWSDLImportTestCase.java | 14 +- .../itests/QuestionMarkWSDLIncludeTestCase.java | 14 +- .../ws/axis2/itests/QuestionMarkWSDLTestCase.java | 14 +- .../ws/axis2/itests/UriPrecedenceTestCase.java | 16 +- .../endpoints/AbstractHelloWorldOMTestCase.java | 16 +- .../ws/axis2/itests/epr/HelloWorldTestCase.java | 16 +- .../configparams/AbstractHelloWorldOMTestCase.java | 16 +- .../policy/mixed/AbstractHelloWorldOMTestCase.java | 16 +- .../wspolicy/AbstractHelloWorldOMTestCase.java | 16 +- .../itests/soap12/HelloWorldSOAP12TestCase.java | 21 +- .../itests/soap12/QuestionMarkWSDLTestCase.java | 14 +- .../org/apache/tuscany/sca/node/impl/NodeImpl.java | 59 +++++- .../org/apache/tuscany/sca/node/impl/NodeUtil.java | 55 ----- 22 files changed, 276 insertions(+), 399 deletions(-) delete mode 100644 branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java diff --git a/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java b/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java index 40d64be9b1..0ae3c68f99 100644 --- a/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java +++ b/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java @@ -23,14 +23,17 @@ import junit.framework.Assert; import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; import org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientCallbackOnewayRemoteImpl; +import org.apache.tuscany.sca.node.Contribution; +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; public class AsynchTestCase { - public static TestNode nodeA; - public static TestNode nodeB; + public static Node nodeG; + public static Node nodeH; @BeforeClass public static void init() throws Exception { @@ -38,11 +41,13 @@ public class AsynchTestCase { try { // create and start domains - nodeA = new TestNode("nodeG"); - nodeB = new TestNode("nodeH"); + NodeFactory nodeFactory = NodeFactory.newInstance(); + ClassLoader cl = AsynchTestCase.class.getClassLoader(); + nodeG = nodeFactory.createNode("HelloWorld.composite", new Contribution("http://calculator", cl.getResource("nodeG").toString())); + nodeH = nodeFactory.createNode("HelloWorld.composite", new Contribution("http://calculator", cl.getResource("nodeH").toString())); - nodeA.start(); - nodeB.start(); + nodeG.start(); + nodeH.start(); } catch (Exception ex) { System.err.println("Exception when creating domain " + ex.getMessage()); @@ -53,14 +58,16 @@ public class AsynchTestCase { @AfterClass public static void destroy() throws Exception { - nodeA.stop(); - nodeB.stop(); + nodeG.stop(); + nodeG.destroy(); + nodeH.stop(); + nodeG.destroy(); } @Test public void testHelloWorldAsynch() throws Exception { HelloWorldClient helloWorldClientB; - helloWorldClientB = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote"); + helloWorldClientB = nodeG.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote"); helloWorldClientB.getGreetings("fred"); System.out.println("Sleeping ..."); Thread.sleep(2000); diff --git a/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java b/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java index 76dbc5a5c7..5a68b6c3d9 100644 --- a/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java +++ b/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java @@ -21,14 +21,17 @@ package org.apache.tuscany.sca.binding.sca.axis2; import junit.framework.Assert; import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.node.Contribution; +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; public class CallbackTestCase { - public static TestNode nodeA; - public static TestNode nodeB; + public static Node nodeE; + public static Node nodeF; @BeforeClass public static void init() throws Exception { @@ -36,11 +39,13 @@ public class CallbackTestCase { try { // create and start domains - nodeA = new TestNode("nodeE"); - nodeB = new TestNode("nodeF"); + NodeFactory nodeFactory = NodeFactory.newInstance(); + ClassLoader cl = AsynchTestCase.class.getClassLoader(); + nodeE = nodeFactory.createNode("HelloWorld.composite", new Contribution("http://calculator", cl.getResource("nodeE").toString())); + nodeF = nodeFactory.createNode("HelloWorld.composite", new Contribution("http://calculator", cl.getResource("nodeF").toString())); - nodeA.start(); - nodeB.start(); + nodeE.start(); + nodeF.start(); } catch (Exception ex) { System.err.println("Exception when creating domain " + ex.getMessage()); @@ -51,8 +56,10 @@ public class CallbackTestCase { @AfterClass public static void destroy() throws Exception { - nodeA.stop(); - nodeB.stop(); + nodeE.stop(); + nodeE.destroy(); + nodeF.stop(); + nodeF.destroy(); } //@Test @@ -64,14 +71,14 @@ public class CallbackTestCase { @Test public void testHelloWorldCallbackLocal() throws Exception { HelloWorldClient helloWorldClientB; - helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientCallbackLocal"); + helloWorldClientB = nodeF.getService(HelloWorldClient.class, "BHelloWorldClientCallbackLocal"); Assert.assertEquals("Hello callback fred", helloWorldClientB.getGreetings("fred")); } @Test public void testHelloWorldCallbackRemote() throws Exception { HelloWorldClient helloWorldClientA; - helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote"); + helloWorldClientA = nodeE.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote"); Assert.assertEquals("Hello callback fred", helloWorldClientA.getGreetings("fred")); } } diff --git a/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java b/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java index 2deb62e6c4..3f48f1d465 100644 --- a/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java +++ b/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java @@ -21,14 +21,17 @@ package org.apache.tuscany.sca.binding.sca.axis2; import junit.framework.Assert; import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.node.Contribution; +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; public class PromotionTestCase { - public static TestNode nodeA; - public static TestNode nodeB; + public static Node nodeC; + public static Node nodeD; @BeforeClass public static void init() throws Exception { @@ -36,11 +39,13 @@ public class PromotionTestCase { try { // create and start domains - nodeA = new TestNode("nodeC"); - nodeB = new TestNode("nodeD"); + NodeFactory nodeFactory = NodeFactory.newInstance(); + ClassLoader cl = AsynchTestCase.class.getClassLoader(); + nodeC = nodeFactory.createNode("HelloWorld.composite", new Contribution("http://calculator", cl.getResource("nodeC").toString())); + nodeD = nodeFactory.createNode("HelloWorld.composite", new Contribution("http://calculator", cl.getResource("nodeD").toString())); - nodeA.start(); - nodeB.start(); + nodeC.start(); + nodeD.start(); } catch (Exception ex) { System.err.println("Exception when creating domain " + ex.getMessage()); @@ -51,14 +56,16 @@ public class PromotionTestCase { @AfterClass public static void destroy() throws Exception { - nodeA.stop(); - nodeB.stop(); + nodeC.stop(); + nodeC.destroy(); + nodeD.stop(); + nodeD.destroy(); } @Test public void testHelloWorldPromotion() throws Exception { HelloWorldClient helloWorldClientA; - helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientRemotePromotion"); + helloWorldClientA = nodeC.getService(HelloWorldClient.class, "AHelloWorldClientRemotePromotion"); Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); } diff --git a/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java b/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java index 2d2a23d7df..d6724d2a61 100644 --- a/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java +++ b/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java @@ -21,6 +21,9 @@ package org.apache.tuscany.sca.binding.sca.axis2; import junit.framework.Assert; import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.node.Contribution; +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; @@ -28,8 +31,8 @@ import org.osoa.sca.ServiceUnavailableException; public class SimpleTestCase { - public static TestNode nodeA; - public static TestNode nodeB; + public static Node nodeA; + public static Node nodeB; @BeforeClass public static void init() throws Exception { @@ -37,8 +40,10 @@ public class SimpleTestCase { try { // create and start domains - nodeA = new TestNode("nodeA"); - nodeB = new TestNode("nodeB"); + NodeFactory nodeFactory = NodeFactory.newInstance(); + ClassLoader cl = AsynchTestCase.class.getClassLoader(); + nodeA = nodeFactory.createNode("HelloWorld.composite", new Contribution("http://calculator", cl.getResource("nodeA").toString())); + nodeB = nodeFactory.createNode("HelloWorld.composite", new Contribution("http://calculator", cl.getResource("nodeB").toString())); nodeA.start(); nodeB.start(); @@ -53,7 +58,9 @@ public class SimpleTestCase { @AfterClass public static void destroy() throws Exception { nodeA.stop(); + nodeA.destroy(); nodeB.stop(); + nodeB.destroy(); } @Test diff --git a/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java b/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java deleted file mode 100644 index 5e4ad12c23..0000000000 --- a/branches/sca-equinox/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.binding.sca.axis2; - -import java.net.URL; -import java.util.logging.Logger; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.CompositeService; -import org.apache.tuscany.sca.assembly.SCABinding; -import org.apache.tuscany.sca.assembly.SCABindingFactory; -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.service.ContributionService; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.core.context.ServiceReferenceImpl; -import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime; -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentContext; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; -import org.osoa.sca.ServiceReference; -import org.osoa.sca.ServiceRuntimeException; - -/** - * The very minimum node implementation to get these tests going without creating a dependency on - * any runtime/hosting implementation - * - * @version $Rev: 552343 $ $Date: 2007-09-20 14:53:40 +0100 (Thu, 20 Sep 2007) $ - */ -public class TestNode { - - private static final Logger logger = Logger.getLogger(TestNode.class.getName()); - - private String nodeName; - private ReallySmallRuntime nodeRuntime; - - private ClassLoader cl = TestNode.class.getClassLoader(); - - private Composite nodeComposite = null; - private Composite appComposite = null; - - public TestNode(String nodeName) - throws Exception { - this.nodeName = nodeName; - - try { - - // create and start domainA - nodeRuntime = new ReallySmallRuntime(cl); - nodeRuntime.start(); - - // Create an in-memory domain level composite - AssemblyFactory assemblyFactory = nodeRuntime.getAssemblyFactory(); - nodeComposite = assemblyFactory.createComposite(); - nodeComposite.setName(new QName(Constants.SCA10_NS, "domain")); - nodeComposite.setURI("http://localhost"); - - // add the top level composite into the composite activator - nodeRuntime.getCompositeActivator().setDomainComposite(nodeComposite); - - // add a contribution to the domain - ContributionService contributionService = nodeRuntime.getContributionService(); - - // find the current directory as a URL. This is where our contribution - // will come from - URL contributionURL = Thread.currentThread().getContextClassLoader().getResource(nodeName + "/"); - - // Contribute the SCA application - Contribution contribution = contributionService.contribute("http://calculator", contributionURL, null, false); - appComposite = contribution.getDeployables().get(0); - - // Add the deployable composite to the domain - nodeComposite.getIncludes().add(appComposite); - nodeRuntime.buildComposite(appComposite); - nodeRuntime.getCompositeActivator().activate(appComposite); - - - } catch (Exception ex) { - System.err.println("Exception when creating node " + ex.getMessage()); - ex.printStackTrace(System.err); - throw ex; - } - } - - public void start() { - - try { - nodeRuntime.getCompositeActivator().start(appComposite); - } catch (Exception ex) { - System.err.println("Exception when creating domain " + ex.getMessage()); - ex.printStackTrace(System.err); - } - - } - - public void stop() { - try { - nodeRuntime.stop(); - } catch (Exception ex) { - System.err.println("Exception when creating domain " + ex.getMessage()); - ex.printStackTrace(System.err); - } - } - - public B getService(Class businessInterface, String serviceName) { - ServiceReference serviceReference = getServiceReference(businessInterface, serviceName); - if (serviceReference == null) { - throw new ServiceRuntimeException("Service not found: " + serviceName); - } - return serviceReference.getService(); - } - - private ServiceReference createServiceReference(Class businessInterface, String targetURI) { - try { - AssemblyFactory assemblyFactory = nodeRuntime.getAssemblyFactory(); - Composite composite = assemblyFactory.createComposite(); - composite.setName(new QName(Constants.SCA10_TUSCANY_NS, "default")); - RuntimeComponent component = (RuntimeComponent)assemblyFactory.createComponent(); - component.setName("default"); - component.setURI("default"); - nodeRuntime.getCompositeActivator().configureComponentContext(component); - composite.getComponents().add(component); - RuntimeComponentReference reference = (RuntimeComponentReference)assemblyFactory.createComponentReference(); - reference.setName("default"); - FactoryExtensionPoint factories = - nodeRuntime.getExtensionPointRegistry().getExtensionPoint(FactoryExtensionPoint.class); - JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class); - InterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract(); - interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface)); - reference.setInterfaceContract(interfaceContract); - component.getReferences().add(reference); - reference.setComponent(component); - SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class); - SCABinding binding = scaBindingFactory.createSCABinding(); - binding.setURI(targetURI); - reference.getBindings().add(binding); - return new ServiceReferenceImpl(businessInterface, component, reference, binding, nodeRuntime - .getProxyFactory(), nodeRuntime.getCompositeActivator()); - } catch (Exception e) { - throw new ServiceRuntimeException(e); - } - } - - public ServiceReference getServiceReference(Class businessInterface, String name) { - - // Extract the component name - String componentName; - String serviceName; - int i = name.indexOf('/'); - if (i != -1) { - componentName = name.substring(0, i); - serviceName = name.substring(i + 1); - - } else { - componentName = name; - serviceName = null; - } - - // Lookup the component in the domain - - Component component = null; - - for (Composite composite: nodeComposite.getIncludes()) { - for (Component componentLoop: composite.getComponents()) { - if (componentLoop.getName().equals(componentName)) { - component = componentLoop; - break; - } - } - } - if (component == null) { - // The component is not local in the partition, try to create a remote service ref - return createServiceReference(businessInterface, name); - } - RuntimeComponentContext componentContext = null; - - // If the component is a composite, then we need to find the - // non-composite component that provides the requested service - if (component.getImplementation() instanceof Composite) { - for (ComponentService componentService : component.getServices()) { - if (serviceName == null || serviceName.equals(componentService.getName())) { - CompositeService compositeService = (CompositeService)componentService.getService(); - if (compositeService != null) { - if (serviceName != null) { - serviceName = "$promoted$" + component.getName() + "$slash$" + serviceName; - } - componentContext = - ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext(); - return componentContext.createSelfReference(businessInterface, compositeService - .getPromotedService()); - } - break; - } - } - // No matching service is found - throw new ServiceRuntimeException("Composite service not found: " + name); - } else { - componentContext = ((RuntimeComponent)component).getComponentContext(); - if (serviceName != null) { - return componentContext.createSelfReference(businessInterface, serviceName); - } else { - return componentContext.createSelfReference(businessInterface); - } - } - } - -} - diff --git a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDLTestCase.java b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDLTestCase.java index 7ee48d4451..09b414b2d8 100644 --- a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDLTestCase.java +++ b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDLTestCase.java @@ -21,14 +21,17 @@ package org.apache.tuscany.sca.binding.ws.axis2.itests ; import junit.framework.TestCase; -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 HelloWorldNoWSDLTestCase extends TestCase { - private SCADomain domain; + private Node node; public void testHelloWorld() throws Exception { - HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldComponent"); + HelloWorld helloWorld = node.getService(HelloWorld.class, "HelloWorldComponent"); assertEquals("Hello petra", helloWorld.getGreetings("petra")); } @@ -36,7 +39,7 @@ public class HelloWorldNoWSDLTestCase extends TestCase { * Test a a WS call with a complex type */ public void testEchoFoo() throws Exception { - Echo echo = domain.getService(Echo.class, "EchoComponent"); + Echo echo = node.getService(Echo.class, "EchoComponent"); Foo f = new Foo(); Bar b1 = new Bar(); @@ -66,12 +69,15 @@ public class HelloWorldNoWSDLTestCase extends TestCase { @Override protected void setUp() throws Exception { - domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite"); + String contribution = ContributionLocationHelper.getContributionLocation(getClass()); + node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite", new Contribution("test", contribution)); + node.start(); } @Override protected void tearDown() throws Exception { - domain.close(); + node.stop(); + node.destroy(); } } diff --git a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMTestCase.java b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMTestCase.java index e7511027c2..4bb5bdb87d 100644 --- a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMTestCase.java +++ b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMTestCase.java @@ -26,11 +26,14 @@ import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMText; -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 HelloWorldOMTestCase extends TestCase { - private SCADomain domain; + private Node node; private HelloWorldOM helloWorld; public void testHelloWorld() throws Exception { @@ -46,13 +49,16 @@ public class HelloWorldOMTestCase extends TestCase { @Override protected void setUp() throws Exception { - domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite"); - helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent"); + String contribution = ContributionLocationHelper.getContributionLocation(getClass()); + node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite", new Contribution("test", contribution)); + node.start(); + helloWorld = node.getService(HelloWorldOM.class, "HelloWorldComponent"); } @Override protected void tearDown() throws Exception { - domain.close(); + node.stop(); + node.destroy(); } } diff --git a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldTestCase.java b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldTestCase.java index a3a43d032f..ab197ae25e 100644 --- a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldTestCase.java +++ b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldTestCase.java @@ -21,11 +21,14 @@ package org.apache.tuscany.sca.binding.ws.axis2.itests; import junit.framework.TestCase; -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 HelloWorldTestCase extends TestCase { - private SCADomain domain; + private Node node; private HelloWorld helloWorld; public void testCalculator() throws Exception { @@ -34,13 +37,15 @@ public class HelloWorldTestCase extends TestCase { @Override protected void setUp() throws Exception { - domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite"); - helloWorld = domain.getService(HelloWorld.class, "HelloWorldComponent"); + String contribution = ContributionLocationHelper.getContributionLocation(getClass()); + node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite", new Contribution("test", contribution)); + helloWorld = node.getService(HelloWorld.class, "HelloWorldComponent"); } @Override protected void tearDown() throws Exception { - domain.close(); + node.stop(); + node.destroy(); } } diff --git a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldWSDLMergedTestCase.java b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldWSDLMergedTestCase.java index 8e17b89f33..8b4113e7ec 100644 --- a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldWSDLMergedTestCase.java +++ b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldWSDLMergedTestCase.java @@ -26,11 +26,14 @@ import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMText; -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 HelloWorldWSDLMergedTestCase extends TestCase { - private SCADomain domain; + private Node node; private HelloWorldOM helloWorld; public void testHelloWorld() throws Exception { @@ -46,13 +49,15 @@ public class HelloWorldWSDLMergedTestCase extends TestCase { @Override protected void setUp() throws Exception { - domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite"); - helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldWSDLMergedComponent"); + String contribution = ContributionLocationHelper.getContributionLocation(getClass()); + node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite", new Contribution("test", contribution)); + helloWorld = node.getService(HelloWorldOM.class, "HelloWorldWSDLMergedComponent"); } @Override protected void tearDown() throws Exception { - domain.close(); + node.stop(); + node.destroy(); } } diff --git a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java index b276d8210f..6c62d52cc6 100644 --- a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java +++ b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java @@ -36,7 +36,10 @@ import javax.xml.namespace.QName; import junit.framework.TestCase; import org.apache.axis2.transport.http.server.HttpUtils; -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; /** * Test ?wsdl works and that the returned WSDL has the correct endpoint @@ -45,7 +48,7 @@ import org.apache.tuscany.sca.host.embedded.SCADomain; */ public class QuestionMarkWSDLImportTestCase extends TestCase { - private SCADomain domain; + private Node node; /** * Tests ?wsdl works and returns the correct port endpoint from the WSDL @@ -85,12 +88,15 @@ public class QuestionMarkWSDLImportTestCase extends TestCase { @Override protected void setUp() throws Exception { - domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-import.composite"); + String contribution = ContributionLocationHelper.getContributionLocation(getClass()); + node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-import.composite", new Contribution("test", contribution)); + node.start(); } @Override protected void tearDown() throws Exception { - domain.close(); + node.stop(); + node.destroy(); } } diff --git a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java index 59eb6164fa..a9d31fb9a8 100644 --- a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java +++ b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java @@ -36,7 +36,10 @@ import javax.xml.namespace.QName; import junit.framework.TestCase; import org.apache.axis2.transport.http.server.HttpUtils; -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; /** * Test ?wsdl works and that the returned WSDL has the correct endpoint @@ -45,7 +48,7 @@ import org.apache.tuscany.sca.host.embedded.SCADomain; */ public class QuestionMarkWSDLIncludeTestCase extends TestCase { - private SCADomain domain; + private Node node; /** * Tests ?wsdl works and returns the correct port endpoint from the WSDL @@ -85,12 +88,15 @@ public class QuestionMarkWSDLIncludeTestCase extends TestCase { @Override protected void setUp() throws Exception { - domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-include.composite"); + String contribution = ContributionLocationHelper.getContributionLocation(getClass()); + node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-include.composite", new Contribution("test", contribution)); + node.start(); } @Override protected void tearDown() throws Exception { - domain.close(); + node.stop(); + node.destroy(); } } diff --git a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java index 0508f28e11..63026f95f7 100644 --- a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java +++ b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java @@ -36,7 +36,10 @@ import javax.xml.namespace.QName; import junit.framework.TestCase; import org.apache.axis2.transport.http.server.HttpUtils; -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; /** * Test ?wsdl works and that the returned WSDL has the correct endpoint @@ -45,7 +48,7 @@ import org.apache.tuscany.sca.host.embedded.SCADomain; */ public class QuestionMarkWSDLTestCase extends TestCase { - private SCADomain domain; + private Node node; /** * Tests ?wsdl works and returns the correct port endpoint from the WSDL @@ -113,12 +116,15 @@ public class QuestionMarkWSDLTestCase extends TestCase { @Override protected void setUp() throws Exception { - domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite"); + String contribution = ContributionLocationHelper.getContributionLocation(getClass()); + node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite", new Contribution("test", contribution)); + node.start(); } @Override protected void tearDown() throws Exception { - domain.close(); + node.stop(); + node.destroy(); } } diff --git a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/UriPrecedenceTestCase.java b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/UriPrecedenceTestCase.java index 5efbedba4c..7a6752126d 100644 --- a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/UriPrecedenceTestCase.java +++ b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/UriPrecedenceTestCase.java @@ -26,7 +26,10 @@ import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMText; -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; import org.osoa.sca.ServiceRuntimeException; /** @@ -37,7 +40,7 @@ import org.osoa.sca.ServiceRuntimeException; */ public class UriPrecedenceTestCase extends TestCase { - private SCADomain domain; + private Node node; private HelloWorldOM helloWorld; public void testUriPrecedence() throws Exception { @@ -57,12 +60,15 @@ public class UriPrecedenceTestCase extends TestCase { @Override protected void setUp() throws Exception { - domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-prec.composite"); - helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent"); + String contribution = ContributionLocationHelper.getContributionLocation(getClass()); + node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-prec.composite", new Contribution("test", contribution)); + node.start(); + helloWorld = node.getService(HelloWorldOM.class, "HelloWorldComponent"); } @Override protected void tearDown() throws Exception { - domain.close(); + node.stop(); + node.destroy(); } } diff --git a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java index 56d0537a44..a41e0fd2c9 100644 --- a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java +++ b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java @@ -27,11 +27,14 @@ import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMText; import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOM; -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 abstract class AbstractHelloWorldOMTestCase extends TestCase { - private SCADomain domain; + private Node node; private HelloWorldOM helloWorld; public void testCalculator() throws Exception { @@ -47,13 +50,16 @@ public abstract class AbstractHelloWorldOMTestCase extends TestCase { @Override protected void setUp() throws Exception { - domain = SCADomain.newInstance(getCompositeName()); - helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent"); + String contribution = ContributionLocationHelper.getContributionLocation(getClass()); + node = NodeFactory.newInstance().createNode(getCompositeName(), new Contribution("test", contribution)); + node.start(); + helloWorld = node.getService(HelloWorldOM.class, "HelloWorldComponent"); } @Override protected void tearDown() throws Exception { - domain.close(); + node.stop(); + node.destroy(); } protected String getCompositeName() { diff --git a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorldTestCase.java b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorldTestCase.java index f5d87cdcee..23dcd5ff6d 100644 --- a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorldTestCase.java +++ b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorldTestCase.java @@ -22,11 +22,14 @@ package org.apache.tuscany.sca.binding.ws.axis2.itests.epr; import junit.framework.TestCase; import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld; -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 HelloWorldTestCase extends TestCase { - private SCADomain domain; + private Node node; private HelloWorld helloWorld; public void testCalculator() throws Exception { @@ -35,13 +38,16 @@ public class HelloWorldTestCase extends TestCase { @Override protected void setUp() throws Exception { - domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite"); - helloWorld = domain.getService(HelloWorld.class, "HelloWorldComponent"); + String contribution = ContributionLocationHelper.getContributionLocation(getClass()); + node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite", new Contribution("test", contribution)); + node.start(); + helloWorld = node.getService(HelloWorld.class, "HelloWorldComponent"); } @Override protected void tearDown() throws Exception { - domain.close(); + node.stop(); + node.destroy(); } } diff --git a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/AbstractHelloWorldOMTestCase.java b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/AbstractHelloWorldOMTestCase.java index 6cdb12c221..dedd5a52a3 100644 --- a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/AbstractHelloWorldOMTestCase.java +++ b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/AbstractHelloWorldOMTestCase.java @@ -27,11 +27,14 @@ import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMText; import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOM; -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 abstract class AbstractHelloWorldOMTestCase extends TestCase { - private SCADomain domain; + private Node node; private HelloWorldOM helloWorld; public void testHelloWorld() throws Exception { @@ -47,13 +50,16 @@ public abstract class AbstractHelloWorldOMTestCase extends TestCase { @Override protected void setUp() throws Exception { - domain = SCADomain.newInstance(getCompositeName()); - helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent"); + String contribution = ContributionLocationHelper.getContributionLocation(getClass()); + node = NodeFactory.newInstance().createNode(getCompositeName(), new Contribution("test", contribution)); + node.start(); + helloWorld = node.getService(HelloWorldOM.class, "HelloWorldComponent"); } @Override protected void tearDown() throws Exception { - domain.close(); + node.stop(); + node.destroy(); } protected String getCompositeName() { diff --git a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/AbstractHelloWorldOMTestCase.java b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/AbstractHelloWorldOMTestCase.java index 458a472479..a432f46b7a 100644 --- a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/AbstractHelloWorldOMTestCase.java +++ b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/AbstractHelloWorldOMTestCase.java @@ -26,14 +26,17 @@ import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMText; import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOM; -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; import org.junit.After; import org.junit.Before; import org.junit.Test; public abstract class AbstractHelloWorldOMTestCase { - private SCADomain domain; + private Node node; private HelloWorldOM helloWorld; @Test @@ -50,13 +53,16 @@ public abstract class AbstractHelloWorldOMTestCase { @Before public void setUp() throws Exception { - domain = SCADomain.newInstance(getCompositeName()); - helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent"); + String contribution = ContributionLocationHelper.getContributionLocation(getClass()); + node = NodeFactory.newInstance().createNode(getCompositeName(), new Contribution("test", contribution)); + node.start(); + helloWorld = node.getService(HelloWorldOM.class, "HelloWorldComponent"); } @After public void tearDown() throws Exception { - domain.close(); + node.stop(); + node.destroy(); } protected String getCompositeName() { diff --git a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/AbstractHelloWorldOMTestCase.java b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/AbstractHelloWorldOMTestCase.java index 04de589fb1..66852c9ce3 100644 --- a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/AbstractHelloWorldOMTestCase.java +++ b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/AbstractHelloWorldOMTestCase.java @@ -27,11 +27,14 @@ import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMText; import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOM; -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 abstract class AbstractHelloWorldOMTestCase extends TestCase { - private SCADomain domain; + private Node node; private HelloWorldOM helloWorld; public void testHelloWorld() throws Exception { @@ -47,13 +50,16 @@ public abstract class AbstractHelloWorldOMTestCase extends TestCase { @Override protected void setUp() throws Exception { - domain = SCADomain.newInstance(getCompositeName()); - helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent"); + String contribution = ContributionLocationHelper.getContributionLocation(getClass()); + node = NodeFactory.newInstance().createNode(getCompositeName(), new Contribution("test", contribution)); + node.start(); + helloWorld = node.getService(HelloWorldOM.class, "HelloWorldComponent"); } @Override protected void tearDown() throws Exception { - domain.close(); + node.stop(); + node.destroy(); } protected String getCompositeName() { diff --git a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCase.java b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCase.java index b2ccd7f97d..b8304a0c61 100644 --- a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCase.java +++ b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCase.java @@ -22,37 +22,42 @@ package org.apache.tuscany.sca.binding.ws.axis2.itests.soap12 ; import junit.framework.TestCase; import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld; -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 HelloWorldSOAP12TestCase extends TestCase { - private SCADomain domain; + private Node node; public void testHelloWorld() throws Exception { - HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClient"); + HelloWorld helloWorld = node.getService(HelloWorld.class, "HelloWorldClient"); assertEquals("Hello petra", helloWorld.getGreetings("petra")); } public void testHelloWorldSOAP() throws Exception { - HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClientSOAP"); + HelloWorld helloWorld = node.getService(HelloWorld.class, "HelloWorldClientSOAP"); assertEquals("Hello petra", helloWorld.getGreetings("petra")); } public void testHelloWorldSOAP11() throws Exception { - HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClientSOAP11"); + HelloWorld helloWorld = node.getService(HelloWorld.class, "HelloWorldClientSOAP11"); assertEquals("Hello petra", helloWorld.getGreetings("petra")); } public void testHelloWorldSOAP12() throws Exception { - HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClientSOAP12"); + HelloWorld helloWorld = node.getService(HelloWorld.class, "HelloWorldClientSOAP12"); assertEquals("Hello petra", helloWorld.getGreetings("petra")); } @Override protected void setUp() throws Exception { - domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite"); + String contribution = ContributionLocationHelper.getContributionLocation(getClass()); + node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite", new Contribution("test", contribution)); } @Override protected void tearDown() throws Exception { - domain.close(); + node.stop(); + node.destroy(); } } diff --git a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java index 8d378565d4..5a75846e9d 100644 --- a/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java +++ b/branches/sca-equinox/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java @@ -33,7 +33,10 @@ import javax.xml.namespace.QName; import junit.framework.TestCase; import org.apache.axis2.transport.http.server.HttpUtils; -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; /** * Test ?wsdl works and that the returned WSDL has the correct endpoint @@ -43,7 +46,7 @@ import org.apache.tuscany.sca.host.embedded.SCADomain; public class QuestionMarkWSDLTestCase extends TestCase { private static boolean newGenerator = true; - private SCADomain domain; + private Node node; /** * Tests ?wsdl returns a soap 1.1 port by default @@ -127,12 +130,15 @@ public class QuestionMarkWSDLTestCase extends TestCase { @Override protected void setUp() throws Exception { - domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/questionmark-wsdl.composite"); + String contribution = ContributionLocationHelper.getContributionLocation(getClass()); + node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/questionmark-wsdl.composite", new Contribution("test", contribution)); + node.start(); } @Override protected void tearDown() throws Exception { - domain.close(); + node.stop(); + node.destroy(); } } diff --git a/branches/sca-equinox/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/branches/sca-equinox/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java index fb22d2ea5d..f827a4ff32 100644 --- a/branches/sca-equinox/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java +++ b/branches/sca-equinox/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java @@ -20,6 +20,7 @@ package org.apache.tuscany.sca.node.impl; import static java.lang.System.currentTimeMillis; +import static org.apache.tuscany.sca.definitions.util.SCADefinitionsUtil.aggregateSCADefinitions; import static org.apache.tuscany.sca.node.impl.NodeUtil.contribution; import static org.apache.tuscany.sca.node.impl.NodeUtil.createURI; @@ -53,9 +54,11 @@ import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver; import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; +import org.apache.tuscany.sca.contribution.service.ContributionResolveException; import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; @@ -69,6 +72,7 @@ import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory; import org.apache.tuscany.sca.core.invocation.ProxyFactory; import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint; import org.apache.tuscany.sca.definitions.SCADefinitions; +import org.apache.tuscany.sca.definitions.impl.SCADefinitionsImpl; import org.apache.tuscany.sca.implementation.node.ConfiguredNodeImplementation; import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory; import org.apache.tuscany.sca.monitor.Monitor; @@ -77,6 +81,12 @@ import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.Problem.Severity; import org.apache.tuscany.sca.node.Client; import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.policy.Intent; +import org.apache.tuscany.sca.policy.IntentAttachPointType; +import org.apache.tuscany.sca.policy.PolicySet; +import org.apache.tuscany.sca.provider.SCADefinitionsProvider; +import org.apache.tuscany.sca.provider.SCADefinitionsProviderException; +import org.apache.tuscany.sca.provider.SCADefinitionsProviderExtensionPoint; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentContext; import org.apache.tuscany.sca.work.WorkScheduler; @@ -120,6 +130,7 @@ public class NodeImpl implements Node, Client { private List moduleActivators = new ArrayList(); private CompositeActivator compositeActivator; private WorkScheduler workScheduler; + private SCADefinitions systemDefinitions; /** * Constructs a new SCA node. @@ -308,9 +319,47 @@ public class NodeImpl implements Node, Client { compositeActivator = utilities.getUtility(CompositeActivator.class); workScheduler = utilities.getUtility(WorkScheduler.class); + + // This is not right, the aggregate algorithm is not right, adding policies to + // a resolver like that is not correct as these policies won't be seen by the resolvers + // used by the contributions, and we shouldn't have to use the doc processor to do + // the resolution, so commenting out for now as it's not critical to get working in + // the Equinox environment initially - // Load the definitions.xml - //loadSCADefinitions(); +// // Load the system definitions.xml +// SCADefinitionsProviderExtensionPoint definitionsProviders = extensionPoints.getExtensionPoint(SCADefinitionsProviderExtensionPoint.class); +// systemDefinitions = new SCADefinitionsImpl(); +// try { +// for (SCADefinitionsProvider definitionsProvider : definitionsProviders.getSCADefinitionsProviders()) { +// aggregateSCADefinitions(definitionsProvider.getSCADefinition(), systemDefinitions); +// } +// } catch (SCADefinitionsProviderException e) { +// throw new IllegalStateException(e); +// } +// +// // Configure a resolver for the system definitions +// ModelResolver definitionsResolver = new DefaultModelResolver(); +// for (Intent intent : systemDefinitions.getPolicyIntents()) { +// definitionsResolver.addModel(intent); +// } +// for (PolicySet policySet : systemDefinitions.getPolicySets()) { +// definitionsResolver.addModel(policySet); +// } +// for (IntentAttachPointType bindingType : systemDefinitions.getBindingTypes()) { +// definitionsResolver.addModel(bindingType); +// } +// for (IntentAttachPointType implementationType : systemDefinitions.getImplementationTypes()) { +// definitionsResolver.addModel(implementationType); +// } +// +// // Now that all system sca definitions have been read, let's resolve them +// URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); +// URLArtifactProcessor definitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class); +// try { +// definitionsProcessor.resolve(systemDefinitions, definitionsResolver); +// } catch (ContributionResolveException e) { +// throw new IllegalStateException(e); +// } if (logger.isLoggable(Level.FINE)) { long end = currentTimeMillis(); @@ -388,10 +437,10 @@ public class NodeImpl implements Node, Client { } // Build an aggregated SCA definitions model - SCADefinitions definitions = null; + SCADefinitions definitions = systemDefinitions; //definitions = new SCADefinitionsImpl(); //for (SCADefinitions definition : ((List)policyDefinitions)) { - // SCADefinitionsUtil.aggregateSCADefinitions(definition, aggregatedDefinitions); + // SCADefinitionsUtil.aggregateSCADefinitions(definition, definitions); //} // Build the composite and wire the components included in it @@ -407,7 +456,7 @@ public class NodeImpl implements Node, Client { // Include the node composite in the top-level composite tempComposite.getIncludes().add(composite); - // set the top level composite on the composite activator as + // Set the top level composite on the composite activator as // logic in callable reference resolution relies on this being // available compositeActivator.setDomainComposite(tempComposite); diff --git a/branches/sca-equinox/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeUtil.java b/branches/sca-equinox/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeUtil.java index 2a4d6c7e69..396d77af66 100644 --- a/branches/sca-equinox/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeUtil.java +++ b/branches/sca-equinox/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeUtil.java @@ -19,22 +19,11 @@ package org.apache.tuscany.sca.node.impl; -import java.io.IOException; import java.net.URI; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.logging.Level; import java.util.logging.Logger; import org.apache.tuscany.sca.contribution.Contribution; import org.apache.tuscany.sca.contribution.ContributionFactory; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.ModuleActivator; -import org.apache.tuscany.sca.core.assembly.ActivationException; -import org.apache.tuscany.sca.extensibility.ServiceDeclaration; -import org.apache.tuscany.sca.extensibility.ServiceDiscovery; /** * NodeUtil @@ -64,48 +53,4 @@ public class NodeUtil { return URI.create(uri); } -// private void loadSCADefinitions() throws ActivationException { -// try { -// URLArtifactProcessorExtensionPoint documentProcessors = -// registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); -// URLArtifactProcessor definitionsProcessor = -// documentProcessors.getProcessor(SCADefinitions.class); -// SCADefinitionsProviderExtensionPoint scaDefnProviders = -// registry.getExtensionPoint(SCADefinitionsProviderExtensionPoint.class); -// -// SCADefinitions systemSCADefinitions = new SCADefinitionsImpl(); -// SCADefinitions aSCADefn = null; -// for (SCADefinitionsProvider aProvider : scaDefnProviders.getSCADefinitionsProviders()) { -// aSCADefn = aProvider.getSCADefinition(); -// SCADefinitionsUtil.aggregateSCADefinitions(aSCADefn, systemSCADefinitions); -// } -// -// policyDefinitions.add(systemSCADefinitions); -// -// //we cannot expect that providers will add the intents and policysets into the resolver -// //so we do this here explicitly -// for (Intent intent : systemSCADefinitions.getPolicyIntents()) { -// policyDefinitionsResolver.addModel(intent); -// } -// -// for (PolicySet policySet : systemSCADefinitions.getPolicySets()) { -// policyDefinitionsResolver.addModel(policySet); -// } -// -// for (IntentAttachPointType attachPoinType : systemSCADefinitions.getBindingTypes()) { -// policyDefinitionsResolver.addModel(attachPoinType); -// } -// -// for (IntentAttachPointType attachPoinType : systemSCADefinitions.getImplementationTypes()) { -// policyDefinitionsResolver.addModel(attachPoinType); -// } -// -// //now that all system sca definitions have been read, lets resolve them right away -// definitionsProcessor.resolve(systemSCADefinitions, policyDefinitionsResolver); -// -// } catch (Exception e) { -// throw new ActivationException(e); -// } -// } - } -- cgit v1.2.3