tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwilli...@apache.org
Subject svn commit: r652715 - in /incubator/tuscany/java/sca/vtest/java-api/conversation/id/src: main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/ main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/ main/resources/ test/java/org/...
Date Thu, 01 May 2008 23:49:51 GMT
Author: kwilliams
Date: Thu May  1 16:49:50 2008
New Revision: 652715

URL: http://svn.apache.org/viewvc?rev=652715&view=rev
Log:
More tests for Conversation ID. TUSCANY-2247

Added:
    incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CService.java
  (with props)
    incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CustomConversationId.java
  (with props)
    incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/CServiceImpl.java
  (with props)
Modified:
    incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/AService.java
    incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/BService.java
    incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/AServiceImpl.java
    incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/BServiceImpl.java
    incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/resources/conversation-id.composite
    incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/ConversationIDTestCase.java

Modified: incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/AService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/AService.java?rev=652715&r1=652714&r2=652715&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/AService.java
(original)
+++ incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/AService.java
Thu May  1 16:49:50 2008
@@ -28,4 +28,10 @@
 
     public void testAnnotation();
 
+    public void testAnnotation2();
+
+    public void testAnnotation3();
+
+    public void testAnnotation4();
+
 }

Modified: incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/BService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/BService.java?rev=652715&r1=652714&r2=652715&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/BService.java
(original)
+++ incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/BService.java
Thu May  1 16:49:50 2008
@@ -33,6 +33,9 @@
     public String getState();
 
     public void testAnnotation();
-  
+
+    public void testAnnotation2();
+
+    public void testAnnotation3();
 
 }

