Package org.apache.tuscany.sca.node

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


    }

    List<?> start(final String name, final String cloc, final String dcuri) {
        if(nodes.containsKey(name))
            return emptyList();
        final Node node = dcuri != null? nf.createNode(dcuri, new Contribution(cloc, cloc)) : nf.createNode(new Contribution(cloc, cloc));
        nodes.put(name, new Nodeconf(name, cloc, dcuri, node));
        node.start();
        return emptyList();
    }
View Full Code Here


public class CalculatorTestCase {

    @Test
    public void testCalculator() throws Exception {
       
        Node node = NodeFactory.newInstance().createNode(new Contribution("c1", "./target/classes"));
        node.start();
       
        CalculatorService calculator = node.getService(CalculatorService.class, "CalculatorServiceComponent");
       
        assertEquals(calculator.add(3, 2), 5.0, 0);
        assertEquals(calculator.subtract(3, 2), 1.0, 0);
        assertEquals(calculator.multiply(3, 2), 6.0, 0);
        assertEquals(calculator.divide(3, 2), 1.5, 0);
       
        node.stop();       
    }
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();
       
       
        // This doesn't actually check the logging yet, need to figure out a
        // way to get the log output so for now has to be run manually
        Assert.assertEquals(0 , logRecords.size());
View Full Code Here

        }
        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

    @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

    @Test
    public void testNodeWithAbsoluteCompositeURI() throws MalformedURLException {
        NodeFactory factory = new NodeFactoryImpl();
        Contribution contribution = new Contribution("c1", new File("target/test-classes").toURL().toString());
        String compositeURI = new File("target/test-classes/HelloWorld.composite").toURL().toString();
        Node node = factory.createNode(compositeURI, contribution);
        testNode(node);
    }
View Full Code Here

    }

    @Test
    public void testAutoDestroy() throws Exception {
        NodeFactory nf = NodeFactory.newInstance();
        Node node = nf.createNode();
        node.start();
        Assert.assertTrue(((NodeFactoryImpl)nf).inited);
        node.stop();
        Assert.assertFalse(((NodeFactoryImpl)nf).inited);
       
        nf = NodeFactory.newInstance();
        nf.setAutoDestroy(false);
        node = nf.createNode();
        node.start();
        Assert.assertTrue(((NodeFactoryImpl)nf).inited);
        node.stop();
        Assert.assertTrue(((NodeFactoryImpl)nf).inited);
       
    }
View Full Code Here

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

        } catch (IOException e) {
            throw new ServletException(e);
        } catch (URISyntaxException e) {
            throw new ServletException(e);
        }
        Node node = factory.createNode(configuration).start();
        return 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.