Skip to content

Commit

Permalink
Don't URL encode username and password fields for Oracle database.
Browse files Browse the repository at this point in the history
  • Loading branch information
scottfrederick committed Sep 10, 2018
1 parent 06cb0c5 commit b66b97a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,6 @@ public void oracleServiceCreation() {
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"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public OracleServiceInfo(String id, String url, String jdbcUrl) {
@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());
}
}

0 comments on commit b66b97a

Please sign in to comment.