You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2007/05/01 21:03:21 UTC

svn commit: r534200 - in /incubator/tuscany/java/sca/samples/das-service: service/ service/src/main/java/org/ service/src/main/resources/ service/src/test/java/das/ service/src/test/resources/dastest/ webclient/src/main/webapp/ webclient/src/main/webap...

Author: lresende
Date: Tue May  1 12:03:20 2007
New Revision: 534200

URL: http://svn.apache.org/viewvc?view=rev&rev=534200
Log:
[work in progress] More updates to bring up das-service sample... The service itself is working fine, now i need to finish work on the web client.

Added:
    incubator/tuscany/java/sca/samples/das-service/service/src/test/java/das/DASServiceTestCase.java
    incubator/tuscany/java/sca/samples/das-service/service/src/test/resources/dastest/
      - copied from r534127, incubator/tuscany/java/sca/samples/das-service/webclient/dastest/
    incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/WEB-INF/default.composite
      - copied unchanged from r534127, incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/WEB-INF/default.scdl
Removed:
    incubator/tuscany/java/sca/samples/das-service/service/src/main/java/org/
    incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/WEB-INF/default.scdl
Modified:
    incubator/tuscany/java/sca/samples/das-service/service/pom.xml
    incubator/tuscany/java/sca/samples/das-service/service/src/main/resources/dasservice.composite
    incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/Company.jsp
    incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/WEB-INF/web.xml

Modified: incubator/tuscany/java/sca/samples/das-service/service/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/das-service/service/pom.xml?view=diff&rev=534200&r1=534199&r2=534200
==============================================================================
--- incubator/tuscany/java/sca/samples/das-service/service/pom.xml (original)
+++ incubator/tuscany/java/sca/samples/das-service/service/pom.xml Tue May  1 12:03:20 2007
@@ -65,6 +65,20 @@
 			<scope>compile</scope>
 		</dependency>
 
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derby</artifactId>
+            <version>10.1.2.1</version>
+            <scope>test</scope>
+        </dependency>  
+        		
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.2</version>
+            <scope>test</scope>
+        </dependency>		
+
 	</dependencies>
 
 	<build>

Modified: incubator/tuscany/java/sca/samples/das-service/service/src/main/resources/dasservice.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/das-service/service/src/main/resources/dasservice.composite?view=diff&rev=534200&r1=534199&r2=534200
==============================================================================
--- incubator/tuscany/java/sca/samples/das-service/service/src/main/resources/dasservice.composite (original)
+++ incubator/tuscany/java/sca/samples/das-service/service/src/main/resources/dasservice.composite Tue May  1 12:03:20 2007
@@ -21,13 +21,13 @@
            	targetNamespace="http://DASService"
             name="DASService">
 
-    <service name="DASService"  promote="DASComponent">
-        <interface.java interface="org.apache.tuscany.samples.das.service.DASService"/>
-        <reference>DASComponent</reference>
+    <service name="DASService"  promote="DASServiceComponent">
+        <interface.java interface="das.DASService"/>
+        <reference>DASServiceComponent</reference>
     </service>
     
-    <component name="DASComponent">
-	    <implementation.java class="org.apache.tuscany.samples.das.service.DASServiceImpl"/>
+    <component name="DASServiceComponent">
+	    <implementation.java class="das.DASServiceImpl"/>
     </component>
 
 </composite>

