use of com.amazonaws.services.kinesisvideo.model.StreamInfo in project aws-iot-greengrass-edge-connector-for-kinesis-video-stream by awslabs.
the class EdgeConnectorForKVSService method initKinesisVideoStream.
private void initKinesisVideoStream() {
for (EdgeConnectorForKVSConfiguration configuration : edgeConnectorForKVSConfigurationList) {
String kinesisVideoStreamName = configuration.getKinesisVideoStreamName();
Optional<StreamInfo> result = kvsClient.describeStream(kinesisVideoStreamName);
if (!result.isPresent()) {
log.info("Configured KinesisVideoStream name :" + kinesisVideoStreamName + " does not exist, creating it ...");
kvsClient.createStream(kinesisVideoStreamName);
log.info("Created KinesisVideoStream name :" + kinesisVideoStreamName);
}
}
}
use of com.amazonaws.services.kinesisvideo.model.StreamInfo in project aws-iot-greengrass-edge-connector-for-kinesis-video-stream by awslabs.
the class KvsClientTest method describeStream_ResourceNotFound.
@Test
public void describeStream_ResourceNotFound() {
// when
when(amazonKinesisVideoClient.describeStream(any())).thenThrow(new ResourceNotFoundException(""));
// then
Optional<StreamInfo> result = kvsClient.describeStream(STREAM_NAME);
// verify
assertFalse(result.isPresent());
}
use of com.amazonaws.services.kinesisvideo.model.StreamInfo in project aws-iot-greengrass-edge-connector-for-kinesis-video-stream by awslabs.
the class KvsClientTest method testRegionOverride.
@Test
public void testRegionOverride() {
// when
this.kvsClient = new KvsClient(awsCredentialsProvider, region);
DescribeStreamResult describeStreamResult = new DescribeStreamResult().withStreamInfo(new StreamInfo().withStreamName(STREAM_NAME));
when(amazonKinesisVideoClient.describeStream(any())).thenReturn(describeStreamResult);
// then and verify
assertThrows(EdgeConnectorForKVSException.class, () -> {
kvsClient.describeStream(STREAM_NAME);
});
}
use of com.amazonaws.services.kinesisvideo.model.StreamInfo in project aws-iot-greengrass-edge-connector-for-kinesis-video-stream by awslabs.
the class KvsClientTest method describeStream_Success.
@Test
public void describeStream_Success() {
// when
DescribeStreamResult describeStreamResult = new DescribeStreamResult().withStreamInfo(new StreamInfo().withStreamName(STREAM_NAME));
when(amazonKinesisVideoClient.describeStream(any())).thenReturn(describeStreamResult);
// then
Optional<StreamInfo> result = kvsClient.describeStream(STREAM_NAME);
// verify
assertEquals(result.get().getStreamName(), STREAM_NAME);
}
Aggregations