@Test public void should_bulk_append_objectgroup_report_and_check_no_duplicate() throws Exception { List<PurgeObjectGroupModel> purgeUnitModels = getDocuments("/purgeObjectGroupWithDuplicateObjectGroup.json"); repository.bulkAppendReport(purgeUnitModels); repository.bulkAppendReport(purgeUnitModels); FindIterable<Document> iterable = purgeObjectGroupCollection.find(); MongoCursor<Document> iterator = iterable.iterator(); List<Document> documents = new ArrayList<>(); while (iterator.hasNext()) { documents.add(iterator.next()); } Assertions.assertThat(documents.size()).isEqualTo(6); }
public void bulkAppendReport(List<PurgeObjectGroupModel> reports) { Set<PurgeObjectGroupModel> reportsWithoutDuplicate = new HashSet<>(reports); List<Document> purgeObjectGroupDocument = reportsWithoutDuplicate.stream() .map(ReportCommonRepository::pojoToDocument) .collect(Collectors.toList()); super.bulkAppendReport(purgeObjectGroupDocument, objectGroupReportCollection); }
PurgeObjectGroupRepository extends ReportCommonRepository { public void bulkAppendReport(List<PurgeObjectGroupModel> reports) { Set<PurgeObjectGroupModel> reportsWithoutDuplicate = new HashSet<>(reports); List<Document> purgeObjectGroupDocument = reportsWithoutDuplicate.stream() .map(ReportCommonRepository::pojoToDocument) .collect(Collectors.toList()); super.bulkAppendReport(purgeObjectGroupDocument, objectGroupReportCollection); } }
PurgeObjectGroupRepository extends ReportCommonRepository { public void bulkAppendReport(List<PurgeObjectGroupModel> reports) { Set<PurgeObjectGroupModel> reportsWithoutDuplicate = new HashSet<>(reports); List<Document> purgeObjectGroupDocument = reportsWithoutDuplicate.stream() .map(ReportCommonRepository::pojoToDocument) .collect(Collectors.toList()); super.bulkAppendReport(purgeObjectGroupDocument, objectGroupReportCollection); } @VisibleForTesting  PurgeObjectGroupRepository(MongoDbAccess mongoDbAccess, String collectionName);  PurgeObjectGroupRepository(MongoDbAccess mongoDbAccess); }
PurgeObjectGroupRepository extends ReportCommonRepository { public void bulkAppendReport(List<PurgeObjectGroupModel> reports) { Set<PurgeObjectGroupModel> reportsWithoutDuplicate = new HashSet<>(reports); List<Document> purgeObjectGroupDocument = reportsWithoutDuplicate.stream() .map(ReportCommonRepository::pojoToDocument) .collect(Collectors.toList()); super.bulkAppendReport(purgeObjectGroupDocument, objectGroupReportCollection); } @VisibleForTesting  PurgeObjectGroupRepository(MongoDbAccess mongoDbAccess, String collectionName);  PurgeObjectGroupRepository(MongoDbAccess mongoDbAccess); void bulkAppendReport(List<PurgeObjectGroupModel> reports); MongoCursor<Document> findCollectionByProcessIdTenant(String processId, int tenantId); void deleteReportByIdAndTenant(String processId, int tenantId); MongoCursor<Document> computeOwnAccessionRegisterDetails(String processId, int tenantId); }
PurgeObjectGroupRepository extends ReportCommonRepository { public void bulkAppendReport(List<PurgeObjectGroupModel> reports) { Set<PurgeObjectGroupModel> reportsWithoutDuplicate = new HashSet<>(reports); List<Document> purgeObjectGroupDocument = reportsWithoutDuplicate.stream() .map(ReportCommonRepository::pojoToDocument) .collect(Collectors.toList()); super.bulkAppendReport(purgeObjectGroupDocument, objectGroupReportCollection); } @VisibleForTesting  PurgeObjectGroupRepository(MongoDbAccess mongoDbAccess, String collectionName);  PurgeObjectGroupRepository(MongoDbAccess mongoDbAccess); void bulkAppendReport(List<PurgeObjectGroupModel> reports); MongoCursor<Document> findCollectionByProcessIdTenant(String processId, int tenantId); void deleteReportByIdAndTenant(String processId, int tenantId); MongoCursor<Document> computeOwnAccessionRegisterDetails(String processId, int tenantId); static final String PURGE_OBJECT_GROUP; static final String OPI_GOT; }