Added: incubator/tuscany/java/sca/samples/das-service/service/src/test/java/das/DASServiceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/das-service/service/src/test/java/das/DASServiceTestCase.java?view=auto&rev=534200
==============================================================================
--- incubator/tuscany/java/sca/samples/das-service/service/src/test/java/das/DASServiceTestCase.java (added)
+++ incubator/tuscany/java/sca/samples/das-service/service/src/test/java/das/DASServiceTestCase.java Tue May  1 12:03:20 2007
@@ -0,0 +1,54 @@
+/*
+ * 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 das;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.host.embedded.SCARuntime;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+
+import commonj.sdo.DataObject;
+
+public class DASServiceTestCase extends TestCase {
+
+    private DASService dasService;
+    
+    protected void setUp() throws Exception {
+        SCARuntime.start("dasservice.composite");
+        ComponentContext context = SCARuntime.getComponentContext("DASServiceComponent");
+        ServiceReference<DASService> service = context.createSelfReference(DASService.class);
+        dasService = service.getService();
+    }
+    
+    protected void tearDown() throws Exception {
+        SCARuntime.stop();
+    }
+
+    public void testDAS() throws Exception{
+        dasService.configureService(getClass().getResourceAsStream("/CompanyConfig.xml"));
+        DataObject root = dasService.executeCommand("all companies", null);
+        List companyList = root.getList("COMPANY");
+        
+        assertNotNull(companyList);
+        assertEquals(3,companyList.size());
+    }
+}

Modified: incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/Company.jsp
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/Company.jsp?view=diff&rev=534200&r1=534199&r2=534200
==============================================================================
--- incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/Company.jsp (original)
+++ incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/Company.jsp Tue May  1 12:03:20 2007
@@ -20,26 +20,33 @@
 
 <%@ page import="java.util.*" %>
 
-<%@ page import="org.osoa.sca.CompositeContext" %>
-<%@ page import="org.osoa.sca.CurrentCompositeContext" %>
+<%@ page import="org.apache.tuscany.host.embedded.SCARuntime"%>
+<%@ page import="org.osoa.sca.ComponentContext" %>
+<%@ page import="org.osoa.sca.ServiceReference" %>
 
 <%@ page import="commonj.sdo.*" %>
-<%@ page import="org.apache.tuscany.samples.das.service.*" %>
+<%@ page import="das.*" %>
 
 <html>
 <head>
 <%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
 <%
-    CompositeContext context = CurrentCompositeContext.getContext();
-    DASService dasService = context.locateService(DASService.class, "DASServiceComponent");
-    List companyList = null;
-    try{
+
+   SCARuntime.start("dasservice.composite");
+   
+   ComponentContext context = SCARuntime.getComponentContext("DASServiceComponent");
+   ServiceReference<DASService> service = context.createSelfReference(DASService.class);
+   DASService dasService = service.getService();
+   List companyList = null;
+
+   try{
 		dasService.configureService(getClass().getClassLoader().getResourceAsStream("CompanyConfig.xml"));
 		DataObject root = dasService.executeCommand("all companies", null);
-    	companyList = root.getList("COMPANY");
-    }catch(Exception e){
-        //TODO: handle case where dasService can't be initiated properly
-    }
+   	companyList = root.getList("COMPANY");
+   }catch(Exception e){
+       //TODO: handle case where dasService can't be initiated properly
+   }
+
 %>
 
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
@@ -78,4 +85,8 @@
 
 </form>
 </body>
+<% 
+   //stop the runtime
+   SCARuntime.stop();
+%>
 </html>

Modified: incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/WEB-INF/web.xml?view=diff&rev=534200&r1=534199&r2=534200
==============================================================================
--- incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/WEB-INF/web.xml (original)
+++ incubator/tuscany/java/sca/samples/das-service/webclient/src/main/webapp/WEB-INF/web.xml Tue May  1 12:03:20 2007
@@ -28,6 +28,7 @@
     </welcome-file-list>
 
     <!--  SCA Related configuration -->
+    <!--
     <filter>
         <filter-name>TuscanyFilter</filter-name>
         <filter-class>org.apache.tuscany.runtime.webapp.TuscanyFilter</filter-class>
@@ -40,5 +41,6 @@
     <listener>
         <listener-class>org.apache.tuscany.runtime.webapp.TuscanyContextListener</listener-class>
     </listener>
+    -->
     <!--  END of SCA Related configuration -->
 </web-app>



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