Package org.apache.tuscany.sca

Examples of org.apache.tuscany.sca.Node


        Assert.assertEquals("foo", ics.get(0));
    }

    @Test
    public void testGetDeployedCompostes() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, MalformedURLException, ActivationException, ValidationException {
        Node node = TuscanyRuntime.newInstance().createNode("default");
        node.installContribution("foo", "src/test/resources/sample-helloworld.jar", null, null);
        List<String> dcs = node.startDeployables("foo");
        Assert.assertEquals(1, dcs.size());
        Assert.assertEquals("helloworld.composite", dcs.get(0));
    }
View Full Code Here


        Assert.assertEquals("helloworld.composite", dcs.get(0));
    }

    @Test
    public void testRemoveComposte() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, MalformedURLException, ActivationException, ValidationException {
        Node node = TuscanyRuntime.newInstance().createNode("default");
        node.installContribution("foo", "src/test/resources/sample-helloworld.jar", null, null);
        List<String> dcs = node.startDeployables("foo");
        Assert.assertEquals(1, dcs.size());
        Map<String, List<String>> dcsx = node.getStartedCompositeURIs();
        Assert.assertEquals(1, dcsx.size());
        node.stopComposite("foo", "helloworld.composite");
        dcsx = node.getStartedCompositeURIs();
        Assert.assertEquals(0, dcsx.size());
    }
View Full Code Here

        Assert.assertEquals(0, dcsx.size());
    }

    @Test
    public void testInstallWithMetaData() throws ContributionReadException, ActivationException, ValidationException, NoSuchServiceException {
        Node node = TuscanyRuntime.newInstance().createNode("default");
        node.installContribution("helloworld", "src/test/resources/sample-helloworld-nodeployable.jar", "src/test/resources/sca-contribution-generated.xml", null);
        node.startComposite("helloworld", "helloworld.composite");

        Map<String, List<String>> dcs = node.getStartedCompositeURIs();
        Assert.assertEquals(1, dcs.size());
        Assert.assertEquals("helloworld.composite", dcs.get("helloworld").get(0));

        Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
        Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
    }
View Full Code Here

        Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
    }

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

        Assert.assertEquals("sample-helloworld", uri);
    }

    @Test
    public void testStaticCreate() {
        Node node = TuscanyRuntime.runComposite("helloworld.composite", "src/test/resources/sample-helloworld.jar");
        List<String> cs = node.getInstalledContributionURIs();
        Assert.assertEquals(1, cs.size());
        Map<String, List<String>> dcs = node.getStartedCompositeURIs();
        Assert.assertEquals(1, dcs.size());
        Assert.assertEquals("helloworld.composite", dcs.get("sample-helloworld").get(0));
    }
View Full Code Here

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

    @Test
    public void testStaticCreateWithNullComposite() {
        Node node = TuscanyRuntime.runComposite(null, "src/test/resources/sample-helloworld.jar");
        List<String> cs = node.getInstalledContributionURIs();
        Assert.assertEquals(1, cs.size());
        Map<String, List<String>> dcs = node.getStartedCompositeURIs();
        Assert.assertEquals(1, dcs.size());
        Assert.assertEquals("helloworld.composite", dcs.get("sample-helloworld").get(0));
    }
View Full Code Here

        Assert.assertEquals(1, dcs.size());
        Assert.assertEquals("helloworld.composite", dcs.get("sample-helloworld").get(0));
    }
    @Test
    public void testRunComposite() throws NoSuchServiceException {
        Node node = TuscanyRuntime.runComposite("helloworld.composite", "src/test/resources/sample-helloworld.jar");
        Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
        Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
    }
View Full Code Here

        Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
    }

    @Test
    public void testRunCompositeSharedRuntime() throws NoSuchServiceException {
        Node node = TuscanyRuntime.runComposite(URI.create("default"), "helloworld.composite", "src/test/resources/sample-helloworld.jar");
        Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
        Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
    }
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 ClassLoaderReleaseTestCase {

    @Test
    public void testInstallDeployable() throws IOException, ActivationException{
        File f = copyFile("src/test/resources/sample-helloworld.jar");
        Node node = TuscanyRuntime.runComposite(null, f.toURI().toURL().toString());
        // this delete should fail on Windows as the jar is locked, but the doesn't seem to happen in 'nix
        boolean b = f.delete();
        if (!b) {
            Map<String, List<String>> scuris = node.getStartedCompositeURIs();
            node.stopCompositeAndUninstallUnused(scuris.keySet().iterator().next(), scuris.get(scuris.keySet().iterator().next()).get(0));
            Assert.assertTrue(f.delete());
        }
    }
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.