JsonWireUtils { public static String getFullSessionId(String uri) { String tail = uri.substring(WD_HUB_SESSION.length()); int end = tail.indexOf('/'); if (end < 0) { return tail; } return tail.substring(0, end); } private  JsonWireUtils(); static boolean isUriValid(String uri); static boolean isSessionDeleteRequest(HttpServletRequest request, String command); static String getSessionHash(String uri); static String getFullSessionId(String uri); static int getUriPrefixLength(); static String redirectionUrl(String host, String command); static String getCommand(String uri); static final String WD_HUB_SESSION; static final int SESSION_HASH_LENGTH; }
@Test public void testGetFullSessionId() { String routeHash = md5Hex("hubAddress".getBytes(StandardCharsets.UTF_8)); String sessionId = randomUUID().toString(); String expected = routeHash + sessionId; assertThat(getFullSessionId(sessionRequest(routeHash, sessionId, "")), is(equalTo(expected))); assertThat(getFullSessionId(sessionRequest(routeHash, sessionId, "sfgsds")), is(equalTo(expected))); assertThat(getFullSessionId(sessionRequest(routeHash, sessionId, "sfg/sds/")), is(equalTo(expected))); assertThat(getFullSessionId(sessionRequest(routeHash, sessionId, "sfg/sds/adfad")), is(equalTo(expected))); }