Package org.apache.tuscany.sca

Examples of org.apache.tuscany.sca.Node


        Assert.assertEquals("helloworld.composite", startedComposites.get("sample-helloworld").get(0));
    }

    @Test
    public void testDependencies() throws ContributionReadException, ActivationException, ValidationException, XMLStreamException, IOException, NoSuchServiceException {
        Node node = TuscanyRuntime.newInstance().createNode(new File("src/test/resources/test-domains/dependencies"));
        Assert.assertEquals("dependencies", node.getDomainName());
        List<String> cs = node.getInstalledContributionURIs();
        Assert.assertEquals(4, cs.size());
        Assert.assertEquals("Hello 1 Petra", node.getService(TestIface.class, "Helloworld1Component").sayHello("Petra"));
        Assert.assertEquals("Hello 2 Amelia", node.getService(TestIface.class, "Helloworld2Component").sayHello("Amelia"));
    }
View Full Code Here


*/
public class ContributionClassLoaderTestCase {

    @Test
    public void testInstallDeployable() throws ContributionReadException, ValidationException, ActivationException {
        Node node = TuscanyRuntime.newInstance().createNode();
        String curi = node.installContribution("src/test/resources/sample-helloworld.jar");
        Contribution contribution = node.getContribution(curi);
        Assert.assertNull(contribution.getClassLoader());
        node.validateContribution(curi);
        ClassLoader cl1 = contribution.getClassLoader();
        Assert.assertNotNull(cl1);
        node.startComposite(curi, "helloworld.composite");
        Assert.assertEquals(cl1, node.getContribution(curi).getClassLoader());
    }
View Full Code Here

public class UsedCompositesTestCase {

    @Test
    public void includeTest1() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, XMLStreamException, FileNotFoundException {
        Node node = TuscanyRuntime.newInstance().createNode("localTest");
        String curi = node.installContribution("src/test/resources/sample-helloworld.jar");
        String compositeURI = node.addDeploymentComposite(curi, new FileReader("src/test/resources/include.composite"));

        node.startComposite(curi, compositeURI);
       
        List<String> xs = ((NodeImpl)node).updateUsingComposites(curi, "helloworld.composite");
        Assert.assertEquals(1, xs.size());
        Assert.assertEquals("sample-helloworld/include.composite", xs.get(0));
    }
View Full Code Here

        Assert.assertEquals(1, xs.size());
        Assert.assertEquals("sample-helloworld/include.composite", xs.get(0));
    }
    @Test
    public void implCompositeTest() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, XMLStreamException, FileNotFoundException {
        Node node = TuscanyRuntime.newInstance().createNode("localTest");
        String curi = node.installContribution("src/test/resources/sample-helloworld.jar");
        String compositeURI = node.addDeploymentComposite(curi, new FileReader("src/test/resources/compositeImpl.composite"));

        node.startComposite(curi, compositeURI);
       
        List<String> xs = ((NodeImpl)node).updateUsingComposites(curi, "helloworld.composite");
        Assert.assertEquals(1, xs.size());
        Assert.assertEquals("sample-helloworld/compositeImpl.composite", xs.get(0));
    }
View Full Code Here

        Assert.assertEquals("sample-helloworld/compositeImpl.composite", xs.get(0));
    }

    @Test
    public void nestedTest1() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, XMLStreamException, FileNotFoundException {
        Node node = TuscanyRuntime.newInstance().createNode("NestedTest");
        String curi = node.installContribution("src/test/resources/helloworld2.jar");

        node.startComposite(curi, "compositeImpl.composite");

        String compositeURI = node.addDeploymentComposite(curi, new FileReader("src/test/resources/nested.composite"));
        node.startComposite(curi, compositeURI);
       
        List<String> xs = ((NodeImpl)node).updateUsingComposites(curi, "helloworld.composite");
        Assert.assertEquals(2, xs.size());
        Assert.assertTrue(xs.contains("helloworld2/compositeImpl.composite"));
        Assert.assertTrue(xs.contains("helloworld2/nested.composite"));
View Full Code Here

public class DeployerTestCase {

    @Test
    public void testArtifacts() throws ContributionReadException, ValidationException {

        Node node = TuscanyRuntime.newInstance().createNode();
        String curi = node.installContribution("src/test/resources/sample-helloworld.jar");
        node.validateContribution(curi);

        Contribution contribution = node.getContribution(curi);
        Composite composite = contribution.getArtifactModel("helloworld.composite");
        Component component = composite.getComponents().get(0);
        Service service = component.getImplementation().getServices().get(0);

        Assert.assertEquals("helloworld", composite.getName().getLocalPart());
View Full Code Here

    @Test
    public void testInstallDeployable() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
        TuscanyRuntime runtime = TuscanyRuntime.newInstance();
        try {
        Node node1 = runtime.createNode("uri:TwoNodesTestCase?multicast=off&bind=127.0.0.1:44331");
        node1.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null);
        node1.startComposite("helloworld", "helloworld.composite");

        Node node2 = TuscanyRuntime.newInstance().createNode("uri:TwoNodesTestCase?multicast=off&bind=127.0.0.1:44332&wka=127.0.0.1:44331");

        Helloworld helloworldService = node2.getService(Helloworld.class, "HelloworldComponent");
        Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
    } finally { runtime.stop(); }
    }
View Full Code Here

public class DomainCompositeTestCase {

    @Test
    public void localOnlyDomain() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
        Node node = TuscanyRuntime.newInstance().createNode("DomainCompositeTestCase");
        testIt(node);
    }
View Full Code Here

    @Test
    public void distributedDomain() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
        TuscanyRuntime runtime = TuscanyRuntime.newInstance();
        try {
        Node node = runtime.createNode("uri:DomainCompositeTestCase");
        testIt(node);
        } finally { runtime.stop(); }
    }
View Full Code Here

public class Node2TestCase {

    @Test
    public void localInstall() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
        Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase");
        node.installContribution("src/test/resources/import.jar");

        Assert.assertEquals(1, node.getInstalledContributionURIs().size());
        Assert.assertEquals("import", node.getInstalledContributionURIs().get(0));
        Contribution c = node.getContribution("import");
        Assert.assertNotNull(c);
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.