Package org.apache.tuscany.core.client

Examples of org.apache.tuscany.core.client.TuscanyRuntime


        // Required to allow the SDO runtime to use the correct classloader
        oldCL=Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
       
        // Obtain Tuscany runtime
        tuscany = new TuscanyRuntime("interopclient", null);
       
        // Start the runtime
        tuscany.start();

        // Get the SDO DataFactory
View Full Code Here


    @Override
    protected void setUp() throws Exception {
        super.setUp();

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

    }
View Full Code Here

   
    protected void setUp() throws Exception {
        super.setUp();
       
        // Create a Tuscany runtime for the sample module component
        tuscany = new TuscanyRuntime("CustomerInfoModuleComponent", "http://customerinfo");

        // Start the Tuscany runtime and associate it with this thread
        tuscany.start();
    }
View Full Code Here

        LogManager.getLogManager().readConfiguration(CalculatorClient.class.getResourceAsStream("/logging.properties"));
        Properties levels = new Properties();
        MonitorFactory monitorFactory = new JavaLoggingMonitorFactory(levels, Level.FINEST, "MonitorMessages");

        // Create a Tuscany runtime for the sample module component
        TuscanyRuntime tuscany = new TuscanyRuntime("CalculatorModuleComponent", "http://calculator", monitorFactory);

        // Start the Tuscany runtime and associate it with this thread
        tuscany.start();

        // 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));
        System.out.println("3 / 2="+calculatorService.divide(3, 2));
       
        System.out.flush();

        // Disassociate the runtime from this thread
        tuscany.stop();

        // Shut down the runtime
        tuscany.shutdown();
    }
View Full Code Here

public class ClientTestCase extends TestCase {

    public void testGetQuote() throws ConfigurationException, SecurityException, NoSuchMethodException, IllegalArgumentException,
            IllegalAccessException, InvocationTargetException {

        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>"));

        tuscany.stop();
    }
View Full Code Here

   
    protected void setUp() throws Exception {
        super.setUp();
       
        // Create a Tuscany runtime for the sample module component
        tuscany = new TuscanyRuntime("CalculatorModuleComponent", "http://calculator");

        // Start the Tuscany runtime and associate it with this thread
        tuscany.start();
    }
View Full Code Here

        LogManager.getLogManager().readConfiguration(SupplyChainClient.class.getResourceAsStream("/logging.properties"));
        Properties levels = new Properties();
        MonitorFactory monitorFactory = new JavaLoggingMonitorFactory(levels, Level.FINEST, "MonitorMessages");

        // Obtain Tuscany runtime
        TuscanyRuntime tuscany = new TuscanyRuntime("supplychain", null, monitorFactory);

        // 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
View Full Code Here

public class SupplyChainClientTestCase extends TestCase {

    public void test() throws Exception {
       
        // Obtain Tuscany runtime
        TuscanyRuntime tuscany = new TuscanyRuntime("hello", null);

        // 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
View Full Code Here

*/
public class HelloWorldTestCase extends TestCase {
    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();
    }
View Full Code Here

public class HelloWorldWebServiceTestCase extends TestCase {
   
    String getGreetings(String name) throws ConfigurationException {
        // Obtain Tuscany runtime
        TuscanyRuntime tuscany = new TuscanyRuntime("hello", null);

        // 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();
       
        return value;
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.core.client.TuscanyRuntime

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.