From 10ad16464c4d402ed55f78ae0ae9bbbbfac7ea31 Mon Sep 17 00:00:00 2001 From: pabloFuente Date: Thu, 11 Nov 2021 18:50:32 +0100 Subject: [PATCH] openvidu-test-e2e: fix restApiProTest --- .../io/openvidu/client/OpenViduException.java | 2 +- .../kurento/core/KurentoSessionManager.java | 16 +++++++++++----- .../kurento/endpoint/PublisherEndpoint.java | 2 +- .../openvidu/test/e2e/OpenViduEventManager.java | 2 ++ .../openvidu/test/e2e/OpenViduTestappUser.java | 4 ---- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/openvidu-client/src/main/java/io/openvidu/client/OpenViduException.java b/openvidu-client/src/main/java/io/openvidu/client/OpenViduException.java index ed79e5ba..b3f49924 100644 --- a/openvidu-client/src/main/java/io/openvidu/client/OpenViduException.java +++ b/openvidu-client/src/main/java/io/openvidu/client/OpenViduException.java @@ -41,7 +41,7 @@ public class OpenViduException extends JsonRpcErrorException { USER_UNAUTHORIZED_ERROR_CODE(401), ROLE_NOT_FOUND_ERROR_CODE(402), SESSIONID_CANNOT_BE_CREATED_ERROR_CODE(403), TOKEN_CANNOT_BE_CREATED_ERROR_CODE(404), EXISTING_FILTER_ALREADY_APPLIED_ERROR_CODE(405), - FILTER_NOT_APPLIED_ERROR_CODE(406), FILTER_EVENT_LISTENER_NOT_FOUND(407), + FILTER_NOT_APPLIED_ERROR_CODE(406), FILTER_EVENT_LISTENER_NOT_FOUND_ERROR_CODE(407), PUBLISHER_ENDPOINT_NOT_FOUND_ERROR_CODE(408), USER_METADATA_FORMAT_INVALID_ERROR_CODE(500), diff --git a/openvidu-server/src/main/java/io/openvidu/server/kurento/core/KurentoSessionManager.java b/openvidu-server/src/main/java/io/openvidu/server/kurento/core/KurentoSessionManager.java index 62d8fa3f..77503770 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/kurento/core/KurentoSessionManager.java +++ b/openvidu-server/src/main/java/io/openvidu/server/kurento/core/KurentoSessionManager.java @@ -750,11 +750,17 @@ public class KurentoSessionManager extends SessionManager { KurentoParticipant kParticipant = (KurentoParticipant) participant; log.debug("Request [ICE_CANDIDATE] endpoint={} candidate={} " + "sdpMLineIdx={} sdpMid={} ({})", endpointName, candidate, sdpMLineIndex, sdpMid, participant.getParticipantPublicId()); - kParticipant.addIceCandidate(endpointName, new IceCandidate(candidate, sdpMid, sdpMLineIndex)); - sessionEventsHandler.onRecvIceCandidate(participant, transactionId, null); + if (kParticipant.isPublisherEndpointDefined()) { + kParticipant.addIceCandidate(endpointName, new IceCandidate(candidate, sdpMid, sdpMLineIndex)); + sessionEventsHandler.onRecvIceCandidate(participant, transactionId, null); + } else { + throw new OpenViduException(Code.PUBLISHER_ENDPOINT_NOT_FOUND_ERROR_CODE, + "Request to onIceCandidate for connection " + endpointName + + " gone wrong. There is no publisher endpoint available"); + } } catch (OpenViduException e) { - log.error("PARTICIPANT {}: Error receiving ICE " + "candidate (epName={}, candidate={})", - participant.getParticipantPublicId(), endpointName, candidate, e); + log.error("PARTICIPANT {}: Error receiving ICE " + "candidate (epName={}, candidate={}): {}", + participant.getParticipantPublicId(), endpointName, candidate, e.getMessage()); sessionEventsHandler.onRecvIceCandidate(participant, transactionId, e); } } @@ -1374,7 +1380,7 @@ public class KurentoSessionManager extends SessionManager { } catch (Exception e) { log.error("Request to addFilterEventListener to stream {} gone wrong. Error: {}", streamId, e.getMessage()); - throw new OpenViduException(Code.FILTER_EVENT_LISTENER_NOT_FOUND, + throw new OpenViduException(Code.FILTER_EVENT_LISTENER_NOT_FOUND_ERROR_CODE, "Request to addFilterEventListener to stream " + streamId + " gone wrong: " + e.getMessage()); } } diff --git a/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/PublisherEndpoint.java b/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/PublisherEndpoint.java index 0ef196b3..4ebce76d 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/PublisherEndpoint.java +++ b/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/PublisherEndpoint.java @@ -158,7 +158,7 @@ public class PublisherEndpoint extends MediaEndpoint { String streamId = this.getStreamId(); log.error("Request to removeFilterEventListener to stream {} gone wrong: Filter {} has no listener added", streamId, eventType); - throw new OpenViduException(Code.FILTER_EVENT_LISTENER_NOT_FOUND, + throw new OpenViduException(Code.FILTER_EVENT_LISTENER_NOT_FOUND_ERROR_CODE, "Request to removeFilterEventListener to stream " + streamId + " gone wrong: Filter " + eventType + " has no listener added"); } diff --git a/openvidu-test-e2e/src/main/java/io/openvidu/test/e2e/OpenViduEventManager.java b/openvidu-test-e2e/src/main/java/io/openvidu/test/e2e/OpenViduEventManager.java index d4fc6359..416b934a 100644 --- a/openvidu-test-e2e/src/main/java/io/openvidu/test/e2e/OpenViduEventManager.java +++ b/openvidu-test-e2e/src/main/java/io/openvidu/test/e2e/OpenViduEventManager.java @@ -121,6 +121,8 @@ public class OpenViduEventManager { this.pollingThread.interrupt(); } + this.isInterrupted.set(false); + this.pollingThread = new Thread(() -> { while (!this.isInterrupted.get()) { this.getEventsFromBrowser(); diff --git a/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/OpenViduTestappUser.java b/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/OpenViduTestappUser.java index 96c1f886..5fe13696 100644 --- a/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/OpenViduTestappUser.java +++ b/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/OpenViduTestappUser.java @@ -1,10 +1,6 @@ package io.openvidu.test.e2e; -import java.time.Duration; -import java.time.temporal.ChronoUnit; - import org.openqa.selenium.WebDriver; -import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.WebDriverWait; import io.openvidu.test.browsers.BrowserUser;