Author: jmarino
Date: Sun Nov 26 03:19:54 2006
New Revision: 479345
URL: http://svn.apache.org/viewvc?view=rev&rev=479345
Log:
add javadoc for testcase
Modified:
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/BasicConversationInvocationTestCase.java
Modified:
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/BasicConversationInvocationTestCase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/BasicConversationInvocationTestCase.java?view=diff&rev=479345&r1=479344&r2=479345
==============================================================================
---
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/BasicConversationInvocationTestCase.java
(original)
+++
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/BasicConversationInvocationTestCase.java
Sun Nov 26 03:19:54 2006
@@ -51,6 +51,8 @@
import org.easymock.classextension.EasyMock;
/**
+ * Provides fine-grained integration-level testing for conversational
invocation sequences using a partial runtime
+ *
* @version $Rev$ $Date$
*/
public class BasicConversationInvocationTestCase extends TestCase {
@@ -59,10 +61,21 @@
private WorkContext workContext;
private ConnectorImpl connector;
private OutboundWire owire;
+ private JavaAtomicComponent target;
private Foo targetInstance;
+
+ /**
+ * Verifies start, continue and end conversation invocations are processed
properly. Checks that a target instance
+ * is properly instantiated and persisted in the store. Additionally
verifies that invocations are dispatched to a
+ * target instance, and that start, continue, and end operations are
performed correctly. Finally, verfies that the
+ * target instance is removed from the store when the conversation ends.
+ *
+ * @throws Exception
+ */
public void testConversationStartContinueEnd() throws Exception {
workContext.setIdentifier(CONVERSATION, "12345A");
+ // start the conversation
for (Map.Entry<Operation<?>, OutboundInvocationChain> entry :
owire.getInvocationChains().entrySet()) {
if ("operation1".equals(entry.getKey().getName())) {
MessageImpl msg = new MessageImpl();
@@ -70,6 +83,9 @@
entry.getValue().getHeadInterceptor().invoke(msg);
}
}
+ // verify the instance was persisted
+ // continue the conversation
+ assertEquals(targetInstance, store.readRecord(target, "12345A"));
for (Map.Entry<Operation<?>, OutboundInvocationChain> entry :
owire.getInvocationChains().entrySet()) {
if ("operation2".equals(entry.getKey().getName())) {
MessageImpl msg = new MessageImpl();
@@ -77,6 +93,9 @@
entry.getValue().getHeadInterceptor().invoke(msg);
}
}
+ // verify the instance was persisted
+ assertEquals(targetInstance, store.readRecord(target, "12345A"));
+ // end the conversation
for (Map.Entry<Operation<?>, OutboundInvocationChain> entry :
owire.getInvocationChains().entrySet()) {
if ("end".equals(entry.getKey().getName())) {
MessageImpl msg = new MessageImpl();
@@ -85,9 +104,9 @@
}
}
workContext.clearIdentifier(CONVERSATION);
-
- // start, continue, end
EasyMock.verify(targetInstance);
+ // verify the store has removed the instance
+ assertNull(store.readRecord(target, "12345A"));
}
@@ -100,7 +119,7 @@
targetInstance.end();
EasyMock.replay(targetInstance);
// create target component mock
- JavaAtomicComponent target = createAtomicComponent();
+ target = createAtomicComponent();
// create source component mock
JavaAtomicComponent source =
EasyMock.createMock(JavaAtomicComponent.class);
EasyMock.expect(source.getName()).andReturn("source");
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]