/** * 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 List<Datasource> datasources) { return new DatasourceDependencyBuilder() .withDatasources(datasources) .withType(DatasourceDependency.TYPE_DB) .withSubtype(DatasourceDependency.SUBTYPE_MONGODB); }
/** * Creates a ServiceDependencyBuilder with type="queue" and subtype="Kafka". * * @param datasources the datasources of the accessed queue. * @return builder used to configure Kafka datasource dependencies */ public static DatasourceDependencyBuilder kafkaDependency(final List<Datasource> datasources) { return new DatasourceDependencyBuilder() .withDatasources(datasources) .withType(DatasourceDependency.TYPE_QUEUE) .withSubtype(DatasourceDependency.SUBTYPE_KAFKA); }
/** * Creates a ServiceDependencyBuilder with type="db" and subtype="Redis". * * @param datasources the datasources of the accessed database. * @return builder used to configure Redis datasource dependencies */ public static DatasourceDependencyBuilder redisDependency(final List<Datasource> datasources) { return new DatasourceDependencyBuilder() .withDatasources(datasources) .withType(DatasourceDependency.TYPE_DB) .withSubtype(DatasourceDependency.SUBTYPE_REDIS); }
/** * Creates a ServiceDependencyBuilder with type="db" and subtype="Cassandra". * * @param datasources the datasources of the accessed database. * @return builder used to configure Cassandra datasource dependencies */ public static DatasourceDependencyBuilder cassandraDependency(final List<Datasource> datasources) { return new DatasourceDependencyBuilder() .withDatasources(datasources) .withType(DatasourceDependency.TYPE_DB) .withSubtype(DatasourceDependency.SUBTYPE_CASSANDRA); }
/** * Creates a ServiceDependencyBuilder with type="db" and subtype="ElasticSearch". * * @param datasources the datasources of the accessed ES services. * @return builder used to configure ES datasource dependencies */ public static DatasourceDependencyBuilder elasticSearchDependency(final List<Datasource> datasources) { return new DatasourceDependencyBuilder() .withDatasources(datasources) .withType(DatasourceDependency.TYPE_DB) .withSubtype(DatasourceDependency.SUBTYPE_ELASTICSEARCH); }
@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")); }
/** * 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()); }