Package de.javakaffee.web.msm.integration.TestUtils

Examples of de.javakaffee.web.msm.integration.TestUtils.Response


                sid2,
                sid1.substring( 0, sid1.indexOf( "-" ) + 1 ) + expectedNode,
                "Unexpected sessionId, sid1: " + sid1 + ", sid2: " + sid2 );

        // we must get the same session back
        final Response response2 = get( _httpClient, _portTomcat1, sid2 );
        assertEquals( response2.getSessionId(), sid2, "We should keep the sessionId." );
        assertNotNull( getFailoverInfo( secondNode ).activeNode.getCache().get( key( sid2 ) )[0], "The session should exist in memcached." );
        assertEquals( response2.get( paramKey ), paramValue, "The session should still contain the previously stored value." );

    }
View Full Code Here


         */
        _daemon1.stop();
        _daemon2.stop();
        _daemon3.stop();

        final Response response1 = get( _httpClient, _portTomcat1, null );
        final String sessionId = response1.getSessionId();
        assertNotNull( sessionId );
        assertNotNull( response1.getResponseSessionId() );

        final String nodeId = extractNodeId( response1.getResponseSessionId() );
        assertNull( nodeId, "NodeId should be null, but is " + nodeId + "." );

        final Response response2 = get( _httpClient, _portTomcat1, sessionId );
        assertEquals( response2.getSessionId(), sessionId, "SessionId changed" );
        assertNull( response2.getResponseSessionId() );

    }
View Full Code Here

         */
        _daemon2.stop();

        TestUtils.waitForReconnect(_tomcat1.getService().getMemcached(), 1, 1000l);

        final Response response1 = get( _httpClient, _portTomcat1, null );
        final String sessionId = response1.getSessionId();
        assertNotNull( sessionId );
        assertNotNull( response1.getResponseSessionId() );

        final String nodeId = extractNodeId( response1.getResponseSessionId() );
        assertEquals( nodeId, _nodeId1 );

        final Response response2 = get( _httpClient, _portTomcat1, sessionId );
        assertEquals( response2.getSessionId(), sessionId, "SessionId changed" );
        assertNull( response2.getResponseSessionId() );

    }
View Full Code Here

        /* wait until everything's up and running...
         */
        Thread.sleep( 200 );

        final Response response1 = get( _httpClient, _portTomcat1, null );
        final String sessionId1 = response1.getSessionId();
        assertNotNull( sessionId1 );
        assertEquals( extractNodeId( sessionId1 ), _nodeId1 );

        /* reconfigure tomcat with only third memcached nodes and stop
         * the first one
         */
        final String memcachedNodes2 = toString( _nodeId1, _address1 ) +
            " " + toString( _nodeId2, _address2 ) +
            " " + toString( _nodeId3, _address3 );
        _tomcat1.getManager().setMemcachedNodes( memcachedNodes2 );

        _daemon1.stop();

        Thread.sleep( 1000 );

        /* Expect relocation to node3
         */
        final Response response2 = get( _httpClient, _portTomcat1, sessionId1 );
        assertNotSame( response2.getSessionId(), sessionId1 );
        final String sessionId2 = response2.getResponseSessionId();
        assertNotNull( sessionId2 );
        assertEquals( extractNodeId( sessionId2 ), _nodeId3 );

    }
View Full Code Here

        /* wait for changes...
         */
        Thread.sleep( 200 );

        final Response response1 = get( _httpClient, _portTomcat1, null );
        final String sessionId1 = response1.getSessionId();
        assertNotNull( sessionId1 );
        assertEquals( extractNodeId( sessionId1 ), _nodeId1 );

        /* set failover nodes n1 and n2
         */
        _tomcat1.getManager().setFailoverNodes( _nodeId1 + " " + _nodeId2 );

        /* wait for changes...
         */
        Thread.sleep( 200 );

        // we need to use another http client, otherwise there's no response cookie.
        final Response response2 = get( new DefaultHttpClient(), _portTomcat1, null );
        final String sessionId2 = response2.getSessionId();
        assertNotNull( sessionId2 );
        assertEquals( extractNodeId( sessionId2 ), _nodeId3 );

    }
View Full Code Here

TOP

Related Classes of de.javakaffee.web.msm.integration.TestUtils.Response

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.