Package org.apache.tuscany.sca.node

Examples of org.apache.tuscany.sca.node.Node


            logger.log(Level.SEVERE, e.getMessage(), e);
        }
    }

    private void bundleStopping(Bundle bundle) {
        Node node = factory.getNodes().get(bundle);
        if (node == null) {
            return;
        }
        node.stop();
    }
View Full Code Here


public class LaunchCalculatorContributionTestCase {
   

    @Test
    public void testCalculatorContribution() throws Exception {
        Node node = NodeFactory.newInstance().createNode(new Contribution("c1", "../calculator-contribution.jar"));
        node.start();
       
        CalculatorService calculator = node.getService(CalculatorService.class, "CalculatorServiceComponent");
       
        double result = calculator.add(3, 2);
       
        System.out.println("3 + 2 = " + result);
       
        Assert.assertEquals(5.0, result);
       
        node.stop();
    }
View Full Code Here

     *    - get a local service proxy
     *    - make a service call using the proxy
     *    - stop the node
     */
    public static void main(String[] args) throws Exception {
        Node node = NodeFactory.newInstance().createNode(new Contribution("c1", "../calculator-contribution.jar"));
       
        node.start();
       
        CalculatorService calculator = node.getService(CalculatorService.class, "CalculatorServiceComponent");
       
        double result = calculator.add(3, 2);
       
        System.out.println("3 + 2 = " + result);
       
        if (result != 5.0){
            throw new RuntimeException("Expected 5.0 but result was " + result);
        }
       
        node.stop();
    }
View Full Code Here

    public static Node init(final WebContextConfigurator configurator) {
        synchronized (configurator) {

            bootstrapRuntime(configurator);
            Node node = (Node)configurator.getAttribute(SCA_NODE_ATTRIBUTE);
            if (node == null) {
                try {
                    node = createAndStartNode(configurator);
                } catch (ServletException e) {
                    throw new ServiceRuntimeException(e);
View Full Code Here

        } catch (IOException e) {
            throw new ServletException(e);
        } catch (URISyntaxException e) {
            throw new ServletException(e);
        }
        Node node = null;
        if (configuration != null) {
            node = factory.createNode(configuration).start();
        }
        return node;
    }
View Full Code Here

        }
        return node;
    }

    public static void stop(WebContextConfigurator configurator) {
        Node node = null;
        if (configurator != null) {
            node = (Node)configurator.getAttribute(SCA_NODE_ATTRIBUTE);
        }
        if (node != null) {
            node.stop();
            configurator.setAttribute(SCA_NODE_ATTRIBUTE, null);
        }
    }
View Full Code Here

public class T3558TestCase {

    @Test
    public void testAllJar() throws Exception {
        Node node = NodeFactory.newInstance().createNode((String)null, new String[]{"src/test/resources/sample-store-all.jar"});
        node.start();
    }
View Full Code Here

        node.start();
    }

    @Test
    public void testOneNode() throws Exception {
        Node node = NodeFactory.newInstance().createNode((String)null, new String[]{"src/test/resources/sample-store.jar","src/test/resources/sample-store-client.jar"});
        node.start();
    }
View Full Code Here

        node.start();
    }
   
    @Test
    public void testTwoNodes() throws Exception {
        Node node2 = NodeFactory.newInstance().createNode((String)null, new String[]{"src/test/resources/sample-store.jar"});
        node2.start();
        Node node1 = NodeFactory.newInstance().createNode((String)null, new String[]{"src/test/resources/sample-store-client.jar"});
        node1.start();
    }
View Full Code Here

    @Test
    public void testTwoNodesJIRACode1() throws Exception {
        String storeLocation = "src/test/resources/sample-store.jar";
        String storeClientLocation = "src/test/resources/sample-store-client.jar";

        Node node1 = NodeFactory.newInstance().createNode(new Contribution("store",storeLocation));
        node1.start();
        // The dependent contributions need to be added in the Node and need to be following the main contribution
        Node node2 = NodeFactory.newInstance().createNode("store-client.composite",new Contribution("storeClient", storeClientLocation),new Contribution("store", storeLocation));
        node2.start();    
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.node.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.