openvidu-test-e2e: fix uri resolution from protocol

pull/848/head
pabloFuente 2024-10-07 16:43:16 +02:00
parent d19f0f7bb5
commit 8e12739c97
3 changed files with 12 additions and 11 deletions

View File

@ -24,8 +24,8 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -91,12 +91,12 @@ public class OpenViduEventManager {
public OpenViduEventManager(WebDriver driver, int timeOfWaitInSeconds) {
this.driver = driver;
this.eventQueue = new ConcurrentLinkedQueue<JsonObject>();
this.eventCallbacks = new ConcurrentHashMap<>();
this.eventNumbers = new ConcurrentHashMap<>();
this.eventCountdowns = new ConcurrentHashMap<>();
this.eventCallbacksByUser = new ConcurrentHashMap<>();
this.eventNumbersByUser = new ConcurrentHashMap<>();
this.eventCountdownsByUser = new ConcurrentHashMap<>();
this.eventCallbacks = new ConcurrentSkipListMap<>();
this.eventNumbers = new ConcurrentSkipListMap<>();
this.eventCountdowns = new ConcurrentSkipListMap<>();
this.eventCallbacksByUser = new ConcurrentSkipListMap<>();
this.eventNumbersByUser = new ConcurrentSkipListMap<>();
this.eventCountdownsByUser = new ConcurrentSkipListMap<>();
this.timeOfWaitInSeconds = timeOfWaitInSeconds;
}
@ -280,11 +280,11 @@ public class OpenViduEventManager {
this.startPolling();
}
public AtomicInteger getNumEvents(String eventTypeAndCategory) {
public synchronized AtomicInteger getNumEvents(String eventTypeAndCategory) {
return this.eventNumbers.computeIfAbsent(eventTypeAndCategory, k -> new AtomicInteger(0));
}
public AtomicInteger getNumEvents(int numberOfUser, String eventTypeAndCategory) {
public synchronized AtomicInteger getNumEvents(int numberOfUser, String eventTypeAndCategory) {
this.eventNumbersByUser.putIfAbsent(numberOfUser, new HashMap<>());
return this.eventNumbersByUser.get(numberOfUser).computeIfAbsent(eventTypeAndCategory,
k -> new AtomicInteger(0));

View File

@ -145,7 +145,8 @@ public class OpenViduTestE2e {
} catch (URISyntaxException e) {
Assertions.fail("Wrong LIVEKIT_URL");
}
String url = ("wss".equals(uri.getScheme()) ? "https" : "http") + "://" + uri.getAuthority() + uri.getPath();
String url = (("wss".equals(uri.getScheme()) || "https".equals(uri.getScheme())) ? "https" : "http") + "://"
+ uri.getAuthority() + uri.getPath();
LK = RoomServiceClient.create(url.toString(), LIVEKIT_API_KEY, LIVEKIT_API_SECRET, false,
(okHttpClientBuilder) -> {

View File

@ -185,7 +185,7 @@ export class RoomApiService {
private getUrl(endpoint: string, method: string) {
const wsUrl = this.livekitParamsService.getParams().livekitUrl;
const protocol = wsUrl.startsWith('wss:') ? 'https' : 'http';
const protocol = (wsUrl.startsWith('wss:') || wsUrl.startsWith('https:')) ? 'https' : 'http';
const restUrl = `${protocol}://${wsUrl.substring(wsUrl.indexOf('//') + 2).replace(/\/$/, "")}`;
return `${restUrl}/twirp/livekit.${endpoint}/${method}`;
}