use of org.apache.flink.streaming.connectors.kinesis.proxy.KinesisProxyV2Interface in project flink by apache.
the class KinesisDataFetcherTest method testRecordPublisherFactoryIsTornDown.
@Test(timeout = 1000L)
public void testRecordPublisherFactoryIsTornDown() throws InterruptedException {
KinesisProxyV2Interface kinesisV2 = mock(KinesisProxyV2Interface.class);
TestableKinesisDataFetcher<String> fetcher = new TestableKinesisDataFetcher<String>(singletonList("fakeStream1"), new TestSourceContext<>(), TestUtils.efoProperties(), new KinesisDeserializationSchemaWrapper<>(new SimpleStringSchema()), 10, 2, new AtomicReference<>(), new LinkedList<>(), new HashMap<>(), mock(KinesisProxyInterface.class), kinesisV2) {
};
fetcher.shutdownFetcher();
fetcher.awaitTermination();
}
use of org.apache.flink.streaming.connectors.kinesis.proxy.KinesisProxyV2Interface in project flink by apache.
the class KinesisDataFetcherTest method testRecordPublisherFactoryIsTornDownWhenDeregisterStreamConsumerThrowsException.
@Test(timeout = 10000)
public void testRecordPublisherFactoryIsTornDownWhenDeregisterStreamConsumerThrowsException() throws InterruptedException {
KinesisProxyV2Interface kinesisV2 = mock(KinesisProxyV2Interface.class);
TestableKinesisDataFetcher<String> fetcher = new TestableKinesisDataFetcher<String>(singletonList("fakeStream1"), new TestSourceContext<>(), TestUtils.efoProperties(), new KinesisDeserializationSchemaWrapper<>(new SimpleStringSchema()), 10, 2, new AtomicReference<>(), new LinkedList<>(), new HashMap<>(), mock(KinesisProxyInterface.class), kinesisV2) {
@Override
protected void deregisterStreamConsumer() {
throw new RuntimeException();
}
};
fetcher.shutdownFetcher();
verify(kinesisV2).close();
fetcher.awaitTermination();
}
use of org.apache.flink.streaming.connectors.kinesis.proxy.KinesisProxyV2Interface in project flink by apache.
the class FanOutRecordPublisherTest method testInterruptedPublisherReturnsCancelled.
@Test
public void testInterruptedPublisherReturnsCancelled() throws Exception {
KinesisProxyV2Interface kinesis = FakeKinesisFanOutBehavioursFactory.errorDuringSubscription(new SdkInterruptedException(null));
RecordPublisher publisher = createRecordPublisher(kinesis, StartingPosition.continueFromSequenceNumber(SEQUENCE_NUMBER));
RecordPublisherRunResult actual = publisher.run(new TestConsumer());
assertEquals(CANCELLED, actual);
}
use of org.apache.flink.streaming.connectors.kinesis.proxy.KinesisProxyV2Interface in project flink by apache.
the class FanOutRecordPublisherTest method testResourceNotFoundWhenObtainingSubscriptionTerminatesApplication.
@Test
public void testResourceNotFoundWhenObtainingSubscriptionTerminatesApplication() throws Exception {
thrown.expect(ResourceNotFoundException.class);
KinesisProxyV2Interface kinesis = FakeKinesisFanOutBehavioursFactory.resourceNotFoundWhenObtainingSubscription();
RecordPublisher recordPublisher = createRecordPublisher(kinesis);
recordPublisher.run(new TestConsumer());
}
use of org.apache.flink.streaming.connectors.kinesis.proxy.KinesisProxyV2Interface in project flink by apache.
the class StreamConsumerRegistrarTest method testRegisterStreamConsumerRegistersNewStreamConsumer.
@Test
public void testRegisterStreamConsumerRegistersNewStreamConsumer() throws Exception {
FullJitterBackoff backoff = mock(FullJitterBackoff.class);
KinesisProxyV2Interface kinesis = FakeKinesisFanOutBehavioursFactory.streamConsumerNotFound();
StreamConsumerRegistrar registrar = createRegistrar(kinesis, backoff);
String result = registrar.registerStreamConsumer(STREAM, "name");
assertEquals(STREAM_CONSUMER_ARN_NEW, result);
}
Aggregations