Skip to content

Commit

Permalink
Add DB2 and SqlServer ServiceInfoCreators for localconfig.
Browse files Browse the repository at this point in the history
  • Loading branch information
scottfrederick committed Apr 5, 2017
1 parent f8f5eb9 commit 277a6f7
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}

}
Original file line number Diff line number Diff line change
@@ -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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 277a6f7

Please sign in to comment.