Jean-Sebastien Delfino wrote:
Can you point me a good example or test case showing how to bootstrap a Tuscany runtime?

I have the URL of a contribution, the qname of a composite in that contribution, the name of a component in that composite. I'd like to start a Tuscany runtime instance and run the component on it.

I remember several attempts at different designs and APIs to manage Tuscany runtime instances, but I'm not sure which of these now works with the 2.x runtime.

The tests in samples/launcher-embedded-jse fail for me with this error:

Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.441 sec <<< FAILURE! testCOntributionBindingSCACalculator(launcher.LauncherTestCase) Time elapsed: 1.939 sec <<< ERROR! java.lang.IllegalStateException: org.apache.tuscany.sca.contribution.processor.ContributionReadException: java.io.FileNotFoundException: /home/delfinoj/SCA/Source/tuscany-sca-java/samples/launcher-embedded-jse/../contribution-binding-sca-calculator/target/classes (No such file or directory)
    at org.apache.tuscany.sca.node.impl.NodeImpl.start(NodeImpl.java:173)
    at launcher.RuntimeIntegration.startNode(RuntimeIntegration.java:35)
at launcher.SampleJSELauncher.launchBindingSCACalculator(SampleJSELauncher.java:61)
<snip>
Jean_Sebastien,

The technique I use in the Client for the OASIS SCA test suite is as follows:

------
        public boolean startContribution(String compositeName,
                                                 String contributionLocation,
                                                 String[] contributionNames) 
throws Exception {
        try {
        // Tuscany specific code which starts the contribution(s) holding the 
test
        launcher = NodeLauncher.newInstance();

        Contribution[] contributions = new 
Contribution[contributionNames.length];
        String[] contributionURIs = getContributionURIs( contributionLocation, 
contributionNames );
        for( int i = 0; i < contributions.length ; i++ ) {
                contributions[i] = new Contribution(contributionNames[i], 
contributionURIs[i]);
        } // end for

                node = launcher.createNode(compositeName, contributions );
        // Start the node
        node.start();
        } catch (Exception e) {
                System.out.println( "Exception during startup: " + 
e.getMessage() );
                throw e;
        } // end try

        return true;
        } // end method startContribution
-----

This deals with a set of contributions and a single composite to deploy as the "root" of the application.

Hope this helps,


Yours,  Mike.


Reply via email to