mirror of https://github.com/OpenVidu/openvidu.git
openvidu-test-e2e: fix uri resolution from protocol
parent
d19f0f7bb5
commit
8e12739c97
|
@ -24,8 +24,8 @@ import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
import java.util.concurrent.ConcurrentSkipListMap;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
@ -91,12 +91,12 @@ public class OpenViduEventManager {
|
||||||
public OpenViduEventManager(WebDriver driver, int timeOfWaitInSeconds) {
|
public OpenViduEventManager(WebDriver driver, int timeOfWaitInSeconds) {
|
||||||
this.driver = driver;
|
this.driver = driver;
|
||||||
this.eventQueue = new ConcurrentLinkedQueue<JsonObject>();
|
this.eventQueue = new ConcurrentLinkedQueue<JsonObject>();
|
||||||
this.eventCallbacks = new ConcurrentHashMap<>();
|
this.eventCallbacks = new ConcurrentSkipListMap<>();
|
||||||
this.eventNumbers = new ConcurrentHashMap<>();
|
this.eventNumbers = new ConcurrentSkipListMap<>();
|
||||||
this.eventCountdowns = new ConcurrentHashMap<>();
|
this.eventCountdowns = new ConcurrentSkipListMap<>();
|
||||||
this.eventCallbacksByUser = new ConcurrentHashMap<>();
|
this.eventCallbacksByUser = new ConcurrentSkipListMap<>();
|
||||||
this.eventNumbersByUser = new ConcurrentHashMap<>();
|
this.eventNumbersByUser = new ConcurrentSkipListMap<>();
|
||||||
this.eventCountdownsByUser = new ConcurrentHashMap<>();
|
this.eventCountdownsByUser = new ConcurrentSkipListMap<>();
|
||||||
this.timeOfWaitInSeconds = timeOfWaitInSeconds;
|
this.timeOfWaitInSeconds = timeOfWaitInSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,11 +280,11 @@ public class OpenViduEventManager {
|
||||||
this.startPolling();
|
this.startPolling();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AtomicInteger getNumEvents(String eventTypeAndCategory) {
|
public synchronized AtomicInteger getNumEvents(String eventTypeAndCategory) {
|
||||||
return this.eventNumbers.computeIfAbsent(eventTypeAndCategory, k -> new AtomicInteger(0));
|
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<>());
|
this.eventNumbersByUser.putIfAbsent(numberOfUser, new HashMap<>());
|
||||||
return this.eventNumbersByUser.get(numberOfUser).computeIfAbsent(eventTypeAndCategory,
|
return this.eventNumbersByUser.get(numberOfUser).computeIfAbsent(eventTypeAndCategory,
|
||||||
k -> new AtomicInteger(0));
|
k -> new AtomicInteger(0));
|
||||||
|
|
|
@ -145,7 +145,8 @@ public class OpenViduTestE2e {
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
Assertions.fail("Wrong LIVEKIT_URL");
|
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,
|
LK = RoomServiceClient.create(url.toString(), LIVEKIT_API_KEY, LIVEKIT_API_SECRET, false,
|
||||||
(okHttpClientBuilder) -> {
|
(okHttpClientBuilder) -> {
|
||||||
|
|
|
@ -185,7 +185,7 @@ export class RoomApiService {
|
||||||
|
|
||||||
private getUrl(endpoint: string, method: string) {
|
private getUrl(endpoint: string, method: string) {
|
||||||
const wsUrl = this.livekitParamsService.getParams().livekitUrl;
|
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(/\/$/, "")}`;
|
const restUrl = `${protocol}://${wsUrl.substring(wsUrl.indexOf('//') + 2).replace(/\/$/, "")}`;
|
||||||
return `${restUrl}/twirp/livekit.${endpoint}/${method}`;
|
return `${restUrl}/twirp/livekit.${endpoint}/${method}`;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue