You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2008/03/11 12:32:26 UTC
svn commit: r635892 - in /incubator/tuscany/java/sca/itest/conversations/src:
main/java/org/apache/tuscany/sca/itest/conversational/
main/java/org/apache/tuscany/sca/itest/conversational/impl/
test/java/org/apache/tuscany/sca/itest/conversational/
Author: slaws
Date: Tue Mar 11 04:32:15 2008
New Revision: 635892
URL: http://svn.apache.org/viewvc?rev=635892&view=rev
Log:
TUSCANY-2055
Adjust conversation lifetime testing following spec clarification contained in the JIRA.
Modified:
incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/CService.java
incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/DService.java
incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/CServiceImpl.java
incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/DServiceImpl.java
incubator/tuscany/java/sca/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationLifetimeTestCase.java
Modified: incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/CService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/CService.java?rev=635892&r1=635891&r2=635892&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/CService.java (original)
+++ incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/CService.java Tue Mar 11 04:32:15 2008
@@ -31,6 +31,8 @@
void setState(String aState);
Object getConversationID();
+
+ Object getConversationObjectConversationId();
void setConversationID(String theID);
Modified: incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/DService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/DService.java?rev=635892&r1=635891&r2=635892&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/DService.java (original)
+++ incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/DService.java Tue Mar 11 04:32:15 2008
@@ -19,6 +19,7 @@
package org.apache.tuscany.sca.itest.conversational;
import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
/**
* Simple conversational Service
@@ -40,5 +41,6 @@
*/
void setState(String aState);
+ @EndsConversation
void endConversationViaAnnotatedMethod();
}
Modified: incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/CServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/CServiceImpl.java?rev=635892&r1=635891&r2=635892&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/CServiceImpl.java (original)
+++ incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/CServiceImpl.java Tue Mar 11 04:32:15 2008
@@ -47,13 +47,28 @@
dServiceRef.getService().setState(aState);
}
+
/*
- * Whether the conversation ID is chosen by the client or is generated by
- * the system, the client may access the conversation ID by calling
- * ServiceReference.getConversationID().
+ * When the coversationId is set manually the client may access the
+ * conversation id that will be used by the reference using
+ * ServiceReference.getConversationId()
*/
public Object getConversationID() {
return dServiceRef.getConversationID();
+ }
+
+ /*
+ * Whether the conversation ID is chosen by the client or is generated by
+ * the system, the client may access the conversation ID by calling
+ * Conversation.getConversationID().
+ */
+ public Object getConversationObjectConversationId() {
+ // TODO Auto-generated method stub
+ if (dServiceRef.getConversation() != null){
+ return dServiceRef.getConversation().getConversationID();
+ } else {
+ return null;
+ }
}
public void endConversation() {
Modified: incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/DServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/DServiceImpl.java?rev=635892&r1=635891&r2=635892&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/DServiceImpl.java (original)
+++ incubator/tuscany/java/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/DServiceImpl.java Tue Mar 11 04:32:15 2008
@@ -62,10 +62,9 @@
*/
@ConversationID
public void setConversationID(String id) {
- System.out.println ("Setting conversation ID");
+ System.out.println ("Setting conversation ID at service = " + id );
}
- @EndsConversation
public void endConversationViaAnnotatedMethod() {
System.out.println ("Annotated Ends Conversation");
}
Modified: incubator/tuscany/java/sca/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationLifetimeTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationLifetimeTestCase.java?rev=635892&r1=635891&r2=635892&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationLifetimeTestCase.java (original)
+++ incubator/tuscany/java/sca/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationLifetimeTestCase.java Tue Mar 11 04:32:15 2008
@@ -42,48 +42,87 @@
}
}
+ /**
+ * Following a clarification re. the wording of the Java Common Annotations and APIs 1.00 Specification
+ * (see TUSCANY-2055) the following is accepted to be the intended operation
+ *
+ * Whether the conversation ID is chosen by the user or is generated by the system, the client
+ * may access the conversation ID by calling getConversationID() on the current conversation object.
+ *
+ * ServiceReference.getConversationID() - Returns the id supplied by the user that will be associated with
+ * future conversations initiated through this reference, or null if no ID has been set by the user.
+ *
+ * ServiceReference.setConversationID(Object conversationId) - Set an ID, supplied by the user, to associate with any future conversation
+ * started through this reference. If the value supplied is null then the id will be generated
+ * by the implementation. Throws an IllegalStateException if a conversation is currently
+ * associated with this reference.
+ *
+ */
/**
- * Java Common Annotations and APIs 1.00 Specification line 522-523 Verify: Whether the
- * conversation ID is chosen by the client or is generated by the system,
- * the client may access the conversation ID by calling ServiceReference.getConversationID().
+ * Verify that ServiceReference.getConversationID() returns null before a conversation
+ * ID has been set manually.
*/
- @Ignore
@Test
public void getConversationID() {
CService service = domain.getService(CService.class, "ConversationalCComponent");
service.getState();
- Assert.assertNotNull(service.getConversationID());
+ Assert.assertNull(service.getConversationID());
}
/**
- * Java Common Annotations and APIs 1.00 Specification line 522-523 Verify: Whether the
- * conversation ID is chosen by the client or is generated by the system,
- * the client may access the conversation ID by calling ServiceReference.getConversationID().
+ * Verify that ServiceReference.getConversationID() returns any value previous set through the
+ * setConversationID() api.
*/
@Test
public void getConversationID2() {
String userProvidedID = "A conversation ID";
CService service = domain.getService(CService.class, "ConversationalCComponent");
service.setConversationID(userProvidedID);
+ service.getState();
Assert.assertEquals(service.getConversationID(), userProvidedID);
}
/**
+ * Whether the conversation ID is chosen by the user or is generated by the system, the client
+ * may access the conversation ID by calling getConversationID() on the current conversation object.
+ * Here test the manually set conversationID
+ */
+ @Test
+ public void getConversationID3() {
+ String userProvidedID = "A conversation ID";
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.setConversationID(userProvidedID);
+ service.getState();
+ Assert.assertEquals(service.getConversationObjectConversationId(), userProvidedID);
+ }
+
+ /**
+ * Whether the conversation ID is chosen by the user or is generated by the system, the client
+ * may access the conversation ID by calling getConversationID() on the current conversation object.
+ * Here test the auto generated conversationId
+ */
+ @Test
+ public void getConversationID4() {
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.getState();
+ Assert.assertNotNull(service.getConversationObjectConversationId());
+ }
+
+ /**
* Java Common Annotations and APIs 1.00 Specification line 494-495 Verify:
* If a method is invoked on a service reference after an
* "@EndsConversation" method has been called then a new conversation will
* automatically be started.
*/
- @Ignore
@Test
public void implicitStartNewConversationAfterEnd() {
CService service = domain.getService(CService.class, "ConversationalCComponent");
service.getState();
- Object firstID = service.getConversationID();
+ Object firstID = service.getConversationObjectConversationId();
service.endConversationViaAnnotatedMethod();
service.getState();
- Assert.assertNotSame(firstID, service.getConversationID());
+ Assert.assertNotSame(firstID, service.getConversationObjectConversationId());
}
/**
@@ -92,15 +131,14 @@
* method has been called then a new conversation will automatically be
* started. Note: Uses Conversation.end() rather than "@EndsConversation"
*/
- @Ignore
@Test
public void implicitStartNewConversationAfterEnd2() {
CService service = domain.getService(CService.class, "ConversationalCComponent");
service.getState();
- Object firstID = service.getConversationID();
+ Object firstID = service.getConversationObjectConversationId();
service.endConversation();
service.getState();
- Assert.assertNotSame(firstID, service.getConversationID());
+ Assert.assertNotSame(firstID, service.getConversationObjectConversationId());
}
/**
@@ -114,7 +152,7 @@
CService service = domain.getService(CService.class, "ConversationalCComponent");
service.getState();
service.endConversationViaAnnotatedMethod();
- Assert.assertNull(service.getConversationID());
+ Assert.assertNull(service.getConversationObjectConversationId());
}
/**
@@ -123,14 +161,13 @@
* "@EndsConversation" method is called, but before the next conversation
* has been started, it will return null. Note: Uses explicit set of Conversation ID
*/
- @Ignore
@Test
public void nullConversationIDAfterEndConversation1a() {
CService service = domain.getService(CService.class, "ConversationalCComponent");
service.setConversationID("User provided ID");
service.getState();
service.endConversationViaAnnotatedMethod();
- Assert.assertNull(service.getConversationID());
+ Assert.assertNull(service.getConversationObjectConversationId());
}
/**
@@ -145,7 +182,7 @@
CService service = domain.getService(CService.class, "ConversationalCComponent");
service.getState();
service.endConversation();
- Assert.assertNull(service.getConversationID());
+ Assert.assertNull(service.getConversationObjectConversationId());
}
/**
@@ -155,14 +192,13 @@
* been started, it will return null. Note: Uses Conversation.end() rather
* than "@EndsConversation". Note 2: Uses explicit set of Conversation ID
*/
- @Ignore
@Test
public void nullConversationIDAfterEndConversation2a() {
CService service = domain.getService(CService.class, "ConversationalCComponent");
service.setConversationID("User provided ID");
service.getState();
service.endConversation();
- Assert.assertNull(service.getConversationID());
+ Assert.assertNull(service.getConversationObjectConversationId());
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org