Search in sources :

Example 1 with FlowMapReduceApp

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());
}
Also used : ApplicationSpecification(co.cask.cdap.api.app.ApplicationSpecification) ProgramSpecification(co.cask.cdap.api.ProgramSpecification) FlowMapReduceApp(co.cask.cdap.FlowMapReduceApp) AllProgramsApp(co.cask.cdap.AllProgramsApp) ApplicationId(co.cask.cdap.proto.id.ApplicationId) Test(org.junit.Test)

Aggregations

AllProgramsApp (co.cask.cdap.AllProgramsApp)1 FlowMapReduceApp (co.cask.cdap.FlowMapReduceApp)1 ProgramSpecification (co.cask.cdap.api.ProgramSpecification)1 ApplicationSpecification (co.cask.cdap.api.app.ApplicationSpecification)1 ApplicationId (co.cask.cdap.proto.id.ApplicationId)1 Test (org.junit.Test)1