Examples of TuscanyRuntime


Examples of org.apache.servicemix.sca.tuscany.TuscanyRuntime

      urls[i] = files[i].toURL();
    }
    urls[urls.length - 1] = root.toURL();
    classLoader = new URLClassLoader(urls, getClass().getClassLoader());
   
        tuscanyRuntime = new TuscanyRuntime(getName(), getRootPath(), classLoader, new CommonsLoggingMonitorFactory());
  }
View Full Code Here

Examples of org.apache.servicemix.sca.tuscany.TuscanyRuntime

       
        URL url = getClass().getResource("bigbank/sca.module");
        URL parentUrl = new File(url.toURI()).getParentFile().toURL();
        ClassLoader cl = new URLClassLoader(new URL[] { parentUrl }, getClass().getClassLoader());
       
        TuscanyRuntime rt = new TuscanyRuntime(name, uri, cl, new NullMonitorFactory());
        assertNotNull(rt);
       
        Module module = rt.getModuleComponent().getModuleImplementation();

        Assert.assertTrue(module.getName().equals("org.apache.servicemix.sca.bigbank"));

        Component component = module.getComponent("AccountServiceComponent");
        Assert.assertTrue(component != null);
View Full Code Here

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

    public void stop() {
    }

    public static void main(String[] args) throws Exception {
        TuscanyRuntime tuscany = new TuscanyRuntime("bigbank.account.testclient", null);
        tuscany.start();
        ModuleContext moduleContext = CurrentModuleContext.getContext();

        AccountService accountService = (AccountService) moduleContext.locateService("AccountServiceComponent");

        AccountReport accountReport = accountService.getAccountReport(12345);
View Full Code Here

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

    public void stop() {
    }

    public static void main(String[] args) throws Exception {
        TuscanyRuntime tuscany = new TuscanyRuntime("bigbank.webclient.testclient", null);
        tuscany.start();
        ModuleContext moduleContext = CurrentModuleContext.getContext();

        AccountService accountService = (AccountService) moduleContext.locateService("AccountServiceComponent");

        AccountReport report = accountService.getAccountReport(12345);
        List summaries = report.getAccountSummaries();

        System.out.println("retrieved " + summaries.size() + " summaries");

        tuscany.stop();
    }
View Full Code Here

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

        LogManager.getLogManager().readConfiguration(HelloWorldClient.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("HelloWorldModuleComponent", "http://helloworld", monitorFactory);

        // 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("HelloWorldService");
       
        // 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

    }

    public static void main(String[] args) throws Exception {


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

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

public class HelloWorldServer {

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


        System.out.println("Hit ENTER to exit");
        System.in.read();

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

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

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

*/
public class HelloWorldMCTestCase extends TestCase {
    private ClassLoader oldCL;

    public void testHelloWorld() throws Exception {
        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

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

        LogManager.getLogManager().readConfiguration(CustomerInfoClient.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("CustomerInfoModuleComponent", "http://customerinfo", monitorFactory);

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

        // 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");
       
        System.out.println("customerID = " + customer.getString("customerID"));
        System.out.println("firstName = " + customer.getString("firstName"));
        System.out.println("lastName = " + customer.getString("lastName"));
        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

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

        // Start the Tuscany runtime and associate it with this thread
        tuscany.start();
    }
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.