/** * Creates a ServiceDependencyBuilder with type="db" and subtype="MongoDB". * * @param datasources the datasources of the accessed database. * @return builder used to configure MongoDB datasource dependencies */ public static DatasourceDependencyBuilder mongoDependency(final Datasource... datasources) { return mongoDependency(asList(datasources)); }
@Test public void shouldBuildMongoDatasource() { DatasourceDependency dependency = mongoDependency(singletonList(datasource("foo"))).build(); assertThat(dependency.getDatasources()).contains(datasource("foo", -1, "")); assertThat(dependency.getType()).isEqualTo("db"); assertThat(dependency.getSubtype()).isEqualTo("MongoDB"); }
@Test public void shouldCopyDatasource() { DatasourceDependency dependency = mongoDependency(singletonList(datasource("foo"))).build(); assertThat(dependency).isEqualTo(copyOf(dependency).build()); assertThat(dependency.hashCode()).isEqualTo(copyOf(dependency).build().hashCode()); }
private DatasourceDependency someMongoDb() { return mongoDependency(asList( datasource("10.42.42.41:27001/shoppingcarts"), datasource("10.42.42.42:27001/shoppingcarts"))) .withName("shoppingcart-db") .withDescription("Shoppingcart Database") .build(); } }
@Test public void shouldReturnCriticalityAndExpectations() throws Exception { when(externalDependencies.getDependencies()).thenReturn(asList( mongoDependency(singletonList(datasource("foo:42/bar"))).build(), restServiceDependency("foobar:4711") .withCriticality(criticality(HIGH, "Bad. Really bad."))
@Test public void shouldReturnDependencies() throws Exception { when(externalDependencies.getDependencies()).thenReturn(asList( mongoDependency(singletonList(datasource("foo:42/bar"))).withName("test").build(), restServiceDependency("foobar:4711").build() ));