use of com.amazonaws.services.kinesis.model.GetShardIteratorResult in project camel by apache.
the class KinesisConsumerTest method setup.
@Before
public void setup() throws Exception {
KinesisEndpoint endpoint = new KinesisEndpoint(null, "streamName", component);
endpoint.setAmazonKinesisClient(kinesisClient);
endpoint.setIteratorType(ShardIteratorType.LATEST);
undertest = new KinesisConsumer(endpoint, processor);
when(kinesisClient.getRecords(any(GetRecordsRequest.class))).thenReturn(new GetRecordsResult().withNextShardIterator("nextShardIterator"));
when(kinesisClient.describeStream(any(DescribeStreamRequest.class))).thenReturn(new DescribeStreamResult().withStreamDescription(new StreamDescription().withShards(new Shard().withShardId("shardId"))));
when(kinesisClient.getShardIterator(any(GetShardIteratorRequest.class))).thenReturn(new GetShardIteratorResult().withShardIterator("shardIterator"));
}
use of com.amazonaws.services.kinesis.model.GetShardIteratorResult in project beam by apache.
the class SimplifiedKinesisClientTest method shouldReturnIteratorStartingWithSequenceNumber.
@Test
public void shouldReturnIteratorStartingWithSequenceNumber() throws Exception {
given(kinesis.getShardIterator(new GetShardIteratorRequest().withStreamName(STREAM).withShardId(SHARD_1).withShardIteratorType(ShardIteratorType.AT_SEQUENCE_NUMBER).withStartingSequenceNumber(SEQUENCE_NUMBER))).willReturn(new GetShardIteratorResult().withShardIterator(SHARD_ITERATOR));
String stream = underTest.getShardIterator(STREAM, SHARD_1, ShardIteratorType.AT_SEQUENCE_NUMBER, SEQUENCE_NUMBER, null);
assertThat(stream).isEqualTo(SHARD_ITERATOR);
}
Aggregations