mirror of https://github.com/OpenVidu/openvidu.git
Fix all deprecations and warnings from tests
parent
bf56fe02a7
commit
a8fe54fa6c
|
|
@ -45,16 +45,16 @@ public class AndroidAppUser extends BrowserUser {
|
|||
"--autoplay-policy=no-user-gesture-required")));
|
||||
}
|
||||
|
||||
URL url = null;
|
||||
URL url;
|
||||
try {
|
||||
url = URI.create(REMOTE_URL).toURL();
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalArgumentException | MalformedURLException e) {
|
||||
throw new IllegalArgumentException("Invalid REMOTE_URL_ANDROID value: " + REMOTE_URL, e);
|
||||
}
|
||||
|
||||
this.driver = new AndroidDriver(url, options);
|
||||
|
||||
this.configureDriver();
|
||||
super.configureDriver();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package io.openvidu.test.browsers;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
|
||||
import org.openqa.selenium.chrome.ChromeOptions;
|
||||
|
|
@ -47,8 +48,7 @@ public class AndroidChromeUser extends BrowserUser {
|
|||
"autoplay-policy=no-user-gesture-required",
|
||||
// Basic stability
|
||||
"no-sandbox",
|
||||
"disable-dev-shm-usage"
|
||||
);
|
||||
"disable-dev-shm-usage");
|
||||
// Enable W3C protocol
|
||||
options.setExperimentalOption("w3c", true);
|
||||
|
||||
|
|
@ -60,15 +60,15 @@ public class AndroidChromeUser extends BrowserUser {
|
|||
// Grant permissions at Android level instead of Chrome prefs
|
||||
capabilities.setCapability("appium:autoGrantPermissions", true);
|
||||
|
||||
URL url = null;
|
||||
URL url;
|
||||
try {
|
||||
url = new URL(REMOTE_URL);
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
url = URI.create(REMOTE_URL).toURL();
|
||||
} catch (IllegalArgumentException | MalformedURLException e) {
|
||||
throw new IllegalArgumentException("Invalid REMOTE_URL_ANDROID value: " + REMOTE_URL, e);
|
||||
}
|
||||
this.driver = new RemoteWebDriver(url, capabilities);
|
||||
|
||||
this.configureDriver();
|
||||
super.configureDriver();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.awt.Point;
|
|||
import java.time.Duration;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -114,7 +115,7 @@ public class BrowserUser {
|
|||
+ "rgb.g += data.data[i + 1];" + "rgb.b += data.data[i + 2];" + "}" + "rgb.r = ~~(rgb.r / count);"
|
||||
+ "rgb.g = ~~(rgb.g / count);" + "rgb.b = ~~(rgb.b / count);" + "callback(rgb);" + "};";
|
||||
Object averageRgb = ((JavascriptExecutor) driver).executeAsyncScript(script);
|
||||
return (Map<String, Long>) averageRgb;
|
||||
return toLongChannelMap(averageRgb);
|
||||
}
|
||||
|
||||
public Map<String, Long> getAverageColorFromPixels(WebElement videoElement, List<Point> pixelPercentagePositions) {
|
||||
|
|
@ -148,7 +149,7 @@ public class BrowserUser {
|
|||
}
|
||||
points += "]";
|
||||
Object averageRgb = ((JavascriptExecutor) driver).executeAsyncScript(script, points);
|
||||
return (Map<String, Long>) averageRgb;
|
||||
return toLongChannelMap(averageRgb);
|
||||
}
|
||||
|
||||
public String getDimensionOfViewport() {
|
||||
|
|
@ -157,6 +158,24 @@ public class BrowserUser {
|
|||
return dimension;
|
||||
}
|
||||
|
||||
private Map<String, Long> toLongChannelMap(Object scriptResult) {
|
||||
if (!(scriptResult instanceof Map<?, ?> rawMap)) {
|
||||
throw new IllegalStateException("Script result is not a map: " + scriptResult);
|
||||
}
|
||||
Map<String, Long> converted = new HashMap<>();
|
||||
converted.put("r", toLong(rawMap.get("r")));
|
||||
converted.put("g", toLong(rawMap.get("g")));
|
||||
converted.put("b", toLong(rawMap.get("b")));
|
||||
return converted;
|
||||
}
|
||||
|
||||
private long toLong(Object value) {
|
||||
if (value instanceof Number number) {
|
||||
return number.longValue();
|
||||
}
|
||||
throw new IllegalStateException("Value is not numeric: " + value);
|
||||
}
|
||||
|
||||
public void stopVideoTracksOfVideoElement(WebElement videoElement, String parentSelector) {
|
||||
String script = "return (document.querySelector('" + parentSelector + (parentSelector.isEmpty() ? "" : " ")
|
||||
+ "#" + videoElement.getAttribute("id")
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
package io.openvidu.test.browsers;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
|
@ -84,9 +85,10 @@ public class ChromeUser extends BrowserUser {
|
|||
if (REMOTE_URL != null) {
|
||||
log.info("Using URL {} to connect to remote web driver", REMOTE_URL);
|
||||
try {
|
||||
this.driver = new RemoteWebDriver(new URL(REMOTE_URL), options);
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
URL remoteUrl = URI.create(REMOTE_URL).toURL();
|
||||
this.driver = new RemoteWebDriver(remoteUrl, options);
|
||||
} catch (IllegalArgumentException | MalformedURLException e) {
|
||||
throw new IllegalArgumentException("Invalid REMOTE_URL_CHROME value: " + REMOTE_URL, e);
|
||||
}
|
||||
} else {
|
||||
log.info("Using local web driver");
|
||||
|
|
@ -94,7 +96,7 @@ public class ChromeUser extends BrowserUser {
|
|||
}
|
||||
|
||||
this.driver.manage().timeouts().scriptTimeout(Duration.ofSeconds(timeOfWaitInSeconds));
|
||||
this.configureDriver(new org.openqa.selenium.Dimension(1920, 1080));
|
||||
super.configureDriver(new org.openqa.selenium.Dimension(1920, 1080));
|
||||
}
|
||||
|
||||
private static ChromeOptions generateDefaultScreenChromeOptions() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package io.openvidu.test.browsers;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.time.Duration;
|
||||
|
||||
|
|
@ -27,9 +28,10 @@ public class EdgeUser extends BrowserUser {
|
|||
options.addArguments("--headless=new");
|
||||
log.info("Using URL {} to connect to remote web driver", REMOTE_URL);
|
||||
try {
|
||||
this.driver = new RemoteWebDriver(new URL(REMOTE_URL), options);
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
URL remoteUrl = URI.create(REMOTE_URL).toURL();
|
||||
this.driver = new RemoteWebDriver(remoteUrl, options);
|
||||
} catch (IllegalArgumentException | MalformedURLException e) {
|
||||
throw new IllegalArgumentException("Invalid REMOTE_URL_EDGE value: " + REMOTE_URL, e);
|
||||
}
|
||||
} else {
|
||||
log.info("Using local web driver");
|
||||
|
|
@ -37,7 +39,7 @@ public class EdgeUser extends BrowserUser {
|
|||
}
|
||||
|
||||
this.driver.manage().timeouts().scriptTimeout(Duration.ofSeconds(timeOfWaitInSeconds));
|
||||
this.configureDriver(new org.openqa.selenium.Dimension(1920, 1080));
|
||||
super.configureDriver(new org.openqa.selenium.Dimension(1920, 1080));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
package io.openvidu.test.browsers;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.time.Duration;
|
||||
|
||||
|
|
@ -51,9 +52,10 @@ public class FirefoxUser extends BrowserUser {
|
|||
options.addArguments("--headless");
|
||||
log.info("Using URL {} to connect to remote web driver", REMOTE_URL);
|
||||
try {
|
||||
this.driver = new RemoteWebDriver(new URL(REMOTE_URL), options);
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
URL remoteUrl = URI.create(REMOTE_URL).toURL();
|
||||
this.driver = new RemoteWebDriver(remoteUrl, options);
|
||||
} catch (IllegalArgumentException | MalformedURLException e) {
|
||||
throw new IllegalArgumentException("Invalid REMOTE_URL_FIREFOX value: " + REMOTE_URL, e);
|
||||
}
|
||||
} else {
|
||||
log.info("Using local web driver");
|
||||
|
|
@ -61,7 +63,7 @@ public class FirefoxUser extends BrowserUser {
|
|||
}
|
||||
|
||||
this.driver.manage().timeouts().scriptTimeout(Duration.ofSeconds(timeOfWaitInSeconds));
|
||||
this.configureDriver(new org.openqa.selenium.Dimension(1920, 1080));
|
||||
super.configureDriver(new org.openqa.selenium.Dimension(1920, 1080));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package io.openvidu.test.browsers;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.time.Duration;
|
||||
|
||||
|
|
@ -30,9 +31,10 @@ public class OperaUser extends BrowserUser {
|
|||
if (REMOTE_URL != null) {
|
||||
log.info("Using URL {} to connect to remote web driver", REMOTE_URL);
|
||||
try {
|
||||
this.driver = new RemoteWebDriver(new URL(REMOTE_URL), options);
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
URL remoteUrl = URI.create(REMOTE_URL).toURL();
|
||||
this.driver = new RemoteWebDriver(remoteUrl, options);
|
||||
} catch (IllegalArgumentException | MalformedURLException e) {
|
||||
throw new IllegalArgumentException("Invalid REMOTE_URL_OPERA value: " + REMOTE_URL, e);
|
||||
}
|
||||
} else {
|
||||
log.info("Using local web driver");
|
||||
|
|
@ -40,7 +42,7 @@ public class OperaUser extends BrowserUser {
|
|||
}
|
||||
|
||||
this.driver.manage().timeouts().scriptTimeout(Duration.ofSeconds(timeOfWaitInSeconds));
|
||||
this.configureDriver(new org.openqa.selenium.Dimension(1920, 1080));
|
||||
super.configureDriver(new org.openqa.selenium.Dimension(1920, 1080));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ public class RecordingUtils {
|
|||
Picture frame;
|
||||
try {
|
||||
// Get a frame at 75% duration and check that it has the expected color
|
||||
frame = FrameGrab.getFrameAtSec(file, (double) (recording.getDuration() * 0.75));
|
||||
double targetSecond = recording.getDuration() * 0.75;
|
||||
frame = FrameGrab.getFrameAtSec(file, targetSecond);
|
||||
BufferedImage image = AWTUtil.toBufferedImage(frame);
|
||||
Map<String, Long> colorMap = this.averageColor(image);
|
||||
|
||||
|
|
@ -165,7 +166,7 @@ public class RecordingUtils {
|
|||
for (int i = 0; i < syncArray.size(); i++) {
|
||||
JsonObject j = syncArray.get(i).getAsJsonObject();
|
||||
if (webmFile.getName().contains(j.get("streamId").getAsString())) {
|
||||
durationInSeconds = (double) (j.get("endTimeOffset").getAsDouble()
|
||||
durationInSeconds = (j.get("endTimeOffset").getAsDouble()
|
||||
- j.get("startTimeOffset").getAsDouble()) / 1000;
|
||||
found = true;
|
||||
break;
|
||||
|
|
@ -273,9 +274,9 @@ public class RecordingUtils {
|
|||
}
|
||||
int num = w * h;
|
||||
Map<String, Long> colorMap = new HashMap<>();
|
||||
colorMap.put("r", (long) (sumr / num));
|
||||
colorMap.put("g", (long) (sumg / num));
|
||||
colorMap.put("b", (long) (sumb / num));
|
||||
colorMap.put("r", sumr / num);
|
||||
colorMap.put("g", sumg / num);
|
||||
colorMap.put("b", sumb / num);
|
||||
return colorMap;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -179,13 +179,9 @@ public class CustomWebhook {
|
|||
public class SecurityConfig {
|
||||
@Bean
|
||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
http.requiresChannel(channel -> channel
|
||||
.requestMatchers("/webhook").requiresInsecure()
|
||||
);
|
||||
http.csrf(csrf -> csrf.disable())
|
||||
.authorizeHttpRequests(auth -> auth
|
||||
.requestMatchers("/webhook").permitAll()
|
||||
);
|
||||
.authorizeHttpRequests(auth -> auth
|
||||
.requestMatchers("/webhook").permitAll());
|
||||
return http.build();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import org.openqa.selenium.support.ui.ExpectedCondition;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.testcontainers.containers.BindMode;
|
||||
import org.testcontainers.containers.GenericContainer;
|
||||
import org.testcontainers.containers.wait.strategy.AbstractWaitStrategy;
|
||||
import org.testcontainers.containers.wait.strategy.Wait;
|
||||
|
|
@ -165,9 +166,12 @@ public class OpenViduTestE2e {
|
|||
map.put("SE_NODE_OVERRIDE_MAX_SESSIONS", "true");
|
||||
map.put("SE_NODE_MAX_SESSIONS", String.valueOf(maxBrowserSessions));
|
||||
}
|
||||
GenericContainer<?> chrome = new GenericContainer<>(DockerImageName.parse(image)).withSharedMemorySize(shmSize)
|
||||
.withFileSystemBind("/opt/openvidu", "/opt/openvidu").withEnv(map).withExposedPorts(4444)
|
||||
.waitingFor(waitBrowser);
|
||||
GenericContainer<?> chrome = new GenericContainer<>(DockerImageName.parse(image));
|
||||
chrome.withSharedMemorySize(shmSize);
|
||||
chrome.withFileSystemBind("/opt/openvidu", "/opt/openvidu", BindMode.READ_WRITE);
|
||||
chrome.withEnv(map);
|
||||
chrome.withExposedPorts(4444);
|
||||
chrome.waitingFor(waitBrowser);
|
||||
chrome.setPortBindings(Arrays.asList("6666:4444"));
|
||||
return chrome;
|
||||
}
|
||||
|
|
@ -181,9 +185,12 @@ public class OpenViduTestE2e {
|
|||
map.put("SE_NODE_OVERRIDE_MAX_SESSIONS", "true");
|
||||
map.put("SE_NODE_MAX_SESSIONS", String.valueOf(maxBrowserSessions));
|
||||
}
|
||||
GenericContainer<?> firefox = new GenericContainer<>(DockerImageName.parse(image)).withSharedMemorySize(shmSize)
|
||||
.withFileSystemBind("/opt/openvidu", "/opt/openvidu").withEnv(map).withExposedPorts(4444)
|
||||
.waitingFor(waitBrowser);
|
||||
GenericContainer<?> firefox = new GenericContainer<>(DockerImageName.parse(image));
|
||||
firefox.withSharedMemorySize(shmSize);
|
||||
firefox.withFileSystemBind("/opt/openvidu", "/opt/openvidu", BindMode.READ_WRITE);
|
||||
firefox.withEnv(map);
|
||||
firefox.withExposedPorts(4444);
|
||||
firefox.waitingFor(waitBrowser);
|
||||
firefox.setPortBindings(Arrays.asList("6667:4444"));
|
||||
return firefox;
|
||||
}
|
||||
|
|
@ -194,9 +201,12 @@ public class OpenViduTestE2e {
|
|||
map.put("SE_NODE_OVERRIDE_MAX_SESSIONS", "true");
|
||||
map.put("SE_NODE_MAX_SESSIONS", String.valueOf(maxBrowserSessions));
|
||||
}
|
||||
GenericContainer<?> opera = new GenericContainer<>(DockerImageName.parse(image)).withSharedMemorySize(shmSize)
|
||||
.withFileSystemBind("/opt/openvidu", "/opt/openvidu").withEnv(map).withExposedPorts(4444)
|
||||
.waitingFor(waitBrowser);
|
||||
GenericContainer<?> opera = new GenericContainer<>(DockerImageName.parse(image));
|
||||
opera.withSharedMemorySize(shmSize);
|
||||
opera.withFileSystemBind("/opt/openvidu", "/opt/openvidu", BindMode.READ_WRITE);
|
||||
opera.withEnv(map);
|
||||
opera.withExposedPorts(4444);
|
||||
opera.waitingFor(waitBrowser);
|
||||
opera.setPortBindings(Arrays.asList("6668:4444"));
|
||||
return opera;
|
||||
}
|
||||
|
|
@ -210,9 +220,12 @@ public class OpenViduTestE2e {
|
|||
map.put("SE_NODE_OVERRIDE_MAX_SESSIONS", "true");
|
||||
map.put("SE_NODE_MAX_SESSIONS", String.valueOf(maxBrowserSessions));
|
||||
}
|
||||
GenericContainer<?> edge = new GenericContainer<>(DockerImageName.parse(image)).withSharedMemorySize(shmSize)
|
||||
.withFileSystemBind("/opt/openvidu", "/opt/openvidu").withEnv(map).withExposedPorts(4444)
|
||||
.waitingFor(waitBrowser);
|
||||
GenericContainer<?> edge = new GenericContainer<>(DockerImageName.parse(image));
|
||||
edge.withSharedMemorySize(shmSize);
|
||||
edge.withFileSystemBind("/opt/openvidu", "/opt/openvidu", BindMode.READ_WRITE);
|
||||
edge.withEnv(map);
|
||||
edge.withExposedPorts(4444);
|
||||
edge.waitingFor(waitBrowser);
|
||||
edge.setPortBindings(Arrays.asList("6669:4444"));
|
||||
return edge;
|
||||
}
|
||||
|
|
@ -230,14 +243,18 @@ public class OpenViduTestE2e {
|
|||
envVars.put("WEB_VNC", "true");
|
||||
envVars.put("WEB_LOG", "false");
|
||||
envVars.put("DATAPARTITION", "8192m");
|
||||
envVars.put("EMULATOR_ARGS", "-gpu swiftshader_indirect -no-snapshot -no-audio -memory 8192 -partition-size 8192");
|
||||
envVars.put("EMULATOR_ARGS",
|
||||
"-gpu swiftshader_indirect -no-snapshot -no-audio -memory 8192 -partition-size 8192");
|
||||
|
||||
GenericContainer<?> android = new GenericContainer<>(DockerImageName.parse(image))
|
||||
.withEnv(envVars)
|
||||
.withPrivilegedMode(true).withSharedMemorySize(shmSize)
|
||||
.withExposedPorts(6080, 5554, 5555, 4723).withFileSystemBind("/dev/kvm", "/dev/kvm")
|
||||
.withFileSystemBind("/opt/openvidu/android", "/opt/openvidu/android").withReuse(true)
|
||||
.waitingFor(new AndroidContainerWaitStrategy());
|
||||
GenericContainer<?> android = new GenericContainer<>(DockerImageName.parse(image));
|
||||
android.withEnv(envVars);
|
||||
android.withPrivilegedMode(true);
|
||||
android.withSharedMemorySize(shmSize);
|
||||
android.withExposedPorts(6080, 5554, 5555, 4723);
|
||||
android.withFileSystemBind("/dev/kvm", "/dev/kvm", BindMode.READ_WRITE);
|
||||
android.withFileSystemBind("/opt/openvidu/android", "/opt/openvidu/android", BindMode.READ_WRITE);
|
||||
android.withReuse(true);
|
||||
android.waitingFor(new AndroidContainerWaitStrategy());
|
||||
android.setPortBindings(Arrays.asList("6080:6080", "5554:5554", "5555:5555", "4723:4723"));
|
||||
return android;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ import java.net.HttpURLConnection;
|
|||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
import java.util.Collection;
|
||||
|
|
@ -33,6 +31,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
|
@ -42,7 +41,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.apache.hc.client5.http.auth.AuthScope;
|
||||
import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
|
||||
import org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider;
|
||||
|
|
@ -50,12 +48,9 @@ import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
|
|||
import org.apache.hc.client5.http.impl.classic.HttpClients;
|
||||
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;
|
||||
import org.apache.hc.client5.http.io.HttpClientConnectionManager;
|
||||
import org.apache.hc.client5.http.ssl.DefaultClientTlsStrategy;
|
||||
import org.apache.hc.client5.http.ssl.HostnameVerificationPolicy;
|
||||
import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
|
||||
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
|
||||
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder;
|
||||
import org.apache.hc.core5.http.Header;
|
||||
import org.apache.hc.core5.http.HttpHeaders;
|
||||
import org.apache.hc.core5.http.message.BasicHeader;
|
||||
import org.apache.hc.core5.ssl.SSLContextBuilder;
|
||||
import org.apache.hc.core5.ssl.TrustStrategy;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
|
@ -65,6 +60,9 @@ import org.junit.jupiter.api.DisplayName;
|
|||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.apache.hc.core5.http.Header;
|
||||
import org.apache.hc.core5.http.HttpHeaders;
|
||||
import org.apache.hc.core5.http.message.BasicHeader;
|
||||
import org.openqa.selenium.Alert;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.Dimension;
|
||||
|
|
@ -1523,22 +1521,24 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
|||
user.getEventManager().waitUntilEventReaches("streamPlaying", 4);
|
||||
checkDockerContainerRunning("openvidu/openvidu-recording", 1);
|
||||
|
||||
OV.fetch();
|
||||
session = OV.getActiveSessions().get(0);
|
||||
session.close();
|
||||
OV.fetch();
|
||||
session = OV.getActiveSessions().get(0);
|
||||
session.close();
|
||||
|
||||
// Recording hasn't had time to start. Should trigger stopped, then failed immediately
|
||||
event = CustomWebhook.waitForEvent("recordingStatusChanged", 1); // stopped
|
||||
Assertions.assertEquals("stopped", event.get("status").getAsString(),
|
||||
"Wrong status in recordingStatusChanged event");
|
||||
|
||||
event = CustomWebhook.waitForEvent("recordingStatusChanged", 5); // failed
|
||||
Assertions.assertEquals("failed", event.get("status").getAsString(),
|
||||
"Wrong status in recordingStatusChanged event");
|
||||
Assertions.assertEquals(Recording.Status.failed, OV.getRecording(sessionName + "~2").getStatus(),
|
||||
"Wrong recording status");
|
||||
// Recording hasn't had time to start. Should trigger stopped, then failed
|
||||
// immediately
|
||||
event = CustomWebhook.waitForEvent("recordingStatusChanged", 1); // stopped
|
||||
Assertions.assertEquals("stopped", event.get("status").getAsString(),
|
||||
"Wrong status in recordingStatusChanged event");
|
||||
|
||||
checkDockerContainerRunning("openvidu/openvidu-recording", 0); } finally {
|
||||
event = CustomWebhook.waitForEvent("recordingStatusChanged", 5); // failed
|
||||
Assertions.assertEquals("failed", event.get("status").getAsString(),
|
||||
"Wrong status in recordingStatusChanged event");
|
||||
Assertions.assertEquals(Recording.Status.failed, OV.getRecording(sessionName + "~2").getStatus(),
|
||||
"Wrong recording status");
|
||||
|
||||
checkDockerContainerRunning("openvidu/openvidu-recording", 0);
|
||||
} finally {
|
||||
CustomWebhook.shutDown();
|
||||
}
|
||||
}
|
||||
|
|
@ -2455,22 +2455,17 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
|||
|
||||
private HttpClientBuilder getHttpClientBuilder() {
|
||||
HttpClientBuilder builder = HttpClients.custom();
|
||||
TrustStrategy trustStrategy = new TrustStrategy() {
|
||||
@Override
|
||||
public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
TrustStrategy trustStrategy = (chain, authType) -> true;
|
||||
SSLContext sslContext;
|
||||
try {
|
||||
sslContext = new SSLContextBuilder().loadTrustMaterial(null, trustStrategy).build();
|
||||
} catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
final SSLConnectionSocketFactory sslSocketFactory = SSLConnectionSocketFactoryBuilder.create()
|
||||
.setSslContext(sslContext).setHostnameVerifier(NoopHostnameVerifier.INSTANCE).build();
|
||||
final DefaultClientTlsStrategy tlsStrategy = new DefaultClientTlsStrategy(sslContext,
|
||||
HostnameVerificationPolicy.CLIENT, NoopHostnameVerifier.INSTANCE);
|
||||
final HttpClientConnectionManager connectionManager = PoolingHttpClientConnectionManagerBuilder.create()
|
||||
.setSSLSocketFactory(sslSocketFactory).build();
|
||||
.setTlsSocketStrategy(tlsStrategy).build();
|
||||
builder.setConnectionManager(connectionManager);
|
||||
return builder;
|
||||
}
|
||||
|
|
@ -2485,7 +2480,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
|||
// present and wrong and no present; in combination with custom Authorization
|
||||
// header present and valid, present and wrong and no present
|
||||
|
||||
final String WRONG_SECRET = "WRONG_SECRET_" + RandomStringUtils.randomAlphanumeric(10);
|
||||
final String WRONG_SECRET = "WRONG_SECRET_"
|
||||
+ UUID.randomUUID().toString().replace("-", "").substring(0, 10);
|
||||
|
||||
final String VALID_BASIC_AUTH = "Basic "
|
||||
+ Base64.getEncoder().encodeToString(("OPENVIDUAPP:" + OPENVIDU_SECRET).getBytes());
|
||||
|
|
@ -2739,10 +2735,10 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
|||
final int numberOfVideos = user.getDriver().findElements(By.tagName("video")).size();
|
||||
Assertions.assertEquals(2, numberOfVideos, "Wrong number of videos");
|
||||
Assertions.assertTrue(user.getBrowserUser().assertMediaTracks(
|
||||
(WebElement) user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 video")), false, true,
|
||||
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 video")), false, true,
|
||||
"#openvidu-instance-0"), "Moderator video was expected to have audio only track");
|
||||
Assertions.assertTrue(user.getBrowserUser().assertMediaTracks(
|
||||
(WebElement) user.getDriver().findElement(By.cssSelector("#openvidu-instance-1 video")), true, true,
|
||||
user.getDriver().findElement(By.cssSelector("#openvidu-instance-1 video")), true, true,
|
||||
"#openvidu-instance-1"), "Subscriber video was expected to have audio and video tracks");
|
||||
|
||||
Assertions.assertTrue(OV.fetch(), "Session.fetch() should return true after users connected");
|
||||
|
|
|
|||
Loading…
Reference in New Issue