use of co.cask.cdap.FlowMapReduceApp in project cdap by caskdata.
the class DefaultStoreTest method testCheckDeletedWorkflow.
@Test
public void testCheckDeletedWorkflow() throws Exception {
// Deploy program with all types of programs.
ApplicationSpecification spec = Specifications.from(new AllProgramsApp());
ApplicationId appId = NamespaceId.DEFAULT.app(spec.getName());
store.addApplication(appId, spec);
Set<String> specsToBeDeleted = Sets.newHashSet();
specsToBeDeleted.addAll(spec.getWorkflows().keySet());
Assert.assertEquals(1, specsToBeDeleted.size());
// Get the spec for app that contains only flow and mapreduce - removing workflows.
spec = Specifications.from(new FlowMapReduceApp());
// Get the deleted program specs by sending a spec with same name as AllProgramsApp but with no programs
List<ProgramSpecification> deletedSpecs = store.getDeletedProgramSpecifications(appId, spec);
Assert.assertEquals(2, deletedSpecs.size());
for (ProgramSpecification specification : deletedSpecs) {
// Remove the spec that is verified, to check the count later.
specsToBeDeleted.remove(specification.getName());
}
// 2 specs should have been deleted and 0 should be remaining.
Assert.assertEquals(0, specsToBeDeleted.size());
}
Aggregations