/** * Test method for {@link org.apache.ace.connectionfactory.impl.ConnectionFactoryImpl#updated(java.lang.String, java.util.Dictionary)}. */ @Test() public void testUpdatedUpdatesCredentialsOk() throws Exception { ConnectionFactoryImpl connFactory = new ConnectionFactoryImpl(); Dictionary<String, Object> props = createBasicAuthConfig(TEST_URL.toExternalForm()); connFactory.updated("pid1", props); UrlCredentials credentials1 = connFactory.getCredentials(TEST_URL); assert credentials1 != null : "Expected valid credentials to be found!"; URL newURL = new URL("http://localhost:8181/test/"); props.put(UrlCredentialsFactory.KEY_AUTH_BASE_URL, newURL.toExternalForm()); connFactory.updated("pid1", props); UrlCredentials credentials2 = connFactory.getCredentials(TEST_URL); assert credentials2 == null : "Expected no credentials to be found!"; credentials2 = connFactory.getCredentials(newURL); assert credentials2 != null : "Expected valid credentials to be found!"; assert credentials1 != credentials2 && !credentials1.equals(credentials2) : "Expected not the same credentials to be returned!"; }