Examples of TuscanyRuntime


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

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

public class HelloWorldClient {

    public static final void main(String[] args) throws Exception {
       
        // Create a Tuscany runtime for the sample module component
        TuscanyRuntime tuscany = new TuscanyRuntime("HelloWorldModuleComponent", "http://helloworld");

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

        // 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);
        System.out.flush();

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

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

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

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

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

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

    }
View Full Code Here

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

   
    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

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

        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

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

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

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

   
    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

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

        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

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

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