Add DB2 and SqlServer ServiceInfoCreators for localconfig.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package org.springframework.cloud.localconfig;
|
||||
|
||||
import org.springframework.cloud.service.common.DB2ServiceInfo;
|
||||
|
||||
/**
|
||||
* DB2 ServiceInfoCreator for the localconfig connector.
|
||||
*
|
||||
* @author Scott Frederick
|
||||
*/
|
||||
public class DB2ServiceInfoCreator extends LocalConfigServiceInfoCreator<DB2ServiceInfo> {
|
||||
|
||||
public DB2ServiceInfoCreator() {
|
||||
super(DB2ServiceInfo.DB2_SCHEME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DB2ServiceInfo createServiceInfo(String id, String uri) {
|
||||
return new DB2ServiceInfo(id, uri);
|
||||
}
|
||||
}
|
||||
@@ -3,13 +3,15 @@ package org.springframework.cloud.localconfig;
|
||||
import org.springframework.cloud.service.common.OracleServiceInfo;
|
||||
|
||||
/**
|
||||
* Oracle ServiceInfo creator for localconfig connector.
|
||||
* Oracle ServiceInfoCreator for the localconfig connector.
|
||||
*
|
||||
* @author Jason Woodrich
|
||||
*/
|
||||
public class OracleServiceInfoCreator extends LocalConfigServiceInfoCreator<OracleServiceInfo> {
|
||||
public OracleServiceInfoCreator() {
|
||||
super(OracleServiceInfo.ORACLE_SCHEME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OracleServiceInfo createServiceInfo(String id, String uri) {
|
||||
return new OracleServiceInfo(id,uri);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.springframework.cloud.localconfig;
|
||||
|
||||
import org.springframework.cloud.service.common.SqlServerServiceInfo;
|
||||
|
||||
/**
|
||||
* DB2 ServiceInfoCreator for the localconfig connector.
|
||||
*
|
||||
* @author Scott Frederick
|
||||
*/
|
||||
public class SqlServerServiceInfoCreator extends LocalConfigServiceInfoCreator<SqlServerServiceInfo> {
|
||||
|
||||
public SqlServerServiceInfoCreator() {
|
||||
super(SqlServerServiceInfo.SQLSERVER_SCHEME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqlServerServiceInfo createServiceInfo(String id, String uri) {
|
||||
return new SqlServerServiceInfo(id, uri);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
org.springframework.cloud.localconfig.AmqpServiceInfoCreator
|
||||
org.springframework.cloud.localconfig.DB2ServiceInfoCreator
|
||||
org.springframework.cloud.localconfig.MongoServiceInfoCreator
|
||||
org.springframework.cloud.localconfig.MysqlServiceInfoCreator
|
||||
org.springframework.cloud.localconfig.OracleServiceInfoCreator
|
||||
org.springframework.cloud.localconfig.PostgresqlServiceInfoCreator
|
||||
org.springframework.cloud.localconfig.RedisServiceInfoCreator
|
||||
org.springframework.cloud.localconfig.RedisServiceInfoCreator
|
||||
org.springframework.cloud.localconfig.SqlServerServiceInfoCreator
|
||||
@@ -11,9 +11,7 @@ import org.springframework.cloud.service.UriBasedServiceInfo;
|
||||
|
||||
public class AbstractLocalConfigConnectorTest {
|
||||
|
||||
public static final String PROPERTIES_FILE = "localconfig.testuris.properties";
|
||||
|
||||
protected StubbedOpenFileLocalConfigConnector connector = new StubbedOpenFileLocalConfigConnector();
|
||||
protected StubbedOpenFileLocalConfigConnector connector = new StubbedOpenFileLocalConfigConnector();
|
||||
|
||||
protected PassthroughEnvironmentAccessor env;
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.springframework.cloud.localconfig;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.cloud.service.ServiceInfo;
|
||||
import org.springframework.cloud.service.common.DB2ServiceInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class LocalConfigConnectorDB2ServiceTest extends AbstractLocalConfigConnectorWithUrisTest {
|
||||
|
||||
@Test
|
||||
public void serviceCreation() {
|
||||
List<ServiceInfo> services = connector.getServiceInfos();
|
||||
ServiceInfo service = getServiceInfo(services, "db2");
|
||||
assertNotNull(service);
|
||||
assertTrue(service instanceof DB2ServiceInfo);
|
||||
assertUriParameters((DB2ServiceInfo) service);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.springframework.cloud.localconfig;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.cloud.service.ServiceInfo;
|
||||
import org.springframework.cloud.service.common.SqlServerServiceInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class LocalConfigConnectorSqlServerServiceTest extends AbstractLocalConfigConnectorWithUrisTest {
|
||||
|
||||
@Test
|
||||
public void serviceCreation() {
|
||||
List<ServiceInfo> services = connector.getServiceInfos();
|
||||
ServiceInfo service = getServiceInfo(services, "sql");
|
||||
assertNotNull(service);
|
||||
assertTrue(service instanceof SqlServerServiceInfo);
|
||||
assertUriParameters((SqlServerServiceInfo) service);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,4 +4,6 @@ spring.cloud.maria: mysql://myuser:mypass@10.20.30.40:1234/dbname
|
||||
spring.cloud.candygram: mongodb://myuser:mypass@10.20.30.40:1234/dbname
|
||||
spring.cloud.ingres: postgres://myuser:mypass@10.20.30.40:1234/dbname
|
||||
spring.cloud.oracle: oracle://myuser:mypass@10.20.30.40:1234/dbname
|
||||
spring.cloud.blue: redis://myuser:mypass@10.20.30.40:1234/dbname
|
||||
spring.cloud.blue: redis://myuser:mypass@10.20.30.40:1234/dbname
|
||||
spring.cloud.db2: db2://myuser:mypass@10.20.30.40:1234/dbname
|
||||
spring.cloud.sql: sqlserver://myuser:mypass@10.20.30.40:1234/dbname
|
||||
|
||||
Reference in New Issue
Block a user