use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class DistroXCreateInternalAction method action.
@Override
public DistroXTestDto action(TestContext testContext, DistroXTestDto testDto, CloudbreakClient client) throws Exception {
Log.whenJson(LOGGER, " Distrox create internal request: ", testDto.getRequest());
StackV4Response stackV4Response = client.getInternalClient(testContext).distroXV1Endpoint().postInternal(testDto.getInitiatorUserCrn(), null, testDto.getRequest());
testDto.setFlow("Distrox create internal", stackV4Response.getFlowIdentifier());
testDto.setResponse(stackV4Response);
Log.whenJson(LOGGER, " Distrox create response: ", stackV4Response);
return testDto;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class DistroXScaleAction method action.
@Override
public DistroXTestDto action(TestContext testContext, DistroXTestDto testDto, CloudbreakClient client) throws Exception {
Log.when(LOGGER, String.format("Distrox scale request on: %s. Hostgroup: %s, desiredCount: %d", testDto.getName(), hostGroup, desiredCount));
Log.whenJson(LOGGER, " Distrox scale request: ", testDto.getRequest());
DistroXScaleV1Request scaleRequest = new DistroXScaleV1Request();
scaleRequest.setGroup(hostGroup);
scaleRequest.setDesiredCount(desiredCount);
scaleRequest.setAdjustmentType(adjustmentType);
scaleRequest.setThreshold(threshold);
FlowIdentifier flowIdentifier = client.getDefaultClient().distroXV1Endpoint().putScalingByName(testDto.getName(), scaleRequest);
StackV4Response stackV4Response = client.getDefaultClient().distroXV1Endpoint().getByName(testDto.getName(), new HashSet<>(Arrays.asList("hardware_info", "events")));
testDto.setFlow("Distrox scale", flowIdentifier);
testDto.setResponse(stackV4Response);
Log.whenJson(LOGGER, " Distrox scale response: ", stackV4Response);
LOGGER.info("Hardware info for stack after upscale: {}", stackV4Response.getHardwareInfoGroups());
return testDto;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class InstanceUtilTest method getResponse.
private StackV4Response getResponse(InstanceGroupV4Response... groups) {
StackV4Response response = new StackV4Response();
response.setInstanceGroups(Lists.newArrayList());
response.getInstanceGroups().addAll(Arrays.asList(groups));
return response;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class TagsUtilTest method verifyCreatorWithCdpCrnButTestContextHasAltusCrn.
@Test
void verifyCreatorWithCdpCrnButTestContextHasAltusCrn() {
DistroXTestDto testDto = new DistroXTestDto(mock(TestContext.class));
StackV4Response response = new StackV4Response();
TagsV4Response tags = new TagsV4Response();
tags.setUserDefined(Map.of(TagsUtil.TEST_NAME_TAG, TEST_NAME));
tags.setDefaults(DEFAULT_TAGS);
response.setTags(tags);
testDto.setResponse(response);
when(testContext.getActingUserCrn()).thenReturn(Crn.fromString("crn:altus:iam:us-west-1:qe-gcp:user:cloudbreak-qe@hortonworks.com"));
when(gcpLabelUtil.transformLabelKeyOrValue(anyString())).thenReturn(CLOUDERA_CREATOR_RESOURCE_NAME_TAG_KEY);
assertThatCode(() -> underTest.verifyTags(testDto, testContext)).doesNotThrowAnyException();
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response in project cloudbreak by hortonworks.
the class TagsUtilTest method verifyTagsShouldFailAbstractTestDtoDoesNotHaveAllNeededTags.
@Test
void verifyTagsShouldFailAbstractTestDtoDoesNotHaveAllNeededTags() {
DistroXTestDto testDto = new DistroXTestDto(mock(TestContext.class));
StackV4Response response = new StackV4Response();
TagsV4Response tags = new TagsV4Response();
tags.setUserDefined(Map.of(TagsUtil.TEST_NAME_TAG, TEST_NAME));
Map<String, String> defaultTags = new HashMap<>(DEFAULT_TAGS);
defaultTags.remove("owner");
tags.setDefaults(defaultTags);
response.setTags(tags);
testDto.setResponse(response);
String expectedMsg = String.format(TagsUtil.TAG_VALUE_IS_NULL_FAILURE_PATTERN, OWNER_TAG_KEY);
assertThatThrownBy(() -> underTest.verifyTags(testDto, testContext)).hasMessageContaining(expectedMsg).matches(e -> !e.getMessage().contains(TagsUtil.MISSING_TEST_NAME_TAG_MESSAGE)).matches(e -> defaultTags.keySet().stream().noneMatch(tag -> e.getMessage().contains(tag)));
}
Aggregations