ProductionServiceImpl extends Observable implements ProductionService { @Override public synchronized void stageProductions(String... productionIds) throws ProductionException { int count = 0; for (String productionId : productionIds) { Production production = productionStore.getProduction(productionId); if (production != null) { try { if (production.getProcessingStatus().getState() == ProcessState.COMPLETED && ((production.getStagingStatus().getState() == ProcessState.UNKNOWN && productionStagingsMap.get(production.getId()) == null)) || production.getStagingStatus().getState() == ProcessState.ERROR || production.getStagingStatus().getState() == ProcessState.CANCELLED) { stageProductionResults(production); } count++; } catch (ProductionException e) { logger.log(Level.SEVERE, String.format("Failed to stage production '%s': %s", production.getId(), e.getMessage()), e); } } } if (count < productionIds.length) { throw new ProductionException( String.format("Only %d of %d production(s) have been staged.", count, productionIds.length)); } } ProductionServiceImpl(FileSystemService fileSystemService,
                                 ProcessingService processingService,
                                 StagingService stagingService,
                                 ProductionStore productionStore,
                                 ProductionType... productionTypes); @Override ProcessingService getProcessingService(); @Override BundleDescriptor[] getBundles(String username, BundleFilter filter); @Override MaskDescriptor[] getMasks(String userName); @Override synchronized Production[] getProductions(String filter); @Override Production getProduction(String id); @Override ProductionResponse orderProduction(ProductionRequest productionRequest); @Override ProductionResponse orderProduction(ProductionRequest productionRequest, HadoopJobHook jobHook); @Override synchronized void stageProductions(String... productionIds); @Override synchronized void scpProduction(final String productionId, final String scpPath); @Override void cancelProductions(String... productionIds); @Override void deleteProductions(String... productionIds); @Override synchronized void updateStatuses(String username); @Override void close(); @Override synchronized void setChanged(); @Override String[][] loadRegionDataInfo(String username, String url); @Override void invalidateBundleCache();  }
@Test public void testStageUnknownProduction() { try { productionServiceUnderTest.stageProductions("id_98"); fail("ProductionException expected, because we don't have production 'id_98'"); } catch (ProductionException e) { } }