@Override public Report execute( IndexService index, ModelService model, StorageService storage, List<Void> list) throws PluginException { try { int counter = index .count( IndexedAIP.class, new Filter( new SimpleFilterParameter(RodaConstants.AIP_GHOST, Boolean.TRUE.toString()))) .intValue(); // XXX 20160929 Is it really needed? (it is there to be possible to get // 100% done reports) if (counter == 0) { counter = index.count(IndexedAIP.class, Filter.ALL).intValue(); } SimpleJobPluginInfo jobPluginInfo = PluginHelper.getInitialJobInformation(this, counter); jobPluginInfo.setSourceObjectsCount(counter); PluginHelper.updateJobInformation(this, jobPluginInfo); Optional<String> computedSearchScope = PluginHelper.getSearchScopeFromParameters(this, model); Job originalJob = PluginHelper.getJob(originalJobId, model); PluginHelper.fixParents( index, model, Optional.ofNullable(originalJob.getId()), computedSearchScope); jobPluginInfo.incrementObjectsProcessedWithSuccess(counter); jobPluginInfo.finalizeInfo(); PluginHelper.updateJobInformation(this, jobPluginInfo); } catch (GenericException | RequestNotValidException | AuthorizationDeniedException | JobException | NotFoundException e) { LOGGER.error("Error while fixing the ancestors.", e); } return PluginHelper.initPluginReport(this); }
@Test public void testVeraPDFPlugin() throws RODAException, FileAlreadyExistsException, InterruptedException, IOException, SolrServerException, IsStillUpdatingException { ingestCorpora(); Map<String, String> parameters = new HashMap<>(); parameters.put(RodaConstants.PLUGIN_PARAMS_PDF_PROFILE, "1b"); Job job = TestsHelper.executeJob( VeraPDFPlugin.class, parameters, PluginType.AIP_TO_AIP, SelectedItemsAll.create(Representation.class)); // job should fail if (job.getJobStats().getSourceObjectsProcessedWithFailure() == 0) { AssertJUnit.fail("Report should have ended with failures"); } // Plugin<Representation> plugin2 = new PdfToPdfaPlugin<Representation>(); // FIXME 20160623 hsilva: passing by null just to make code compiling // TestsHelper.executeJob(PdfToPdfaPlugin.class, parameters, // PluginType.AIP_TO_AIP, SelectedItemsAll.create(Representation.class)); // Plugin<AIP> plugin3 = new VeraPDFPlugin(); // plugin3.setParameterValues(parameters); // FIXME 20160623 hsilva: passing by null just to make code compiling // TestsHelper.executeJob(VeraPDFPlugin.class, parameters, // PluginType.AIP_TO_AIP, SelectedItemsAll.create(Representation.class)); // Report report1 = reports.get(0).getReports().get(1); // if (!PluginState.SUCCESS.equals(report1.getPluginState())) { // Assert.fail("Report failed: " + report1); // } }