mirror of https://github.com/OpenVidu/openvidu.git
Fix tests
parent
b76ec484e5
commit
cfc704c665
|
@ -203,7 +203,7 @@ public class OpenVidu {
|
|||
json.addProperty("hasAudio", properties.hasAudio());
|
||||
json.addProperty("hasVideo", properties.hasVideo());
|
||||
|
||||
if ((Recording.OutputMode.COMPOSED.equals(properties.outputMode())
|
||||
if ((properties.outputMode() == null || Recording.OutputMode.COMPOSED.equals(properties.outputMode())
|
||||
|| (Recording.OutputMode.COMPOSED_QUICK_START.equals(properties.outputMode())))
|
||||
&& properties.hasVideo()) {
|
||||
json.addProperty("resolution", properties.resolution());
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
package io.openvidu.java.client;
|
||||
|
||||
import io.openvidu.java.client.Recording.OutputMode;
|
||||
|
||||
/**
|
||||
* See
|
||||
* {@link io.openvidu.java.client.OpenVidu#startRecording(String, RecordingProperties)}
|
||||
|
@ -41,7 +39,7 @@ public class RecordingProperties {
|
|||
public static class Builder {
|
||||
|
||||
private String name = "";
|
||||
private Recording.OutputMode outputMode = Recording.OutputMode.COMPOSED;
|
||||
private Recording.OutputMode outputMode;
|
||||
private RecordingLayout recordingLayout;
|
||||
private String customLayout;
|
||||
private String resolution;
|
||||
|
@ -54,14 +52,6 @@ public class RecordingProperties {
|
|||
* Builder for {@link io.openvidu.java.client.RecordingProperties}
|
||||
*/
|
||||
public RecordingProperties build() {
|
||||
if (OutputMode.COMPOSED.equals(this.outputMode)
|
||||
|| OutputMode.COMPOSED_QUICK_START.equals(this.outputMode)) {
|
||||
this.recordingLayout = this.recordingLayout != null ? this.recordingLayout : RecordingLayout.BEST_FIT;
|
||||
this.resolution = this.resolution != null ? this.resolution : "1920x1080";
|
||||
if (RecordingLayout.CUSTOM.equals(this.recordingLayout)) {
|
||||
this.customLayout = this.customLayout != null ? this.customLayout : "";
|
||||
}
|
||||
}
|
||||
return new RecordingProperties(this.name, this.outputMode, this.recordingLayout, this.customLayout,
|
||||
this.resolution, this.hasAudio, this.hasVideo, this.shmSize, this.mediaNode);
|
||||
}
|
||||
|
|
|
@ -163,7 +163,10 @@ public class ComposedQuickStartRecordingService extends ComposedRecordingService
|
|||
runContainer(recorderSession, new RecordingProperties.Builder().name("")
|
||||
.outputMode(recorderSession.getSessionProperties().defaultOutputMode())
|
||||
.recordingLayout(recorderSession.getSessionProperties().defaultRecordingLayout())
|
||||
.customLayout(recorderSession.getSessionProperties().defaultCustomLayout()).build());
|
||||
.customLayout(recorderSession.getSessionProperties().defaultCustomLayout())
|
||||
.resolution(
|
||||
/* recorderSession.getSessionProperties().defaultRecordingResolution() */"1920x1080")
|
||||
.build());
|
||||
log.info("COMPOSED_QUICK_START recording container launched for session: {}",
|
||||
recorderSession.getSessionId());
|
||||
launched = true;
|
||||
|
|
|
@ -959,11 +959,21 @@ public class SessionRestController {
|
|||
throw new RuntimeException("Cannot start a recording with both \"hasAudio\" and \"hasVideo\" set to false");
|
||||
}
|
||||
|
||||
// If outputMode is COMPOSED when defaultOutputMode is COMPOSED_QUICK_START,
|
||||
// change outputMode to COMPOSED_QUICK_START (and vice versa)
|
||||
OutputMode defaultOutputMode = sessionProperties.defaultOutputMode();
|
||||
if (OutputMode.COMPOSED_QUICK_START.equals(defaultOutputMode) && OutputMode.COMPOSED.equals(finalOutputMode)) {
|
||||
finalOutputMode = OutputMode.COMPOSED_QUICK_START;
|
||||
} else if (OutputMode.COMPOSED.equals(defaultOutputMode)
|
||||
&& OutputMode.COMPOSED_QUICK_START.equals(finalOutputMode)) {
|
||||
finalOutputMode = OutputMode.COMPOSED;
|
||||
}
|
||||
|
||||
builder.outputMode(finalOutputMode == null ? sessionProperties.defaultOutputMode() : finalOutputMode);
|
||||
if (RecordingUtils.IS_COMPOSED(finalOutputMode)) {
|
||||
if (resolution != null) {
|
||||
builder.resolution(resolution);
|
||||
}
|
||||
builder.resolution(resolution != null ? resolution : "1920x1080"); // resolution == null ?
|
||||
// sessionProperties.defaultRecordingResolution)
|
||||
// : resolution));
|
||||
builder.recordingLayout(
|
||||
recordingLayout == null ? sessionProperties.defaultRecordingLayout() : recordingLayout);
|
||||
if (RecordingLayout.CUSTOM.equals(recordingLayout)) {
|
||||
|
|
|
@ -486,17 +486,47 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
|
||||
log.info("openvidu-java-client PRO test");
|
||||
|
||||
// Create default Connection
|
||||
Session session = OV.createSession();
|
||||
Assert.assertFalse(session.fetch());
|
||||
Connection connection = session.createConnection();
|
||||
Connection connectionDefault = session.createConnection();
|
||||
Assert.assertFalse(session.fetch());
|
||||
Assert.assertEquals("Wrong role property", OpenViduRole.PUBLISHER, connection.getRole());
|
||||
Assert.assertTrue("Wrong record property", connection.record());
|
||||
session.updateConnection(connection.getConnectionId(),
|
||||
new ConnectionProperties.Builder().role(OpenViduRole.SUBSCRIBER).record(false).build());
|
||||
Assert.assertEquals("Wrong role property", OpenViduRole.SUBSCRIBER, connection.getRole());
|
||||
Assert.assertEquals("Wrong role property", OpenViduRole.PUBLISHER, connectionDefault.getRole());
|
||||
Assert.assertTrue("Wrong record property", connectionDefault.record());
|
||||
Assert.assertEquals("Wrong data property", "", connectionDefault.getServerData());
|
||||
// Update Connection
|
||||
session.updateConnection(connectionDefault.getConnectionId(), new ConnectionProperties.Builder()
|
||||
.role(OpenViduRole.SUBSCRIBER).record(false).data("WILL HAVE NO EFFECT").build());
|
||||
Assert.assertEquals("Wrong role property", OpenViduRole.SUBSCRIBER, connectionDefault.getRole());
|
||||
Assert.assertFalse("Wrong record property", connectionDefault.record());
|
||||
Assert.assertEquals("Wrong data property", "", connectionDefault.getServerData());
|
||||
Assert.assertFalse(session.fetch());
|
||||
|
||||
// Create custom properties Connection
|
||||
long timestamp = System.currentTimeMillis();
|
||||
Connection connection = session.createConnection(
|
||||
new ConnectionProperties.Builder().record(false).role(OpenViduRole.MODERATOR).data("SERVER_SIDE_DATA")
|
||||
.kurentoOptions(new KurentoOptions.Builder().videoMaxRecvBandwidth(555)
|
||||
.videoMinRecvBandwidth(555).videoMaxSendBandwidth(555).videoMinSendBandwidth(555)
|
||||
.allowedFilters(new String[] { "555" }).build())
|
||||
.build());
|
||||
Assert.assertEquals("Wrong status Connection property", "pending", connection.getStatus());
|
||||
Assert.assertTrue("Wrong timestamp Connection property", connection.createdAt() > timestamp);
|
||||
Assert.assertTrue("Wrong activeAt Connection property", connection.activeAt() == null);
|
||||
Assert.assertTrue("Wrong location Connection property", connection.getLocation() == null);
|
||||
Assert.assertTrue("Wrong platform Connection property", connection.getPlatform() == null);
|
||||
Assert.assertTrue("Wrong clientData Connection property", connection.getClientData() == null);
|
||||
Assert.assertTrue("Wrong publishers Connection property", connection.getPublishers().size() == 0);
|
||||
Assert.assertTrue("Wrong subscribers Connection property", connection.getSubscribers().size() == 0);
|
||||
Assert.assertTrue("Wrong token Connection property", connection.getToken().contains(session.getSessionId()));
|
||||
Assert.assertEquals("Wrong type property", ConnectionType.WEBRTC, connection.getType());
|
||||
Assert.assertEquals("Wrong data property", "SERVER_SIDE_DATA", connection.getServerData());
|
||||
Assert.assertFalse("Wrong record property", connection.record());
|
||||
Assert.assertFalse(session.fetch());
|
||||
Assert.assertEquals("Wrong role property", OpenViduRole.MODERATOR, connection.getRole());
|
||||
Assert.assertTrue("Wrong rtspUri property", connection.getRtspUri() == null);
|
||||
Assert.assertTrue("Wrong adaptativeBitrate property", connection.adaptativeBitrate() == null);
|
||||
Assert.assertTrue("Wrong onlyPlayWithSubscribers property", connection.onlyPlayWithSubscribers() == null);
|
||||
Assert.assertTrue("Wrong networkCache property", connection.getNetworkCache() == null);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -2295,7 +2295,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
// Verify publisher properties
|
||||
Publisher pub = connectionModerator.getPublishers().get(0);
|
||||
Assert.assertEquals("{\"width\":640,\"height\":480}", pub.getVideoDimensions());
|
||||
Assert.assertEquals(new Integer(30), pub.getFrameRate());
|
||||
Assert.assertEquals(Integer.valueOf(30), pub.getFrameRate());
|
||||
Assert.assertEquals("CAMERA", pub.getTypeOfVideo());
|
||||
Assert.assertTrue(pub.hasVideo());
|
||||
Assert.assertTrue(pub.isVideoActive());
|
||||
|
@ -2341,7 +2341,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
Assert.assertEquals(
|
||||
"{\"width\":" + obj.get("width").getAsLong() + ",\"height\":" + obj.get("height").getAsLong() + "}",
|
||||
pub.getVideoDimensions());
|
||||
Assert.assertEquals(new Integer(30), pub.getFrameRate());
|
||||
Assert.assertEquals(Integer.valueOf(30), pub.getFrameRate());
|
||||
Assert.assertEquals("SCREEN", pub.getTypeOfVideo());
|
||||
Assert.assertTrue(pub.hasVideo());
|
||||
Assert.assertTrue(pub.isVideoActive());
|
||||
|
@ -2352,6 +2352,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
RecordingProperties recordingProperties;
|
||||
try {
|
||||
OV.startRecording("NOT_EXISTS");
|
||||
Assert.fail("Expected OpenViduHttpException");
|
||||
} catch (OpenViduHttpException e) {
|
||||
Assert.assertEquals("Wrong HTTP status on OpenVidu.startRecording()", 404, e.getStatus());
|
||||
}
|
||||
|
@ -2359,6 +2360,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
Assert.assertFalse("OpenVidu.fetch() should return false", OV.fetch());
|
||||
try {
|
||||
OV.startRecording(sessionAux.getSessionId());
|
||||
Assert.fail("Expected OpenViduHttpException");
|
||||
} catch (OpenViduHttpException e) {
|
||||
Assert.assertEquals("Wrong HTTP status on OpenVidu.startRecording()", 406, e.getStatus());
|
||||
} finally {
|
||||
|
@ -2366,25 +2368,49 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
sessionAux.close();
|
||||
try {
|
||||
sessionAux.fetch();
|
||||
Assert.fail("Expected OpenViduHttpException");
|
||||
} catch (OpenViduHttpException e2) {
|
||||
Assert.assertEquals("Wrong HTTP status on Session.fetch()", 404, e2.getStatus());
|
||||
}
|
||||
Assert.assertFalse("OpenVidu.fetch() should return false", OV.fetch());
|
||||
}
|
||||
// Not recorded session
|
||||
Session notRecordedSession = OV.createSession();
|
||||
notRecordedSession.createConnection(new ConnectionProperties.Builder().type(ConnectionType.IPCAM)
|
||||
.rtspUri("rtsp://does-not-matter.com").build());
|
||||
try {
|
||||
recordingProperties = new RecordingProperties.Builder().hasAudio(false).hasVideo(false).build();
|
||||
OV.startRecording(session.getSessionId(), recordingProperties);
|
||||
OV.startRecording(notRecordedSession.getSessionId(), recordingProperties);
|
||||
Assert.fail("Expected OpenViduHttpException");
|
||||
} catch (OpenViduHttpException e) {
|
||||
Assert.assertEquals("Wrong HTTP status on OpenVidu.startRecording()", 422, e.getStatus());
|
||||
}
|
||||
try {
|
||||
recordingProperties = new RecordingProperties.Builder().resolution("99x1080").build();
|
||||
OV.startRecording(session.getSessionId(), recordingProperties);
|
||||
OV.startRecording(notRecordedSession.getSessionId(), recordingProperties);
|
||||
Assert.fail("Expected OpenViduHttpException");
|
||||
} catch (OpenViduHttpException e) {
|
||||
Assert.assertEquals("Wrong HTTP status on OpenVidu.startRecording()", 422, e.getStatus());
|
||||
}
|
||||
notRecordedSession.close();
|
||||
// Recorded session
|
||||
try {
|
||||
recordingProperties = new RecordingProperties.Builder().hasAudio(false).hasVideo(false).build();
|
||||
OV.startRecording(session.getSessionId(), recordingProperties);
|
||||
Assert.fail("Expected OpenViduHttpException");
|
||||
} catch (OpenViduHttpException e) {
|
||||
Assert.assertEquals("Wrong HTTP status on OpenVidu.startRecording()", 409, e.getStatus());
|
||||
}
|
||||
try {
|
||||
recordingProperties = new RecordingProperties.Builder().resolution("99x1080").build();
|
||||
OV.startRecording(session.getSessionId(), recordingProperties);
|
||||
Assert.fail("Expected OpenViduHttpException");
|
||||
} catch (OpenViduHttpException e) {
|
||||
Assert.assertEquals("Wrong HTTP status on OpenVidu.startRecording()", 409, e.getStatus());
|
||||
}
|
||||
try {
|
||||
OV.startRecording(session.getSessionId());
|
||||
Assert.fail("Expected OpenViduHttpException");
|
||||
} catch (OpenViduHttpException e) {
|
||||
Assert.assertEquals("Wrong HTTP status on OpenVidu.startRecording()", 409, e.getStatus());
|
||||
}
|
||||
|
@ -2580,7 +2606,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
Assert.assertEquals("Wrong property rtspUri", rtsp, ipcamera.getRtspUri());
|
||||
Assert.assertFalse("Wrong property adaptativeBitrate", ipcamera.adaptativeBitrate());
|
||||
Assert.assertFalse("Wrong property onlyPlayWithSubscribers", ipcamera.onlyPlayWithSubscribers());
|
||||
Assert.assertEquals("Wrong property networkCache", 50, ipcamera.getNetworkCache());
|
||||
Assert.assertEquals("Wrong property networkCache", Integer.valueOf(50), ipcamera.getNetworkCache());
|
||||
|
||||
gracefullyLeaveParticipants(2);
|
||||
}
|
||||
|
@ -2751,26 +2777,12 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
// 400
|
||||
body = "{}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_BAD_REQUEST);
|
||||
body = "{'session': true}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_BAD_REQUEST);
|
||||
body = "{'session':'SESSION_ID','name':999}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_BAD_REQUEST);
|
||||
body = "{'session':'SESSION_ID','name':'NAME','outputMode':'NOT_EXISTS'}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_BAD_REQUEST);
|
||||
body = "{'session':'SESSION_ID','name':'NAME','outputMode':'COMPOSED','recordingLayout':'NOT_EXISTS'}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_BAD_REQUEST);
|
||||
body = "{'session':'SESSION_ID','name':'NAME','outputMode':'COMPOSED','recordingLayout':'BEST_FIT','customLayout':'CUSTOM_LAYOUT','hasAudio':true,'hasVideo':true,'resolution':999}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_BAD_REQUEST);
|
||||
|
||||
// 422
|
||||
body = "{'session':'SESSION_ID','name':'NAME','outputMode':'COMPOSED','recordingLayout':'BEST_FIT','customLayout':'CUSTOM_LAYOUT','hasAudio':false,'hasVideo':false}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_UNPROCESSABLE_ENTITY);
|
||||
body = "{'session':'SESSION_ID','name':'NAME','outputMode':'COMPOSED','recordingLayout':'BEST_FIT','customLayout':'CUSTOM_LAYOUT','hasAudio':true,'hasVideo':true,'resolution':'1920x2000'}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_UNPROCESSABLE_ENTITY);
|
||||
|
||||
// 404
|
||||
body = "{'session':'SESSION_ID'}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_NOT_FOUND);
|
||||
body = "{'session':'SESSION_ID','name':999}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_NOT_FOUND);
|
||||
|
||||
// 406
|
||||
body = "{'session':'CUSTOM_SESSION_ID'}";
|
||||
|
@ -2839,6 +2851,24 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
"{'count':0,'items':[]}");
|
||||
|
||||
/** POST /openvidu/api/recordings/start (ACTIVE SESSION) **/
|
||||
// 400
|
||||
body = "{'session': true}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_BAD_REQUEST);
|
||||
body = "{'session':'CUSTOM_SESSION_ID','name':999}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_BAD_REQUEST);
|
||||
body = "{'session':'CUSTOM_SESSION_ID','name':'NAME','outputMode':'NOT_EXISTS'}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_BAD_REQUEST);
|
||||
body = "{'session':'CUSTOM_SESSION_ID','name':'NAME','outputMode':'COMPOSED','recordingLayout':'NOT_EXISTS'}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_BAD_REQUEST);
|
||||
body = "{'session':'CUSTOM_SESSION_ID','name':'NAME','outputMode':'COMPOSED','recordingLayout':'BEST_FIT','customLayout':'CUSTOM_LAYOUT','hasAudio':true,'hasVideo':true,'resolution':999}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_BAD_REQUEST);
|
||||
|
||||
// 422
|
||||
body = "{'session':'CUSTOM_SESSION_ID','name':'NAME','outputMode':'COMPOSED','recordingLayout':'BEST_FIT','customLayout':'CUSTOM_LAYOUT','hasAudio':false,'hasVideo':false}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_UNPROCESSABLE_ENTITY);
|
||||
body = "{'session':'CUSTOM_SESSION_ID','name':'NAME','outputMode':'COMPOSED','recordingLayout':'BEST_FIT','customLayout':'CUSTOM_LAYOUT','hasAudio':true,'hasVideo':true,'resolution':'1920x2000'}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_UNPROCESSABLE_ENTITY);
|
||||
|
||||
// 200
|
||||
body = "{'session':'CUSTOM_SESSION_ID'}";
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/recordings/start", body, HttpStatus.SC_OK, true, false, true,
|
||||
|
@ -3653,6 +3683,16 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
checkNodeFetchChanged(true, true);
|
||||
checkNodeFetchChanged(true, false);
|
||||
|
||||
// OpenVidu CE does not support Session#updateConnection method
|
||||
try {
|
||||
session.updateConnection(connection.getConnectionId(), new ConnectionProperties.Builder().build());
|
||||
Assert.fail("Expected exception was not thrown by OpenVidu Java Client");
|
||||
} catch (OpenViduHttpException e) {
|
||||
Assert.assertEquals("Wrong OpenViduException status", HttpStatus.SC_METHOD_NOT_ALLOWED, e.getStatus());
|
||||
} catch (Exception e) {
|
||||
Assert.fail("Wrong exception type thrown by OpenVidu Java Client");
|
||||
}
|
||||
|
||||
restClient.rest(HttpMethod.POST, "/openvidu/api/tokens", "{'session':'REST_SESSION'}", HttpStatus.SC_OK);
|
||||
Assert.assertFalse("Fetch should be true", session.fetch());
|
||||
Assert.assertTrue("Fetch should be false", OV.fetch());
|
||||
|
@ -3692,18 +3732,62 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
checkNodeFetchChanged(true, false);
|
||||
checkNodeFetchChanged(true, false);
|
||||
|
||||
// Create and delete connection with openvidu-node-client
|
||||
// Modify connection properties
|
||||
user.getDriver().findElement(By.id("record-checkbox")).click();
|
||||
user.getDriver().findElement(By.id("token-role-select")).click();
|
||||
Thread.sleep(500);
|
||||
user.getDriver().findElement(By.id("option-MODERATOR")).click();
|
||||
Thread.sleep(500);
|
||||
user.getDriver().findElement(By.id("connection-data-field")).sendKeys("MY_SERVER_DATA");
|
||||
|
||||
// Create Connection with openvidu-node-client
|
||||
long timestamp = System.currentTimeMillis();
|
||||
final String successMessage = "Connection created: ";
|
||||
user.getDriver().findElement(By.id("crate-connection-api-btn")).click();
|
||||
user.getWaiter()
|
||||
.until(ExpectedConditions.attributeContains(By.id("api-response-text-area"), "value", successMessage));
|
||||
String value = user.getDriver().findElement(By.id("api-response-text-area")).getAttribute("value");
|
||||
String connectionId = value.substring(value.lastIndexOf(successMessage) + successMessage.length());
|
||||
// Check openvidu-node-client Connection properties
|
||||
JsonObject connectionJson = JsonParser
|
||||
.parseString(value.substring(value.lastIndexOf(successMessage) + successMessage.length()))
|
||||
.getAsJsonObject();
|
||||
JsonObject connectionProperties = connectionJson.get("connectionProperties").getAsJsonObject();
|
||||
String connectionId = connectionJson.get("connectionId").getAsString();
|
||||
Assert.assertEquals("Wrong status Connection property", "pending", connectionJson.get("status").getAsString());
|
||||
Assert.assertTrue("Wrong timestamp Connection property",
|
||||
connectionJson.get("createdAt").getAsLong() > timestamp);
|
||||
Assert.assertTrue("Wrong activeAt Connection property", connectionJson.get("activeAt").isJsonNull());
|
||||
Assert.assertTrue("Wrong location Connection property", connectionJson.get("location").isJsonNull());
|
||||
Assert.assertTrue("Wrong platform Connection property", connectionJson.get("platform").isJsonNull());
|
||||
Assert.assertTrue("Wrong clientData Connection property", connectionJson.get("clientData").isJsonNull());
|
||||
Assert.assertTrue("Wrong publishers Connection property",
|
||||
connectionJson.get("publishers").getAsJsonArray().size() == 0);
|
||||
Assert.assertTrue("Wrong subscribers Connection property",
|
||||
connectionJson.get("subscribers").getAsJsonArray().size() == 0);
|
||||
Assert.assertTrue("Wrong token Connection property",
|
||||
connectionJson.get("token").getAsString().contains(session.getSessionId()));
|
||||
Assert.assertEquals("Wrong number of keys in connectionProperties", 9, connectionProperties.keySet().size());
|
||||
Assert.assertEquals("Wrong type property", ConnectionType.WEBRTC.name(),
|
||||
connectionProperties.get("type").getAsString());
|
||||
Assert.assertEquals("Wrong data property", "MY_SERVER_DATA", connectionProperties.get("data").getAsString());
|
||||
Assert.assertTrue("Wrong record property", connectionProperties.get("record").getAsBoolean()); // Is true in CE
|
||||
Assert.assertEquals("Wrong role property", OpenViduRole.MODERATOR.name(),
|
||||
connectionProperties.get("role").getAsString());
|
||||
Assert.assertTrue("Wrong kurentoOptions property", connectionProperties.get("kurentoOptions").isJsonNull());
|
||||
Assert.assertTrue("Wrong rtspUri property", connectionProperties.get("rtspUri").isJsonNull());
|
||||
Assert.assertTrue("Wrong adaptativeBitrate property",
|
||||
connectionProperties.get("adaptativeBitrate").isJsonNull());
|
||||
Assert.assertTrue("Wrong onlyPlayWithSubscribers property",
|
||||
connectionProperties.get("onlyPlayWithSubscribers").isJsonNull());
|
||||
Assert.assertTrue("Wrong networkCache property", connectionProperties.get("networkCache").isJsonNull());
|
||||
|
||||
Assert.assertTrue("Java fetch should be true", session.fetch());
|
||||
Assert.assertFalse("Java fetch should be false", OV.fetch());
|
||||
checkNodeFetchChanged(true, false);
|
||||
checkNodeFetchChanged(false, false);
|
||||
checkNodeFetchChanged(true, false);
|
||||
|
||||
// Delete Connection with openvidu-node-client
|
||||
user.getDriver().findElement(By.id("connection-id-field")).clear();
|
||||
user.getDriver().findElement(By.id("connection-id-field")).sendKeys(connectionId);
|
||||
user.getDriver().findElement(By.id("force-disconnect-api-btn")).click();
|
||||
|
|
|
@ -19,13 +19,16 @@
|
|||
<div style="margin-left:9px">
|
||||
<mat-checkbox class="checkbox-form" [(ngModel)]="connectionProperties.record" id="record-checkbox">Record
|
||||
</mat-checkbox>
|
||||
<mat-form-field class="inner-text-input" [style.fontSize.px]=14>
|
||||
<mat-form-field class="inner-text-input" [style.fontSize.px]=14 style="width:33%">
|
||||
<mat-select [(ngModel)]="connectionProperties.role" id="token-role-select">
|
||||
<mat-option *ngFor="let enumerator of enumToArray(openviduRoles)" [value]="enumerator">
|
||||
<span [attr.id]="'option-' + enumerator">{{ enumerator }}</span>
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="inner-text-input" [style.fontSize.px]=14 style="width:40%">
|
||||
<input matInput id="connection-data-field" placeholder="data" [(ngModel)]="connectionProperties.data">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div>
|
||||
<button mat-button id="crate-connection-api-btn" (click)="createConnection()">Create connection</button>
|
||||
|
|
|
@ -28,7 +28,8 @@ export class SessionApiDialogComponent {
|
|||
|
||||
connectionProperties: ConnectionProperties = {
|
||||
record: true,
|
||||
role: OpenViduRole.PUBLISHER
|
||||
role: OpenViduRole.PUBLISHER,
|
||||
data: ''
|
||||
};
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<SessionApiDialogComponent>,
|
||||
|
@ -176,7 +177,7 @@ export class SessionApiDialogComponent {
|
|||
console.log('Creating connection');
|
||||
this.session.createConnection(this.connectionProperties)
|
||||
.then(connection => {
|
||||
this.response = 'Connection created: ' + connection.connectionId;
|
||||
this.response = 'Connection created: ' + JSON.stringify(connection);
|
||||
})
|
||||
.catch(error => {
|
||||
this.response = 'Error [' + error.message + ']';
|
||||
|
@ -187,7 +188,11 @@ export class SessionApiDialogComponent {
|
|||
console.log('Updating connection');
|
||||
this.session.updateConnection(this.connectionId, this.connectionProperties)
|
||||
.then(modifiedConnection => {
|
||||
this.response = 'Connection updated: ' + JSON.stringify({ role: modifiedConnection.connectionProperties.role, record: modifiedConnection.connectionProperties.record });
|
||||
this.response = 'Connection updated: ' + JSON.stringify({
|
||||
role: modifiedConnection.connectionProperties.role,
|
||||
record: modifiedConnection.connectionProperties.record,
|
||||
data: modifiedConnection.connectionProperties.data
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
this.response = 'Error [' + error.message + ']';
|
||||
|
|
Loading…
Reference in New Issue