Examples of TuscanyRuntime


Examples of org.apache.tuscany.sca.TuscanyRuntime

    @Test
    public void testDestroyExceptionShutdownCE() throws Exception{
       
        HelloworldClientImplCE.throwTestExceptionOnDestroy = true;
       
        TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();

        // create a Tuscany node
        node = tuscanyRuntime.createNode();
       
        // install a contribution
        node.installContribution("HelloworldContrib", "target/classes", null, null);
       
        // start a composite
        try {
            node.startComposite("HelloworldContrib", "lifecycle.composite");
        } catch (Exception exception) {
            // it's thrown from the HelloworldClientImpl @Destroy method
            StatusImpl.appendStatus("Exception caught on node.startComposite", "LifecycleTestCase.testDestroyExceptionShutdownCE");
        }
       
        // don't need to send a message as eager init ensures that
        // the component instance is created start time and hence should
        // be destroyed
       
        // stop a composite
        try {
            // not required in this test as the exception during EagerInit will cause the stop
            //node.stopComposite("HelloworldContrib", "lifecycle.composite");
        } catch (Exception exception) {
            // it will complain about the composite not being started
            StatusImpl.appendStatus("Exception caught on node.stopComposite", "LifecycleTestCase.testDestroyExceptionShutdownCE");
        }  
       
        // uninstall a constribution
        node.uninstallContribution("HelloworldContrib");
       
        // stop a Tuscany node
        node.stop();
       
        // stop the runtime
        tuscanyRuntime.stop();
       
        HelloworldClientImplCE.throwTestExceptionOnDestroy = false;       
       
        // see what happened
        System.out.println(StatusImpl.statusString);
View Full Code Here

Examples of org.apache.tuscany.sca.TuscanyRuntime

    @Test
    public void testDestroyExceptionShutdownC() throws Exception{
       
        HelloworldClientImplC.throwTestExceptionOnDestroy = true;
       
        TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();

        // create a Tuscany node
        node = tuscanyRuntime.createNode();
       
        // install a contribution
        node.installContribution("HelloworldContrib", "target/classes", null, null);
       
        // start a composite
        try {
            node.startComposite("HelloworldContrib", "lifecycle.composite");
        } catch (Exception exception) {
            // it's thrown from the HelloworldClientImpl @Destroy method
            StatusImpl.appendStatus("Exception caught on node.startComposite", "LifecycleTestCase.testDestroyExceptionShutdownC");
        }
       
        // send a message to the appropriate client
        Helloworld hwCE = node.getService(Helloworld.class, "HelloworldClientC");
        System.out.println(hwCE.sayHello("name"))
        // don't need to catch exception here as the component instance won't
        // be destroyed until shutdown
       
        // stop a composite
        try {
            node.stopComposite("HelloworldContrib", "lifecycle.composite");
        } catch (Exception exception) {
            // it will complain about the composite not being started
            StatusImpl.appendStatus("Exception caught on node.stopComposite", "LifecycleTestCase.testDestroyExceptionShutdownC");
        }  
       
        // uninstall a constribution
        node.uninstallContribution("HelloworldContrib");
       
        // stop a Tuscany node
        node.stop();
       
        // stop the runtime
        tuscanyRuntime.stop();
       
        HelloworldClientImplC.throwTestExceptionOnDestroy = false;       
       
        // see what happened
        System.out.println(StatusImpl.statusString);
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.