mirror of https://github.com/OpenVidu/openvidu.git
openvidu-test-e2e: check ffmpeg installation on @BeforeAll
parent
eac716abf9
commit
c66bfc3ea5
|
@ -83,6 +83,7 @@ import io.openvidu.test.e2e.browser.ChromeAndroidUser;
|
||||||
import io.openvidu.test.e2e.browser.ChromeUser;
|
import io.openvidu.test.e2e.browser.ChromeUser;
|
||||||
import io.openvidu.test.e2e.browser.FirefoxUser;
|
import io.openvidu.test.e2e.browser.FirefoxUser;
|
||||||
import io.openvidu.test.e2e.browser.OperaUser;
|
import io.openvidu.test.e2e.browser.OperaUser;
|
||||||
|
import io.openvidu.test.e2e.utils.CommandLineExecuter;
|
||||||
import io.openvidu.test.e2e.utils.MultimediaFileMetadata;
|
import io.openvidu.test.e2e.utils.MultimediaFileMetadata;
|
||||||
import io.openvidu.test.e2e.utils.Unzipper;
|
import io.openvidu.test.e2e.utils.Unzipper;
|
||||||
|
|
||||||
|
@ -111,6 +112,16 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
@BeforeAll()
|
@BeforeAll()
|
||||||
static void setupAll() {
|
static void setupAll() {
|
||||||
|
|
||||||
|
String ffmpegOutput = new CommandLineExecuter().executeCommand("which ffmpeg");
|
||||||
|
if (ffmpegOutput == null || ffmpegOutput.isEmpty()) {
|
||||||
|
log.error("ffmpeg package is not installed in the host machine");
|
||||||
|
Assert.fail();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
log.info("ffmpeg is installed and accesible");
|
||||||
|
}
|
||||||
|
|
||||||
WebDriverManager.chromedriver().setup();
|
WebDriverManager.chromedriver().setup();
|
||||||
WebDriverManager.firefoxdriver().setup();
|
WebDriverManager.firefoxdriver().setup();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* (C) Copyright 2017-2019 OpenVidu (https://openvidu.io/)
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.openvidu.test.e2e.utils;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
public class CommandLineExecuter {
|
||||||
|
|
||||||
|
public String executeCommand(String command) {
|
||||||
|
String output = "";
|
||||||
|
Process p = null;
|
||||||
|
try {
|
||||||
|
p = Runtime.getRuntime().exec(command);
|
||||||
|
p.waitFor();
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||||||
|
String line = "";
|
||||||
|
while ((line = br.readLine()) != null) {
|
||||||
|
output += line;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
p.destroy();
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -17,10 +17,6 @@
|
||||||
|
|
||||||
package io.openvidu.test.e2e.utils;
|
package io.openvidu.test.e2e.utils;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -32,6 +28,9 @@ public class MultimediaFileMetadata {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(MultimediaFileMetadata.class);
|
private static final Logger log = LoggerFactory.getLogger(MultimediaFileMetadata.class);
|
||||||
|
|
||||||
|
private CommandLineExecuter executer = new CommandLineExecuter();
|
||||||
|
private JsonParser parser = new JsonParser();
|
||||||
|
|
||||||
private JsonObject json;
|
private JsonObject json;
|
||||||
private JsonObject formatJson;
|
private JsonObject formatJson;
|
||||||
private JsonObject audioStreamJson;
|
private JsonObject audioStreamJson;
|
||||||
|
@ -139,22 +138,8 @@ public class MultimediaFileMetadata {
|
||||||
|
|
||||||
private JsonObject executeFfprobeCommand(String filePath) {
|
private JsonObject executeFfprobeCommand(String filePath) {
|
||||||
log.info("Running ffprobe command on '{}'", filePath);
|
log.info("Running ffprobe command on '{}'", filePath);
|
||||||
String jsonLines = "";
|
String cmd = "ffprobe -v quiet -print_format json -show_format -show_streams " + filePath;
|
||||||
try {
|
return this.parser.parse(this.executer.executeCommand(cmd)).getAsJsonObject();
|
||||||
String s;
|
|
||||||
Process p;
|
|
||||||
p = Runtime.getRuntime().exec("ffprobe -v quiet -print_format json -show_format -show_streams " + filePath);
|
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
|
||||||
while ((s = br.readLine()) != null) {
|
|
||||||
jsonLines += s;
|
|
||||||
}
|
|
||||||
p.waitFor();
|
|
||||||
p.destroy();
|
|
||||||
} catch (IOException | InterruptedException e1) {
|
|
||||||
log.info("Error updateing permissions of jave executable. Error: {}" + e1.getMessage());
|
|
||||||
}
|
|
||||||
JsonParser parser = new JsonParser();
|
|
||||||
return parser.parse(jsonLines).getAsJsonObject();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue