Source:
<code>public void testForceDeleteJobFromJobQueue() throws InterruptedException { String jobQueueName = TestHelper.getTestMethodName(); JobConfig.Builder jobBuilder = JobConfig.Builder.fromMap(WorkflowGenerator.DEFAULT_JOB_CONFIG) .setMaxAttemptsPerTask(1).setWorkflow(jobQueueName) .setJobCommandConfigMap(ImmutableMap.of(MockTask.JOB_DELAY, "10")); JobConfig.Builder jobBuilder2 = JobConfig.Builder.fromMap(WorkflowGenerator.DEFAULT_JOB_CONFIG) .setMaxAttemptsPerTask(1).setWorkflow(jobQueueName) .setJobCommandConfigMap(ImmutableMap.of(MockTask.JOB_DELAY, "100000")).setTimeout(100000); JobQueue.Builder jobQueue = TaskTestUtil.buildJobQueue(jobQueueName); jobQueue.enqueueJob("job1", jobBuilder); jobQueue.enqueueJob("job2", jobBuilder2); _driver.start(jobQueue.build()); _driver.pollForJobState(jobQueueName, TaskUtil.getNamespacedJobName(jobQueueName, "job2"), TaskState.IN_PROGRESS); try { _driver.deleteJob(jobQueueName, "job2"); } catch (IllegalStateException e) { } <START> <END> _driver.deleteJob(jobQueueName, "job2", true); Assert.assertNull(_driver.getJobConfig(TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); Assert.assertNull(_driver.getJobContext(TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); Assert.assertNull(_manager.getClusterManagmentTool().getResourceIdealState(CLUSTER_NAME, TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); }</code><technical_language>add checks/asserts Config, Context IdealState null ForceDelete deleted regular delete</technical_language>

Target:
public void testForceDeleteJobFromJobQueue() throws InterruptedException { String jobQueueName = TestHelper.getTestMethodName(); JobConfig.Builder jobBuilder = JobConfig.Builder.fromMap(WorkflowGenerator.DEFAULT_JOB_CONFIG) .setMaxAttemptsPerTask(1).setWorkflow(jobQueueName) .setJobCommandConfigMap(ImmutableMap.of(MockTask.JOB_DELAY, "10")); JobConfig.Builder jobBuilder2 = JobConfig.Builder.fromMap(WorkflowGenerator.DEFAULT_JOB_CONFIG) .setMaxAttemptsPerTask(1).setWorkflow(jobQueueName) .setJobCommandConfigMap(ImmutableMap.of(MockTask.JOB_DELAY, "100000")).setTimeout(100000); JobQueue.Builder jobQueue = TaskTestUtil.buildJobQueue(jobQueueName); jobQueue.enqueueJob("job1", jobBuilder); jobQueue.enqueueJob("job2", jobBuilder2); _driver.start(jobQueue.build()); _driver.pollForJobState(jobQueueName, TaskUtil.getNamespacedJobName(jobQueueName, "job2"), TaskState.IN_PROGRESS); try { _driver.deleteJob(jobQueueName, "job2"); Assert.fail("Regular, non-force deleteJob should fail since the workflow is in progress!"); } catch (IllegalStateException e) { } Assert.assertNotNull(_driver.getJobConfig(TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); Assert .assertNotNull(_driver.getJobContext(TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); Assert.assertNotNull(_manager.getClusterManagmentTool().getResourceIdealState(CLUSTER_NAME, TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); _driver.deleteJob(jobQueueName, "job2", true); Assert.assertNull(_driver.getJobConfig(TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); Assert.assertNull(_driver.getJobContext(TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); Assert.assertNull(_manager.getClusterManagmentTool().getResourceIdealState(CLUSTER_NAME, TaskUtil.getNamespacedJobName(jobQueueName, "job2"))); }