@Deprecated @Test public void shouldHandleConnectionContributionWithoutFailure() { MongoDBRepositoryDescriptor descriptor = new MongoDBRepositoryDescriptor(); descriptor.server = "anyServer"; BiConsumer<DefaultComponent, MongoDBConnectionConfig> consumer = (dc, mc) -> { assertNotNull(dc); assertNotNull(mc); assertTrue(dc instanceof MongoDBConnectionService); }; mongoDBRepositoryService.handleConnectionContribution(descriptor, consumer); }
@Deprecated protected void handleConnectionContribution(MongoDBRepositoryDescriptor descriptor, BiConsumer<DefaultComponent, MongoDBConnectionConfig> consumer) { if (StringUtils.isNotBlank(descriptor.server)) { String id = "repository/" + descriptor.name; String server = descriptor.server; String dbName = StringUtils.defaultIfBlank(descriptor.dbname, DB_DEFAULT); MongoDBConnectionConfig connection = new MongoDBConnectionConfig(); connection.server = server; connection.dbname = dbName; connection.id = id; MongoDBComponent component = (MongoDBComponent) Framework.getService(MongoDBConnectionService.class); consumer.accept(component, connection); } }
MongoDBRepositoryService extends DefaultComponent { @Deprecated protected void handleConnectionContribution(MongoDBRepositoryDescriptor descriptor, BiConsumer<DefaultComponent, MongoDBConnectionConfig> consumer) { if (StringUtils.isNotBlank(descriptor.server)) { String id = "repository/" + descriptor.name; String server = descriptor.server; String dbName = StringUtils.defaultIfBlank(descriptor.dbname, DB_DEFAULT); MongoDBConnectionConfig connection = new MongoDBConnectionConfig(); connection.server = server; connection.dbname = dbName; connection.id = id; MongoDBComponent component = (MongoDBComponent) Framework.getService(MongoDBConnectionService.class); consumer.accept(component, connection); } } }
MongoDBRepositoryService extends DefaultComponent { @Deprecated protected void handleConnectionContribution(MongoDBRepositoryDescriptor descriptor, BiConsumer<DefaultComponent, MongoDBConnectionConfig> consumer) { if (StringUtils.isNotBlank(descriptor.server)) { String id = "repository/" + descriptor.name; String server = descriptor.server; String dbName = StringUtils.defaultIfBlank(descriptor.dbname, DB_DEFAULT); MongoDBConnectionConfig connection = new MongoDBConnectionConfig(); connection.server = server; connection.dbname = dbName; connection.id = id; MongoDBComponent component = (MongoDBComponent) Framework.getService(MongoDBConnectionService.class); consumer.accept(component, connection); } }  }
MongoDBRepositoryService extends DefaultComponent { @Deprecated protected void handleConnectionContribution(MongoDBRepositoryDescriptor descriptor, BiConsumer<DefaultComponent, MongoDBConnectionConfig> consumer) { if (StringUtils.isNotBlank(descriptor.server)) { String id = "repository/" + descriptor.name; String server = descriptor.server; String dbName = StringUtils.defaultIfBlank(descriptor.dbname, DB_DEFAULT); MongoDBConnectionConfig connection = new MongoDBConnectionConfig(); connection.server = server; connection.dbname = dbName; connection.id = id; MongoDBComponent component = (MongoDBComponent) Framework.getService(MongoDBConnectionService.class); consumer.accept(component, connection); } }  @Override void registerContribution(Object contrib, String xpoint, ComponentInstance contributor); @Override void unregisterContribution(Object contrib, String xpoint, ComponentInstance contributor); }
MongoDBRepositoryService extends DefaultComponent { @Deprecated protected void handleConnectionContribution(MongoDBRepositoryDescriptor descriptor, BiConsumer<DefaultComponent, MongoDBConnectionConfig> consumer) { if (StringUtils.isNotBlank(descriptor.server)) { String id = "repository/" + descriptor.name; String server = descriptor.server; String dbName = StringUtils.defaultIfBlank(descriptor.dbname, DB_DEFAULT); MongoDBConnectionConfig connection = new MongoDBConnectionConfig(); connection.server = server; connection.dbname = dbName; connection.id = id; MongoDBComponent component = (MongoDBComponent) Framework.getService(MongoDBConnectionService.class); consumer.accept(component, connection); } }  @Override void registerContribution(Object contrib, String xpoint, ComponentInstance contributor); @Override void unregisterContribution(Object contrib, String xpoint, ComponentInstance contributor); static final String DB_DEFAULT; }