-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DB2 and SqlServer ServiceInfoCreators for localconfig.
- Loading branch information
1 parent
f8f5eb9
commit 277a6f7
Showing
8 changed files
with
96 additions
and
6 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
...-connector/src/main/java/org/springframework/cloud/localconfig/DB2ServiceInfoCreator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...ctor/src/main/java/org/springframework/cloud/localconfig/SqlServerServiceInfoCreator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
4 changes: 3 additions & 1 deletion
4
...ces/META-INF/services/org.springframework.cloud.localconfig.LocalConfigServiceInfoCreator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...c/test/java/org/springframework/cloud/localconfig/LocalConfigConnectorDB2ServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
.../java/org/springframework/cloud/localconfig/LocalConfigConnectorSqlServerServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters