Package org.osoa.sca

Examples of org.osoa.sca.ModuleContext.locateService()


        TuscanyRuntime tuscany = new TuscanyRuntime("bigbank.webclient.testclient", null);
        tuscany.start();
        ModuleContext moduleContext = CurrentModuleContext.getContext();
        LoginService loginService = (LoginService)
                moduleContext.locateService("LoginServiceComponent");

        if (loginService.login("test", "password") == LoginService.SUCCESS)
            System.out.println("Success");
        else
            System.out.println("Failure");
View Full Code Here


        TuscanyRuntime tuscany = new TuscanyRuntime("test", "foo");
        tuscany.start();
        ModuleContext moduleContext = CurrentModuleContext.getContext();
        assertNotNull(moduleContext);
        assertEquals("foo", moduleContext.getURI());
        HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorld");
        assertNotNull(helloworldService);

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

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

        // Locate the CustomerInfo service
        Object customerInfoService = moduleContext.locateService("CustomerInfoServiceComponent");
       
        // Invoke the CustomerInfo service
        Method getCustomerInfo = customerInfoService.getClass().getMethod("getCustomerInfo", new Class[] {String.class});
        DataObject customer = (DataObject)getCustomerInfo.invoke(customerInfoService, "12345");
       
View Full Code Here

        // 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

        // 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");
       
        System.out.println(value);
View Full Code Here

        String name = moduleContext.getName();
        if (!"/testContext".equals(name)) {
            throw new ServletException("Invalid module context name: " + name);
        }

        HelloWorldService helloService = (HelloWorldService) moduleContext.locateService("HelloWorld");
        String greetings = helloService.getGreetings("World");
        if (!"Hello World".equals(greetings)) {
            throw new ServletException("Serivce returned " + greetings);
        }
    }
View Full Code Here

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

        // Locate the CustomerInfo service
        Object customerInfoService = moduleContext.locateService("CustomerInfoServiceComponent");
       
        // Invoke the CustomerInfo service
        Method getCustomerInfo = customerInfoService.getClass().getMethod("getCustomerInfo", new Class[] {String.class});
        DataObject customer = (DataObject)getCustomerInfo.invoke(customerInfoService, "12345");
       
View Full Code Here

        // Get the SCA module context.
        ModuleContext moduleContext = CurrentModuleContext.getContext();
       
        // Locate the Calculator service
        CalculatorService calculatorService = (CalculatorService) moduleContext.locateService("CalculatorServiceComponent");
       
        // Calculate
        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));
View Full Code Here

        TuscanyRuntime tuscany = new TuscanyRuntime("getQuote", null);
        tuscany.start();
        ModuleContext moduleContext = CurrentModuleContext.getContext();

        Object serviceProxy = moduleContext.locateService("webserviceXSQ");
        Method m = serviceProxy.getClass().getMethod("GetQuote", new Class[] { String.class });

        String sqResponse = (String) m.invoke(serviceProxy, "IBM");

        assertTrue(sqResponse.startsWith("<StockQuotes><Stock><Symbol>IBM</Symbol>"));
View Full Code Here

        // 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

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.