tests/arq/src/test/java/org/jboss/test/arquillian/ce/common/EapClusteringTestBase.java
/**
     * This test starts two pods; insert a value into the first pod's session.
     * Then it retrieves this value from the second pod.
     * <p>
     * After that it starts a third pod and try to get the value from it, to see
     * if session replication is working at pod's startup as well.
     *
     * @throws Exception
     */
This test starts two pods; insert a value into the first pod's session.
Then it retrieves this value from the second pod.

After that it starts a third pod and try to get the value from it, to see
if session replication is working at pod's startup as well.

@throws Exception
This test starts two pods ; insert a value into the first pod ' s session . Then it retrieves this value from the second pod . After that it starts a third pod and try to get the value from it to see if session replication is working at pod ' s startup as well . @throws Exception
@Test
    @RunAsClient
    @InSequence(1)
    public void testSession() throws Exception {
        scale(2);
        final String valueToCheck = UUID.randomUUID().toString();
        String servletUrl = buildURL(pods.get(0));
        servletUrl = sanitizeUrl(servletUrl);
        System.out.println("ServletURL: " + servletUrl);
        Map<String, String> params = new HashMap<>();
        params.put("key", valueToCheck);
        Response response = given().header("Authorization", "Bearer " + token).params(params).post(servletUrl);
        System.out.println("Response: " + response.asString());
        assertEquals(servletUrl + "(Authorization: Bearer " + token +")", "OK", response.getBody().asString());
        String cookie = response.getHeader("Set-Cookie");
        System.out.println("Cookie: " + cookie);
        assertEquals(servletUrl, valueToCheck, retrieveKey(1, cookie));
        scale(3);
        assertEquals(servletUrl, valueToCheck, retrieveKey(2, cookie));
    }
@ Test @ RunAsClient @ InSequence ( 1 ) public void testSession ( ) throws Exception { scale ( 2 ) ; final String valueToCheck = UUID . randomUUID ( ) . toString ( ) ; String servletUrl = buildURL ( pods . get ( 0 ) ) ; servletUrl = sanitizeUrl ( servletUrl ) ; System . out . println ( "ServletURL: " + servletUrl ) ; Map < String , String > params = new HashMap < > ( ) ; params . put ( "key" , valueToCheck ) ; Response response = given ( ) . header ( "Authorization" , "Bearer " + token ) . params ( params ) . post ( servletUrl ) ; System . out . println ( "Response: " + response . asString ( ) ) ; assertEquals ( servletUrl + "(Authorization: Bearer " + token + ")" , "OK" , response . getBody ( ) . asString ( ) ) ; String cookie = response . getHeader ( "Set-Cookie" ) ; System . out . println ( "Cookie: " + cookie ) ; assertEquals ( servletUrl , valueToCheck , retrieveKey ( 1 , cookie ) ) ; scale ( 3 ) ; assertEquals ( servletUrl , valueToCheck , retrieveKey ( 2 , cookie ) ) ; }
This test starts two pods; insert a value into the first pod's session.
This test starts two pods ; insert a value into the first pod ' s session .
// Start with 2 pods // Insert a session value into the first pod // Note, pods.get() / buildURL can return urls that look like http://foo/bar//baz and the double // slash causes requests to fail, as it becomes encoded as %2F, so filter those. // Retrieve the value from the second pod // Now start a third shiny new pod and retrieve the value from it