From 390aca598bc91e446b3f6a4c5fa9409130443e91 Mon Sep 17 00:00:00 2001 From: pabloFuente Date: Tue, 11 May 2021 14:15:02 +0200 Subject: [PATCH] Fix tests after RecordingProperties#ignoreFailedStreams --- .../io/openvidu/java/client/Recording.java | 9 ++++ .../java/client/RecordingProperties.java | 44 ++++++++++--------- openvidu-node-client/src/OpenVidu.ts | 1 + .../test/e2e/OpenViduTestAppE2eTest.java | 8 ++++ 4 files changed, 41 insertions(+), 21 deletions(-) diff --git a/openvidu-java-client/src/main/java/io/openvidu/java/client/Recording.java b/openvidu-java-client/src/main/java/io/openvidu/java/client/Recording.java index 36e7152d..a70f8c0d 100644 --- a/openvidu-java-client/src/main/java/io/openvidu/java/client/Recording.java +++ b/openvidu-java-client/src/main/java/io/openvidu/java/client/Recording.java @@ -192,6 +192,15 @@ public class Recording { return this.recordingProperties.customLayout(); } + /** + * Whether failed streams were ignored when the recording process started or + * not. Only applicable if {@link io.openvidu.java.client.Recording.OutputMode} + * is {@link io.openvidu.java.client.Recording.OutputMode#INDIVIDUAL} + */ + public boolean ignoreFailedStreams() { + return this.recordingProperties.ignoreFailedStreams(); + } + /** * Session associated to the recording */ diff --git a/openvidu-java-client/src/main/java/io/openvidu/java/client/RecordingProperties.java b/openvidu-java-client/src/main/java/io/openvidu/java/client/RecordingProperties.java index 8ec22466..2e3a5ec4 100644 --- a/openvidu-java-client/src/main/java/io/openvidu/java/client/RecordingProperties.java +++ b/openvidu-java-client/src/main/java/io/openvidu/java/client/RecordingProperties.java @@ -216,16 +216,17 @@ public class RecordingProperties { * starting the recording. This property only applies to * {@link io.openvidu.java.client.Recording.OutputMode#INDIVIDUAL} recordings. * For this type of recordings, when calling - * {@link io.openvidu.java.client.OpenVidu#startRecording} by default all the - * streams available at the moment the recording process starts must be healthy - * and properly sending media. If some stream that should be sending media is - * broken, then the recording process fails after a 10s timeout. In this way - * your application is notified that some stream is not being recorded, so it - * can retry the process again. But you can disable this rollback behavior and - * simply ignore any failed stream, which will be susceptible to be recorded in - * the future if media starts flowing as expected at any point. The downside of - * this behavior is that you will have no guarantee that all streams present at - * the beginning of a recording are actually being recorded. + * {@link io.openvidu.java.client.OpenVidu#startRecording(String, RecordingProperties)} + * by default all the streams available at the moment the recording process + * starts must be healthy and properly sending media. If some stream that should + * be sending media is broken, then the recording process fails after a 10s + * timeout. In this way your application is notified that some stream is not + * being recorded, so it can retry the process again. But you can disable this + * rollback behavior and simply ignore any failed stream, which will be + * susceptible to be recorded in the future if media starts flowing as expected + * at any point. The downside of this behavior is that you will have no + * guarantee that all streams present at the beginning of a recording are + * actually being recorded. */ public RecordingProperties.Builder ignoreFailedStreams(boolean ignoreFailedStreams) { this.ignoreFailedStreams = ignoreFailedStreams; @@ -402,16 +403,17 @@ public class RecordingProperties { * This property only applies to * {@link io.openvidu.java.client.Recording.OutputMode#INDIVIDUAL} recordings. * For this type of recordings, when calling - * {@link io.openvidu.java.client.OpenVidu#startRecording} by default all the - * streams available at the moment the recording process starts must be healthy - * and properly sending media. If some stream that should be sending media is - * broken, then the recording process fails after a 10s timeout. In this way - * your application is notified that some stream is not being recorded, so it - * can retry the process again. But you can disable this rollback behavior and - * simply ignore any failed stream, which will be susceptible to be recorded in - * the future if media starts flowing as expected at any point. The downside of - * this behavior is that you will have no guarantee that all streams present at - * the beginning of a recording are actually being recorded.
+ * {@link io.openvidu.java.client.OpenVidu#startRecording(String, RecordingProperties)} + * by default all the streams available at the moment the recording process + * starts must be healthy and properly sending media. If some stream that should + * be sending media is broken, then the recording process fails after a 10s + * timeout. In this way your application is notified that some stream is not + * being recorded, so it can retry the process again. But you can disable this + * rollback behavior and simply ignore any failed stream, which will be + * susceptible to be recorded in the future if media starts flowing as expected + * at any point. The downside of this behavior is that you will have no + * guarantee that all streams present at the beginning of a recording are + * actually being recorded.
*
* * Default to false @@ -510,7 +512,7 @@ public class RecordingProperties { } } } - if (OutputMode.INDIVIDUAL.equals(outputModeAux)) { + if (json.has("ignoreFailedStreams") && OutputMode.INDIVIDUAL.equals(outputModeAux)) { builder.ignoreFailedStreams(json.get("ignoreFailedStreams").getAsBoolean()); } if (json.has("mediaNode")) { diff --git a/openvidu-node-client/src/OpenVidu.ts b/openvidu-node-client/src/OpenVidu.ts index 28d59d32..672786f9 100644 --- a/openvidu-node-client/src/OpenVidu.ts +++ b/openvidu-node-client/src/OpenVidu.ts @@ -156,6 +156,7 @@ export class OpenVidu { outputMode: properties.outputMode, recordingLayout: properties.recordingLayout, customLayout: properties.customLayout, + ignoreFailedStreams: properties.ignoreFailedStreams, resolution: properties.resolution, frameRate: properties.frameRate, hasAudio: properties.hasAudio, diff --git a/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/OpenViduTestAppE2eTest.java b/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/OpenViduTestAppE2eTest.java index 4f414ca6..6544ea1f 100644 --- a/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/OpenViduTestAppE2eTest.java +++ b/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/OpenViduTestAppE2eTest.java @@ -2304,6 +2304,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { Assert.assertEquals("Wrong recording mode", RecordingMode.ALWAYS, session.getProperties().recordingMode()); Assert.assertEquals("Wrong default output mode", Recording.OutputMode.INDIVIDUAL, session.getProperties().defaultRecordingProperties().outputMode()); + Assert.assertEquals("Wrong default ignoreFailedStreams", false, + session.getProperties().defaultRecordingProperties().ignoreFailedStreams()); Assert.assertTrue("Session should be being recorded", session.isBeingRecorded()); Assert.assertEquals("Expected 2 active connections but found " + session.getActiveConnections().size(), 2, session.getActiveConnections().size()); @@ -2483,6 +2485,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { Assert.assertEquals("Wrong recording size", 0, recording.getSize()); Assert.assertNull("Wrong recording url", recording.getUrl()); Assert.assertEquals("Wrong recording output mode", Recording.OutputMode.INDIVIDUAL, recording.getOutputMode()); + Assert.assertEquals("Wrong recording ignoreFailedStreams", false, recording.ignoreFailedStreams()); Assert.assertNull("Wrong recording layout", recording.getRecordingLayout()); Assert.assertNull("Wrong recording custom layout", recording.getCustomLayout()); Assert.assertNull("Wrong recording resolution", recording.getResolution()); @@ -3370,6 +3373,9 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { user.getDriver().findElement(By.id("add-user-btn")).click(); user.getDriver().findElement(By.id("session-settings-btn-0")).click(); Thread.sleep(1000); + + String rareCharsName = "öæééEstoSi`+´çḈ€$"; + user.getDriver().findElement(By.id("recording-name-field")).sendKeys(rareCharsName); user.getDriver().findElement(By.id("recording-mode-select")).click(); Thread.sleep(500); user.getDriver().findElement(By.id("option-ALWAYS")).click(); @@ -3413,6 +3419,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest { Assert.assertEquals("Wrong recording startTime/timestamp in webhook event", event.get("startTime").getAsLong(), event.get("timestamp").getAsLong()); Assert.assertNull("Wrong recording reason in webhook event (should be null)", event.get("reason")); + Assert.assertEquals("Wrong recording name in webhook event", rareCharsName, + event.get("name").getAsString()); // Filter event webhook user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .filter-btn")).click();