public void producerConsumerTest_loop_fileStore()

in src/integrationtests/java/com/aws/iot/integrationtests/edgeconnectorforkvs/videorecorder/VideoRecorderPipeConsumerTest.java [69:107]


    public void producerConsumerTest_loop_fileStore() throws InterruptedException, IOException {
        VideoRecorderBuilder builder = new VideoRecorderBuilder((recorder, status, description) -> {
            System.out.println("Status changed: " + status + ", description: " + description);
            Assertions.assertNotEquals(RecorderStatus.FAILED, status);
        });
        builder.registerCamera(CameraType.RTSP, RTSP_URL);
        builder.registerAppDataCallback(ContainerType.MATROSKA, (recorder, bBuff) -> {
        });
        builder.registerAppDataOutputStream(ContainerType.MATROSKA, new ByteArrayOutputStream());

        final VideoRecorder recorder = builder.construct();
        new Thread(() -> recorder.startRecording()).start();

        isConsumerRunning = false;

        for (int i = 0; i < 3; ++i) {
            initPipedStream();

            System.out.println(String.format("Toggle %d ", i));

            isConsumerRunning = true;
            new Thread(() -> consumerRun()).start();
            recorder.setAppDataOutputStream(pipedOs);
            recorder.toggleAppDataOutputStream(true);
            TimeUnit.SECONDS.sleep(this.TEST_IDLE_INTERVAL);

            recorder.toggleAppDataOutputStream(false);
            isConsumerRunning = false;
            TimeUnit.SECONDS.sleep(1);

            int len = byteOut.toByteArray().length;
            System.out.println("consumer len = " + len);
            Assertions.assertTrue(len > 0);

            closeStreams();
        }

        recorder.stopRecording();
    }