You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2007/09/10 08:38:02 UTC
svn commit: r574151 - in /myfaces/orchestra/trunk/core/src/test:
java/org/apache/myfaces/orchestra/conversation/ resources/
Author: skitching
Date: Sun Sep 9 23:38:02 2007
New Revision: 574151
URL: http://svn.apache.org/viewvc?rev=574151&view=rev
Log:
Minor test tidyups: mainly, rename DummyConversation to DummyBean.
Added:
myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/DummyBean.java
- copied, changed from r574147, myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/DummyConversation.java
Removed:
myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/DummyConversation.java
Modified:
myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversation.java
myfaces/orchestra/trunk/core/src/test/resources/testApplicationContext.xml
Copied: myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/DummyBean.java (from r574147, myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/DummyConversation.java)
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/DummyBean.java?p2=myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/DummyBean.java&p1=myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/DummyConversation.java&r1=574147&r2=574151&rev=574151&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/DummyConversation.java (original)
+++ myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/DummyBean.java Sun Sep 9 23:38:02 2007
@@ -18,13 +18,13 @@
*/
package org.apache.myfaces.orchestra.conversation;
-public class DummyConversation implements ConversationBindingListener
+public class DummyBean implements ConversationBindingListener
{
private String data;
public static ConversationBindingListener callback;
- public DummyConversation()
+ public DummyBean()
{
}
@@ -57,7 +57,7 @@
Conversation.getCurrentInstance().invalidateAndRestart();
}
- public DummyConversation getRaw()
+ public DummyBean getRaw()
{
return this;
}
Modified: myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversation.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversation.java?rev=574151&r1=574150&r2=574151&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversation.java (original)
+++ myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversation.java Sun Sep 9 23:38:02 2007
@@ -49,59 +49,63 @@
public void testConversation() throws Exception
{
- DummyConversation.callback=this;
- final String CONVERSATION_NAME = "dummyConversation";
+ DummyBean.callback=this;
+ final String BEAN_NAME = "dummyBean";
+
+ // The Spring configuration for dummyBean does not explicitly set a conversation name,
+ // so conversation-name = bean-name
+ final String CONVERSATION_NAME = BEAN_NAME;
valueBoundCount = 0;
valueUnboundCount = 0;
/* simple create test */
- DummyConversation conv = (DummyConversation) applicationContext.getBean(CONVERSATION_NAME);
+ DummyBean bean = (DummyBean) applicationContext.getBean(BEAN_NAME);
- assertTrue("should be a scoped object", conv instanceof ScopedObject);
+ assertTrue("should be a scoped object", bean instanceof ScopedObject);
assertFalse("conversation should not have been started yet", ConversationManager.getInstance().hasConversation(CONVERSATION_NAME));
assertEquals("value bound", 0, valueBoundCount);
assertEquals("value unbound", 0, valueUnboundCount);
- conv.touch();
+ bean.touch();
assertEquals("value bound", 1, valueBoundCount);
assertEquals("value unbound", 0, valueUnboundCount);
assertTrue("conversation should have been started", ConversationManager.getInstance().hasConversation(CONVERSATION_NAME));
/* check if correct conversation has been started */
- Conversation conversationHolder = conv.checkCurrentConversation();
+ Conversation conversationHolder = bean.checkCurrentConversation();
assertNotNull("current conversation", conversationHolder);
assertEquals("conversation name", CONVERSATION_NAME, conversationHolder.getName());
/* invalidate conversation */
- conv.invalidateSelf();
+ bean.invalidateSelf();
assertFalse("conversation should not be running", ConversationManager.getInstance().hasConversation(CONVERSATION_NAME));
assertTrue("conversation should be marked invalid", conversationHolder.isInvalid());
assertEquals("value bound", 1, valueBoundCount);
assertEquals("value unbound", 1, valueUnboundCount);
- conv.touch();
+ bean.touch();
assertTrue("conversation should have been started", ConversationManager.getInstance().hasConversation(CONVERSATION_NAME));
assertEquals("value bound", 2, valueBoundCount);
/* check if a new conversation bean has been created */
- conv.setData("check");
+ bean.setData("check");
- conv.invalidateAndRestartSelf();
+ bean.invalidateAndRestartSelf();
assertEquals("value bound", 2, valueBoundCount);
assertEquals("value unbound", 2, valueUnboundCount);
assertTrue("conversation should still be running", ConversationManager.getInstance().hasConversation(CONVERSATION_NAME));
- DummyConversation convNew = (DummyConversation) applicationContext.getBean(CONVERSATION_NAME);
+ DummyBean beanNew = (DummyBean) applicationContext.getBean(BEAN_NAME);
- assertNotNull("should have got a new conversation", convNew);
- assertNull("the conversation is not new", conv.getData());
+ assertNotNull("should have got a new conversation", beanNew);
+ assertNull("the conversation is not new", bean.getData());
- convNew.touch();
+ beanNew.touch();
assertEquals("value bound", 3, valueBoundCount);
Modified: myfaces/orchestra/trunk/core/src/test/resources/testApplicationContext.xml
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/test/resources/testApplicationContext.xml?rev=574151&r1=574150&r2=574151&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/test/resources/testApplicationContext.xml (original)
+++ myfaces/orchestra/trunk/core/src/test/resources/testApplicationContext.xml Sun Sep 9 23:38:02 2007
@@ -31,8 +31,15 @@
<bean class="org.springframework.beans.factory.config.CustomScopeConfigurer">
<property name="scopes">
<map>
- <entry key="conversation">
- <bean class="org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope" />
+ <entry key="conversation.manual">
+ <bean class="org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope">
+ <property name="timeout" value="30"/>
+ </bean>
+ </entry>
+ <entry key="conversation.flash">
+ <bean class="org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope">
+ <property name="lifetime" value="flash"/>
+ </bean>
</entry>
</map>
</property>
@@ -42,9 +49,9 @@
<!-- our beans -->
<bean
- name="dummyConversation"
- class="org.apache.myfaces.orchestra.conversation.DummyConversation"
- scope="conversation"
+ name="dummyBean"
+ class="org.apache.myfaces.orchestra.conversation.DummyBean"
+ scope="conversation.manual"
autowire="byName">
<aop:scoped-proxy/>