@Test public void setClientIdentifierForUrl() throws Exception { implement = new ClientSessionStoreImpl(); URL url = new URL("http: String clientID = "dolphin"; implement.setClientIdentifierForUrl(url.toURI(), clientID); final String setUrl = implement.getClientIdentifierForUrl(url.toURI()); Assert.assertEquals(setUrl, clientID); }
public void setClientIdentifierForUrl(final URI url, final String clientId) { Assert.requireNonNull(url, "url"); final String applicationDomain = domainToAppConverter.apply(url); if(applicationDomain == null) { throw new IllegalStateException("Can not define application domain for url " + url); } LOG.debug("updating client id for application domain: {}", applicationDomain); mapLock.lock(); try { if (domainToId.containsKey(applicationDomain)) { final String storedId = domainToId.get(applicationDomain); if (clientId != null && !storedId.equals(clientId)) { throw new IllegalStateException("PlatformClient Id for application domain " + applicationDomain + " already specified."); } } else { LOG.debug("Defining client id '{}' for application domain {}", clientId, applicationDomain); if(clientId == null) { LOG.debug("Since client id for application domain {} is defined as 'null' it will be removed", applicationDomain); domainToId.remove(applicationDomain); } else { domainToId.put(applicationDomain, clientId); } } } finally { mapLock.unlock(); } }
ClientSessionStoreImpl implements ClientSessionStore { public void setClientIdentifierForUrl(final URI url, final String clientId) { Assert.requireNonNull(url, "url"); final String applicationDomain = domainToAppConverter.apply(url); if(applicationDomain == null) { throw new IllegalStateException("Can not define application domain for url " + url); } LOG.debug("updating client id for application domain: {}", applicationDomain); mapLock.lock(); try { if (domainToId.containsKey(applicationDomain)) { final String storedId = domainToId.get(applicationDomain); if (clientId != null && !storedId.equals(clientId)) { throw new IllegalStateException("PlatformClient Id for application domain " + applicationDomain + " already specified."); } } else { LOG.debug("Defining client id '{}' for application domain {}", clientId, applicationDomain); if(clientId == null) { LOG.debug("Since client id for application domain {} is defined as 'null' it will be removed", applicationDomain); domainToId.remove(applicationDomain); } else { domainToId.put(applicationDomain, clientId); } } } finally { mapLock.unlock(); } } }
ClientSessionStoreImpl implements ClientSessionStore { public void setClientIdentifierForUrl(final URI url, final String clientId) { Assert.requireNonNull(url, "url"); final String applicationDomain = domainToAppConverter.apply(url); if(applicationDomain == null) { throw new IllegalStateException("Can not define application domain for url " + url); } LOG.debug("updating client id for application domain: {}", applicationDomain); mapLock.lock(); try { if (domainToId.containsKey(applicationDomain)) { final String storedId = domainToId.get(applicationDomain); if (clientId != null && !storedId.equals(clientId)) { throw new IllegalStateException("PlatformClient Id for application domain " + applicationDomain + " already specified."); } } else { LOG.debug("Defining client id '{}' for application domain {}", clientId, applicationDomain); if(clientId == null) { LOG.debug("Since client id for application domain {} is defined as 'null' it will be removed", applicationDomain); domainToId.remove(applicationDomain); } else { domainToId.put(applicationDomain, clientId); } } } finally { mapLock.unlock(); } }  }
ClientSessionStoreImpl implements ClientSessionStore { public void setClientIdentifierForUrl(final URI url, final String clientId) { Assert.requireNonNull(url, "url"); final String applicationDomain = domainToAppConverter.apply(url); if(applicationDomain == null) { throw new IllegalStateException("Can not define application domain for url " + url); } LOG.debug("updating client id for application domain: {}", applicationDomain); mapLock.lock(); try { if (domainToId.containsKey(applicationDomain)) { final String storedId = domainToId.get(applicationDomain); if (clientId != null && !storedId.equals(clientId)) { throw new IllegalStateException("PlatformClient Id for application domain " + applicationDomain + " already specified."); } } else { LOG.debug("Defining client id '{}' for application domain {}", clientId, applicationDomain); if(clientId == null) { LOG.debug("Since client id for application domain {} is defined as 'null' it will be removed", applicationDomain); domainToId.remove(applicationDomain); } else { domainToId.put(applicationDomain, clientId); } } } finally { mapLock.unlock(); } }  @Override String getClientIdentifierForUrl(final URI url); void setClientIdentifierForUrl(final URI url, final String clientId); @Override void resetSession(final URI url); Function<URI, String> getDomainToAppConverter(); void setDomainToAppConverter(final Function<URI, String> domainToAppConverter); }
ClientSessionStoreImpl implements ClientSessionStore { public void setClientIdentifierForUrl(final URI url, final String clientId) { Assert.requireNonNull(url, "url"); final String applicationDomain = domainToAppConverter.apply(url); if(applicationDomain == null) { throw new IllegalStateException("Can not define application domain for url " + url); } LOG.debug("updating client id for application domain: {}", applicationDomain); mapLock.lock(); try { if (domainToId.containsKey(applicationDomain)) { final String storedId = domainToId.get(applicationDomain); if (clientId != null && !storedId.equals(clientId)) { throw new IllegalStateException("PlatformClient Id for application domain " + applicationDomain + " already specified."); } } else { LOG.debug("Defining client id '{}' for application domain {}", clientId, applicationDomain); if(clientId == null) { LOG.debug("Since client id for application domain {} is defined as 'null' it will be removed", applicationDomain); domainToId.remove(applicationDomain); } else { domainToId.put(applicationDomain, clientId); } } } finally { mapLock.unlock(); } }  @Override String getClientIdentifierForUrl(final URI url); void setClientIdentifierForUrl(final URI url, final String clientId); @Override void resetSession(final URI url); Function<URI, String> getDomainToAppConverter(); void setDomainToAppConverter(final Function<URI, String> domainToAppConverter);  }