use of org.springdoc.demo.app2.model.Tag in project titus-control-plane by Netflix.
the class AwsInstanceCloudConnector method addTagToResource.
/**
* Internal method used for testing.
*/
Completable addTagToResource(String resourceId, String tag, String value) {
List<String> resources = singletonList(resourceId);
List<Tag> tags = singletonList(new Tag(tag, value));
Observable<CreateTagsResult> observable = toObservable(new CreateTagsRequest(resources, tags), ec2Client::createTagsAsync);
return observable.toCompletable();
}
use of org.springdoc.demo.app2.model.Tag in project aws-cloudformation-resource-providers-transitgateway by aws-cloudformation.
the class CreateHandlerTest method handleRequest_Error.
@Test
public void handleRequest_Error() {
final List<Tag> tags = new ArrayList<>();
tags.add(MOCKS.tag());
AwsErrorDetails errorDetails = AwsErrorDetails.builder().errorMessage("Something went wrong").errorCode("Invalid Request").build();
AwsServiceException exception = AwsServiceException.builder().awsErrorDetails(errorDetails).build();
when(proxyClient.client().createTransitGatewayConnect(any(CreateTransitGatewayConnectRequest.class))).thenThrow(exception);
ResourceModel model = MOCKS.model(tags);
final ProgressEvent<ResourceModel, CallbackContext> response = handler.handleRequest(proxy, MOCKS.request(model), new CallbackContext(), proxyClient, logger);
assertThat(response).isNotNull();
assertThat(response.getStatus()).isEqualTo(OperationStatus.FAILED);
assertThat(response.getCallbackDelaySeconds()).isEqualTo(0);
assertThat(response.getResourceModel()).isNull();
assertThat(response.getResourceModels()).isNull();
assertThat(response.getMessage().contains("Something went wrong")).isTrue();
assertThat(response.getErrorCode()).isEqualTo(HandlerErrorCode.InvalidRequest);
}
use of org.springdoc.demo.app2.model.Tag in project aws-cloudformation-resource-providers-transitgateway by aws-cloudformation.
the class ListHandlerTest method handleRequest_Error.
@Test
public void handleRequest_Error() {
final List<Tag> tags = new ArrayList<>();
tags.add(MOCKS.tag());
AwsErrorDetails errorDetails = AwsErrorDetails.builder().errorMessage("Something went wrong").errorCode("Invalid Request").build();
AwsServiceException exception = AwsServiceException.builder().awsErrorDetails(errorDetails).build();
when(proxyClient.client().describeTransitGatewayConnects(any(DescribeTransitGatewayConnectsRequest.class))).thenThrow(exception);
ResourceModel model = MOCKS.model(tags);
final ProgressEvent<ResourceModel, CallbackContext> response = handler.handleRequest(proxy, MOCKS.request(model), new CallbackContext(), proxyClient, logger);
assertThat(response).isNotNull();
assertThat(response.getStatus()).isEqualTo(OperationStatus.FAILED);
assertThat(response.getCallbackDelaySeconds()).isEqualTo(0);
assertThat(response.getResourceModel()).isNull();
assertThat(response.getResourceModels()).isNull();
assertThat(response.getMessage().contains("Something went wrong")).isTrue();
assertThat(response.getErrorCode()).isEqualTo(HandlerErrorCode.InvalidRequest);
}
use of org.springdoc.demo.app2.model.Tag in project aws-cloudformation-resource-providers-transitgateway by aws-cloudformation.
the class ReadHandlerTest method handleRequest_Error.
@Test
public void handleRequest_Error() {
final List<Tag> tags = new ArrayList<>();
tags.add(MOCKS.tag());
AwsErrorDetails errorDetails = AwsErrorDetails.builder().errorMessage("Something went wrong").errorCode("Invalid Request").build();
AwsServiceException exception = AwsServiceException.builder().awsErrorDetails(errorDetails).build();
when(proxyClient.client().describeTransitGatewayConnects(any(DescribeTransitGatewayConnectsRequest.class))).thenThrow(exception);
ResourceModel model = MOCKS.model(tags);
final ProgressEvent<ResourceModel, CallbackContext> response = handler.handleRequest(proxy, MOCKS.request(model), new CallbackContext(), proxyClient, logger);
assertThat(response).isNotNull();
assertThat(response.getStatus()).isEqualTo(OperationStatus.FAILED);
assertThat(response.getCallbackDelaySeconds()).isEqualTo(0);
assertThat(response.getResourceModel()).isNull();
assertThat(response.getResourceModels()).isNull();
assertThat(response.getMessage().contains("Something went wrong")).isTrue();
assertThat(response.getErrorCode()).isEqualTo(HandlerErrorCode.InvalidRequest);
}
use of org.springdoc.demo.app2.model.Tag in project aws-cloudformation-resource-providers-transitgateway by aws-cloudformation.
the class TagUtilsTest method difference2.
@Test
public void difference2() {
Tag sharedTag = MOCKS.tag();
final List<Tag> tags1 = new ArrayList<>();
tags1.add(sharedTag);
tags1.add(MOCKS.tag());
final List<Tag> tags2 = new ArrayList<>();
tags2.add(sharedTag);
tags2.add(MOCKS.tag());
List<Tag> difference = TagUtils.difference(TagUtils.sdkTagsToCfnTags(tags2), TagUtils.sdkTagsToCfnTags(tags1));
assertThat(difference.size()).isEqualTo(1);
assertThat(difference.get(0).key()).isEqualTo(tags2.get(1).key());
assertThat(difference.get(0).value()).isEqualTo(tags2.get(1).value());
}
Aggregations