Package org.apache.myfaces.orchestra.conversation.model

Examples of org.apache.myfaces.orchestra.conversation.model.UserData


        final String BEAN_NAME = "persistentBackingBean";

        PersistentBackingBean conv = (PersistentBackingBean) applicationContext.getBean(BEAN_NAME);

        /* create and reread a user */
        UserData user = conv.createUser();
        UserData user2 = conv.readUser(user.getId());

        assertSame("has to be the same user",user , user2);

        conv.invalidateConversation();

        /* restart conversatin */
        UserData user3 = conv.readUser(user.getId());

        assertNotSame("should not be the same user", user ,user3);
    }
View Full Code Here


    {
        final String BEAN_NAME = "persistentBackingBean";

        PersistentBackingBean bean = (PersistentBackingBean) applicationContext.getBean(BEAN_NAME);

        UserData user = bean.createUser();

        bean.invalidateAndRestartConversation();

        /* here we access the new conversation */
        UserData restartedUser = bean.getRestartedUser();

        assertNotNull("should have got a user", restartedUser);
        assertNotSame("should not be the same user", user, restartedUser);
        assertEquals("has to be the same user id", user.getId(), restartedUser.getId());

        /* end all conversations*/
        ConversationManager.getInstance().clearCurrentConversationContext();

        bean.updateUser(user.getId(), "test2");

        /* invalidate conversation */
        bean.invalidateConversation();

        UserData user4 = bean.readUser(user.getId());

        assertNotNull(user4);
        assertEquals(user.getId(), user4.getId());
        assertEquals("test", user4.getUsername());
    }
View Full Code Here

     */
    @Transactional
    public UserData createUser()
    {
        // Create an object that is not yet attached to a persistence context.
        UserData userData = new UserData();
        userData.setUsername("test");

        // Attach the object to the persistence context. Note that nothing
        // is written to the database at this point; that only happens when
        // the persistence context is flushed and committed. Due to the
        // Transactional annotation on this method, that happens when this
View Full Code Here

        restartedUser = readUser(id);
    }

    public void updateUser(Long id, String username)
    {
        UserData user = readUser(id);
        user.setUsername(username);
    }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.orchestra.conversation.model.UserData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.