Hi,
You can try this one:
NodeFactory factory = NodeFactory.newInstance(); // Use
NodeFactory.getInstance() if you want to share the Tuscany runtime within the
same classloading space
String contribution =
ContributionLocationHelper.getContributionLocation(HelloWorldClient.class); //
You can use a URL for contribution too
node =
factory.createNode("helloworldwsclient.composite", new
Contribution("helloworld", contribution))
.start(); // There are a few variants of createNode()
methods
helloWorldService = node.getService(HelloWorldService.class,
"HelloWorldServiceComponent");
http://tuscany.apache.org/documentation-2x/development-guides.data/Tuscany%20SCA%20Domain%20Node.odp
Thanks,
Raymond
________________________________________________________________
Raymond Feng
[email protected]
Apache Tuscany PMC member and committer: tuscany.apache.org
Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
Personal Web Site: www.enjoyjava.com
________________________________________________________________
On May 18, 2010, at 9:44 AM, 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)
> at launcher.SampleJSELauncher.main(SampleJSELauncher.java:48)
> at
> launcher.LauncherTestCase.testCOntributionBindingSCACalculator(LauncherTestCase.java:30)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:616)
> at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> at
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
> at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
> at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
> at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:616)
> at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
> at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
>
>
> Thanks
> --
> Jean-Sebastien