Package org.osoa.sca

Examples of org.osoa.sca.ModuleContext


    }
   
    public void testCalculator() throws Exception {

        // Get the SCA module context.
        ModuleContext moduleContext = CurrentModuleContext.getContext();

        // Locate the Calculator service
        CalculatorService calculatorService = (CalculatorService) moduleContext.locateService("CalculatorServiceComponent");
       
        // Calculate
        assertEquals(calculatorService.add(3, 2), 5.0);
        assertEquals(calculatorService.subtract(3, 2), 1.0);
        assertEquals(calculatorService.multiply(3, 2), 6.0);
View Full Code Here


        // Associate the application module component with this thread
        tuscany.start();

        // Obtain SCA module context.
        ModuleContext moduleContext = CurrentModuleContext.getContext();

        // Locate the HelloWorld service component and invoke it
        Customer customer = (Customer) moduleContext.locateService("CustomerComponent");
        System.out.println("Main thread " + Thread.currentThread());
        customer.purchaseGoods();

    }
View Full Code Here

        // Associate the application module component with this thread
        tuscany.start();

        // Obtain SCA module context.
        ModuleContext moduleContext = CurrentModuleContext.getContext();

        // Locate the HelloWorld service component and invoke it
        // Locate the CustomerComponent service component and invoke it
        Customer customer = (Customer) moduleContext.locateService("CustomerComponent");
        System.out.println("Main thread " + Thread.currentThread());
        customer.purchaseGoods();

    }
View Full Code Here

        this.messageFactory=messageFactory;
    }
   
    public Message invoke(final Message message) {

        final ModuleContext currentModuleContext=CurrentModuleContext.getContext();
       
        // Schedule the invocation of the next interceptor in a new Work instance
        try {
            workManager.scheduleWork(new Work() {
               
                public void run() {
                    ModuleContext oldModuleContext=CurrentModuleContext.getContext();
                    try {
                        BINDER.setContext(currentModuleContext);
                       
                        // Invoke the next interceptor
                        next.invoke(message);
View Full Code Here

    private ClassLoader oldCL;

    public void testHelloWorld() throws Exception {
        TuscanyRuntime tuscany = new TuscanyRuntime("test", null);
        tuscany.start();
        ModuleContext moduleContext = CurrentModuleContext.getContext();
        assertNotNull(moduleContext);

        HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorld");
        assertNotNull(helloworldService);

        String value = helloworldService .getGreetings("World");
        assertEquals("Hello World", value);
View Full Code Here

        // Start the runtime
        tuscany.start();

        // Obtain SCA module context.
        ModuleContext moduleContext = CurrentModuleContext.getContext();

        // Locate the HelloWorld service component and invoke it
        HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldService");

        String value = helloworldService.getGreetings(name);
       
        // Stop the runtime
        tuscany.stop();
View Full Code Here

    private ClassLoader oldCL;

    public void testHelloWorld() throws Exception {
        TuscanyRuntime tuscany = new TuscanyRuntime("test", null);
        tuscany.start();
        ModuleContext moduleContext = CurrentModuleContext.getContext();
        assertNotNull(moduleContext);

        HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorld");
        assertNotNull(helloworldService);

        String value = helloworldService .getGreetings("World");
        assertEquals("Hello World", value);
        tuscany.stop();
        tuscany = new TuscanyRuntime("test", null);
        tuscany.start();
        moduleContext = CurrentModuleContext.getContext();
        assertNotNull(moduleContext);
        helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorld");
        assertNotNull(helloworldService);
        value = helloworldService .getGreetings("World");
        assertEquals("Hello World", value);
        tuscany.stop();
    }
View Full Code Here

    }
   
    public void testGeetings() throws Exception {

        // Get the SCA module context.
        ModuleContext moduleContext = CurrentModuleContext.getContext();

        // Locate the HelloWorld service
        HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldServiceComponent");
       
        // Invoke the HelloWorld service
        String value = helloworldService.getGreetings("World");
       
        assertEquals(value, "Hello World");
View Full Code Here

TOP

Related Classes of org.osoa.sca.ModuleContext

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.