Package org.apache.tuscany.sca

Examples of org.apache.tuscany.sca.Node.stop()


        String ci = node.getStartedCompositeURIs("helloworld").get(0);

        Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
        Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));

        node.stop("helloworld", ci);
        try {
            node.getService(Helloworld.class, "HelloworldComponent");
            Assert.fail();
        } catch (NoSuchServiceException e) {
            // expected as there is no deployables
View Full Code Here


    @Test
    public void testRemoveComposte() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, MalformedURLException, ActivationException, ValidationException {
        Node node = TuscanyRuntime.newInstance().createNode("default");
        node.installContribution("foo", "src/test/resources/sample-helloworld.jar", null, null, true);
        node.stop("foo", "helloworld.composite");
        List<String> dcs = node.getStartedCompositeURIs("foo");
        Assert.assertEquals(0, dcs.size());
    }

    @Test
View Full Code Here

        Node node = TuscanyRuntime.runComposite("helloworld.composite", "src/test/resources/sample-helloworld.jar");
        try {
        Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
        Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
        } finally {
            node.stop();
        }
    }

    @Test
    public void testRunCompositeSharedRuntime() throws NoSuchServiceException {
View Full Code Here

        Node node = TuscanyRuntime.runComposite(runtime, "helloworld.composite", "src/test/resources/sample-helloworld.jar");
        try {
        Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
        Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
        } finally {
            node.stop();
        }
        runtime.stop();
    }
}
View Full Code Here

            URL url = new URL("http://localhost:8080/HelloworldComponent/Helloworld?method=sayHello&params=WyJXb3JsZCJd&id=1");
            Assert.assertEquals("{\"id\":1,\"result\":\"Hello World\"}", read(url.openStream()));

        } finally {
            // Stop the Tuscany runtime Node
            node.stop();       
        }
    }

    private static String read(InputStream is) throws IOException {
        BufferedReader reader = null;
View Full Code Here

            // test that it works as expected
            Assert.assertEquals("Hello Amelia", helloworld.sayHello("Amelia"));
           
        } finally {
            // Stop the Tuscany runtime Node
            node.stop();       
        }
    }
}
View Full Code Here

        node.startComposite(contribution.getURI(), composite.getURI());

        // test that the service has started and can be invoked
        testService(node, contribution.getClassLoader());

        node.stop();
        tuscanyRuntime.stop();
    }

    private void testService(Node node, ClassLoader classLoader) throws ClassNotFoundException, NoSuchServiceException, NoSuchDomainException, IllegalArgumentException, InvocationTargetException, IllegalAccessException {
        Class<?> interfaze = classLoader.loadClass("sample.Helloworld");
View Full Code Here

            calculatorClient.calculate();
        }catch (Exception e){
            e.printStackTrace();     
        } finally {
            // Stop the Tuscany runtime Node
            node.stop();       
        }
    }
}
View Full Code Here

            URL url = new URL("http://localhost:8080/HelloworldComponent/Helloworld/sayHello?name=Amelia&callback=someFunc");
            Assert.assertEquals("someFunc(\"Hello Amelia\");", read(url.openStream()));

        } finally {
            // Stop the Tuscany runtime Node
            node.stop();
        }
    }

    private static String read(InputStream is) throws IOException {
        BufferedReader reader = null;
View Full Code Here

    private Logger logger = Logger.getLogger(CalculatorActivator.class.getName());

    public void start(BundleContext context) throws Exception {
        logger.info("Starting " + context.getBundle());
        Node node = TuscanyRuntime.runComposite("Calculator.composite", context.getBundle().getLocation());
        node.stop();
    }

    public void stop(BundleContext context) throws Exception {
        logger.info("Stopping " + context.getBundle());
        // Registered services will be automatically unregistered
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.