@Test
 public void testChangeExecutionModes() throws Exception {
   pipelineStoreTask.create("user1", "pipeline2", "blah", false);
   pipelineStateStore.saveState(
       "user",
       "pipeline2",
       "0",
       PipelineStatus.EDITED,
       "blah",
       null,
       ExecutionMode.STANDALONE,
       null,
       0,
       0);
   Runner runner1 = pipelineManager.getRunner("user1", "pipeline2", "0");
   pipelineStateStore.saveState(
       "user",
       "pipeline2",
       "0",
       PipelineStatus.EDITED,
       "blah",
       null,
       ExecutionMode.CLUSTER_BATCH,
       null,
       0,
       0);
   Runner runner2 = pipelineManager.getRunner("user1", "pipeline2", "0");
   assertTrue(runner1 != runner2);
   pipelineStateStore.saveState(
       "user",
       "pipeline2",
       "0",
       PipelineStatus.STARTING,
       "blah",
       null,
       ExecutionMode.CLUSTER_BATCH,
       null,
       0,
       0);
   pipelineManager.getRunner("user1", "pipeline2", "0");
   pipelineStateStore.saveState(
       "user",
       "pipeline2",
       "0",
       PipelineStatus.STARTING,
       "blah",
       null,
       ExecutionMode.STANDALONE,
       null,
       0,
       0);
   try {
     pipelineManager.getRunner("user1", "pipeline2", "0");
     fail("Expected exception but didn't get any");
   } catch (PipelineManagerException pme) {
     // Expected
   }
 }
  @Test
  public void testExpiry() throws Exception {
    pipelineStoreTask.create("user", "aaaa", "blah", false);
    Runner runner = pipelineManager.getRunner("user1", "aaaa", "0");
    pipelineStateStore.saveState(
        "user",
        "aaaa",
        "0",
        PipelineStatus.RUNNING_ERROR,
        "blah",
        null,
        ExecutionMode.STANDALONE,
        null,
        0,
        0);
    assertEquals(PipelineStatus.RUNNING_ERROR, runner.getState().getStatus());
    pipelineStateStore.saveState(
        "user",
        "aaaa",
        "0",
        PipelineStatus.RUN_ERROR,
        "blah",
        null,
        ExecutionMode.STANDALONE,
        null,
        0,
        0);

    pipelineManager.stop();
    pipelineStoreTask.stop();

    pipelineStateStore.saveState(
        "user",
        "aaaa",
        "0",
        PipelineStatus.RUNNING_ERROR,
        "blah",
        null,
        ExecutionMode.STANDALONE,
        null,
        0,
        0);
    pipelineManager = null;
    setUpManager(100, false);
    await()
        .atMost(Duration.FIVE_SECONDS)
        .until(
            new Callable<Boolean>() {
              @Override
              public Boolean call() throws Exception {
                return !((StandaloneAndClusterPipelineManager) pipelineManager)
                    .isRunnerPresent("aaaa", "0");
              }
            });
  }
 @Test
 public void testPipelineNotExist() {
   try {
     pipelineManager.getRunner("user", "none_existing_pipeline", "0");
     fail("Expected PipelineStoreException but didn't get any");
   } catch (PipelineStoreException ex) {
     LOG.debug("Ignoring exception", ex);
   } catch (Exception ex) {
     fail("Expected PipelineStoreException but got " + ex);
   }
 }
 @Test
 public void testRunner() throws Exception {
   pipelineStoreTask.create("user", "aaaa", "blah", false);
   Runner runner = pipelineManager.getRunner("user1", "aaaa", "0");
   assertNotNull(runner);
 }