You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/05/19 18:47:54 UTC

svn commit: r539773 - in /incubator/tuscany/java/sca/samples: binding-echo-appl/ binding-echo-appl/src/main/java/echo/client/ binding-echo-appl/src/main/resources/ binding-echo-appl/src/test/java/echo/appl/ implementation-crud-client/ implementation-cr...

Author: jsdelfino
Date: Sat May 19 09:47:52 2007
New Revision: 539773

URL: http://svn.apache.org/viewvc?view=rev&rev=539773
Log:
Cleaning up new crud implementation and echo binding modules.

Added:
    incubator/tuscany/java/sca/samples/binding-echo-appl/src/main/resources/EchoBinding.composite
      - copied unchanged from r539613, incubator/tuscany/java/sca/samples/binding-echo-appl/src/main/resources/EchoBindingApplication.composite
    incubator/tuscany/java/sca/samples/implementation-crud-client/src/main/java/crud/client/
    incubator/tuscany/java/sca/samples/implementation-crud-client/src/main/java/crud/client/CRUDClient.java
      - copied, changed from r539613, incubator/tuscany/java/sca/samples/implementation-crud-client/src/main/java/crud/CRUDClient.java
    incubator/tuscany/java/sca/samples/implementation-crud-client/src/main/resources/crud.composite
      - copied unchanged from r539613, incubator/tuscany/java/sca/samples/implementation-crud-client/src/main/resources/crudclient.composite
    incubator/tuscany/java/sca/samples/implementation-crud-client/src/test/java/crud/client/
    incubator/tuscany/java/sca/samples/implementation-crud-client/src/test/java/crud/client/CRUDTestCase.java
      - copied, changed from r539613, incubator/tuscany/java/sca/samples/implementation-crud-client/src/test/java/crud/CRUDTestCase.java
    incubator/tuscany/java/sca/samples/implementation-crud/src/test/resources/
    incubator/tuscany/java/sca/samples/implementation-crud/src/test/resources/crud.composite
      - copied unchanged from r539613, incubator/tuscany/java/sca/samples/implementation-crud/src/main/resources/crud.composite
Removed:
    incubator/tuscany/java/sca/samples/binding-echo-appl/src/main/resources/EchoBindingApplication.composite
    incubator/tuscany/java/sca/samples/implementation-crud-client/src/main/java/crud/CRUDClient.java
    incubator/tuscany/java/sca/samples/implementation-crud-client/src/main/resources/crudclient.composite
    incubator/tuscany/java/sca/samples/implementation-crud-client/src/test/java/crud/CRUDTestCase.java
    incubator/tuscany/java/sca/samples/implementation-crud/src/main/resources/crud.composite
Modified:
    incubator/tuscany/java/sca/samples/binding-echo-appl/   (props changed)
    incubator/tuscany/java/sca/samples/binding-echo-appl/src/main/java/echo/client/EchoBindingClient.java
    incubator/tuscany/java/sca/samples/binding-echo-appl/src/test/java/echo/appl/EchoApplTestCase.java
    incubator/tuscany/java/sca/samples/implementation-crud-client/   (props changed)

