@Test public void shouldBuildDatasourceDependency() { final DatasourceDependency dependency = datasourceDependency(datasource("foo:42/bar")) .withType("test") .withSubtype("unittest") .withName("name") .withDescription("description") .build(); assertThat(dependency.getName()).isEqualTo("name"); assertThat(dependency.getDescription()).isEqualTo("description"); assertThat(dependency.getType()).isEqualTo("test"); assertThat(dependency.getSubtype()).isEqualTo("unittest"); assertThat(dependency.getDatasources()).contains(datasource("foo", 42, "bar")); }
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(); } }
/** * Returns a builder instance that is initialized using a prototype DatasourceDependency. * <p> * All values of the prototype are copied. * </p> * @param prototype the prototype dependency * @return DatasourceDependencyBuilder */ public static DatasourceDependencyBuilder copyOf(final DatasourceDependency prototype) { return new DatasourceDependencyBuilder() .withName(prototype.getName()) .withDescription(prototype.getDescription()) .withType(prototype.getType()) .withSubtype(prototype.getSubtype()) .withDatasources(prototype.getDatasources()) .withCriticality(prototype.getCriticality()) .withExpectations(prototype.getExpectations()); }
@Test public void shouldReturnDependencies() throws Exception { when(externalDependencies.getDependencies()).thenReturn(asList( mongoDependency(singletonList(datasource("foo:42/bar"))).withName("test").build(), restServiceDependency("foobar:4711").build() ));