pull up Postgres URI schema, split out JDBC URL types--this should
probably be done in the interface instead of ad-hocky
This commit is contained in:
@@ -3,14 +3,14 @@ package org.springframework.cloud.cloudfoundry;
|
||||
import org.springframework.cloud.service.common.PostgresqlServiceInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Ramnivas Laddad
|
||||
*
|
||||
*/
|
||||
public class PostgresqlServiceInfoCreator extends RelationalServiceInfoCreator<PostgresqlServiceInfo> {
|
||||
|
||||
public PostgresqlServiceInfoCreator() {
|
||||
super(new Tags("postgresql"), "postgres");
|
||||
super(new Tags("postgresql"), PostgresqlServiceInfo.URI_SCHEMA);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.springframework.cloud.cloudfoundry;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Ramnivas Laddad
|
||||
*
|
||||
*/
|
||||
@@ -20,12 +20,13 @@ public abstract class AbstractCloudFoundryConnectorRelationalServiceTest extends
|
||||
}
|
||||
|
||||
protected static String getJdbcUrl(String databaseType, String name) {
|
||||
// this should be cleaned up more broadly; pull into RelationalServiceInfo interface?
|
||||
String jdbcUrlDatabaseType = databaseType;
|
||||
if (databaseType.equals("postgres")) {
|
||||
jdbcUrlDatabaseType = "postgresql";
|
||||
}
|
||||
|
||||
return "jdbc:" + jdbcUrlDatabaseType + "://" + hostname + ":" + port + "/" + name +
|
||||
return "jdbc:" + jdbcUrlDatabaseType + "://" + hostname + ":" + port + "/" + name +
|
||||
"?user=" + username + "&password=" + password;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,11 @@ import org.springframework.cloud.service.ServiceInfo.ServiceLabel;
|
||||
@ServiceLabel("mysql")
|
||||
public class MysqlServiceInfo extends RelationalServiceInfo {
|
||||
|
||||
public static final String URI_SCHEME = "mysql";
|
||||
public static final String JDBC_URL_TYPE = "mysql";
|
||||
|
||||
public MysqlServiceInfo(String id, String url) {
|
||||
super(id, url, URI_SCHEME);
|
||||
}
|
||||
public static final String URI_SCHEME = JDBC_URL_TYPE;
|
||||
|
||||
public MysqlServiceInfo(String id, String url) {
|
||||
super(id, url, URI_SCHEME);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,12 @@ import org.springframework.cloud.service.ServiceInfo;
|
||||
@ServiceInfo.ServiceLabel("oracle")
|
||||
public class OracleServiceInfo extends RelationalServiceInfo {
|
||||
|
||||
public static final String URI_SCHEME = "oracle";
|
||||
public static final String JDBC_URL_TYPE = "oracle";
|
||||
|
||||
public static final String URI_SCHEME = JDBC_URL_TYPE;
|
||||
|
||||
public OracleServiceInfo(String id, String url) {
|
||||
super(id, url, URI_SCHEME);
|
||||
super(id, url, JDBC_URL_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,13 +4,18 @@ import org.springframework.cloud.service.ServiceInfo.ServiceLabel;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Ramnivas Laddad
|
||||
*
|
||||
*/
|
||||
@ServiceLabel("postgresql")
|
||||
public class PostgresqlServiceInfo extends RelationalServiceInfo {
|
||||
|
||||
public static final String JDBC_URL_TYPE = "postgresql";
|
||||
|
||||
public static final String URI_SCHEMA = "postgres";
|
||||
|
||||
public PostgresqlServiceInfo(String id, String url) {
|
||||
super(id, url, "postgresql");
|
||||
super(id, url, JDBC_URL_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ package org.springframework.cloud.heroku;
|
||||
import org.springframework.cloud.service.common.PostgresqlServiceInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Ramnivas Laddad
|
||||
*
|
||||
*/
|
||||
public class PostgresqlServiceInfoCreator extends RelationalServiceInfoCreator<PostgresqlServiceInfo> {
|
||||
|
||||
public PostgresqlServiceInfoCreator() {
|
||||
super("postgres");
|
||||
super(PostgresqlServiceInfo.URI_SCHEMA);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,15 +13,15 @@ import org.springframework.cloud.service.ServiceInfo;
|
||||
import org.springframework.cloud.service.common.PostgresqlServiceInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Ramnivas Laddad
|
||||
*
|
||||
*/
|
||||
public class HerokuConnectorPostgresqlServiceTest extends AbstractHerokuConnectorRelationalServiceTest {
|
||||
public HerokuConnectorPostgresqlServiceTest() {
|
||||
super("postgres");
|
||||
super(PostgresqlServiceInfo.URI_SCHEMA);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void postgresqlServiceCreation() {
|
||||
Map<String, String> env = new HashMap<String, String>();
|
||||
|
||||
Reference in New Issue
Block a user