@Test @RunWithCustomExecutor public void appendEntries() throws Exception { List<PurgeObjectGroupReportEntry> entries = Arrays.asList( new PurgeObjectGroupReportEntry("got1", "sp1", "opi1", null, new HashSet<>(Arrays.asList("o1", "o2")), PurgeObjectGroupStatus.DELETED.name(), Arrays.asList( new PurgeObjectGroupObjectVersion("opi_o_1", 10L), new PurgeObjectGroupObjectVersion("opi_o_2", 100L))), new PurgeObjectGroupReportEntry("got2", "sp2", "opi2", new HashSet<>(Arrays.asList("unit3")), null, PurgeObjectGroupStatus.PARTIAL_DETACHMENT.name(), null) ); instance.appendObjectGroupEntries(PROC_ID, entries); ArgumentCaptor<ReportBody> reportBodyArgumentCaptor = ArgumentCaptor.forClass(ReportBody.class); verify(batchReportClient).appendReportEntries(reportBodyArgumentCaptor.capture()); ReportBody<PurgeObjectGroupReportEntry> reportBody = reportBodyArgumentCaptor.getValue(); assertThat(reportBody.getReportType()).isEqualTo(ReportType.PURGE_OBJECTGROUP); assertThat(reportBody.getProcessId()).isEqualTo(PROC_ID); assertThat(reportBody.getEntries()).hasSize(2); PurgeObjectGroupReportEntry objectGroup = reportBody.getEntries().get(0); PurgeObjectGroupReportEntry objectGroup2 = reportBody.getEntries().get(1); assertThat(objectGroup.getId()).isEqualTo("got1"); assertThat(objectGroup.getInitialOperation()).isEqualTo("opi1"); assertThat(objectGroup.getOriginatingAgency()).isEqualTo("sp1"); assertThat(objectGroup.getObjectIds()).containsExactly("o1", "o2"); assertThat(objectGroup.getDeletedParentUnitIds()).isNull(); assertThat(objectGroup.getStatus()).isEqualTo(PurgeObjectGroupStatus.DELETED.name()); assertThat(objectGroup2.getId()).isEqualTo("got2"); assertThat(objectGroup2.getInitialOperation()).isEqualTo("opi2"); assertThat(objectGroup2.getOriginatingAgency()).isEqualTo("sp2"); assertThat(objectGroup2.getObjectIds()).isNull(); assertThat(objectGroup2.getDeletedParentUnitIds()).containsExactly("unit3"); assertThat(objectGroup2.getStatus()).isEqualTo(PurgeObjectGroupStatus.PARTIAL_DETACHMENT.name()); }
private <T> void appendEntries(String processId, List<T> entries, ReportType reportType) throws ProcessingStatusException { try (BatchReportClient batchReportClient = batchReportClientFactory.getClient()) { ReportBody<T> reportBody = new ReportBody<>(); reportBody.setProcessId(processId); reportBody.setReportType(reportType); reportBody.setEntries(entries); batchReportClient.appendReportEntries(reportBody); } catch (VitamClientInternalException e) { throw new ProcessingStatusException(StatusCode.FATAL, "Could not append entries into report", e); } }
PurgeReportService { private <T> void appendEntries(String processId, List<T> entries, ReportType reportType) throws ProcessingStatusException { try (BatchReportClient batchReportClient = batchReportClientFactory.getClient()) { ReportBody<T> reportBody = new ReportBody<>(); reportBody.setProcessId(processId); reportBody.setReportType(reportType); reportBody.setEntries(entries); batchReportClient.appendReportEntries(reportBody); } catch (VitamClientInternalException e) { throw new ProcessingStatusException(StatusCode.FATAL, "Could not append entries into report", e); } } }
PurgeReportService { private <T> void appendEntries(String processId, List<T> entries, ReportType reportType) throws ProcessingStatusException { try (BatchReportClient batchReportClient = batchReportClientFactory.getClient()) { ReportBody<T> reportBody = new ReportBody<>(); reportBody.setProcessId(processId); reportBody.setReportType(reportType); reportBody.setEntries(entries); batchReportClient.appendReportEntries(reportBody); } catch (VitamClientInternalException e) { throw new ProcessingStatusException(StatusCode.FATAL, "Could not append entries into report", e); } } PurgeReportService(); @VisibleForTesting  PurgeReportService(
        BatchReportClientFactory batchReportClientFactory,
        WorkspaceClientFactory workspaceClientFactory); }
PurgeReportService { private <T> void appendEntries(String processId, List<T> entries, ReportType reportType) throws ProcessingStatusException { try (BatchReportClient batchReportClient = batchReportClientFactory.getClient()) { ReportBody<T> reportBody = new ReportBody<>(); reportBody.setProcessId(processId); reportBody.setReportType(reportType); reportBody.setEntries(entries); batchReportClient.appendReportEntries(reportBody); } catch (VitamClientInternalException e) { throw new ProcessingStatusException(StatusCode.FATAL, "Could not append entries into report", e); } } PurgeReportService(); @VisibleForTesting  PurgeReportService(
        BatchReportClientFactory batchReportClientFactory,
        WorkspaceClientFactory workspaceClientFactory); void appendUnitEntries(String processId, List<PurgeUnitReportEntry> entries); void appendObjectGroupEntries(String processId, List<PurgeObjectGroupReportEntry> entries); CloseableIterator<String> exportDistinctObjectGroups(String processId); void exportAccessionRegisters(String processId); void cleanupReport(String processId); }
PurgeReportService { private <T> void appendEntries(String processId, List<T> entries, ReportType reportType) throws ProcessingStatusException { try (BatchReportClient batchReportClient = batchReportClientFactory.getClient()) { ReportBody<T> reportBody = new ReportBody<>(); reportBody.setProcessId(processId); reportBody.setReportType(reportType); reportBody.setEntries(entries); batchReportClient.appendReportEntries(reportBody); } catch (VitamClientInternalException e) { throw new ProcessingStatusException(StatusCode.FATAL, "Could not append entries into report", e); } } PurgeReportService(); @VisibleForTesting  PurgeReportService(
        BatchReportClientFactory batchReportClientFactory,
        WorkspaceClientFactory workspaceClientFactory); void appendUnitEntries(String processId, List<PurgeUnitReportEntry> entries); void appendObjectGroupEntries(String processId, List<PurgeObjectGroupReportEntry> entries); CloseableIterator<String> exportDistinctObjectGroups(String processId); void exportAccessionRegisters(String processId); void cleanupReport(String processId);  }