@RunWithCustomExecutor @Test public void should_throw_IllegalArgumentException_when_item_is_negative() { requestItem.setLimit(-5); ReconstructionService reconstructionService = new ReconstructionService(vitamRepositoryProvider, restoreBackupService, adminManagementClientFactory, new LogbookTransformData(), offsetRepository); assertThatCode(() -> reconstructionService.reconstruct(null)) .isInstanceOf(IllegalArgumentException.class); }
public ReconstructionResponseItem reconstruct(ReconstructionRequestItem reconstructionItem) throws DatabaseException { ParametersChecker.checkParameter(RECONSTRUCTION_ITEM_MONDATORY_MSG, reconstructionItem); ParametersChecker.checkParameter(RECONSTRUCTION_TENANT_MONDATORY_MSG, reconstructionItem.getTenant()); if (reconstructionItem.getLimit() < 0) { throw new IllegalArgumentException(RECONSTRUCTION_LIMIT_POSITIVE_MSG); } LOGGER .info(String.format( "[Reconstruction]: Reconstruction of {%s} Collection on {%s} Vitam tenant", DataCategory.BACKUP_OPERATION.name(), reconstructionItem.getTenant())); return reconstructCollection(reconstructionItem.getTenant(), reconstructionItem.getLimit()); }
ReconstructionService { public ReconstructionResponseItem reconstruct(ReconstructionRequestItem reconstructionItem) throws DatabaseException { ParametersChecker.checkParameter(RECONSTRUCTION_ITEM_MONDATORY_MSG, reconstructionItem); ParametersChecker.checkParameter(RECONSTRUCTION_TENANT_MONDATORY_MSG, reconstructionItem.getTenant()); if (reconstructionItem.getLimit() < 0) { throw new IllegalArgumentException(RECONSTRUCTION_LIMIT_POSITIVE_MSG); } LOGGER .info(String.format( "[Reconstruction]: Reconstruction of {%s} Collection on {%s} Vitam tenant", DataCategory.BACKUP_OPERATION.name(), reconstructionItem.getTenant())); return reconstructCollection(reconstructionItem.getTenant(), reconstructionItem.getLimit()); } }
ReconstructionService { public ReconstructionResponseItem reconstruct(ReconstructionRequestItem reconstructionItem) throws DatabaseException { ParametersChecker.checkParameter(RECONSTRUCTION_ITEM_MONDATORY_MSG, reconstructionItem); ParametersChecker.checkParameter(RECONSTRUCTION_TENANT_MONDATORY_MSG, reconstructionItem.getTenant()); if (reconstructionItem.getLimit() < 0) { throw new IllegalArgumentException(RECONSTRUCTION_LIMIT_POSITIVE_MSG); } LOGGER .info(String.format( "[Reconstruction]: Reconstruction of {%s} Collection on {%s} Vitam tenant", DataCategory.BACKUP_OPERATION.name(), reconstructionItem.getTenant())); return reconstructCollection(reconstructionItem.getTenant(), reconstructionItem.getLimit()); } ReconstructionService(VitamRepositoryProvider vitamRepositoryProvider,
        OffsetRepository offsetRepository); @VisibleForTesting  ReconstructionService(VitamRepositoryProvider vitamRepositoryProvider,
        RestoreBackupService recoverBackupService, AdminManagementClientFactory adminManagementClientFactory,
        LogbookTransformData logbookTransformData,
        OffsetRepository offsetRepository); }
ReconstructionService { public ReconstructionResponseItem reconstruct(ReconstructionRequestItem reconstructionItem) throws DatabaseException { ParametersChecker.checkParameter(RECONSTRUCTION_ITEM_MONDATORY_MSG, reconstructionItem); ParametersChecker.checkParameter(RECONSTRUCTION_TENANT_MONDATORY_MSG, reconstructionItem.getTenant()); if (reconstructionItem.getLimit() < 0) { throw new IllegalArgumentException(RECONSTRUCTION_LIMIT_POSITIVE_MSG); } LOGGER .info(String.format( "[Reconstruction]: Reconstruction of {%s} Collection on {%s} Vitam tenant", DataCategory.BACKUP_OPERATION.name(), reconstructionItem.getTenant())); return reconstructCollection(reconstructionItem.getTenant(), reconstructionItem.getLimit()); } ReconstructionService(VitamRepositoryProvider vitamRepositoryProvider,
        OffsetRepository offsetRepository); @VisibleForTesting  ReconstructionService(VitamRepositoryProvider vitamRepositoryProvider,
        RestoreBackupService recoverBackupService, AdminManagementClientFactory adminManagementClientFactory,
        LogbookTransformData logbookTransformData,
        OffsetRepository offsetRepository); ReconstructionResponseItem reconstruct(ReconstructionRequestItem reconstructionItem); }
ReconstructionService { public ReconstructionResponseItem reconstruct(ReconstructionRequestItem reconstructionItem) throws DatabaseException { ParametersChecker.checkParameter(RECONSTRUCTION_ITEM_MONDATORY_MSG, reconstructionItem); ParametersChecker.checkParameter(RECONSTRUCTION_TENANT_MONDATORY_MSG, reconstructionItem.getTenant()); if (reconstructionItem.getLimit() < 0) { throw new IllegalArgumentException(RECONSTRUCTION_LIMIT_POSITIVE_MSG); } LOGGER .info(String.format( "[Reconstruction]: Reconstruction of {%s} Collection on {%s} Vitam tenant", DataCategory.BACKUP_OPERATION.name(), reconstructionItem.getTenant())); return reconstructCollection(reconstructionItem.getTenant(), reconstructionItem.getLimit()); } ReconstructionService(VitamRepositoryProvider vitamRepositoryProvider,
        OffsetRepository offsetRepository); @VisibleForTesting  ReconstructionService(VitamRepositoryProvider vitamRepositoryProvider,
        RestoreBackupService recoverBackupService, AdminManagementClientFactory adminManagementClientFactory,
        LogbookTransformData logbookTransformData,
        OffsetRepository offsetRepository); ReconstructionResponseItem reconstruct(ReconstructionRequestItem reconstructionItem); static final String LOGBOOK; }