Package org.apache.tuscany.sca.node

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


    private static Node clientNode;
//    private static DomainNode clientNode;

    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
        NodeFactory factory = NodeFactory.newInstance();

        clientNode = factory.createNode(new File("client-config.xml").toURI().toURL());
       
        try {
            clientNode.start();
        } catch (Exception ex){
            ex.printStackTrace();
View Full Code Here


public class RunTestCase {
    static Node node;

    @BeforeClass
    public static void setUp() throws Exception {
        final NodeFactory nf = NodeFactory.newInstance();
        node = nf.createNode(new Contribution("test", here()));
        node.start();
    }
View Full Code Here

    static JettyServer jetty;
   
    @BeforeClass
    public static void setUp() throws Exception {
        // Start test composite on a Tuscany node
        final NodeFactory nf = NodeFactory.newInstance();
        node = nf.createNode(new Contribution("test", here()));
        node.start();
       
        // Mock up a test Web service on http://localhost:8086/wsupper
        jetty = new JettyServer((ExtensionPointRegistry)nf.getExtensionPointRegistry());
        jetty.start();
        jetty.addServletMapping("http://localhost:8086/wsupper", new HttpServlet() {
            private static final long serialVersionUID = 1L;
            protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
                assertTrue(read(req.getInputStream()).contains("Hello SOAP"));
View Full Code Here

    @Test
    public void testNodeWithCompositeContent() throws IOException {
        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;
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

            + " </component>"
            + " </composite>";

    @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

        testNode2(node);
    }

    @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

    }

    @SuppressWarnings("deprecation")
    @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

        testNode(new NodeFactoryImpl().createNode(URI.create("foo"), compositeURI, new String[]{"target/test-classes"}));
    }

    @Test
    public void testGetServiceEndpoints() {
        NodeFactory factory = new NodeFactoryImpl();
        Contribution contribution = new Contribution("c1", new File("target/test-classes").toURI().toString());
        NodeImpl node = (NodeImpl)factory.createNode(new StringReader(composite), contribution);
        node.start();
        List<Endpoint> es = node.getServiceEndpoints();  
        Assert.assertEquals(1, es.size());
        Assert.assertEquals("HelloWorld2", es.get(0).getComponent().getName());
        node.stop();
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

TOP

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

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.