Examples of TuscanyRuntime


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

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

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

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

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

*/
public class StartStopTestCase 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();
        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

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

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

Examples of org.apache.tuscany.host.runtime.TuscanyRuntime

        URL systemScdl = booter.getSystemScdl(bootClassLoader);
        URL applicationScdl = booter.getApplicationScdl(applicationClassLoader);

        String className = System.getProperty("tuscany.launcherClass",
                                              "org.apache.tuscany.runtime.standalone.host.StandaloneRuntimeImpl");
        TuscanyRuntime runtime = (TuscanyRuntime) Beans.instantiate(bootClassLoader, className);
        runtime.setMonitorFactory(runtime.createDefaultMonitorFactory());
        runtime.setSystemScdl(systemScdl);
        runtime.setHostClassLoader(hostClassLoader);
        runtime.setApplicationName("application");
        runtime.setApplicationScdl(applicationScdl);
        runtime.setApplicationClassLoader(applicationClassLoader);
        runtime.setRuntimeInfo(runtimeInfo);
        runtime.initialize();
        SCA context = runtime.getContext();

        try {
            context.start();
            booter.runApplication(applicationJar, applicationClassLoader, appArgs);
        } finally {
            context.stop();
            runtime.destroy();
        }
    }
View Full Code Here

Examples of org.apache.tuscany.sca.TuscanyRuntime

        }
    }

    @Test
    public void testRunCompositeSharedRuntime() throws NoSuchServiceException {
        TuscanyRuntime runtime = TuscanyRuntime.newInstance();
        Node node = TuscanyRuntime.runComposite(runtime, "helloworld.composite", "src/test/resources/sample-helloworld.jar");
        try {
        Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
        Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
        } finally {
            node.stop();
        }
        runtime.stop();
    }
View Full Code Here

Examples of org.apache.tuscany.sca.TuscanyRuntime

public class DeployerTestCase {

    @Test
    public void testInstalledContribution() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, MalformedURLException {
        TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
        Node node = tuscanyRuntime.createNode("myDomain");
       
        Deployer deployer = tuscanyRuntime.getDeployer();
        Monitor monitor = deployer.createMonitor();
        Contribution contribution = deployer.loadContribution(URI.create("foo"), new File("src/test/resources/sample-helloworld-nodeployable.jar").toURI().toURL(), monitor);
        monitor.analyzeProblems();
       
        node.installContribution(contribution, null, true);
View Full Code Here

Examples of org.apache.tuscany.sca.TuscanyRuntime

        Assert.assertEquals("foo", ics.get(0));
    }

    @Test
    public void testAddDeploymentComposite() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, MalformedURLException, XMLStreamException {
        TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
        Node node = tuscanyRuntime.createNode("myDomain");
       
        node.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, null, true);

        Deployer deployer = tuscanyRuntime.getDeployer();
        Monitor monitor = deployer.createMonitor();
        Composite composite = deployer.loadXMLDocument(new File("src/test/resources/helloworld2.composite").toURI().toURL(), monitor);
        monitor.analyzeProblems();
        composite.setURI("helloworld2.composite");
        node.start("foo", composite);
View Full Code Here

Examples of org.apache.tuscany.sca.TuscanyRuntime

    public void execute() throws MojoExecutionException, MojoFailureException {
        if (id.length() < 1) {
            // if id is set to "" then stop all runtimes
            for (String id : TuscanyStartMojo.runtimes.keySet()) {
                TuscanyRuntime runtime = TuscanyStartMojo.runtimes.get(id);
                runtime.stop();
                getLog().info("stopped Tuscany runtime " + id);
            }
            TuscanyStartMojo.runtimes.clear();
        } else {
            TuscanyRuntime runtime = TuscanyStartMojo.runtimes.remove(id);
            if (runtime == null) {
                getLog().info("No started runtime found for ID " + id);
            } else {
                runtime.stop();
                getLog().info("stopped Tuscany runtime " + id);
            }
        }
    }
View Full Code Here

Examples of org.apache.tuscany.sca.TuscanyRuntime

    private String[] contributions;

    public void execute() throws MojoExecutionException, MojoFailureException {
        getLog().info("Starting Tuscany Runtime...");
       
        TuscanyRuntime runtime = TuscanyRuntime.newInstance();
        runtimes.put(id, runtime);

        if (nodeConfig != null && nodeConfig.length() > 0) {
            try {
                runtime.createNodeFromXML(nodeConfig);
            } catch (Exception e) {
                throw new MojoExecutionException("Exception creating node", e);
            }
        } else {
            List<String> contributionList = new ArrayList<String>();

            addProjectContribution(contributionList);

            addAdditionalContributions(contributionList);
           
            Node node = runtime.createNode(domainURI);
            for (String c : contributionList) {
                String curi;
                try {
                    curi = node.installContribution(null, c, null, null);
                } catch (Exception e) {
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.