Package org.apache.tuscany.sca.node

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


     */
    @Test
    public void atDestroyMethodWithArgs() throws Exception {
        SCANode2Factory nodeFactory = SCANode2Factory.newInstance();
        try {
            SCANode2 node = nodeFactory.createSCANode(new File("src/main/resources/err4/AServiceErr4.composite").toURL().toString(),
                    new SCAContribution("TestContribution",
                                        new File("src/main/resources/err4").toURL().toString()));
            Assert.fail();
            node.stop();
        } catch(ServiceRuntimeException e) {
            //expected
            Assert.assertNotSame(-1, e.getMessage().indexOf("Destructor must not have argments"));
        }
    }
View Full Code Here


public class LaunchStoreClientNode {

    public static void main(String[] args) throws Exception {
        NodeLauncher nodeLauncher = NodeLauncher.newInstance();
        SCANode2 storeClientNode = nodeLauncher.createNode("http://localhost:9990/node-config/StoreClientNode");
        storeClientNode.start();
        SCAClient client = (SCAClient)storeClientNode;
       
        Shopper shopper = client.getService(Shopper.class, "StoreClient");
       
        String total = shopper.shop("Orange", 5);
        System.out.println("Total: " + total);
       
        storeClientNode.stop();
    }
View Full Code Here

        System.out.println("receiveResult on thread " + Thread.currentThread());
        System.out.println("Result: " + result)// callback from the server
    }

    public static void main(String[] args) throws Exception {
        SCANode2 node = SCANode2Factory.newInstance().createSCANodeFromClassLoader("myapp.composite", MyClientImpl.class.getClassLoader());
        node.start();
        run(node);
        System.out.println("Closing the domain");
        node.stop();
    }
View Full Code Here

import calculator.CalculatorService;

public class LaunchCalculatorNodeA {
    public static void main(String[] args) throws Exception {
       
        SCANode2 node = null;
        try {
           
            NodeLauncher nodeLauncher = NodeLauncher.newInstance();
            node = nodeLauncher.createNode("http://localhost:9990/node-config/NodeA");

            node.start();
           
            // get a reference to the calculator component
            SCAClient client = (SCAClient)node;
            CalculatorService calculatorService =
                client.getService(CalculatorService.class, "CalculatorServiceComponentA");
           
            // Calculate
            System.out.println("3 + 2=" + calculatorService.add(3, 2));
            System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
            System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
            System.out.println("3 / 2=" + calculatorService.divide(3, 2));
           
            if (args.length > 1){
                for (int i=0; i < 1000; i++){
                    // Calculate
                    System.out.println("3 + 2=" + calculatorService.add(3, 2));
                    System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
                    System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
                    System.out.println("3 / 2=" + calculatorService.divide(3, 2));
                }
            }
           
            node.stop();
           
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
        }       
    }
View Full Code Here

*/
public class CallbackServer {

    public static void main(String[] args) throws Exception {
       
        SCANode2 node = SCANode2Factory.newInstance().createSCANodeFromClassLoader("callbackws.composite", null);
        node.start();

        try {
            System.out.println("Callback server started (press enter to shutdown)");
            System.in.read();
        } catch (IOException e) {
            e.printStackTrace();
        }

        node.stop();
        System.out.println("Callback server stopped");
    }
View Full Code Here

            org.apache.tuscany.sca.node.launcher.NodeLauncher.Contribution[] contributions = new org.apache.tuscany.sca.node.launcher.NodeLauncher.Contribution[dependencies.size()];
            for (int c =0, n = dependencies.size(); c < n; c++) {
                Contribution dependency = dependencies.get(c);
                contributions[c] = new org.apache.tuscany.sca.node.launcher.NodeLauncher.Contribution(dependency.getURI(), dependency.getLocation());
            }
            SCANode2 runtimeNode = launcher.createNode("http://sample/" + node.getName(), print(runnable), contributions);
           
            // Start the node
            runtimeNode.start();
            runtimeNodes.add(runtimeNode);
        }
       
        System.out.println("Nodes are running, press enter to stop...");
        System.in.read();
       
        for (SCANode2 runtimeNode: runtimeNodes) {
            runtimeNode.stop();
        }
    }
View Full Code Here

    @Test
    public void testNodeWithCompositeContent() {
        SCANode2Factory factory = SCANode2Factory.newInstance();
        SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
        SCANode2 node = factory.createSCANode("HelloWorld.composite", composite, contribution);
        testNode(node);
    }
View Full Code Here

    }
   
    @Test
    public void testNodeWithCompositeContentAndNoContribution() {
        SCANode2Factory factory = SCANode2Factory.newInstance();
        SCANode2 node = factory.createSCANode("HelloWorld.composite", composite);
        testNode(node);
    }   
View Full Code Here

    @Test
    public void testNodeWithoutCompositeURI() {
        SCANode2Factory factory = SCANode2Factory.newInstance();
        SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
        SCANode2 node = factory.createSCANode(null, contribution);
        testNode(node);
    }
View Full Code Here

    @Test
    public void testNodeWithCompositeURI() {
        SCANode2Factory factory = SCANode2Factory.newInstance();
        SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
        String compositeURI = new File("target/test-classes/HelloWorld.composite").toURI().toString();
        SCANode2 node = factory.createSCANode(compositeURI, contribution);
        testNode(node);
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.node.SCANode2

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.