You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2006/08/01 12:30:20 UTC

svn commit: r427519 - /incubator/tuscany/java/samples/sca/helloworldJavaScript/src/test/java/helloworld/HelloWorldTestCase.java

Author: antelder
Date: Tue Aug  1 03:30:19 2006
New Revision: 427519

URL: http://svn.apache.org/viewvc?rev=427519&view=rev
Log:
Get the javaScript helloworld sample working by using the new extension support in the SCATestCase

Modified:
    incubator/tuscany/java/samples/sca/helloworldJavaScript/src/test/java/helloworld/HelloWorldTestCase.java

Modified: incubator/tuscany/java/samples/sca/helloworldJavaScript/src/test/java/helloworld/HelloWorldTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldJavaScript/src/test/java/helloworld/HelloWorldTestCase.java?rev=427519&r1=427518&r2=427519&view=diff
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldJavaScript/src/test/java/helloworld/HelloWorldTestCase.java (original)
+++ incubator/tuscany/java/samples/sca/helloworldJavaScript/src/test/java/helloworld/HelloWorldTestCase.java Tue Aug  1 03:30:19 2006
@@ -16,6 +16,9 @@
  */
 package helloworld;
 
+import java.net.URL;
+import java.util.Enumeration;
+
 import org.apache.tuscany.test.SCATestCase;
 import org.osoa.sca.CompositeContext;
 import org.osoa.sca.CurrentCompositeContext;
@@ -28,16 +31,20 @@
     private HelloWorldService helloWorldService;
 
     protected void setUp() throws Exception {
-//        super.setUp();
-//
-//        CompositeContext context = CurrentCompositeContext.getContext();
-//        helloWorldService = context.locateService(HelloWorldService.class, "HelloWorldServiceComponent");
+        Enumeration<URL> scdls = getClass().getClassLoader().getResources("META-INF/sca/default.scdl");
+        // both the application and JavaScript container use the name default.scdl, skip over the application one
+        scdls.nextElement();         
+        addExtension("JavaScriptContainer", scdls.nextElement());
+        super.setUp();
+
+        CompositeContext context = CurrentCompositeContext.getContext();
+        helloWorldService = context.locateService(HelloWorldService.class, "HelloWorldComponent");
     }
 
     protected void tearDown() throws Exception {
     }
 
     public void testHelloWorld() throws Exception {
-//        assertEquals(helloWorldService.sayHello("petra"), "hello petra");
+        assertEquals(helloWorldService.sayHello("petra"), "Hello petra");
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org