Propchange: incubator/tuscany/java/sca/samples/binding-echo-appl/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sat May 19 09:47:52 2007
@@ -1 +1,14 @@
-\Tuscany\SVN\TRUNK\etc\svn-ignores
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Modified: incubator/tuscany/java/sca/samples/binding-echo-appl/src/main/java/echo/client/EchoBindingClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-appl/src/main/java/echo/client/EchoBindingClient.java?view=diff&rev=539773&r1=539772&r2=539773
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo-appl/src/main/java/echo/client/EchoBindingClient.java (original)
+++ incubator/tuscany/java/sca/samples/binding-echo-appl/src/main/java/echo/client/EchoBindingClient.java Sat May 19 09:47:52 2007
@@ -29,21 +29,22 @@
  * @version $Rev$ $Date$
  */
 public class EchoBindingClient {
+    
     public static void main(String[] args) throws Exception {
 
-        SCADomain scaDomain  = SCADomain.newInstance("EchoBindingApplication.composite");
+        SCADomain scaDomain  = SCADomain.newInstance("EchoBinding.composite");
         
-        
-        // Call the echo service component which will, in turn, call its 
-        // reference which will echo the string back
+        // Call the echo service component which will, in turn, call a reference
+        // with an echo binding. The echo binding will echo the given string.
         Echo service = scaDomain.getService(Echo.class, "EchoComponent");
         String echoString = service.echo("foo");
         System.out.println("Echo reference = " + echoString );
 
-        // Call the echo servic which will echo the string back straight
-        // away
-        echoString = EchoServer.getServer().sendReceive("EchoComponent/EchoService", "baa");
+        // Call the echo server. This will dispatch the call to a service with an 
+        // echo binding. The echo binding will pass the call to the echo component.
+        echoString = EchoServer.getServer().sendReceive("EchoComponent/EchoService", "bar");
         System.out.println("Echo service = " + echoString );
+        
         scaDomain.close();
 
     }

Modified: incubator/tuscany/java/sca/samples/binding-echo-appl/src/test/java/echo/appl/EchoApplTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-appl/src/test/java/echo/appl/EchoApplTestCase.java?view=diff&rev=539773&r1=539772&r2=539773
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo-appl/src/test/java/echo/appl/EchoApplTestCase.java (original)
+++ incubator/tuscany/java/sca/samples/binding-echo-appl/src/test/java/echo/appl/EchoApplTestCase.java Sat May 19 09:47:52 2007
@@ -19,12 +19,38 @@
 
 package echo.appl;
 
-import echo.client.EchoBindingClient;
 import junit.framework.TestCase;
 
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import echo.server.EchoServer;
+
 public class EchoApplTestCase extends TestCase {
+    
+    private SCADomain scaDomain;
+    
+    @Override
+    protected void setUp() throws Exception {
+        scaDomain  = SCADomain.newInstance("EchoBinding.composite");
+    }
+    
+    @Override
+    protected void tearDown() throws Exception {
+        scaDomain.close();
+    }
 
-    public void test() throws Exception {
-        EchoBindingClient.main(null);
+    public void testReference() throws Exception {
+        // Call the echo service component which will, in turn, call a reference
+        // with an echo binding. The echo binding will echo the given string.
+        Echo service = scaDomain.getService(Echo.class, "EchoComponent");
+        String echoString = service.echo("foo");
+        assertEquals(echoString, "foo");
+    }
+    
+    public void testService() throws Exception {
+        // Call the echo server. This will dispatch the call to a service with an 
+        // echo binding. The echo binding will pass the call to the echo component.
+        String echoString = EchoServer.getServer().sendReceive("EchoComponent/EchoService", "bar");
+        assertEquals(echoString, "bar");
     }
 }

Propchange: incubator/tuscany/java/sca/samples/implementation-crud-client/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sat May 19 09:47:52 2007
@@ -1 +1,14 @@
-\Tuscany\SVN\TRUNK\etc\svn-ignores
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Copied: incubator/tuscany/java/sca/samples/implementation-crud-client/src/main/java/crud/client/CRUDClient.java (from r539613, incubator/tuscany/java/sca/samples/implementation-crud-client/src/main/java/crud/CRUDClient.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud-client/src/main/java/crud/client/CRUDClient.java?view=diff&rev=539773&p1=incubator/tuscany/java/sca/samples/implementation-crud-client/src/main/java/crud/CRUDClient.java&r1=539613&p2=incubator/tuscany/java/sca/samples/implementation-crud-client/src/main/java/crud/client/CRUDClient.java&r2=539773
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud-client/src/main/java/crud/CRUDClient.java (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud-client/src/main/java/crud/client/CRUDClient.java Sat May 19 09:47:52 2007
@@ -17,7 +17,7 @@
  * under the License.    
  */
 
-package crud;
+package crud.client;
 
 import crud.CRUD;
 import org.apache.tuscany.sca.host.embedded.SCADomain;
@@ -29,7 +29,7 @@
 
     public static void main(String[] args) throws Exception {
 
-        SCADomain scaDomain = SCADomain.newInstance("crudclient.composite");
+        SCADomain scaDomain = SCADomain.newInstance("crud.composite");
         CRUD crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent");
         
         String id = crudService.create("ABC");

Copied: incubator/tuscany/java/sca/samples/implementation-crud-client/src/test/java/crud/client/CRUDTestCase.java (from r539613, incubator/tuscany/java/sca/samples/implementation-crud-client/src/test/java/crud/CRUDTestCase.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud-client/src/test/java/crud/client/CRUDTestCase.java?view=diff&rev=539773&p1=incubator/tuscany/java/sca/samples/implementation-crud-client/src/test/java/crud/CRUDTestCase.java&r1=539613&p2=incubator/tuscany/java/sca/samples/implementation-crud-client/src/test/java/crud/client/CRUDTestCase.java&r2=539773
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud-client/src/test/java/crud/CRUDTestCase.java (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud-client/src/test/java/crud/client/CRUDTestCase.java Sat May 19 09:47:52 2007
@@ -17,14 +17,41 @@
  * under the License.    
  */
 
-package crud;
+package crud.client;
 
-import crud.CRUDClient;
 import junit.framework.TestCase;
 
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import crud.CRUD;
+
 public class CRUDTestCase extends TestCase {
+    
+    private SCADomain scaDomain;
+    
+    @Override
+    protected void setUp() throws Exception {
+        scaDomain = SCADomain.newInstance("crud.composite");
+    }
+    
+    @Override
+    protected void tearDown() throws Exception {
+        scaDomain.close();
+    }
 
     public void test() throws Exception {
-        CRUDClient.main(null);
+        CRUD crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent");
+        
+        String id = crudService.create("ABC");
+        Object result = crudService.retrieve(id);
+        assertEquals(result, "ABC");
+
+        crudService.update(id, "EFG");
+        result = crudService.retrieve(id);
+        assertEquals(result, "EFG");
+        
+        crudService.delete(id);
+        result = crudService.retrieve(id);
+        assertNull(result);
     }
 }



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