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/10/06 19:08:35 UTC

svn commit: r453678 - in /incubator/tuscany/sandbox/ant/sample.script.async/src: main/java/sample/AsyncClient.java main/java/sample/ClientComponent.java main/resources/META-INF/sca/default.scdl test/java/sample/AsyncTestCase.java

Author: antelder
Date: Fri Oct  6 10:08:35 2006
New Revision: 453678

URL: http://svn.apache.org/viewvc?view=rev&rev=453678
Log:
Get async working by adding another component as j2se calls aren't done asynchronously

Added:
    incubator/tuscany/sandbox/ant/sample.script.async/src/main/java/sample/ClientComponent.java
Modified:
    incubator/tuscany/sandbox/ant/sample.script.async/src/main/java/sample/AsyncClient.java
    incubator/tuscany/sandbox/ant/sample.script.async/src/main/resources/META-INF/sca/default.scdl
    incubator/tuscany/sandbox/ant/sample.script.async/src/test/java/sample/AsyncTestCase.java

Modified: incubator/tuscany/sandbox/ant/sample.script.async/src/main/java/sample/AsyncClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/ant/sample.script.async/src/main/java/sample/AsyncClient.java?view=diff&rev=453678&r1=453677&r2=453678
==============================================================================
--- incubator/tuscany/sandbox/ant/sample.script.async/src/main/java/sample/AsyncClient.java (original)
+++ incubator/tuscany/sandbox/ant/sample.script.async/src/main/java/sample/AsyncClient.java Fri Oct  6 10:08:35 2006
@@ -29,11 +29,12 @@
     public static void main(String[] args) throws Exception {
 
         AsyncService service = CurrentCompositeContext.getContext().locateService(
-                AsyncService.class, "OneWayComponent");
+                AsyncService.class, "ClientComponent");
 
         System.out.println("Calling service on thread + " + Thread.currentThread());
         service.doitOneWay("foo");
         System.out.println("returned from service");
+        Thread.sleep(500);
 
     }
 }

Added: incubator/tuscany/sandbox/ant/sample.script.async/src/main/java/sample/ClientComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/ant/sample.script.async/src/main/java/sample/ClientComponent.java?view=auto&rev=453678
==============================================================================
--- incubator/tuscany/sandbox/ant/sample.script.async/src/main/java/sample/ClientComponent.java (added)
+++ incubator/tuscany/sandbox/ant/sample.script.async/src/main/java/sample/ClientComponent.java Fri Oct  6 10:08:35 2006
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package sample;
+
+import org.osoa.sca.annotations.Reference;
+
+public class ClientComponent implements AsyncService {
+
+    private AsyncService asyncComponent;
+
+    public void doitOneWay(String s) {
+        System.out.println("ClientComponent calling asyncService on thread + " + Thread.currentThread());
+        asyncComponent.doitOneWay(s);
+    }
+
+    @Reference
+    public void setAsyncComponent(AsyncService asyncComponent) {
+        this.asyncComponent = asyncComponent;
+    }
+    
+
+}

Modified: incubator/tuscany/sandbox/ant/sample.script.async/src/main/resources/META-INF/sca/default.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/ant/sample.script.async/src/main/resources/META-INF/sca/default.scdl?view=diff&rev=453678&r1=453677&r2=453678
==============================================================================
--- incubator/tuscany/sandbox/ant/sample.script.async/src/main/resources/META-INF/sca/default.scdl (original)
+++ incubator/tuscany/sandbox/ant/sample.script.async/src/main/resources/META-INF/sca/default.scdl Fri Oct  6 10:08:35 2006
@@ -21,6 +21,11 @@
 
     name="AsyncSampleComposite">
 
+    <component name="ClientComponent">
+		<implementation.java class="sample.ClientComponent"/>
+        <reference name="asyncComponent">AsyncComponent</reference>
+    </component>
+
     <component name="AsyncComponent">
 		<implementation.script script="AsyncServiceImpl.js"/>
     </component>

Modified: incubator/tuscany/sandbox/ant/sample.script.async/src/test/java/sample/AsyncTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/ant/sample.script.async/src/test/java/sample/AsyncTestCase.java?view=diff&rev=453678&r1=453677&r2=453678
==============================================================================
--- incubator/tuscany/sandbox/ant/sample.script.async/src/test/java/sample/AsyncTestCase.java (original)
+++ incubator/tuscany/sandbox/ant/sample.script.async/src/test/java/sample/AsyncTestCase.java Fri Oct  6 10:08:35 2006
@@ -34,6 +34,7 @@
     protected void setUp() throws Exception {
         URL scdl = getClass().getClassLoader().getResource("META-INF/sca/script.system.scdl");
         addExtension("ScriptContainer", scdl);
+        setApplicationSCDL(AsyncClient.class, "META-INF/sca/default.scdl");
         super.setUp();
     }
 
@@ -43,10 +44,11 @@
     public void testHelloWorld() throws Exception {
 
         AsyncService service = CurrentCompositeContext.getContext().locateService(
-                AsyncService.class, "AsyncComponent");
+                AsyncService.class, "ClientComponent");
 
         System.out.println("Calling async service oneWay on thread + " + Thread.currentThread());
         service.doitOneWay("foo");
         System.out.println("returned from oneWay service");
+        Thread.sleep(500);
     }
 }



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