Package org.apache.tuscany.sca.node

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


        }
        return new NodeImpl(this, configuration);
    }

    protected Node removeNode(NodeConfiguration configuration) {
        Node node = nodes.remove(getNodeKey(configuration));
        if (autoDestroy && nodes.isEmpty()) {
            destroy();
        }
        return node;
    }
View Full Code Here


        nodeServer.stop();
    }
   
    @Test
    public void testInvokeReference() throws Exception {
        Node node = null;

        String contribution = ContributionLocationHelper.getContributionLocation(JSONRPCReferenceTestCase.class);
        node = NodeFactory.newInstance().createNode("JSONRPCReference.composite", new Contribution("testClient", contribution));
        node.start();

        Echo echoComponent = node.getService(Echo.class,"EchoComponentWithReference");
        String result = echoComponent.echo("ABC");
        Assert.assertEquals("echo: ABC", result);
        if (node != null) {
            node.stop();
        }
    }
View Full Code Here

        }
    }

    @Test
    public void testInvokeReferenceVoidOperation() throws Exception {
        Node node = null;

        String contribution = ContributionLocationHelper.getContributionLocation(JSONRPCReferenceTestCase.class);
        node = NodeFactory.newInstance().createNode("JSONRPCReference.composite", new Contribution("testClient", contribution));
        node.start();

        Echo echoComponent = node.getService(Echo.class,"EchoComponentWithReference");
        echoComponent.echoVoid();

        if (node != null) {
            node.stop();
        }
    }
View Full Code Here

    }

    @Test
    public void testSync() {
        try {
            Node node = NodeFactory.newInstance().createNode("sync.composite");
            node.start();
            node.stop();
        } catch (final Exception e) {
            Assert.fail(e.getMessage());
        }
    }
View Full Code Here

    }

    @Test
    public void testAsync() {
        try {
            Node node = NodeFactory.newInstance().createNode("async.composite");
            node.start();
            node.stop();
        } catch (final Exception e) {
            Assert.fail(e.getMessage());
        }
    }
View Full Code Here

        clientNode.start();
    }

    @Test
    public void testNestedClient() throws Exception {
        Node client2Node = NodeFactory.newInstance("uri:HazelcastBindingTestCase?bind=127.0.0.1").createNode("client2.composite", new String[]{"target/test-classes"});
        client2Node.start();
        TestService service = client2Node.getService(TestService.class, "TestServiceClient2");
        assertNotNull(service);
        assertEquals("Petra", service.echoString("Petra"));
        client2Node.stop();
    }
View Full Code Here

        Properties config = new Properties();
        config.setProperty(RuntimeProperties.QUIET_LOGGING, "true");
        NodeFactory factory = NodeFactory.newInstance(config);
        factory.setAutoDestroy(false);
        Contribution contribution = new Contribution("c1", new File("target/test-classes").toURI().toString());
        Node node = factory.createNode(new StringReader(composite), contribution);
        testNode2(node);
       
        node.stop();

        int count = 3000;
        long start = System.currentTimeMillis();
        for (int i=0; i<count; i++) {
            node.start();
            node.stop();
        }
        long total = System.currentTimeMillis() - start;
        System.out.println(count + " = " + total + " = " + total / (double)count);

        // test it still works
View Full Code Here

        Logger.getLogger("").addHandler(handler);

        Properties props = new Properties();
        props.setProperty(RuntimeProperties.QUIET_LOGGING, "true");
        NodeFactory nf = NodeFactory.newInstance(props);
        Node node = nf.createNode();
        node.start();
        node.stop();

        Assert.assertEquals(0 , logRecords.size());
    }
View Full Code Here

    @Test
    public void testNodeWithCompositeContent() {
        NodeFactory factory = new NodeFactoryImpl();
        Contribution contribution = new Contribution("c1", new File("target/test-classes").toURI().toString());
        Node node = factory.createNode(new StringReader(composite), contribution);
        testNode2(node);
    }
View Full Code Here

    @Test
    public void testNodeWithRelativeCompositeURI() {
        NodeFactory factory = new NodeFactoryImpl();
        Contribution contribution = new Contribution("c1", new File("target/test-classes").toURI().toString());
        String compositeURI = "HelloWorld.composite";
        Node node = factory.createNode(compositeURI, contribution);
        testNode(node);
    }
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.