Package org.apache.tuscany.sca.node

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


        System.out.println("receiveResult on thread " + Thread.currentThread());
        System.out.println("Result: " + result)// callback from the server
    }

    public static void main(String[] args) throws Exception {
        SCANode node = SCANodeFactory.newInstance().createSCANodeFromClassLoader("myapp.composite", MyClientImpl.class.getClassLoader());
        node.start();
        run(node);
        System.out.println("Closing the domain");
        node.stop();
    }
View Full Code Here


        }
       
        System.out.println("Starting the Sample SCA Spring BigBank server...");
               
        SCANodeFactory factory = SCANodeFactory.newInstance();
        SCANode node = factory.createSCANodeFromClassLoader("BigBank.composite", BigBankServer.class.getClassLoader());
        node.start();

        if (timeout < 0) {
            System.out.println("Press Enter to Exit...");
            System.in.read();
        } else {
            Thread.sleep(timeout);
        }

        node.stop();
       
        System.out.println("Bye");
    }
View Full Code Here

            jmsBroker.setUseJmx(false);
            jmsBroker.addConnector("tcp://localhost:61619");
            jmsBroker.start();
           
            SCANodeFactory factory = SCANodeFactory.newInstance();
            SCANode node = factory.createSCANodeFromClassLoader("CheckingsAccount.composite", CheckingAccountServer.class.getClassLoader());
            node.start();

            if (timeout < 0) {
                System.out.println("CheckingsAccount server started (press enter to shutdown)");
                System.in.read();
            } else {
                Thread.sleep(timeout);
            }           

            node.stop();
           
            jmsBroker.stop();
            System.out.println("CheckingsAccount server stopped");
       
        } catch (IOException e) {
View Full Code Here

            System.setProperty("java.security.auth.login.config", CalculatorClient.class.getClassLoader()
                .getResource("implementation/policies/CalculatorJass.config").toString());
        }

        SCANodeFactory factory = SCANodeFactory.newInstance();
        SCANode node = factory.createSCANodeFromClassLoader("implementation/policies/Calculator.composite", CalculatorServiceImpl.class.getClassLoader());
        node.start();       
             
        CalculatorService calculatorService =
            ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");

        // Calculate
        System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
                "policy for subtract and divide operations...");
        System.out.println("3 + 2=" + calculatorService.add(3, 2));
        System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
        System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
        System.out.println("3 / 2=" + calculatorService.divide(3, 2));
       
        calculatorService =
            ((SCAClient)node).getService(CalculatorService.class, "AnotherCalculatorServiceComponent");

        // Calculate
        System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
                "for all operations in the implementation...");
        System.out.println("3 + 2=" + calculatorService.add(3, 2));
        System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
        System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
        System.out.println("3 / 2=" + calculatorService.divide(3, 2));

        node.stop();
        System.out.println("Bye");
    }
View Full Code Here

public class MyServiceTestCase {

    @Test
    public void testCalculator() throws Exception {      
       
        SCANode node = SCANodeFactory.newInstance().createSCANodeFromClassLoader("MyService.composite", null);
        try {

            node.start();

            MyService service = ((SCAClient)node).getService(MyService.class, "MyServiceComponent");

            Assert.assertEquals("Hello petra", service.sayHello("petra"));

        } finally {
            node.stop();
        }
    }
View Full Code Here

public class MyClientTestCase {

    @Test
    public void testCalculator() throws Exception {      
       
        SCANode serviceNode = SCANodeFactory.newInstance().createSCANode("MyService.composite", new SCAContribution("bla2", "../service/target/itest-binding-sca-jms-service.jar"));
       
        SCANode clientNode = SCANodeFactory.newInstance().createSCANodeFromClassLoader("MyClient.composite", null);
        try {

            serviceNode.start();
            clientNode.start();

            MyService service = ((SCAClient)clientNode).getService(MyService.class, "MyClientComponent");

            Assert.assertEquals("Hi Hello petra", service.sayHello("petra"));

        } finally {
            clientNode.stop();
            serviceNode.stop();
        }
    }
View Full Code Here

     * with void return type.
     */
    @Test
    public void atDestroyProper() throws Exception {
        SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
        SCANode node = nodeFactory.createSCANode(new File("src/main/resources/proper/AService.composite").toURL().toString(),
                new SCAContribution("TestContribution",
                                    new File("src/main/resources/proper").toURL().toString()));
        node.start();
        AService aService = ((SCAClient)node).getService(AService.class, "AComponent");
        Assert.assertEquals("Hello Pandu", aService.getGreetings("Pandu"));
        node.stop();
    }
View Full Code Here

     */
    @Test
    public void atDestroyProtectedMethod() throws Exception {
        SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
        try {
            SCANode node = nodeFactory.createSCANode(new File("src/main/resources/err1/AServiceErr1.composite").toURL().toString(),
                    new SCAContribution("TestContribution",
                                        new File("src/main/resources/err1").toURL().toString()));
            Assert.fail();
            node.stop();
        } catch(ServiceRuntimeException e) {
            //expected
            Assert.assertNotSame(-1, e.getMessage().indexOf("Destructor must be a public method."));
        }
    }
View Full Code Here

     */
    @Test
    public void atDestroyPrivateMethod() throws Exception {
        SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
        try {
            SCANode node = nodeFactory.createSCANode(new File("src/main/resources/err2/AServiceErr2.composite").toURL().toString(),
                    new SCAContribution("TestContribution",
                                        new File("src/main/resources/err2").toURL().toString()));
            Assert.fail();
            node.stop();
        } catch(ServiceRuntimeException e) {
            //expected
            Assert.assertNotSame(-1, e.getMessage().indexOf("Destructor must be a public method."));
        }
    }
View Full Code Here

     */
    @Test
    public void atDestroyNonVoidReturnType() throws Exception {
        SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
        try {
            SCANode node = nodeFactory.createSCANode(new File("src/main/resources/err3/AServiceErr3.composite").toURL().toString(),
                    new SCAContribution("TestContribution",
                                        new File("src/main/resources/err3").toURL().toString()));
            Assert.fail();
            node.stop();
        } catch(ServiceRuntimeException e) {
            //expected
            Assert.assertNotSame(-1, e.getMessage().indexOf("Destructor must return void."));
        }
    }
View Full Code Here

TOP

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

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.