ProductionServiceImpl extends Observable implements ProductionService { @Override public void deleteProductions(String... productionIds) throws ProductionException { requestProductionKill(productionIds, Action.DELETE); } 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 testDeleteProductions() throws ProductionException, IOException { productionServiceUnderTest.orderProduction(new ProductionRequest("test", "ewa")); productionServiceUnderTest.orderProduction(new ProductionRequest("test", "ewa")); productionServiceUnderTest.orderProduction(new ProductionRequest("test", "ewa")); productionServiceUnderTest.orderProduction(new ProductionRequest("test", "ewa")); productionServiceUnderTest.orderProduction(new ProductionRequest("test", "ewa")); productionServiceUnderTest.deleteProductions("id_2", "id_4"); Production[] productions = productionServiceUnderTest.getProductions(null); assertNotNull(productions); assertEquals(5, productions.length); processingServiceMock.setJobStatus("job_2_1", new ProcessStatus(ProcessState.COMPLETED)); processingServiceMock.setJobStatus("job_2_2", new ProcessStatus(ProcessState.COMPLETED)); processingServiceMock.setJobStatus("job_4_1", new ProcessStatus(ProcessState.RUNNING)); processingServiceMock.setJobStatus("job_4_2", new ProcessStatus(ProcessState.RUNNING)); productionServiceUnderTest.updateStatuses("ewa"); productions = productionServiceUnderTest.getProductions(null); assertNotNull(productions); assertEquals(4, productions.length); processingServiceMock.setJobStatus("job_4_1", new ProcessStatus(ProcessState.COMPLETED)); processingServiceMock.setJobStatus("job_4_2", new ProcessStatus(ProcessState.COMPLETED)); productionServiceUnderTest.updateStatuses("ewa"); productions = productionServiceUnderTest.getProductions(null); assertNotNull(productions); assertEquals(3, productions.length); }
@Test public void testDeleteUnknownProduction() { try { productionServiceUnderTest.deleteProductions("id_45"); fail("ProductionException expected, because we don't have production 'id_45'"); } catch (ProductionException e) { } }