コード例 #1
0
  @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");
              }
            });
  }
コード例 #2
0
  @Test
  public void testInitTask() throws Exception {
    pipelineStoreTask.create("user", "aaaa", "blah", false);
    pipelineStateStore.saveState(
        "user",
        "aaaa",
        "0",
        PipelineStatus.CONNECTING,
        "blah",
        null,
        ExecutionMode.STANDALONE,
        null,
        0,
        0);
    pipelineManager.stop();
    pipelineStoreTask.stop();

    setUpManager(StandaloneAndClusterPipelineManager.DEFAULT_RUNNER_EXPIRY_INTERVAL, false);

    await().atMost(Duration.FIVE_SECONDS).until(numPipelinesEqualTo(pipelineManager, 1));

    List<PipelineState> pipelineStates = pipelineManager.getPipelines();
    assertEquals(1, pipelineStates.size());
    assertTrue(
        ((StandaloneAndClusterPipelineManager) pipelineManager).isRunnerPresent("aaaa", "0"));

    pipelineManager.stop();
    pipelineStoreTask.stop();
    pipelineStateStore.saveState(
        "user",
        "aaaa",
        "0",
        PipelineStatus.FINISHING,
        "blah",
        null,
        ExecutionMode.STANDALONE,
        null,
        0,
        0);

    setUpManager(StandaloneAndClusterPipelineManager.DEFAULT_RUNNER_EXPIRY_INTERVAL, false);
    await().atMost(Duration.FIVE_SECONDS).until(numPipelinesEqualTo(pipelineManager, 1));

    pipelineStates = pipelineManager.getPipelines();
    assertEquals(1, pipelineStates.size());
    // no runner is created
    assertFalse(
        ((StandaloneAndClusterPipelineManager) pipelineManager).isRunnerPresent("aaaa", "0"));
  }
コード例 #3
0
 @Test
 public void testPreviewer() throws PipelineStoreException {
   pipelineStoreTask.create("user", "abcd", "blah", false);
   Previewer previewer = pipelineManager.createPreviewer("user", "abcd", "0");
   assertEquals(previewer, pipelineManager.getPreviewer(previewer.getId()));
   ((StandaloneAndClusterPipelineManager) pipelineManager).outputRetrieved(previewer.getId());
   assertNull(pipelineManager.getPreviewer(previewer.getId()));
 }
コード例 #4
0
 @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
   }
 }
コード例 #5
0
  @Test
  public void testGetPipelineStates() throws Exception {
    pipelineStoreTask.create("user", "aaaa", "blah", false);
    List<PipelineState> pipelineStates = pipelineManager.getPipelines();

    assertEquals("aaaa", pipelineStates.get(0).getName());
    assertEquals("0", pipelineStates.get(0).getRev());

    pipelineStoreTask.create("user", "bbbb", "blah", false);
    pipelineStates = pipelineManager.getPipelines();
    assertEquals(2, pipelineStates.size());

    pipelineStoreTask.delete("aaaa");
    pipelineStates = pipelineManager.getPipelines();
    assertEquals(1, pipelineStates.size());
    pipelineStoreTask.delete("bbbb");
    pipelineStates = pipelineManager.getPipelines();
    assertEquals(0, pipelineStates.size());
  }
コード例 #6
0
 @Test
 public void testRunner() throws Exception {
   pipelineStoreTask.create("user", "aaaa", "blah", false);
   Runner runner = pipelineManager.getRunner("user1", "aaaa", "0");
   assertNotNull(runner);
 }
コード例 #7
0
 @After
 public void tearDown() {
   System.clearProperty(RuntimeModule.SDC_PROPERTY_PREFIX + RuntimeInfo.LIBEXEC_DIR);
   pipelineManager.stop();
   pipelineStoreTask.stop();
 }