Search in sources :

Example 1 with BootstrapResult

use of io.cdap.cdap.proto.bootstrap.BootstrapResult in project cdap by caskdata.

the class BootstrapServiceTest method testAllSuccess.

@Test
public void testAllSuccess() throws Exception {
    BootstrapResult result = bootstrapService.bootstrap();
    List<BootstrapStepResult> expectedStepResults = new ArrayList<>();
    for (BootstrapStep step : bootstrapConfig.getSteps()) {
        expectedStepResults.add(new BootstrapStepResult(step.getLabel(), BootstrapStepResult.Status.SUCCEEDED));
    }
    BootstrapResult expected = new BootstrapResult(expectedStepResults);
    Assert.assertEquals(expected, result);
    Assert.assertTrue(bootstrapService.isBootstrapped());
}
Also used : ArrayList(java.util.ArrayList) BootstrapResult(io.cdap.cdap.proto.bootstrap.BootstrapResult) BootstrapStepResult(io.cdap.cdap.proto.bootstrap.BootstrapStepResult) Test(org.junit.Test)

Example 2 with BootstrapResult

use of io.cdap.cdap.proto.bootstrap.BootstrapResult in project cdap by caskdata.

the class BootstrapServiceTest method testRunCondition.

@Test
public void testRunCondition() throws Exception {
    BootstrapResult result = bootstrapService.bootstrap(step -> step.getRunCondition() == BootstrapStep.RunCondition.ONCE);
    List<BootstrapStepResult> stepResults = new ArrayList<>(3);
    stepResults.add(new BootstrapStepResult(STEP1.getLabel(), BootstrapStepResult.Status.SKIPPED));
    stepResults.add(new BootstrapStepResult(STEP2.getLabel(), BootstrapStepResult.Status.SUCCEEDED));
    stepResults.add(new BootstrapStepResult(STEP3.getLabel(), BootstrapStepResult.Status.SKIPPED));
    Assert.assertEquals(new BootstrapResult(stepResults), result);
}
Also used : ArrayList(java.util.ArrayList) BootstrapResult(io.cdap.cdap.proto.bootstrap.BootstrapResult) BootstrapStepResult(io.cdap.cdap.proto.bootstrap.BootstrapStepResult) Test(org.junit.Test)

Example 3 with BootstrapResult

use of io.cdap.cdap.proto.bootstrap.BootstrapResult in project cdap by caskdata.

the class BootstrapServiceTest method testContinuesAfterFailures.

@Test
public void testContinuesAfterFailures() throws Exception {
    EXECUTOR1.shouldFail();
    BootstrapResult result = bootstrapService.bootstrap();
    List<BootstrapStepResult> stepResults = new ArrayList<>(3);
    stepResults.add(new BootstrapStepResult(STEP1.getLabel(), BootstrapStepResult.Status.FAILED));
    stepResults.add(new BootstrapStepResult(STEP2.getLabel(), BootstrapStepResult.Status.SUCCEEDED));
    stepResults.add(new BootstrapStepResult(STEP3.getLabel(), BootstrapStepResult.Status.SUCCEEDED));
    BootstrapResult expected = new BootstrapResult(stepResults);
    Assert.assertEquals(expected, result);
}
Also used : ArrayList(java.util.ArrayList) BootstrapResult(io.cdap.cdap.proto.bootstrap.BootstrapResult) BootstrapStepResult(io.cdap.cdap.proto.bootstrap.BootstrapStepResult) Test(org.junit.Test)

Example 4 with BootstrapResult

use of io.cdap.cdap.proto.bootstrap.BootstrapResult in project cdap by caskdata.

the class BootstrapServiceTest method testRetries.

@Test
public void testRetries() throws Exception {
    EXECUTOR1.setNumRetryableFailures(3);
    BootstrapResult result = bootstrapService.bootstrap();
    List<BootstrapStepResult> expectedStepResults = new ArrayList<>();
    for (BootstrapStep step : bootstrapConfig.getSteps()) {
        expectedStepResults.add(new BootstrapStepResult(step.getLabel(), BootstrapStepResult.Status.SUCCEEDED));
    }
    BootstrapResult expected = new BootstrapResult(expectedStepResults);
    Assert.assertEquals(expected, result);
}
Also used : ArrayList(java.util.ArrayList) BootstrapResult(io.cdap.cdap.proto.bootstrap.BootstrapResult) BootstrapStepResult(io.cdap.cdap.proto.bootstrap.BootstrapStepResult) Test(org.junit.Test)

Aggregations

BootstrapResult (io.cdap.cdap.proto.bootstrap.BootstrapResult)4 BootstrapStepResult (io.cdap.cdap.proto.bootstrap.BootstrapStepResult)4 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4