use of io.cdap.cdap.proto.bootstrap.BootstrapStepResult 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);
}
use of io.cdap.cdap.proto.bootstrap.BootstrapStepResult 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);
}
use of io.cdap.cdap.proto.bootstrap.BootstrapStepResult in project cdap by caskdata.
the class SystemProfileCreatorTest method testMissingProfileName.
@Test
public void testMissingProfileName() throws Exception {
List<ProvisionerPropertyValue> properties = new ArrayList<>();
properties.add(new ProvisionerPropertyValue("name1", "val1", true));
properties.add(new ProvisionerPropertyValue("name2", "val2", true));
ProvisionerInfo provisionerInfo = new ProvisionerInfo(MockProvisioner.NAME, properties);
SystemProfileCreator.Arguments arguments = new SystemProfileCreator.Arguments("", "label", "desc", provisionerInfo);
BootstrapStepResult result = profileCreator.execute("label", GSON.toJsonTree(arguments).getAsJsonObject());
Assert.assertEquals(BootstrapStepResult.Status.FAILED, result.getStatus());
}
use of io.cdap.cdap.proto.bootstrap.BootstrapStepResult in project cdap by caskdata.
the class NativeProfileCreatorTest method testAlreadyExistsDoesNotError.
@Test
public void testAlreadyExistsDoesNotError() throws Exception {
profileService.saveProfile(ProfileId.NATIVE, Profile.NATIVE);
BootstrapStepResult result = nativeProfileCreator.execute("label", new JsonObject());
BootstrapStepResult expected = new BootstrapStepResult("label", BootstrapStepResult.Status.SUCCEEDED);
Assert.assertEquals(expected, result);
Assert.assertEquals(Profile.NATIVE, profileService.getProfile(ProfileId.NATIVE));
}
use of io.cdap.cdap.proto.bootstrap.BootstrapStepResult in project cdap by caskdata.
the class SystemPreferencesSetterTest method testAllPreferenceSet.
@Test
public void testAllPreferenceSet() throws Exception {
Map<String, String> preferences = new HashMap<>();
preferences.put("p1", "v1");
preferences.put("p2", "v2");
SystemPreferenceSetter.Arguments arguments = new SystemPreferenceSetter.Arguments(preferences);
BootstrapStepResult result = systemPreferenceSetter.execute("label", GSON.toJsonTree(arguments).getAsJsonObject());
Assert.assertEquals(BootstrapStepResult.Status.SUCCEEDED, result.getStatus());
Assert.assertEquals(preferences, preferencesService.getProperties());
}
Aggregations