use of com.amazonaws.http.SdkHttpMetadata in project beam by apache.
the class AwsCodersTest method testSdkHttpMetadataDecodeEncodeEquals.
@Test
public void testSdkHttpMetadataDecodeEncodeEquals() throws Exception {
SdkHttpMetadata value = buildSdkHttpMetadata();
SdkHttpMetadata clone = CoderUtils.clone(AwsCoders.sdkHttpMetadata(), value);
assertThat(clone.getHttpStatusCode(), equalTo(value.getHttpStatusCode()));
assertThat(clone.getHttpHeaders(), equalTo(value.getHttpHeaders()));
}
use of com.amazonaws.http.SdkHttpMetadata in project beam by apache.
the class AwsCodersTest method testSdkHttpMetadataWithoutHeadersDecodeEncodeEquals.
@Test
public void testSdkHttpMetadataWithoutHeadersDecodeEncodeEquals() throws Exception {
SdkHttpMetadata value = buildSdkHttpMetadata();
SdkHttpMetadata clone = CoderUtils.clone(AwsCoders.sdkHttpMetadataWithoutHeaders(), value);
assertThat(clone.getHttpStatusCode(), equalTo(value.getHttpStatusCode()));
assertThat(clone.getHttpHeaders().isEmpty(), equalTo(true));
}
use of com.amazonaws.http.SdkHttpMetadata in project beam by apache.
the class SnsIOTest method configureAmazonSnsMock.
private static void configureAmazonSnsMock(AmazonSNS amazonSNS) {
final GetTopicAttributesResult result = Mockito.mock(GetTopicAttributesResult.class);
final SdkHttpMetadata metadata = Mockito.mock(SdkHttpMetadata.class);
Mockito.when(metadata.getHttpHeaders()).thenReturn(new HashMap<>());
Mockito.when(metadata.getHttpStatusCode()).thenReturn(200);
Mockito.when(result.getSdkHttpMetadata()).thenReturn(metadata);
Mockito.when(amazonSNS.getTopicAttributes(Mockito.anyString())).thenReturn(result);
}
use of com.amazonaws.http.SdkHttpMetadata in project beam by apache.
the class SnsIOTest method getAmazonSnsMockSuccess.
private static AmazonSNS getAmazonSnsMockSuccess() {
final AmazonSNS amazonSNS = Mockito.mock(AmazonSNS.class);
configureAmazonSnsMock(amazonSNS);
final PublishResult result = Mockito.mock(PublishResult.class);
final SdkHttpMetadata metadata = Mockito.mock(SdkHttpMetadata.class);
Mockito.when(metadata.getHttpHeaders()).thenReturn(new HashMap<>());
Mockito.when(metadata.getHttpStatusCode()).thenReturn(200);
Mockito.when(result.getSdkHttpMetadata()).thenReturn(metadata);
Mockito.when(result.getMessageId()).thenReturn(UUID.randomUUID().toString());
Mockito.when(amazonSNS.publish(Mockito.any())).thenReturn(result);
return amazonSNS;
}
Aggregations