Skip to content

Commit

Permalink
openvidu-test-e2e: custom layout recording test
Browse files Browse the repository at this point in the history
pabloFuente committed Oct 1, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 6a86703 commit 3056d21
Showing 8 changed files with 266 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -220,7 +220,7 @@ private String runContainer(Session session, RecordingProperties properties) thr
containers.remove(containerId);
sessionsContainers.remove(session.getSessionId());
}
log.error("Error while launchig container for COMPOSED_QUICK_START: ({})", e.getMessage());
log.error("Error while launching container for COMPOSED_QUICK_START: ({})", e.getMessage());
throw e;
}
return containerId;
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package io.openvidu.test.browsers.utils.layout;

import java.util.concurrent.CountDownLatch;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.event.EventListener;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@SpringBootApplication
public class CustomLayoutHandler extends WebSecurityConfigurerAdapter implements WebMvcConfigurer {

private static ConfigurableApplicationContext context;
public static CountDownLatch initLatch;

public static void main(String[] args, CountDownLatch initLatch) {
CustomLayoutHandler.initLatch = initLatch;
CustomLayoutHandler.context = new SpringApplicationBuilder(CustomLayoutHandler.class)
.properties("spring.config.location:classpath:aplication-pro-layout-handler.properties").build()
.run(args);
}

@Override
protected void configure(HttpSecurity security) throws Exception {
security.httpBasic().disable();
}

@EventListener(ApplicationReadyEvent.class)
public void afterStartup() {
CustomLayoutHandler.initLatch.countDown();
}

public static void shutDown() {
CustomLayoutHandler.context.close();
}

}
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
*
*/

package io.openvidu.test.browsers.utils;
package io.openvidu.test.browsers.utils.webhook;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
@@ -24,7 +24,6 @@
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.TimeUnit;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ConfigurableApplicationContext;
@@ -39,7 +38,6 @@
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

@SpringBootApplication
public class CustomWebhook {

private static ConfigurableApplicationContext context;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
server.port=5555
server.ssl.enabled=false
security.basic.enabled=false
55 changes: 55 additions & 0 deletions openvidu-test-browsers/src/main/resources/static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<html>

<head>
<script>
const xmlHttp = new XMLHttpRequest();
xmlHttp.open('GET', 'https://api.github.com/repos/OpenVidu/openvidu/releases/latest', false);
xmlHttp.send(null);
const response = JSON.parse(xmlHttp.responseText);
const version = response.tag_name.replace(/^v/, '');
const newScript = document.createElement('script');
newScript.src = 'https://github.com/OpenVidu/openvidu/releases/download/v' + version +
'/openvidu-browser-' + version + '.min.js';
document.getElementsByTagName('head')[0].appendChild(newScript);
newScript.onload = () => {
startOpenVidu();
};
</script>
</script>
<style>
video {
height: 5px !important;
width: 10px !important;
}
</style>
</head>

<body style='background-color: red'>
<div id='videos'></div>
</body>

<script>
function startOpenVidu() {
var url = new URL(window.location.href);
var SESSION_ID = url.searchParams.get('sessionId');
var SECRET = url.searchParams.get('secret');
var TOKEN = 'wss://' + location.hostname + ':4443?sessionId=' + SESSION_ID + '&secret=' + SECRET +
'&recorder=true';

var OV = new OpenVidu();
var session = OV.initSession();

session.on('streamCreated', (event) => {
session.subscribe(event.stream, 'videos');
});
session.connect(TOKEN)
.then(() => {
console.log('Recorder participant connected')
})
.catch(error => {
console.error(error)
});
}
</script>

</html>
5 changes: 3 additions & 2 deletions openvidu-test-e2e/jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ node('container') {
sh 'rm -rf /opt/openvidu/* || true'
sh 'wget https://github.com/OpenVidu/openvidu/raw/master/openvidu-test-e2e/docker/barcode.y4m -P /opt/openvidu'
sh 'wget https://github.com/OpenVidu/openvidu/raw/master/openvidu-test-e2e/docker/fakeaudio.wav -P /opt/openvidu'
sh 'wget --directory-prefix=/opt/openvidu/test-layouts/layout1 https://github.com/OpenVidu/openvidu/blob/master/openvidu-test-e2e/docker/my-custom-layout/index.html'
docker.image('selenium/standalone-firefox:latest').withRun('-p 6667:4444 --name firefox --shm-size=1g') { d ->
def mycontainer = docker.image('openvidu/openvidu-test-e2e:$DISTRO')
mycontainer.pull()
@@ -93,10 +94,10 @@ node('container') {
sh(script: '''#!/bin/bash
if [ "$DOCKER_RECORDING_VERSION" != "default" ]; then
echo "Using custom openvidu-recording tag: $DOCKER_RECORDING_VERSION"
java -jar -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_VERSION=$DOCKER_RECORDING_VERSION -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log &
java -jar -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_RECORDING_VERSION=$DOCKER_RECORDING_VERSION -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log &
else
echo "Using default openvidu-recording tag"
java -jar -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log &
java -jar -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log &
fi
'''.stripIndent())
sh 'until $(curl --insecure --output /dev/null --silent --head --fail https://OPENVIDUAPP:MY_SECRET@localhost:4443/); do echo "Waiting for openvidu-server..."; sleep 2; done'
Loading

0 comments on commit 3056d21

Please sign in to comment.