Added: incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CService.java?rev=652715&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CService.java
(added)
+++ incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CService.java
Thu May  1 16:49:50 2008
@@ -0,0 +1,37 @@
+/*
+ * 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 org.apache.tuscany.sca.vtest.javaapi.conversation.id;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Local Service
+ */
+@Remotable
+@Conversational
+public interface CService {
+
+    public void setState(String someState);
+    
+    public String getState();
+
+    public void testAnnotation();
+
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CustomConversationId.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CustomConversationId.java?rev=652715&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CustomConversationId.java
(added)
+++ incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CustomConversationId.java
Thu May  1 16:49:50 2008
@@ -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 org.apache.tuscany.sca.vtest.javaapi.conversation.id;
+
+
+public class CustomConversationId {
+    
+    int id;
+    String name;
+
+    public CustomConversationId(int id, String name) {
+        super();
+        this.id = id;
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public int getNumber() {
+        return id;
+    }
+
+    public void setName(String someName) {
+        name = someName;
+    }
+
+    public void setNumber(int someInt) {
+        id = someInt;
+    }
+
+    public String toString() {
+        return "id->" + id + " name->" + name;
+    }
+    
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CustomConversationId.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CustomConversationId.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/AServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/AServiceImpl.java?rev=652715&r1=652714&r2=652715&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/AServiceImpl.java
(original)
+++ incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/AServiceImpl.java
Thu May  1 16:49:50 2008
@@ -21,6 +21,8 @@
 
 import org.apache.tuscany.sca.vtest.javaapi.conversation.id.AService;
 import org.apache.tuscany.sca.vtest.javaapi.conversation.id.BService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.id.CService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.id.CustomConversationId;
 import org.osoa.sca.ServiceReference;
 import org.osoa.sca.annotations.Reference;
 import org.osoa.sca.annotations.Scope;
@@ -32,11 +34,25 @@
 
     @Reference
     protected ServiceReference<BService> b;
+    
+    @Reference
+    protected ServiceReference<CService> c;
 
     public void testAnnotation() {
-        b.getService().testAnnotation();
-        
+        b.getService().testAnnotation();  
+    }
+
+    public void testAnnotation2() {
+        b.getService().testAnnotation2();     
     }
 
- 
+    public void testAnnotation3() {
+        b.getService().testAnnotation3();        
+    }
+
+    public void testAnnotation4() {
+        CustomConversationId id = new CustomConversationId (1, "One");
+        c.setConversationID(id);
+        c.getService().testAnnotation();        
+    }
 }

Modified: incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/BServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/BServiceImpl.java?rev=652715&r1=652714&r2=652715&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/BServiceImpl.java
(original)
+++ incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/BServiceImpl.java
Thu May  1 16:49:50 2008
@@ -28,14 +28,17 @@
 
 @Service(BService.class)
 @Scope("CONVERSATION")
-@ConversationAttributes(maxAge="1 seconds")
+@ConversationAttributes(maxAge = "1 seconds")
 public class BServiceImpl implements BService {
 
     String someState;
-    
+
     @ConversationID
     protected String conversationID;
 
+    @ConversationID
+    protected Object conversationID2;
+
     public void setState(String someState) {
         this.someState = someState;
     }
@@ -49,5 +52,14 @@
         System.out.println(conversationID);
     }
 
+    public void testAnnotation2() {
+        Assert.assertNotNull(conversationID2);
+        System.out.println(conversationID);
+    }
+
+    public void testAnnotation3() {
+        Assert.assertTrue(conversationID2 instanceof String);
+        System.out.println(conversationID);
+    }
 
 }

Added: incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/CServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/CServiceImpl.java?rev=652715&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/CServiceImpl.java
(added)
+++ incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/CServiceImpl.java
Thu May  1 16:49:50 2008
@@ -0,0 +1,56 @@
+/*
+ * 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 org.apache.tuscany.sca.vtest.javaapi.conversation.id.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.id.CService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.id.CustomConversationId;
+import org.junit.Assert;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+@Scope("CONVERSATION")
+public class CServiceImpl implements CService {
+
+    String someState;
+
+    @ConversationID
+    protected Object conversationID;
+
+
+    public void setState(String someState) {
+        this.someState = someState;
+    }
+
+    public String getState() {
+        return someState;
+    }
+
+    public void testAnnotation() {
+        Assert.assertNotNull(conversationID);
+        Assert.assertTrue(conversationID instanceof CustomConversationId);
+        
+        Assert.assertSame(1, ((CustomConversationId)conversationID).getNumber());
+        Assert.assertSame("One", ((CustomConversationId)conversationID).getName());
+        System.out.println(conversationID);
+    }
+
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/CServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/CServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/resources/conversation-id.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/resources/conversation-id.composite?rev=652715&r1=652714&r2=652715&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/resources/conversation-id.composite
(original)
+++ incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/main/resources/conversation-id.composite
Thu May  1 16:49:50 2008
@@ -18,17 +18,23 @@
 	* under the License.
 -->
 <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
-	targetNamespace="http://java-api-tests" name="Converstion-Lifetime">
+	targetNamespace="http://java-api-tests" name="Converstion-ID">
 
 	<component name="AComponent">
 		<implementation.java
 			class="org.apache.tuscany.sca.vtest.javaapi.conversation.id.impl.AServiceImpl" />
 		<reference name="b" target="BComponent" />
+		<reference name="c" target="CComponent" />
 	</component>
 
 	<component name="BComponent">
 		<implementation.java
 			class="org.apache.tuscany.sca.vtest.javaapi.conversation.id.impl.BServiceImpl" />
 	</component>
-	
+
+	<component name="CComponent">
+		<implementation.java
+			class="org.apache.tuscany.sca.vtest.javaapi.conversation.id.impl.CServiceImpl" />
+	</component>
+
 </composite>

Modified: incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/ConversationIDTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/ConversationIDTestCase.java?rev=652715&r1=652714&r2=652715&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/ConversationIDTestCase.java
(original)
+++ incubator/tuscany/java/sca/vtest/java-api/conversation/id/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/ConversationIDTestCase.java
Thu May  1 16:49:50 2008
@@ -22,9 +22,7 @@
 import org.apache.tuscany.sca.host.embedded.SCADomain;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
-import org.osoa.sca.ConversationEndedException;
 
 /**
  * 
@@ -63,8 +61,39 @@
      * injected onto the field
      */
     @Test
-    public void lifetime1() throws Exception {
+    public void idAnnotation() throws Exception {
         aService.testAnnotation();
     }
 
+    /**
+     * Lines 505
+     * <p>
+     * The type of the field is not necessarily String
+     */
+    @Test
+    public void idAnnotation2() throws Exception {
+        aService.testAnnotation2();
+    }
+
+    /**
+     * Lines 505, 506
+     * <p>
+     * System generated conversation IDs are always strings
+     */
+    @Test
+    public void idAnnotation3() throws Exception {
+        aService.testAnnotation3();
+    }
+
+    /**
+     * Lines 506, 507
+     * <p>
+     * ... but application generated conversation IDs may be other complex
+     * types.
+     */
+    @Test
+    public void idAnnotation4() throws Exception {
+        aService.testAnnotation4();
+    }
+
 }



Mime
View raw message