Fix tests after RecordingProperties#ignoreFailedStreams

pull/630/head
pabloFuente 2021-05-11 14:15:02 +02:00
parent c32548b8a2
commit 390aca598b
4 changed files with 41 additions and 21 deletions

View File

@ -192,6 +192,15 @@ public class Recording {
return this.recordingProperties.customLayout(); 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 * Session associated to the recording
*/ */

View File

@ -216,16 +216,17 @@ public class RecordingProperties {
* starting the recording. This property only applies to * starting the recording. This property only applies to
* {@link io.openvidu.java.client.Recording.OutputMode#INDIVIDUAL} recordings. * {@link io.openvidu.java.client.Recording.OutputMode#INDIVIDUAL} recordings.
* For this type of recordings, when calling * For this type of recordings, when calling
* {@link io.openvidu.java.client.OpenVidu#startRecording} by default all the * {@link io.openvidu.java.client.OpenVidu#startRecording(String, RecordingProperties)}
* streams available at the moment the recording process starts must be healthy * by default all the streams available at the moment the recording process
* and properly sending media. If some stream that should be sending media is * starts must be healthy and properly sending media. If some stream that should
* broken, then the recording process fails after a 10s timeout. In this way * be sending media is broken, then the recording process fails after a 10s
* your application is notified that some stream is not being recorded, so it * timeout. In this way your application is notified that some stream is not
* can retry the process again. But you can disable this rollback behavior and * being recorded, so it can retry the process again. But you can disable this
* simply ignore any failed stream, which will be susceptible to be recorded in * rollback behavior and simply ignore any failed stream, which will be
* the future if media starts flowing as expected at any point. The downside of * susceptible to be recorded in the future if media starts flowing as expected
* this behavior is that you will have no guarantee that all streams present at * at any point. The downside of this behavior is that you will have no
* the beginning of a recording are actually being recorded. * guarantee that all streams present at the beginning of a recording are
* actually being recorded.
*/ */
public RecordingProperties.Builder ignoreFailedStreams(boolean ignoreFailedStreams) { public RecordingProperties.Builder ignoreFailedStreams(boolean ignoreFailedStreams) {
this.ignoreFailedStreams = ignoreFailedStreams; this.ignoreFailedStreams = ignoreFailedStreams;
@ -402,16 +403,17 @@ public class RecordingProperties {
* This property only applies to * This property only applies to
* {@link io.openvidu.java.client.Recording.OutputMode#INDIVIDUAL} recordings. * {@link io.openvidu.java.client.Recording.OutputMode#INDIVIDUAL} recordings.
* For this type of recordings, when calling * For this type of recordings, when calling
* {@link io.openvidu.java.client.OpenVidu#startRecording} by default all the * {@link io.openvidu.java.client.OpenVidu#startRecording(String, RecordingProperties)}
* streams available at the moment the recording process starts must be healthy * by default all the streams available at the moment the recording process
* and properly sending media. If some stream that should be sending media is * starts must be healthy and properly sending media. If some stream that should
* broken, then the recording process fails after a 10s timeout. In this way * be sending media is broken, then the recording process fails after a 10s
* your application is notified that some stream is not being recorded, so it * timeout. In this way your application is notified that some stream is not
* can retry the process again. But you can disable this rollback behavior and * being recorded, so it can retry the process again. But you can disable this
* simply ignore any failed stream, which will be susceptible to be recorded in * rollback behavior and simply ignore any failed stream, which will be
* the future if media starts flowing as expected at any point. The downside of * susceptible to be recorded in the future if media starts flowing as expected
* this behavior is that you will have no guarantee that all streams present at * at any point. The downside of this behavior is that you will have no
* the beginning of a recording are actually being recorded.<br> * guarantee that all streams present at the beginning of a recording are
* actually being recorded.<br>
* <br> * <br>
* *
* Default to false * 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()); builder.ignoreFailedStreams(json.get("ignoreFailedStreams").getAsBoolean());
} }
if (json.has("mediaNode")) { if (json.has("mediaNode")) {

View File

@ -156,6 +156,7 @@ export class OpenVidu {
outputMode: properties.outputMode, outputMode: properties.outputMode,
recordingLayout: properties.recordingLayout, recordingLayout: properties.recordingLayout,
customLayout: properties.customLayout, customLayout: properties.customLayout,
ignoreFailedStreams: properties.ignoreFailedStreams,
resolution: properties.resolution, resolution: properties.resolution,
frameRate: properties.frameRate, frameRate: properties.frameRate,
hasAudio: properties.hasAudio, hasAudio: properties.hasAudio,

View File

@ -2304,6 +2304,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
Assert.assertEquals("Wrong recording mode", RecordingMode.ALWAYS, session.getProperties().recordingMode()); Assert.assertEquals("Wrong recording mode", RecordingMode.ALWAYS, session.getProperties().recordingMode());
Assert.assertEquals("Wrong default output mode", Recording.OutputMode.INDIVIDUAL, Assert.assertEquals("Wrong default output mode", Recording.OutputMode.INDIVIDUAL,
session.getProperties().defaultRecordingProperties().outputMode()); session.getProperties().defaultRecordingProperties().outputMode());
Assert.assertEquals("Wrong default ignoreFailedStreams", false,
session.getProperties().defaultRecordingProperties().ignoreFailedStreams());
Assert.assertTrue("Session should be being recorded", session.isBeingRecorded()); Assert.assertTrue("Session should be being recorded", session.isBeingRecorded());
Assert.assertEquals("Expected 2 active connections but found " + session.getActiveConnections().size(), 2, Assert.assertEquals("Expected 2 active connections but found " + session.getActiveConnections().size(), 2,
session.getActiveConnections().size()); session.getActiveConnections().size());
@ -2483,6 +2485,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
Assert.assertEquals("Wrong recording size", 0, recording.getSize()); Assert.assertEquals("Wrong recording size", 0, recording.getSize());
Assert.assertNull("Wrong recording url", recording.getUrl()); Assert.assertNull("Wrong recording url", recording.getUrl());
Assert.assertEquals("Wrong recording output mode", Recording.OutputMode.INDIVIDUAL, recording.getOutputMode()); 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 layout", recording.getRecordingLayout());
Assert.assertNull("Wrong recording custom layout", recording.getCustomLayout()); Assert.assertNull("Wrong recording custom layout", recording.getCustomLayout());
Assert.assertNull("Wrong recording resolution", recording.getResolution()); 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("add-user-btn")).click();
user.getDriver().findElement(By.id("session-settings-btn-0")).click(); user.getDriver().findElement(By.id("session-settings-btn-0")).click();
Thread.sleep(1000); 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(); user.getDriver().findElement(By.id("recording-mode-select")).click();
Thread.sleep(500); Thread.sleep(500);
user.getDriver().findElement(By.id("option-ALWAYS")).click(); 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", Assert.assertEquals("Wrong recording startTime/timestamp in webhook event",
event.get("startTime").getAsLong(), event.get("timestamp").getAsLong()); event.get("startTime").getAsLong(), event.get("timestamp").getAsLong());
Assert.assertNull("Wrong recording reason in webhook event (should be null)", event.get("reason")); 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 // Filter event webhook
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .filter-btn")).click(); user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .filter-btn")).click();