mirror of https://github.com/OpenVidu/openvidu.git
openvidu-test-e2e: obtain broadcast container IP dynamically
parent
a1b7081f9d
commit
13651e8a76
|
@ -6,6 +6,7 @@ import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
@ -24,6 +25,7 @@ import java.util.concurrent.TimeoutException;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import org.apache.commons.validator.routines.InetAddressValidator;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.openqa.selenium.By;
|
import org.openqa.selenium.By;
|
||||||
|
@ -85,7 +87,6 @@ public class OpenViduTestE2e {
|
||||||
protected static String OPENVIDU_PRO_SPEECH_TO_TEXT = "vosk";
|
protected static String OPENVIDU_PRO_SPEECH_TO_TEXT = "vosk";
|
||||||
protected static String DOCKERHUB_PRIVATE_REGISTRY_PASSWORD = "not_valid";
|
protected static String DOCKERHUB_PRIVATE_REGISTRY_PASSWORD = "not_valid";
|
||||||
protected static String EXTERNAL_CUSTOM_LAYOUT_PARAMS = "sessionId,CUSTOM_LAYOUT_SESSION,secret,MY_SECRET";
|
protected static String EXTERNAL_CUSTOM_LAYOUT_PARAMS = "sessionId,CUSTOM_LAYOUT_SESSION,secret,MY_SECRET";
|
||||||
protected static String BROADCAST_IP = "172.17.0.1";
|
|
||||||
|
|
||||||
protected static String AWS_REGION = "fakeRegion";
|
protected static String AWS_REGION = "fakeRegion";
|
||||||
protected static String AWS_ACCESS_KEY_ID = "fakeKey";
|
protected static String AWS_ACCESS_KEY_ID = "fakeKey";
|
||||||
|
@ -358,12 +359,6 @@ public class OpenViduTestE2e {
|
||||||
OPENVIDU_DEPLOYMENT = openviduDeployment;
|
OPENVIDU_DEPLOYMENT = openviduDeployment;
|
||||||
}
|
}
|
||||||
log.info("Using URL {} to connect to OpenVidu deployment", OPENVIDU_DEPLOYMENT);
|
log.info("Using URL {} to connect to OpenVidu deployment", OPENVIDU_DEPLOYMENT);
|
||||||
|
|
||||||
String broadcastIp = System.getProperty("BROADCAST_IP");
|
|
||||||
if (broadcastIp != null) {
|
|
||||||
BROADCAST_IP = broadcastIp;
|
|
||||||
}
|
|
||||||
log.info("Using IP {} to broadcast", BROADCAST_IP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BrowserUser setupBrowser(String browser) throws Exception {
|
protected BrowserUser setupBrowser(String browser) throws Exception {
|
||||||
|
@ -865,12 +860,17 @@ public class OpenViduTestE2e {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://github.com/tiangolo/nginx-rtmp-docker
|
/**
|
||||||
protected static void startRtmpServer() throws IOException {
|
* https://github.com/tiangolo/nginx-rtmp-docker
|
||||||
|
*
|
||||||
|
* @return The IP address of the Docker container
|
||||||
|
*/
|
||||||
|
protected static String startRtmpServer() throws IOException, TimeoutException {
|
||||||
File file = writeRtmpServerConfigInFile();
|
File file = writeRtmpServerConfigInFile();
|
||||||
String dockerRunCommand = "docker run -d --name broadcast-nginx -p 1935:1935 -v " + file.getAbsolutePath()
|
String dockerRunCommand = "docker run -d --name broadcast-nginx -p 1935:1935 -v " + file.getAbsolutePath()
|
||||||
+ ":/etc/nginx/nginx.conf tiangolo/nginx-rtmp";
|
+ ":/etc/nginx/nginx.conf tiangolo/nginx-rtmp";
|
||||||
commandLine.executeCommand(dockerRunCommand, 10);
|
commandLine.executeCommand(dockerRunCommand, 10);
|
||||||
|
return waitForContainerIpAddress("broadcast-nginx", 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void stopRtmpServer() {
|
protected static void stopRtmpServer() {
|
||||||
|
@ -878,6 +878,21 @@ public class OpenViduTestE2e {
|
||||||
commandLine.executeCommand(dockerRemoveCommand, 10);
|
commandLine.executeCommand(dockerRemoveCommand, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static String waitForContainerIpAddress(String containerNameOrId, int secondsTimeout)
|
||||||
|
throws TimeoutException, UnknownHostException {
|
||||||
|
long currentTime = System.currentTimeMillis();
|
||||||
|
long maxTime = currentTime + (secondsTimeout * 1000);
|
||||||
|
while (System.currentTimeMillis() < maxTime) {
|
||||||
|
String ip = commandLine.executeCommand(
|
||||||
|
"docker container inspect -f '{{ .NetworkSettings.IPAddress }}' " + containerNameOrId, 3);
|
||||||
|
InetAddressValidator validator = InetAddressValidator.getInstance();
|
||||||
|
if (validator.isValid(ip)) {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new TimeoutException();
|
||||||
|
}
|
||||||
|
|
||||||
private static File writeRtmpServerConfigInFile() throws IOException {
|
private static File writeRtmpServerConfigInFile() throws IOException {
|
||||||
String newLine = System.getProperty("line.separator");
|
String newLine = System.getProperty("line.separator");
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
|
|
|
@ -230,7 +230,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
io.openvidu.test.browsers.utils.webhook.CustomWebhook.main(new String[0], initLatch);
|
io.openvidu.test.browsers.utils.webhook.CustomWebhook.main(new String[0], initLatch);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
startRtmpServer();
|
String BROADCAST_IP = startRtmpServer();
|
||||||
|
|
||||||
if (!initLatch.await(30, TimeUnit.SECONDS)) {
|
if (!initLatch.await(30, TimeUnit.SECONDS)) {
|
||||||
Assertions.fail("Timeout waiting for webhook springboot app to start");
|
Assertions.fail("Timeout waiting for webhook springboot app to start");
|
||||||
|
@ -262,14 +262,14 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
OpenViduTestappUser user = setupBrowserAndConnectToOpenViduTestapp("chrome");
|
OpenViduTestappUser user = setupBrowserAndConnectToOpenViduTestapp("chrome");
|
||||||
|
|
||||||
// unsubscribe: webrtcConnectionDestroyed
|
// unsubscribe: webrtcConnectionDestroyed
|
||||||
this.connectTwoUsers(user, restClient, false, false, false);
|
this.connectTwoUsers(user, restClient, false, false, null);
|
||||||
user.getDriver().findElement(By.cssSelector("#openvidu-instance-1 .sub-btn")).click();
|
user.getDriver().findElement(By.cssSelector("#openvidu-instance-1 .sub-btn")).click();
|
||||||
Assertions.assertEquals("unsubscribe",
|
Assertions.assertEquals("unsubscribe",
|
||||||
CustomWebhook.waitForEvent("webrtcConnectionDestroyed", 2).get("reason").getAsString());
|
CustomWebhook.waitForEvent("webrtcConnectionDestroyed", 2).get("reason").getAsString());
|
||||||
CustomWebhook.events.values().forEach(collection -> Assertions.assertTrue(collection.isEmpty()));
|
CustomWebhook.events.values().forEach(collection -> Assertions.assertTrue(collection.isEmpty()));
|
||||||
|
|
||||||
// unpublish: webrtcConnectionDestroyed
|
// unpublish: webrtcConnectionDestroyed
|
||||||
this.connectTwoUsers(user, restClient, false, false, false);
|
this.connectTwoUsers(user, restClient, false, false, null);
|
||||||
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .pub-btn")).click();
|
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .pub-btn")).click();
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
Assertions.assertEquals("unpublish",
|
Assertions.assertEquals("unpublish",
|
||||||
|
@ -280,7 +280,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
// disconnect: webrtcConnectionDestroyed, participantLeft (and subsequent
|
// disconnect: webrtcConnectionDestroyed, participantLeft (and subsequent
|
||||||
// lastParticipantLeft triggered events for sessionDestroyed,
|
// lastParticipantLeft triggered events for sessionDestroyed,
|
||||||
// recordingStatusChanged, broadcastStopped)
|
// recordingStatusChanged, broadcastStopped)
|
||||||
this.connectTwoUsers(user, restClient, false, true, true);
|
this.connectTwoUsers(user, restClient, false, true, BROADCAST_IP);
|
||||||
// First user out
|
// First user out
|
||||||
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .leave-btn")).click();
|
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .leave-btn")).click();
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
|
@ -306,7 +306,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
CustomWebhook.events.values().forEach(collection -> Assertions.assertTrue(collection.isEmpty()));
|
CustomWebhook.events.values().forEach(collection -> Assertions.assertTrue(collection.isEmpty()));
|
||||||
|
|
||||||
// forceUnpublishByUser: webrtcConnectionDestroyed
|
// forceUnpublishByUser: webrtcConnectionDestroyed
|
||||||
this.connectTwoUsers(user, restClient, true, false, false);
|
this.connectTwoUsers(user, restClient, true, false, null);
|
||||||
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .force-unpub-btn")).click();
|
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .force-unpub-btn")).click();
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
Assertions.assertEquals("forceUnpublishByUser",
|
Assertions.assertEquals("forceUnpublishByUser",
|
||||||
|
@ -315,7 +315,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
CustomWebhook.events.values().forEach(collection -> Assertions.assertTrue(collection.isEmpty()));
|
CustomWebhook.events.values().forEach(collection -> Assertions.assertTrue(collection.isEmpty()));
|
||||||
|
|
||||||
// forceUnpublishByServer: webrtcConnectionDestroyed
|
// forceUnpublishByServer: webrtcConnectionDestroyed
|
||||||
this.connectTwoUsers(user, restClient, false, false, false);
|
this.connectTwoUsers(user, restClient, false, false, null);
|
||||||
String streamId = restClient
|
String streamId = restClient
|
||||||
.rest(HttpMethod.GET, "/openvidu/api/sessions/TestSession", HttpURLConnection.HTTP_OK)
|
.rest(HttpMethod.GET, "/openvidu/api/sessions/TestSession", HttpURLConnection.HTTP_OK)
|
||||||
.get("connections").getAsJsonObject().get("content").getAsJsonArray().asList().stream()
|
.get("connections").getAsJsonObject().get("content").getAsJsonArray().asList().stream()
|
||||||
|
@ -331,7 +331,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
CustomWebhook.events.values().forEach(collection -> Assertions.assertTrue(collection.isEmpty()));
|
CustomWebhook.events.values().forEach(collection -> Assertions.assertTrue(collection.isEmpty()));
|
||||||
|
|
||||||
// forceDisconnectByUser: webrtcConnectionDestroyed, participantLeft
|
// forceDisconnectByUser: webrtcConnectionDestroyed, participantLeft
|
||||||
this.connectTwoUsers(user, restClient, true, false, false);
|
this.connectTwoUsers(user, restClient, true, false, null);
|
||||||
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .force-disconnect-btn")).click();
|
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .force-disconnect-btn")).click();
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
Assertions.assertEquals("forceDisconnectByUser",
|
Assertions.assertEquals("forceDisconnectByUser",
|
||||||
|
@ -344,7 +344,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
// forceDisconnectByServer: webrtcConnectionDestroyed, participantLeft (and
|
// forceDisconnectByServer: webrtcConnectionDestroyed, participantLeft (and
|
||||||
// subsequent lastParticipantLeft triggered events for sessionDestroyed,
|
// subsequent lastParticipantLeft triggered events for sessionDestroyed,
|
||||||
// recordingStatusChanged, broadcastStopped)
|
// recordingStatusChanged, broadcastStopped)
|
||||||
this.connectTwoUsers(user, restClient, false, true, true);
|
this.connectTwoUsers(user, restClient, false, true, BROADCAST_IP);
|
||||||
String[] connectionIds = restClient
|
String[] connectionIds = restClient
|
||||||
.rest(HttpMethod.GET, "/openvidu/api/sessions/TestSession", HttpURLConnection.HTTP_OK)
|
.rest(HttpMethod.GET, "/openvidu/api/sessions/TestSession", HttpURLConnection.HTTP_OK)
|
||||||
.get("connections").getAsJsonObject().get("content").getAsJsonArray().asList().stream()
|
.get("connections").getAsJsonObject().get("content").getAsJsonArray().asList().stream()
|
||||||
|
@ -377,7 +377,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
|
|
||||||
// sessionClosedByServer: webrtcConnectionDestroyed, participantLeft,
|
// sessionClosedByServer: webrtcConnectionDestroyed, participantLeft,
|
||||||
// sessionDestroyed, recordingStatusChanged, broadcastStopped
|
// sessionDestroyed, recordingStatusChanged, broadcastStopped
|
||||||
this.connectTwoUsers(user, restClient, false, true, true);
|
this.connectTwoUsers(user, restClient, false, true, BROADCAST_IP);
|
||||||
restClient.rest(HttpMethod.DELETE, "/openvidu/api/sessions/TestSession",
|
restClient.rest(HttpMethod.DELETE, "/openvidu/api/sessions/TestSession",
|
||||||
HttpURLConnection.HTTP_NO_CONTENT);
|
HttpURLConnection.HTTP_NO_CONTENT);
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
|
@ -401,7 +401,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
// networkDisconnect: webrtcConnectionDestroyed, participantLeft (and
|
// networkDisconnect: webrtcConnectionDestroyed, participantLeft (and
|
||||||
// subsequent lastParticipantLeft triggered events for sessionDestroyed,
|
// subsequent lastParticipantLeft triggered events for sessionDestroyed,
|
||||||
// recordingStatusChanged, broadcastStopped)
|
// recordingStatusChanged, broadcastStopped)
|
||||||
this.connectTwoUsers(user, restClient, false, true, true);
|
this.connectTwoUsers(user, restClient, false, true, BROADCAST_IP);
|
||||||
// First user out
|
// First user out
|
||||||
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .network-drop-btn")).click();
|
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .network-drop-btn")).click();
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
|
@ -428,7 +428,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
|
|
||||||
// mediaServerDisconnect: webrtcConnectionDestroyed, participantLeft,
|
// mediaServerDisconnect: webrtcConnectionDestroyed, participantLeft,
|
||||||
// sessionDestroyed, recordingStatusChanged, broadcastStopped
|
// sessionDestroyed, recordingStatusChanged, broadcastStopped
|
||||||
this.connectTwoUsers(user, restClient, false, true, true);
|
this.connectTwoUsers(user, restClient, false, true, BROADCAST_IP);
|
||||||
String mediaNodeId = restClient
|
String mediaNodeId = restClient
|
||||||
.rest(HttpMethod.GET, "/openvidu/api/media-nodes", HttpURLConnection.HTTP_OK).get("content")
|
.rest(HttpMethod.GET, "/openvidu/api/media-nodes", HttpURLConnection.HTTP_OK).get("content")
|
||||||
.getAsJsonArray().get(0).getAsJsonObject().get("id").getAsString();
|
.getAsJsonArray().get(0).getAsJsonObject().get("id").getAsString();
|
||||||
|
@ -457,7 +457,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
restartOpenViduServer(new HashMap<>(), true, HttpURLConnection.HTTP_OK);
|
restartOpenViduServer(new HashMap<>(), true, HttpURLConnection.HTTP_OK);
|
||||||
|
|
||||||
// mediaServerReconnect: webrtcConnectionDestroyed, recordingStatusChanged
|
// mediaServerReconnect: webrtcConnectionDestroyed, recordingStatusChanged
|
||||||
this.connectTwoUsers(user, restClient, false, true, true);
|
this.connectTwoUsers(user, restClient, false, true, BROADCAST_IP);
|
||||||
String containerId = restClient
|
String containerId = restClient
|
||||||
.rest(HttpMethod.GET, "/openvidu/api/media-nodes", HttpURLConnection.HTTP_OK).get("content")
|
.rest(HttpMethod.GET, "/openvidu/api/media-nodes", HttpURLConnection.HTTP_OK).get("content")
|
||||||
.getAsJsonArray().get(0).getAsJsonObject().get("environmentId").getAsString();
|
.getAsJsonArray().get(0).getAsJsonObject().get("environmentId").getAsString();
|
||||||
|
@ -474,7 +474,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
|
|
||||||
// nodeCrashed: webrtcConnectionDestroyed, participantLeft, sessionDestroyed,
|
// nodeCrashed: webrtcConnectionDestroyed, participantLeft, sessionDestroyed,
|
||||||
// recordingStatusChanged, broadcastStopped
|
// recordingStatusChanged, broadcastStopped
|
||||||
this.connectTwoUsers(user, restClient, false, true, true);
|
this.connectTwoUsers(user, restClient, false, true, BROADCAST_IP);
|
||||||
containerId = restClient.rest(HttpMethod.GET, "/openvidu/api/media-nodes", HttpURLConnection.HTTP_OK)
|
containerId = restClient.rest(HttpMethod.GET, "/openvidu/api/media-nodes", HttpURLConnection.HTTP_OK)
|
||||||
.get("content").getAsJsonArray().get(0).getAsJsonObject().get("environmentId").getAsString();
|
.get("content").getAsJsonArray().get(0).getAsJsonObject().get("environmentId").getAsString();
|
||||||
MediaNodeDockerUtils.crashMediaNode(containerId);
|
MediaNodeDockerUtils.crashMediaNode(containerId);
|
||||||
|
@ -507,7 +507,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
|
|
||||||
// openviduServerStopped: webrtcConnectionDestroyed, participantLeft,
|
// openviduServerStopped: webrtcConnectionDestroyed, participantLeft,
|
||||||
// sessionDestroyed, recordingStatusChanged, broadcastStopped
|
// sessionDestroyed, recordingStatusChanged, broadcastStopped
|
||||||
this.connectTwoUsers(user, restClient, false, true, true);
|
this.connectTwoUsers(user, restClient, false, true, BROADCAST_IP);
|
||||||
restartOpenViduServer(new HashMap<>(), true, HttpURLConnection.HTTP_OK);
|
restartOpenViduServer(new HashMap<>(), true, HttpURLConnection.HTTP_OK);
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
Assertions.assertEquals("openviduServerStopped",
|
Assertions.assertEquals("openviduServerStopped",
|
||||||
|
@ -533,7 +533,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
// automaticStop: sessionDestroyed, recordingStatusChanged
|
// automaticStop: sessionDestroyed, recordingStatusChanged
|
||||||
newConfig = Map.of("OPENVIDU_RECORDING_AUTOSTOP_TIMEOUT", 1);
|
newConfig = Map.of("OPENVIDU_RECORDING_AUTOSTOP_TIMEOUT", 1);
|
||||||
restartOpenViduServer(newConfig);
|
restartOpenViduServer(newConfig);
|
||||||
this.connectTwoUsers(user, restClient, false, true, true);
|
this.connectTwoUsers(user, restClient, false, true, BROADCAST_IP);
|
||||||
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .leave-btn")).click();
|
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .leave-btn")).click();
|
||||||
user.getDriver().findElement(By.cssSelector("#openvidu-instance-1 .leave-btn")).click();
|
user.getDriver().findElement(By.cssSelector("#openvidu-instance-1 .leave-btn")).click();
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
|
@ -555,7 +555,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
CustomWebhook.events.values().forEach(collection -> Assertions.assertTrue(collection.isEmpty()));
|
CustomWebhook.events.values().forEach(collection -> Assertions.assertTrue(collection.isEmpty()));
|
||||||
|
|
||||||
// recordingStoppedByServer: recordingStatusChanged
|
// recordingStoppedByServer: recordingStatusChanged
|
||||||
this.connectTwoUsers(user, restClient, false, true, true);
|
this.connectTwoUsers(user, restClient, false, true, BROADCAST_IP);
|
||||||
String recordingId = restClient
|
String recordingId = restClient
|
||||||
.rest(HttpMethod.GET, "/openvidu/api/recordings", HttpURLConnection.HTTP_OK).get("items")
|
.rest(HttpMethod.GET, "/openvidu/api/recordings", HttpURLConnection.HTTP_OK).get("items")
|
||||||
.getAsJsonArray().asList().stream()
|
.getAsJsonArray().asList().stream()
|
||||||
|
@ -571,7 +571,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
CustomWebhook.events.values().forEach(collection -> Assertions.assertTrue(collection.isEmpty()));
|
CustomWebhook.events.values().forEach(collection -> Assertions.assertTrue(collection.isEmpty()));
|
||||||
|
|
||||||
// broadcastStoppedByServer: broadcastStopped
|
// broadcastStoppedByServer: broadcastStopped
|
||||||
this.connectTwoUsers(user, restClient, false, true, true);
|
this.connectTwoUsers(user, restClient, false, true, BROADCAST_IP);
|
||||||
restClient.rest(HttpMethod.POST, "/openvidu/api/broadcast/stop", "{'session':'TestSession'}",
|
restClient.rest(HttpMethod.POST, "/openvidu/api/broadcast/stop", "{'session':'TestSession'}",
|
||||||
HttpURLConnection.HTTP_OK);
|
HttpURLConnection.HTTP_OK);
|
||||||
Assertions.assertEquals("broadcastStoppedByServer",
|
Assertions.assertEquals("broadcastStoppedByServer",
|
||||||
|
@ -1090,7 +1090,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
Assertions.assertTrue(connection.getNetworkCache() == null, "Wrong networkCache property");
|
Assertions.assertTrue(connection.getNetworkCache() == null, "Wrong networkCache property");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
startRtmpServer();
|
String BROADCAST_IP = startRtmpServer();
|
||||||
// Start broadcast
|
// Start broadcast
|
||||||
try {
|
try {
|
||||||
OV.startBroadcast("NOT_EXISTS", "rtmp://" + BROADCAST_IP + "/live");
|
OV.startBroadcast("NOT_EXISTS", "rtmp://" + BROADCAST_IP + "/live");
|
||||||
|
@ -2810,7 +2810,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
log.info("Successfull broadcast Test");
|
log.info("Successfull broadcast Test");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
startRtmpServer();
|
String BROADCAST_IP = startRtmpServer();
|
||||||
|
|
||||||
OpenViduTestappUser user = setupBrowserAndConnectToOpenViduTestapp("chrome");
|
OpenViduTestappUser user = setupBrowserAndConnectToOpenViduTestapp("chrome");
|
||||||
user.getDriver().findElement(By.id("add-user-btn")).click();
|
user.getDriver().findElement(By.id("add-user-btn")).click();
|
||||||
|
@ -2870,7 +2870,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
log.info("Wrong broadcast Test");
|
log.info("Wrong broadcast Test");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
startRtmpServer();
|
String BROADCAST_IP = startRtmpServer();
|
||||||
|
|
||||||
OpenViduTestappUser user = setupBrowserAndConnectToOpenViduTestapp("chrome");
|
OpenViduTestappUser user = setupBrowserAndConnectToOpenViduTestapp("chrome");
|
||||||
user.getDriver().findElement(By.id("add-user-btn")).click();
|
user.getDriver().findElement(By.id("add-user-btn")).click();
|
||||||
|
@ -3211,7 +3211,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void connectTwoUsers(OpenViduTestappUser user, CustomHttpClient restClient, boolean firstUserIsModerator,
|
private void connectTwoUsers(OpenViduTestappUser user, CustomHttpClient restClient, boolean firstUserIsModerator,
|
||||||
boolean startRecording, boolean startBroadcast) throws Exception {
|
boolean startRecording, String broadcastIp) throws Exception {
|
||||||
this.closeAllSessions(OV);
|
this.closeAllSessions(OV);
|
||||||
user.getDriver().findElement(By.id("remove-all-users-btn")).click();
|
user.getDriver().findElement(By.id("remove-all-users-btn")).click();
|
||||||
user.getEventManager().clearAllCurrentEvents();
|
user.getEventManager().clearAllCurrentEvents();
|
||||||
|
@ -3241,9 +3241,9 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
Assertions.assertEquals(Recording.Status.started.name(),
|
Assertions.assertEquals(Recording.Status.started.name(),
|
||||||
CustomWebhook.waitForEvent("recordingStatusChanged", 3).get("status").getAsString());
|
CustomWebhook.waitForEvent("recordingStatusChanged", 3).get("status").getAsString());
|
||||||
}
|
}
|
||||||
if (startBroadcast) {
|
if (broadcastIp != null) {
|
||||||
restClient.rest(HttpMethod.POST, "/openvidu/api/broadcast/start",
|
restClient.rest(HttpMethod.POST, "/openvidu/api/broadcast/start",
|
||||||
"{'session':'TestSession','broadcastUrl':'rtmp://" + BROADCAST_IP + "/live'}",
|
"{'session':'TestSession','broadcastUrl':'rtmp://" + broadcastIp + "/live'}",
|
||||||
HttpURLConnection.HTTP_OK);
|
HttpURLConnection.HTTP_OK);
|
||||||
user.getEventManager().waitUntilEventReaches("broadcastStarted", 2);
|
user.getEventManager().waitUntilEventReaches("broadcastStarted", 2);
|
||||||
CustomWebhook.waitForEvent("broadcastStarted", 3);
|
CustomWebhook.waitForEvent("broadcastStarted", 3);
|
||||||
|
|
Loading…
Reference in New Issue