Package org.apache.tuscany.sca

Examples of org.apache.tuscany.sca.Node


        Assert.assertNotNull(c);
    }

    @Test
    public void remoteInstall() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
        Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase");
        node.installContribution("https://repository.apache.org/content/groups/snapshots/org/apache/tuscany/sca/samples/helloworld/2.0-SNAPSHOT/helloworld-2.0-SNAPSHOT.jar");

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


    @Test
    public void DistributedInstall() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
        TuscanyRuntime runtime = TuscanyRuntime.newInstance();
        try {
        Node nodeA = runtime.createNode("uri:DistributedInstall");
        nodeA.installContribution("https://repository.apache.org/content/groups/snapshots/org/apache/tuscany/sca/samples/helloworld/2.0-SNAPSHOT/helloworld-2.0-SNAPSHOT.jar");
        nodeA.installContribution("src/test/resources/export.jar");

        Assert.assertEquals(2, nodeA.getInstalledContributionURIs().size());
        Assert.assertTrue(nodeA.getInstalledContributionURIs().contains("export"));
        Assert.assertTrue(nodeA.getInstalledContributionURIs().contains("helloworld"));
        Contribution cA = nodeA.getContribution("helloworld");
        Assert.assertNotNull(cA);
       
        Node nodeB = runtime.createNode("uri:DistributedInstall");
        Assert.assertEquals(2, nodeB.getInstalledContributionURIs().size());
        Assert.assertTrue(nodeB.getInstalledContributionURIs().contains("export"));
        Assert.assertTrue(nodeB.getInstalledContributionURIs().contains("helloworld"));
        Contribution cB = nodeB.getContribution("helloworld");
        Assert.assertNotNull(cB);

        ContributionDescription cd = ((NodeImpl)nodeB).getInstalledContribution("export");
        Assert.assertEquals(1, cd.getJavaExports().size());
        Assert.assertEquals("sample", cd.getJavaExports().get(0));
View Full Code Here

        }
    }
   
    @Test
    public void deployables() 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));
        List<String> ds = node.getDeployableCompositeURIs("import");
        Assert.assertEquals(1, ds.size());
        Assert.assertEquals("helloworld.composite", ds.get(0));

    }
View Full Code Here

    }

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

        Assert.assertEquals(1, node.getInstalledContributionURIs().size());
        Assert.assertEquals("export", node.getInstalledContributionURIs().get(0));
       
        ContributionDescription cd = ((NodeImpl)node).getInstalledContribution("export");
        Assert.assertEquals(1, cd.getJavaExports().size());
        Assert.assertEquals("sample", cd.getJavaExports().get(0));
    }
View Full Code Here

        Assert.assertEquals("sample", cd.getJavaExports().get(0));
    }

    @Test
    public void validValidate() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
        Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase");
        node.installContribution("src/test/resources/sample-helloworld.jar");
        node.validateContribution("sample-helloworld");
    }
View Full Code Here

        node.validateContribution("sample-helloworld");
    }

    @Test
    public void invalidValidate() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
        Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase");
        node.installContribution("src/test/resources/import.jar");
        try {
            node.validateContribution("import");
        } catch (ValidationException e) {
            Assert.assertTrue(e.getMessage().endsWith("Unresolved import: Import = sample"));           
        }
    }
View Full Code Here

        }
    }

    @Test
    public void importExportValidate() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
        Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase");
        node.installContribution("src/test/resources/import.jar");
        try {
            node.validateContribution("import");
        } catch (ValidationException e) {
            // expected
        }
        node.installContribution("src/test/resources/export.jar");
        node.validateContribution("import");
        node.startComposite("import", "helloworld.composite");
        Map<String, List<String>> scs = node.getStartedCompositeURIs();
        Assert.assertEquals(1, scs.size());           
    }
View Full Code Here

    @Test
    public void importExportDistributedValidate() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
        TuscanyRuntime runtime = TuscanyRuntime.newInstance();
        try {
            Node nodeA = runtime.createNode("uri:ImportTestCase");
            nodeA.installContribution("src/test/resources/import.jar");
            try {
                nodeA.validateContribution("import");
            } catch (ValidationException e) {
                // expected
            }
            Node nodeB =runtime.createNode("uri:ImportTestCase");
            nodeB.installContribution("src/test/resources/export.jar");
            nodeA.validateContribution("import");
            nodeA.startComposite("import", "helloworld.composite");
            Map<String, List<String>> scs = nodeB.getStartedCompositeURIs();
            Assert.assertEquals(1, scs.size());           
        }finally {
            runtime.stop();
        }
View Full Code Here

    }

    @Test
    public void startTest() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
        Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase");
        node.installContribution("src/test/resources/sample-helloworld.jar");
        Assert.assertEquals(0, node.getStartedCompositeURIs().size());

        node.startComposite("sample-helloworld", "helloworld.composite");
        Assert.assertEquals(1, node.getStartedCompositeURIs().size());
        Assert.assertEquals("helloworld.composite", node.getStartedCompositeURIs().get("sample-helloworld").get(0));
       
        node.stopComposite("sample-helloworld", "helloworld.composite");
//        Assert.assertEquals(0, node.getStartedComposites().size());
        node.startComposite("sample-helloworld", "helloworld.composite");
        Assert.assertEquals(1, node.getStartedCompositeURIs().size());
        Assert.assertEquals("helloworld.composite", node.getStartedCompositeURIs().get("sample-helloworld").get(0));
        node.stopComposite("sample-helloworld", "helloworld.composite");
    }
View Full Code Here

    @Test
    public void startDistributedTest() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, InterruptedException {
        TuscanyRuntime runtime = TuscanyRuntime.newInstance();
        try {
        Node node = runtime.createNode("uri:ImportTestCase");
        Node node2 = runtime.createNode("uri:ImportTestCase");
       
        node.installContribution("src/test/resources/sample-helloworld.jar");
        Assert.assertEquals(1, node.getInstalledContributionURIs().size());
        Assert.assertEquals(1, node2.getInstalledContributionURIs().size());

        node.startComposite("sample-helloworld", "helloworld.composite");
        Assert.assertEquals(1, node.getStartedCompositeURIs().size());
        Assert.assertEquals(1, node2.getStartedCompositeURIs().size());

        Assert.assertEquals("helloworld.composite", node.getStartedCompositeURIs().get("sample-helloworld").get(0));
        Assert.assertEquals("helloworld.composite", node2.getStartedCompositeURIs().get("sample-helloworld").get(0));
       
        node.stopComposite("sample-helloworld", "helloworld.composite");
        Assert.assertEquals(0, node.getStartedCompositeURIs().size());
        Assert.assertEquals(0, node2.getStartedCompositeURIs().size());

        node2.startComposite("sample-helloworld", "helloworld.composite");
        Assert.assertEquals(1, node.getStartedCompositeURIs().size());
        Assert.assertEquals("helloworld.composite", node.getStartedCompositeURIs().get("sample-helloworld").get(0));

        Assert.assertEquals(1, node2.getStartedCompositeURIs().size());
        Assert.assertEquals("helloworld.composite", node2.getStartedCompositeURIs().get("sample-helloworld").get(0));

    } finally {
        runtime.stop();
    }
    }
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.