in src/integrationtests/java/com/aws/iot/integrationtests/edgeconnectorforkvs/videouploader/VideoUploaderIntegrationTest.java [106:140]
public void uploadHistoricalVideo_1MinRecWithin5min_noExceptions() {
long videoRecordPeriod = 20;
long videoPeriodToUpload = 5;
Assumptions.assumeTrue(tempDir != null && sampleFilePath != null);
// Create KVS Stream
Assumptions.assumeTrue(createKvsStream(awsCredentials, region, KVS_STREAM_NAME, 1));
// Setup video files
Path recordFilePath = Paths.get(tempDir.toString(), "record_60_minutes");
Instant now = Instant.now();
Assumptions.assumeTrue(
generateVideoFiles(recordFilePath, sampleFilePath, SAMPLE_MKV_DURATION_MS,
new Date(now.toEpochMilli() - TimeUnit.MINUTES.toMillis(videoRecordPeriod)),
new Date(now.toEpochMilli())));
// Setup test
VideoUploaderClient videoUploaderClient = VideoUploaderClient.builder()
.awsCredentialsProvider(new AWSStaticCredentialsProvider(awsCredentials))
.region(region)
.recordFilePath(recordFilePath.toString())
.kvsStreamName(KVS_STREAM_NAME)
.build();
Date testStart = Date.from(Instant.now());
Assertions.assertDoesNotThrow(() ->
videoUploaderClient.uploadHistoricalVideo(
new Date(now.toEpochMilli() - TimeUnit.MINUTES.toMillis(videoPeriodToUpload)),
new Date(now.toEpochMilli()),
null,
null));
Date testEnd = Date.from(Instant.now());
log.info("Time cost: " + (testEnd.getTime() - testStart.getTime()) + " ms");
}