Package org.apache.tuscany.sca.node

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


public class SampleNativeJMSAsyncTestCase {
    static Node node;

    @BeforeClass
    public static void setUp() throws Exception {
        final NodeFactory nf = NodeFactory.newInstance();
        String here = SampleNativeJMSAsyncTestCase.class.getProtectionDomain().getCodeSource().getLocation().toString();
        // Create the node using the pattern "name of composite file to start" / Contribution to use
        node = nf.createNode("testnativejmsasync.composite", 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("test.composite", 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

    @Before
    public void startServer() throws Exception {
        try {

            NodeFactory factory = NodeFactory.newInstance();
            String contribution = ContributionLocationHelper.getContributionLocation(OrderService_Service.class);
            node = factory.createNode("orderws.composite", new Contribution("order", contribution)).start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    
    }
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
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

     * Runs before each test method
     */
    @BeforeClass
    public static void setUp() throws Exception {
        try {
            NodeFactory factory = NodeFactory.newInstance();
            node = factory.createNode(new File("src/main/resources/primitivesservice.composite").toURI().toURL().toString(),
                new Contribution("TestContribution", new File("src/main/resources/").toURI().toURL().toString()));
            node.start();
        } catch(Throwable e) {
            e.printStackTrace();
            Assert.fail();
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.