@Test
public void testDeleteSuspendedWorkflow() {
NamespaceId namespaceId = new NamespaceId("namespace1");
ApplicationId appId1 = namespaceId.app("app1");
ProgramId programId1 = appId1.workflow("pgm1");
ArtifactId artifactId = namespaceId.artifact("testArtifact", "1.0").toApiArtifactId();
RunId run1 = RunIds.generate();
setStartAndRunning(programId1.run(run1.getId()), artifactId);
store.setSuspend(programId1.run(run1.getId()), AppFabricTestHelper.createSourceId(++sourceId), -1);
store.removeApplication(appId1);
Assert.assertTrue(store.getRuns(programId1, ProgramRunStatus.ALL, 0, Long.MAX_VALUE, Integer.MAX_VALUE).isEmpty());
ProgramId programId2 = namespaceId.app("app2").workflow("pgm2");
RunId run2 = RunIds.generate();
setStartAndRunning(programId2.run(run2.getId()), artifactId);
store.setSuspend(programId2.run(run2.getId()), AppFabricTestHelper.createSourceId(++sourceId), -1);
store.removeAll(namespaceId);
nsStore.delete(namespaceId);
Assert.assertTrue(store.getRuns(programId2, ProgramRunStatus.ALL, 0, Long.MAX_VALUE, Integer.MAX_VALUE).isEmpty());
}