openvidu-test-e2e: fetch sessions before close on AfterEach

pull/203/head
pabloFuente 2019-02-05 20:41:14 +01:00
parent fe29312bfe
commit 85204cb743
1 changed files with 11 additions and 3 deletions

View File

@ -114,6 +114,7 @@ public class OpenViduTestAppE2eTest {
BrowserUser user; BrowserUser user;
Collection<BrowserUser> otherUsers = new ArrayList<>(); Collection<BrowserUser> otherUsers = new ArrayList<>();
volatile static boolean isRecordingTest; volatile static boolean isRecordingTest;
private static OpenVidu OV;
@BeforeAll() @BeforeAll()
static void setupAll() { static void setupAll() {
@ -154,6 +155,7 @@ public class OpenViduTestAppE2eTest {
} catch (IOException e) { } catch (IOException e) {
log.error(e.getMessage()); log.error(e.getMessage());
} }
OV = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET);
} }
void setupBrowser(String browser) { void setupBrowser(String browser) {
@ -211,13 +213,19 @@ public class OpenViduTestAppE2eTest {
other.dispose(); other.dispose();
it.remove(); it.remove();
} }
new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET).getActiveSessions().forEach(session -> { try {
OV.fetch();
} catch (OpenViduJavaClientException | OpenViduHttpException e1) {
log.error("Error fetching sessions: {}", e1.getMessage());
}
OV.getActiveSessions().forEach(session -> {
try { try {
session.close(); session.close();
log.info("Session {} successfully closed", session.getSessionId());
} catch (OpenViduJavaClientException e) { } catch (OpenViduJavaClientException e) {
e.printStackTrace(); log.error("Error closing session: {}", e.getMessage());
} catch (OpenViduHttpException e) { } catch (OpenViduHttpException e) {
e.printStackTrace(); log.error("Error closing session: {}", e.getMessage());
} }
}); });
if (isRecordingTest) { if (isRecordingTest) {