Package org.apache.tuscany.sca

Examples of org.apache.tuscany.sca.Node


    @Test
    public void testSayHello() throws NoSuchServiceException {

        // Run the SCA composite in a Tuscany runtime
        Node node = TuscanyRuntime.runComposite("helloworld.composite", "target/classes");
        try {
           
            // Get the Helloworld service proxy
            Helloworld helloworld = node.getService(Helloworld.class, "HelloworldComponent");
           
            // test that it works as expected
            Assert.assertEquals("Hello Amelia", helloworld.sayHello("Amelia"));
           
        } finally {
            // Stop the Tuscany runtime Node
            node.stop();       
        }
    }
View Full Code Here


    @Test
    public void testSayHello() throws NoSuchServiceException, IOException {

        // Run the SCA composite in a Tuscany runtime
        Node node = TuscanyRuntime.runComposite("helloworld.composite", "target/classes/org/apache/tuscany/sca/itest/interfaces/remoteoverride");
        try {
           
            // Get the Helloworld service proxy
            Helloworld helloworld = node.getService(Helloworld.class, "HelloworldComponent");
           
            // test that it works as expected
            Assert.assertEquals("Hello Amelia", helloworld.sayHello("Amelia"));
           
            // test that has exposed an HTTP endpoint that works as expected
            // to keep this test simple just do ?wsdl on the endpoint 
            URL url = new URL("http://localhost:8085/HelloworldComponent/HelloworldImpl?wsdl");
            Assert.assertTrue(read(url.openStream()).contains("address location="));

        } finally {
            // Stop the Tuscany runtime Node
            node.stop();       
        }
    }
View Full Code Here

//        node.stopComposite("sample-helloworld", "helloworld.composite");
    }

    @Test
    public void stopAndUnistallTest() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, XMLStreamException {
        Node node = TuscanyRuntime.newInstance().createNode("stopAndUnistallTest");
        node.installContribution("src/test/resources/import.jar");
        node.installContribution("src/test/resources/export.jar");
        String compositeXML =
            "<composite xmlns=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\""
                + "     xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.1\""
                + "     targetNamespace=\"http://test/composite\""
                + "     name=\"TestComposite\">"
                + "   <component name=\"TestComponent\">"
                + "      <implementation.java class=\"sample.HelloworldImpl\"/>"
                + "   </component>"
                + "</composite>";
        String compositeURI = node.addDeploymentComposite("export", new StringReader(compositeXML));
        node.startComposite("import", "helloworld.composite");
        node.startComposite("export", compositeURI);
        Assert.assertEquals(2, node.getInstalledContributionURIs().size());
        node.stopCompositeAndUninstallUnused("import", "helloworld.composite");
        Assert.assertEquals(1, node.getInstalledContributionURIs().size());
        node.stopCompositeAndUninstallUnused("export", compositeURI);
        Assert.assertEquals(0, node.getInstalledContributionURIs().size());
    }
View Full Code Here

*/
public class EndpointURITestCase{

    @Test
    public void testDefault() throws Exception {
        Node node = TuscanyRuntime.runComposite(null, "src/test/resources/helloworld-ws.jar");
        try {

            assertEquals(1, node.getInstalledContributionURIs().size());
           
            assertNotNull(getWsdlUrl("http://localhost:8080/HelloworldComponent/Helloworld"));
       
        } finally {
            node.stop();
        }
    }
View Full Code Here

        }
    }

    @Test
    public void testDomainRoot() throws Exception {
        Node node = TuscanyRuntime.runComposite(URI.create("myDomain"), null, "src/test/resources/helloworld-ws.jar");
        try {

            assertEquals(1, node.getInstalledContributionURIs().size());
           
            assertNotNull(getWsdlUrl("http://localhost:8080/myDomain/HelloworldComponent/Helloworld"));
       
        } finally {
            node.stop();
        }
    }
View Full Code Here

    @Test
    public void testStopStart() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
        Properties config = new Properties();
        config.setProperty(RuntimeProperties.QUIET_LOGGING, "true");
        Node node = TuscanyRuntime.newInstance(config).createNode();
        node.installContribution(null, "src/test/resources/sample-helloworld.jar", null, null);
       
        validate(node);

        int count = 3000;
        long start = System.currentTimeMillis();
        for (int i=0; i<count; i++) {
            node.startComposite("sample-helloworld", "helloworld.composite");
            node.stopComposite("sample-helloworld", "helloworld.composite");
        }
        long total = System.currentTimeMillis() - start;
        System.out.println(count + " = " + total + " = " + total / (double)count);

        // test it still works
View Full Code Here

public class NodeXMLTestCase {

    @Test
    public void testHelloworldXML() throws ContributionReadException, ActivationException, ValidationException {
        Node node = TuscanyRuntime.newInstance().createNodeFromXML("src/test/resources/helloworldNode.xml");
        Assert.assertEquals("helloworld", node.getDomainName());
        List<String> cs = node.getInstalledContributionURIs();
        Assert.assertEquals(1, cs.size());
        Assert.assertEquals("sample-helloworld", cs.get(0));
        Map<String, List<String>> startedComposites = node.getStartedCompositeURIs();
        Assert.assertEquals(1, startedComposites.size());
        Assert.assertEquals("helloworld.composite", startedComposites.get("sample-helloworld").get(0));
    }
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

    @Ignore("TUSCANY-3953")
    @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 DeployerTestCase {

    @Test
    public void testInstalledContribution() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, MalformedURLException {
        TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
        Node node = tuscanyRuntime.createNode("myDomain");
       
        Deployer deployer = tuscanyRuntime.getDeployer();
        Monitor monitor = deployer.createMonitor();
        Contribution contribution = deployer.loadContribution(URI.create("foo"), new File("src/test/resources/sample-helloworld-nodeployable.jar").toURI().toURL(), monitor);
        monitor.analyzeProblems();
       
        node.installContribution(contribution, null);
        List<String> ics = node.getInstalledContributionURIs();
        Assert.assertEquals(1, ics.size());
        Assert.assertEquals("foo", ics.get(0));
    }
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.