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 2008/02/26 10:51:59 UTC
svn commit: r631145 - in /myfaces/orchestra/trunk/core15/src/test:
java/org/apache/myfaces/orchestra/conversation/ resources/
Author: skitching
Date: Tue Feb 26 01:51:41 2008
New Revision: 631145
URL: http://svn.apache.org/viewvc?rev=631145&view=rev
Log:
Unit test fixes
Modified:
myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/conversation/PersistentBackingBean.java
myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversationPersistence.java
myfaces/orchestra/trunk/core15/src/test/resources/testApplicationContext.xml
Modified: myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/conversation/PersistentBackingBean.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/conversation/PersistentBackingBean.java?rev=631145&r1=631144&r2=631145&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/conversation/PersistentBackingBean.java (original)
+++ myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/conversation/PersistentBackingBean.java Tue Feb 26 01:51:41 2008
@@ -109,7 +109,7 @@
* hold that bean, and a new PersistenceContext object will
* also be created (and then injected into this instance).
*/
- public void invalidate()
+ public void invalidateConversation()
{
Conversation.getCurrentInstance().invalidate();
}
@@ -122,11 +122,10 @@
* Using invalidateAndRestart allows information to be communicated
* between one instance of this bean and its replacement.
*/
- public void invalidateAndRestart()
+ public void invalidateAndRestartConversation()
{
PersistentBackingBean conv = (PersistentBackingBean)
- ConversationUtils.invalidateAndRestart(
- Conversation.getCurrentInstance());
+ ConversationUtils.invalidateAndRestartCurrent();
conv.setRestartedUser(createdUser.getId());
}
Modified: myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversationPersistence.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversationPersistence.java?rev=631145&r1=631144&r2=631145&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversationPersistence.java (original)
+++ myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversationPersistence.java Tue Feb 26 01:51:41 2008
@@ -49,9 +49,9 @@
public void testPersistence()
{
- final String CONVERSATION_NAME = "persistentConversation";
+ final String BEAN_NAME = "persistentBackingBean";
- PersistentBackingBean conv = (PersistentBackingBean) applicationContext.getBean(CONVERSATION_NAME);
+ PersistentBackingBean conv = (PersistentBackingBean) applicationContext.getBean(BEAN_NAME);
/* create and reread a user */
UserData user = conv.createUser();
@@ -59,8 +59,7 @@
assertSame("has to be the same user",user , user2);
- /* invalidate conversation */
- conv.invalidate();
+ conv.invalidateConversation();
/* restart conversatin */
UserData user3 = conv.readUser(user.getId());
@@ -70,16 +69,16 @@
public void testRestartConversation()
{
- final String CONVERSATION_NAME = "persistentConversation";
+ final String BEAN_NAME = "persistentBackingBean";
- PersistentBackingBean conv = (PersistentBackingBean) applicationContext.getBean(CONVERSATION_NAME);
+ PersistentBackingBean bean = (PersistentBackingBean) applicationContext.getBean(BEAN_NAME);
- UserData user = conv.createUser();
+ UserData user = bean.createUser();
- conv.invalidateAndRestart();
+ bean.invalidateAndRestartConversation();
/* here we access the new conversation */
- UserData restartedUser = conv.getRestartedUser();
+ UserData restartedUser = bean.getRestartedUser();
assertNotNull("should have got a user", restartedUser);
assertNotSame("should not be the same user", user, restartedUser);
@@ -88,12 +87,12 @@
/* end all conversations*/
ConversationManager.getInstance().clearCurrentConversationContext();
- conv.updateUser(user.getId(), "test2");
+ bean.updateUser(user.getId(), "test2");
/* invalidate conversation */
- conv.invalidate();
+ bean.invalidateConversation();
- UserData user4 = conv.readUser(user.getId());
+ UserData user4 = bean.readUser(user.getId());
assertNotNull(user4);
assertEquals(user.getId(), user4.getId());
Modified: myfaces/orchestra/trunk/core15/src/test/resources/testApplicationContext.xml
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core15/src/test/resources/testApplicationContext.xml?rev=631145&r1=631144&r2=631145&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core15/src/test/resources/testApplicationContext.xml (original)
+++ myfaces/orchestra/trunk/core15/src/test/resources/testApplicationContext.xml Tue Feb 26 01:51:41 2008
@@ -22,6 +22,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
+ xmlns:orchestra="http://myfaces.apache.org/orchestra"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
@@ -82,13 +83,12 @@
<!-- our beans -->
<bean
- name="persistentConversation"
- class="org.apache.myfaces.orchestra.conversation.PersistentConversation"
+ name="persistentBackingBean"
+ class="org.apache.myfaces.orchestra.conversation.PersistentBackingBean"
scope="conversation"
- autowire="byName">
-
+ autowire="byName"
+ orchestra:conversationName="persistentConversation">
<aop:scoped-proxy/>
-
</bean>
</beans>