Don't URL encode username and password fields for Oracle database.

This commit is contained in:
Scott Frederick
2018-09-10 12:36:35 -05:00
parent 06cb0c5063
commit b66b97aa7b
2 changed files with 1 additions and 16 deletions

View File

@@ -33,21 +33,6 @@ public class CloudFoundryConnectorOracleServiceTest extends AbstractUserProvided
assertUriBasedServiceInfoFields(info, ORACLE_SCHEME, hostname, port, username, password, INSTANCE_NAME);
}
@Test
public void oracleServiceCreationWithSpecialChars() {
String userWithSpecialChars = "u%u:u+";
String passwordWithSpecialChars = "p%p:p+";
when(mockEnvironment.getEnvValue("VCAP_SERVICES"))
.thenReturn(getServicesPayload(
getUserProvidedServicePayload(SERVICE_NAME, hostname, port, userWithSpecialChars, passwordWithSpecialChars, INSTANCE_NAME, ORACLE_SCHEME + ":")));
List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
ServiceInfo info = getServiceInfo(serviceInfos, SERVICE_NAME);
assertServiceFoundOfType(info, OracleServiceInfo.class);
assertEquals(getJdbcUrl(hostname, port, INSTANCE_NAME, userWithSpecialChars, passwordWithSpecialChars), ((RelationalServiceInfo)info).getJdbcUrl());
assertUriBasedServiceInfoFields(info, ORACLE_SCHEME, hostname, port, userWithSpecialChars, passwordWithSpecialChars, INSTANCE_NAME);
}
@Test
public void oracleServiceCreationWithNoUri() {
when(mockEnvironment.getEnvValue("VCAP_SERVICES"))

View File

@@ -18,7 +18,7 @@ public class OracleServiceInfo extends RelationalServiceInfo {
@Override
protected String buildJdbcUrl() {
return String.format("jdbc:%s:thin:%s/%s@%s:%d/%s",
jdbcUrlDatabaseType, UriInfo.urlEncode(getUserName()), UriInfo.urlEncode(getPassword()),
jdbcUrlDatabaseType, getUserName(), getPassword(),
getHost(), getPort(), getPath());
}
}