Examples of extractMemcachedId()


Examples of de.javakaffee.web.msm.SessionIdFormat.extractMemcachedId()

        final SessionIdFormat format = new SessionIdFormat();

        final String key = "foo";
        final String value = "bar";
        final String sessionId1 = post( _httpClient, TC_PORT_1, null, key, value ).getSessionId();
        assertEquals( format.extractMemcachedId( sessionId1 ), "n2" );
        assertEquals(_daemon.getCache().getCurrentItems(), 0);
        assertEquals(daemon2.getCache().getCurrentItems(), 1);

        // failover simulation, just request the session from tomcat2
        final Response response = get( _httpClient, TC_PORT_2, sessionId1 );
View Full Code Here

Examples of de.javakaffee.web.msm.SessionIdFormat.extractMemcachedId()

        assertEquals(daemon2.getCache().getCurrentItems(), 1);

        // failover simulation, just request the session from tomcat2
        final Response response = get( _httpClient, TC_PORT_2, sessionId1 );
        final String sessionId2 = response.getSessionId();
        assertEquals( format.extractMemcachedId( sessionId2 ), "n1" );
        assertEquals(_daemon.getCache().getCurrentItems(), 1);

        assertEquals( format.stripJvmRoute( sessionId1 ).replaceAll("n2", "n1"), format.stripJvmRoute( sessionId2 ) );

        /* check session attributes could be read
View Full Code Here

Examples of de.javakaffee.web.msm.SessionIdFormat.extractMemcachedId()

        assertEquals(response.getSessionId(), sessionId);
        assertEquals(response.get("k1"), "v1");

        // now we shut down the primary node so that the session is loaded from the backup node
        final SessionIdFormat fmt = new SessionIdFormat();
        final String nodeId = fmt.extractMemcachedId( sessionId );
        final MemCacheDaemon<?> primary = NODE_ID_1.equals(nodeId) ? _daemon1 : _daemon2;
        primary.stop();

        Thread.sleep( 200 );
View Full Code Here

Examples of de.javakaffee.web.msm.SessionIdFormat.extractMemcachedId()

        assertEquals(response.getSessionId(), sessionId);
        assertEquals(response.get("k1"), "v1");

        // now we shut down the primary node so that the session is loaded from the backup node
        final SessionIdFormat fmt = new SessionIdFormat();
        final String nodeId = fmt.extractMemcachedId( sessionId );
        final MemCacheDaemon<?> primary = NODE_ID_1.equals(nodeId) ? _daemon1 : _daemon2;
        primary.stop();

        Thread.sleep( 200 );
View Full Code Here

Examples of de.javakaffee.web.msm.SessionIdFormat.extractMemcachedId()

        // the memcached client writes async, so it's ok to wait a little bit (especially on windows)
        waitForMemcachedClient( 100 );

        final SessionIdFormat fmt = new SessionIdFormat();

        final String nodeId = fmt.extractMemcachedId( sessionId1 );

        final MemCacheDaemon<?> primary = nodeId.equals( NODE_ID_1 ) ? _daemon1 : _daemon2;
        final MemCacheDaemon<?> secondary = nodeId.equals( NODE_ID_1 ) ? _daemon2 : _daemon1;

        assertNotNull( primary.getCache().get( key( sessionId1 ) )[0], sessionId1 );
View Full Code Here

Examples of de.javakaffee.web.msm.SessionIdFormat.extractMemcachedId()

        final String sessionId1 = post( _httpClient, TC_PORT_1, null, "key", "v1" ).getSessionId();
        assertNotNull( sessionId1 );

        final SessionIdFormat fmt = new SessionIdFormat();
        final String nodeId = fmt.extractMemcachedId( sessionId1 );
        final MemCacheDaemon<?> first = memcachedsByNodeId.get(nodeId);

        // the memcached client writes async, so it's ok to wait a little bit (especially on windows)
        assertNotNullElementWaitingWithProxy(0, 100, first.getCache()).get( key( sessionId1 ) );
        assertNotNullElementWaitingWithProxy(0, 100, first.getCache()).get( key( fmt.createValidityInfoKeyName( sessionId1 ) ) );
View Full Code Here

Examples of de.javakaffee.web.msm.SessionIdFormat.extractMemcachedId()

        final Response response3 = get(_httpClient, TC_PORT_1, sessionId1);
        final String sessionId3 = response3.getResponseSessionId();
        assertNotNull(sessionId3);
        assertFalse(sessionId3.equals(sessionId1));
        assertEquals(sessionId3, fmt.createNewSessionId(sessionId1, fmt.extractMemcachedId(sessionId3)));

        assertEquals(response3.get("key"), "v2");

    }
View Full Code Here

Examples of de.javakaffee.web.msm.SessionIdFormat.extractMemcachedId()

        final String sessionId1 = post( _httpClient, TC_PORT_1, null, "key", "v1" ).getSessionId();
        assertNotNull( sessionId1 );

        // the memcached client writes async, so it's ok to wait a little bit (especially on windows)
        final SessionIdFormat fmt = new SessionIdFormat();
        final String nodeId = fmt.extractMemcachedId( sessionId1 );
        final MemCacheDaemon<?> first = memcachedsByNodeId.get(nodeId);

        assertNotNullElementWaitingWithProxy(0, 100, first.getCache()).get( key( sessionId1 ) );
        assertNotNullElementWaitingWithProxy(0, 100, first.getCache()).get( key( fmt.createValidityInfoKeyName( sessionId1 ) ) );
View Full Code Here

Examples of de.javakaffee.web.msm.SessionIdFormat.extractMemcachedId()

        final Response response3 = get(_httpClient, TC_PORT_1, sessionId1);
        final String sessionId3 = response3.getResponseSessionId();
        assertNotNull(sessionId3);
        assertFalse(sessionId3.equals(sessionId1));
        assertEquals(sessionId3, fmt.createNewSessionId(sessionId1, fmt.extractMemcachedId(sessionId3)));

        assertEquals(response3.get("key"), "v1");

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.