Merge branch '6-mongodb-binding'
Signed-off-by: Ben Hale <bhale@vmware.com>
This commit is contained in:
@@ -64,7 +64,14 @@ Disable Property: `org.springframework.cloud.bindings.boot.mongodb.enable`
|
||||
|
||||
| Property | Value
|
||||
| -------- | -----
|
||||
| `spring.mongodb.authentication-database` | `{secret.authentication-database}`
|
||||
| `spring.mongodb.database` | `{secret.database}`
|
||||
| `spring.mongodb.grid-fs-database` | `{secret.grid-fs-database}`
|
||||
| `spring.mongodb.host` | `{secret.host}`
|
||||
| `spring.mongodb.password` | `{secret.password}`
|
||||
| `spring.mongodb.port` | `{secret.port}`
|
||||
| `spring.mongodb.uri` | `{secret.uri}`
|
||||
| `spring.mongodb.username` | `{secret.username}`
|
||||
|
||||
### MySQL RDBMS
|
||||
Kind: `MySQL`
|
||||
|
||||
@@ -43,7 +43,14 @@ public final class MongoDbBindingsPropertiesProcessor implements BindingsPropert
|
||||
bindings.filterBindings(KIND).forEach(binding -> {
|
||||
MapMapper map = new MapMapper(binding.getSecret(), properties);
|
||||
|
||||
map.from("authentication-database").to("spring.mongodb.authentication-database");
|
||||
map.from("database").to("spring.mongodb.database");
|
||||
map.from("grid-fs-database").to("spring.mongodb.grid-fs-database");
|
||||
map.from("host").to("spring.mongodb.host");
|
||||
map.from("password").to("spring.mongodb.password");
|
||||
map.from("port").to("spring.mongodb.port");
|
||||
map.from("uri").to("spring.mongodb.uri");
|
||||
map.from("username").to("spring.mongodb.username");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,14 @@ final class MongoDbBindingsPropertiesProcessorTest {
|
||||
new Binding("test-name", Paths.get("test-path"),
|
||||
Collections.singletonMap("kind", KIND),
|
||||
new FluentMap()
|
||||
.withEntry("authentication-database", "test-authentication-database")
|
||||
.withEntry("database", "test-database")
|
||||
.withEntry("grid-fs-database", "test-grid-fs-database")
|
||||
.withEntry("host", "test-host")
|
||||
.withEntry("password", "test-password")
|
||||
.withEntry("port", "test-port")
|
||||
.withEntry("uri", "test-uri")
|
||||
.withEntry("username", "test-username")
|
||||
)
|
||||
);
|
||||
|
||||
@@ -50,7 +57,14 @@ final class MongoDbBindingsPropertiesProcessorTest {
|
||||
void test() {
|
||||
new MongoDbBindingsPropertiesProcessor().process(environment, bindings, properties);
|
||||
assertThat(properties)
|
||||
.containsEntry("spring.mongodb.uri", "test-uri");
|
||||
.containsEntry("spring.mongodb.authentication-database", "test-authentication-database")
|
||||
.containsEntry("spring.mongodb.database", "test-database")
|
||||
.containsEntry("spring.mongodb.grid-fs-database", "test-grid-fs-database")
|
||||
.containsEntry("spring.mongodb.host", "test-host")
|
||||
.containsEntry("spring.mongodb.password", "test-password")
|
||||
.containsEntry("spring.mongodb.port", "test-port")
|
||||
.containsEntry("spring.mongodb.uri", "test-uri")
|
||||
.containsEntry("spring.mongodb.username", "test-username");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user