mirror of https://github.com/OpenVidu/openvidu.git
openvidu-test-browsers: update to support new JUnit version
parent
fe2f668d58
commit
3ed03167ca
|
@ -98,8 +98,8 @@
|
||||||
<version>${version.openvidu.java.client}</version>
|
<version>${version.openvidu.java.client}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<version>${version.junit}</version>
|
<version>${version.junit}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.jcodec.api.FrameGrab;
|
||||||
import org.jcodec.api.JCodecException;
|
import org.jcodec.api.JCodecException;
|
||||||
import org.jcodec.common.model.Picture;
|
import org.jcodec.common.model.Picture;
|
||||||
import org.jcodec.scale.AWTUtil;
|
import org.jcodec.scale.AWTUtil;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -58,10 +58,9 @@ public class RecordingUtils {
|
||||||
Map<String, Long> colorMap = this.averageColor(image);
|
Map<String, Long> colorMap = this.averageColor(image);
|
||||||
|
|
||||||
String realResolution = image.getWidth() + "x" + image.getHeight();
|
String realResolution = image.getWidth() + "x" + image.getHeight();
|
||||||
Assert.assertEquals(
|
Assertions.assertEquals(recording.getResolution(), realResolution,
|
||||||
"Resolution (" + recording.getResolution()
|
"Resolution (" + recording.getResolution()
|
||||||
+ ") of recording entity is not equal to real video resolution (" + realResolution + ")",
|
+ ") of recording entity is not equal to real video resolution (" + realResolution + ")");
|
||||||
recording.getResolution(), realResolution);
|
|
||||||
|
|
||||||
log.info("Recording map color: {}", colorMap.toString());
|
log.info("Recording map color: {}", colorMap.toString());
|
||||||
log.info("Recording frame below");
|
log.info("Recording frame below");
|
||||||
|
@ -111,26 +110,27 @@ public class RecordingUtils {
|
||||||
|
|
||||||
// Should be only 2 files: zip and metadata
|
// Should be only 2 files: zip and metadata
|
||||||
File folder = new File(recPath);
|
File folder = new File(recPath);
|
||||||
Assert.assertEquals("There are more than 2 files (ZIP and metadata) inside individual recording folder "
|
Assertions.assertEquals(2, folder.listFiles().length,
|
||||||
+ recPath + ": " + Arrays.toString(folder.listFiles()), 2, folder.listFiles().length);
|
"There are more than 2 files (ZIP and metadata) inside individual recording folder " + recPath + ": "
|
||||||
|
+ Arrays.toString(folder.listFiles()));
|
||||||
|
|
||||||
File file1 = new File(recPath + recording.getName() + ".zip");
|
File file1 = new File(recPath + recording.getName() + ".zip");
|
||||||
File file2 = new File(recPath + ".recording." + recording.getId());
|
File file2 = new File(recPath + ".recording." + recording.getId());
|
||||||
|
|
||||||
Assert.assertTrue("File " + file1.getAbsolutePath() + " does not exist or is empty",
|
Assertions.assertTrue(file1.exists() && file1.length() > 0,
|
||||||
file1.exists() && file1.length() > 0);
|
"File " + file1.getAbsolutePath() + " does not exist or is empty");
|
||||||
Assert.assertTrue("File " + file2.getAbsolutePath() + " does not exist or is empty",
|
Assertions.assertTrue(file2.exists() && file2.length() > 0,
|
||||||
file2.exists() && file2.length() > 0);
|
"File " + file2.getAbsolutePath() + " does not exist or is empty");
|
||||||
|
|
||||||
List<File> unzippedWebmFiles = new Unzipper().unzipFile(recPath, recording.getName() + ".zip");
|
List<File> unzippedWebmFiles = new Unzipper().unzipFile(recPath, recording.getName() + ".zip");
|
||||||
|
|
||||||
Assert.assertEquals("Expecting " + numberOfVideoFiles + " videos inside ZIP file but "
|
Assertions.assertEquals(numberOfVideoFiles, unzippedWebmFiles.size(),
|
||||||
+ unzippedWebmFiles.size() + " found: " + unzippedWebmFiles.toString(), numberOfVideoFiles,
|
"Expecting " + numberOfVideoFiles + " videos inside ZIP file but " + unzippedWebmFiles.size()
|
||||||
unzippedWebmFiles.size());
|
+ " found: " + unzippedWebmFiles.toString());
|
||||||
|
|
||||||
File jsonSyncFile = new File(recPath + recording.getName() + ".json");
|
File jsonSyncFile = new File(recPath + recording.getName() + ".json");
|
||||||
Assert.assertTrue("JSON sync file " + jsonSyncFile.getAbsolutePath() + "does not exist or is empty",
|
Assertions.assertTrue(jsonSyncFile.exists() && jsonSyncFile.length() > 0,
|
||||||
jsonSyncFile.exists() && jsonSyncFile.length() > 0);
|
"JSON sync file " + jsonSyncFile.getAbsolutePath() + "does not exist or is empty");
|
||||||
|
|
||||||
JsonObject jsonSyncMetadata;
|
JsonObject jsonSyncMetadata;
|
||||||
try {
|
try {
|
||||||
|
@ -140,7 +140,7 @@ public class RecordingUtils {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Cannot read JSON sync metadata file from {}. Error: {}", jsonSyncFile.getAbsolutePath(),
|
log.error("Cannot read JSON sync metadata file from {}. Error: {}", jsonSyncFile.getAbsolutePath(),
|
||||||
e.getMessage());
|
e.getMessage());
|
||||||
Assert.fail("Cannot read JSON sync metadata file from " + jsonSyncFile.getAbsolutePath());
|
Assertions.fail("Cannot read JSON sync metadata file from " + jsonSyncFile.getAbsolutePath());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,8 +149,8 @@ public class RecordingUtils {
|
||||||
for (File webmFile : unzippedWebmFiles) {
|
for (File webmFile : unzippedWebmFiles) {
|
||||||
totalFileSize += webmFile.length();
|
totalFileSize += webmFile.length();
|
||||||
|
|
||||||
Assert.assertTrue("WEBM file " + webmFile.getAbsolutePath() + " does not exist or is empty",
|
Assertions.assertTrue(webmFile.exists() && webmFile.length() > 0,
|
||||||
webmFile.exists() && webmFile.length() > 0);
|
"WEBM file " + webmFile.getAbsolutePath() + " does not exist or is empty");
|
||||||
|
|
||||||
double durationInSeconds = 0;
|
double durationInSeconds = 0;
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
@ -164,8 +164,8 @@ public class RecordingUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertTrue("Couldn't find in JSON sync object information for webm file " + webmFile.getName(),
|
Assertions.assertTrue(found,
|
||||||
found);
|
"Couldn't find in JSON sync object information for webm file " + webmFile.getName());
|
||||||
|
|
||||||
log.info("Duration of {} according to sync metadata json file: {} s", webmFile.getName(),
|
log.info("Duration of {} according to sync metadata json file: {} s", webmFile.getName(),
|
||||||
durationInSeconds);
|
durationInSeconds);
|
||||||
|
@ -174,8 +174,8 @@ public class RecordingUtils {
|
||||||
webmFile.delete();
|
webmFile.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertEquals("Size of recording entity (" + recording.getSessionId()
|
Assertions.assertEquals(recording.getSize(), totalFileSize, "Size of recording entity ("
|
||||||
+ ") is not equal to real file size (" + totalFileSize + ")", recording.getSize(), totalFileSize);
|
+ recording.getSessionId() + ") is not equal to real file size (" + totalFileSize + ")");
|
||||||
|
|
||||||
jsonSyncFile.delete();
|
jsonSyncFile.delete();
|
||||||
}
|
}
|
||||||
|
@ -188,28 +188,28 @@ public class RecordingUtils {
|
||||||
if (hasVideo) {
|
if (hasVideo) {
|
||||||
if (checkAudio) {
|
if (checkAudio) {
|
||||||
if (hasAudio) {
|
if (hasAudio) {
|
||||||
Assert.assertTrue("Media file " + file.getAbsolutePath() + " should have audio",
|
Assertions.assertTrue(metadata.hasAudio() && metadata.hasVideo(),
|
||||||
metadata.hasAudio() && metadata.hasVideo());
|
"Media file " + file.getAbsolutePath() + " should have audio");
|
||||||
Assert.assertTrue(metadata.getAudioDecoder().toLowerCase().contains(audioDecoder));
|
Assertions.assertTrue(metadata.getAudioDecoder().toLowerCase().contains(audioDecoder));
|
||||||
} else {
|
} else {
|
||||||
Assert.assertTrue("Media file " + file.getAbsolutePath() + " should have video",
|
Assertions.assertTrue(metadata.hasVideo(),
|
||||||
metadata.hasVideo());
|
"Media file " + file.getAbsolutePath() + " should have video");
|
||||||
Assert.assertFalse(metadata.hasAudio());
|
Assertions.assertFalse(metadata.hasAudio());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (resolution != null) {
|
if (resolution != null) {
|
||||||
Assert.assertEquals(resolution, metadata.getVideoWidth() + "x" + metadata.getVideoHeight());
|
Assertions.assertEquals(resolution, metadata.getVideoWidth() + "x" + metadata.getVideoHeight());
|
||||||
}
|
}
|
||||||
if (frameRate != null) {
|
if (frameRate != null) {
|
||||||
Assert.assertEquals(frameRate.intValue(), metadata.getFrameRate());
|
Assertions.assertEquals(frameRate.intValue(), metadata.getFrameRate());
|
||||||
}
|
}
|
||||||
Assert.assertTrue(metadata.getVideoDecoder().toLowerCase().contains(videoDecoder));
|
Assertions.assertTrue(metadata.getVideoDecoder().toLowerCase().contains(videoDecoder));
|
||||||
} else if (hasAudio && checkAudio) {
|
} else if (hasAudio && checkAudio) {
|
||||||
Assert.assertTrue(metadata.hasAudio());
|
Assertions.assertTrue(metadata.hasAudio());
|
||||||
Assert.assertFalse(metadata.hasVideo());
|
Assertions.assertFalse(metadata.hasVideo());
|
||||||
Assert.assertTrue(metadata.getAudioDecoder().toLowerCase().contains(audioDecoder));
|
Assertions.assertTrue(metadata.getAudioDecoder().toLowerCase().contains(audioDecoder));
|
||||||
} else {
|
} else {
|
||||||
Assert.fail("Cannot check a file witho no audio and no video");
|
Assertions.fail("Cannot check a file witho no audio and no video");
|
||||||
}
|
}
|
||||||
// Check duration with 1 decimal precision
|
// Check duration with 1 decimal precision
|
||||||
DecimalFormat df = new DecimalFormat("#0.0");
|
DecimalFormat df = new DecimalFormat("#0.0");
|
||||||
|
@ -218,10 +218,9 @@ public class RecordingUtils {
|
||||||
log.info("Duration of {} according to 'duration' property: {} s", file.getName(), duration);
|
log.info("Duration of {} according to 'duration' property: {} s", file.getName(), duration);
|
||||||
log.info("Difference in s duration: {}", Math.abs(metadata.getDuration() - duration));
|
log.info("Difference in s duration: {}", Math.abs(metadata.getDuration() - duration));
|
||||||
final double difference = 10;
|
final double difference = 10;
|
||||||
Assert.assertTrue(
|
Assertions.assertTrue(Math.abs((metadata.getDuration() - duration)) < difference,
|
||||||
"Difference between recording entity duration (" + duration + ") and real video duration ("
|
"Difference between recording entity duration (" + duration + ") and real video duration ("
|
||||||
+ metadata.getDuration() + ") is greater than " + difference + " in file " + file.getName(),
|
+ metadata.getDuration() + ") is greater than " + difference + " in file " + file.getName());
|
||||||
Math.abs((metadata.getDuration() - duration)) < difference);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean thumbnailIsFine(File file, Function<Map<String, Long>, Boolean> colorCheckFunction) {
|
public boolean thumbnailIsFine(File file, Function<Map<String, Long>, Boolean> colorCheckFunction) {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
server.port=4114
|
server.port=4114
|
||||||
server.ssl.enabled=false
|
server.ssl.enabled=false
|
||||||
security.basic.enabled=false
|
security.basic.enabled=false
|
||||||
|
spring.main.allow-circular-references=true
|
|
@ -1,3 +1,4 @@
|
||||||
server.port=7777
|
server.port=7777
|
||||||
server.ssl.enabled=false
|
server.ssl.enabled=false
|
||||||
management.metrics.export.elastic.enabled=false
|
management.metrics.export.elastic.enabled=false
|
||||||
|
spring.main.allow-circular-references=true
|
|
@ -1,7 +1,7 @@
|
||||||
package io.openvidu.test.browsers;
|
package io.openvidu.test.browsers;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
|
@ -43,12 +43,12 @@ public class CustomHttpClientTest {
|
||||||
expected = "{'prop1':'val1','prop2':{'prop3':'val3'}}";
|
expected = "{'prop1':'val1','prop2':{'prop3':'val3'}}";
|
||||||
actual = "{'prop1':'WRONG','prop2':{'prop3':'WRONG'}}";
|
actual = "{'prop1':'WRONG','prop2':{'prop3':'WRONG'}}";
|
||||||
executeCheck(expected, actual, true, false, true);
|
executeCheck(expected, actual, true, false, true);
|
||||||
Assert.assertThrows(IllegalStateException.class, () -> {
|
Assertions.assertThrows(IllegalStateException.class, () -> {
|
||||||
String expected2 = "{'prop1':'val1','prop2':{'prop3':'val3'}}";
|
String expected2 = "{'prop1':'val1','prop2':{'prop3':'val3'}}";
|
||||||
String actual2 = "{'prop1':'WRONG','prop2':'WRONG'}";
|
String actual2 = "{'prop1':'WRONG','prop2':'WRONG'}";
|
||||||
executeCheck(expected2, actual2, true, false, true);
|
executeCheck(expected2, actual2, true, false, true);
|
||||||
});
|
});
|
||||||
Assert.assertThrows(IllegalStateException.class, () -> {
|
Assertions.assertThrows(IllegalStateException.class, () -> {
|
||||||
String expected2 = "{'prop1':'val1','prop2':{'prop3':'val3'}}";
|
String expected2 = "{'prop1':'val1','prop2':{'prop3':'val3'}}";
|
||||||
String actual2 = "{'prop1':'WRONG','prop2':[12,34]}";
|
String actual2 = "{'prop1':'WRONG','prop2':[12,34]}";
|
||||||
executeCheck(expected2, actual2, true, false, true);
|
executeCheck(expected2, actual2, true, false, true);
|
||||||
|
@ -56,17 +56,17 @@ public class CustomHttpClientTest {
|
||||||
expected = "{'prop1':'val1','prop1':{'prop3':'val3'}}";
|
expected = "{'prop1':'val1','prop1':{'prop3':'val3'}}";
|
||||||
actual = "{'prop1':'val1','prop1':{'prop3':'val3'},'WRONG':'val1'}";
|
actual = "{'prop1':'val1','prop1':{'prop3':'val3'},'WRONG':'val1'}";
|
||||||
executeCheck(expected, actual, false, true, true);
|
executeCheck(expected, actual, false, true, true);
|
||||||
Assert.assertThrows(Exception.class, () -> {
|
Assertions.assertThrows(Exception.class, () -> {
|
||||||
String expected2 = "{'prop1':'val1','prop2':[12,34]}";
|
String expected2 = "{'prop1':'val1','prop2':[12,34]}";
|
||||||
String actual2 = "{'prop1':'val1','prop2':[12,35]}";
|
String actual2 = "{'prop1':'val1','prop2':[12,35]}";
|
||||||
executeCheck(expected2, actual2, false, true, true);
|
executeCheck(expected2, actual2, false, true, true);
|
||||||
});
|
});
|
||||||
Assert.assertThrows(IllegalStateException.class, () -> {
|
Assertions.assertThrows(IllegalStateException.class, () -> {
|
||||||
String expected2 = "{'prop1':'val1','prop2':[12,34]}";
|
String expected2 = "{'prop1':'val1','prop2':[12,34]}";
|
||||||
String actual2 = "{'prop1':'val1','prop2':{'WRONG':true}}";
|
String actual2 = "{'prop1':'val1','prop2':{'WRONG':true}}";
|
||||||
executeCheck(expected2, actual2, true, false, true);
|
executeCheck(expected2, actual2, true, false, true);
|
||||||
});
|
});
|
||||||
Assert.assertThrows(Exception.class, () -> {
|
Assertions.assertThrows(Exception.class, () -> {
|
||||||
String expected2 = "{'prop1':'val1','prop1':{'prop3':null}}";
|
String expected2 = "{'prop1':'val1','prop1':{'prop3':null}}";
|
||||||
String actual2 = "{'prop1':'val1','prop1':{'prop3':12.4},'WRONG':'val1'}";
|
String actual2 = "{'prop1':'val1','prop1':{'prop3':12.4},'WRONG':'val1'}";
|
||||||
executeCheck(expected2, actual2, false, true, true);
|
executeCheck(expected2, actual2, false, true, true);
|
||||||
|
@ -80,12 +80,12 @@ public class CustomHttpClientTest {
|
||||||
expected = "{'prop1':'val1','prop2':[true,false]}";
|
expected = "{'prop1':'val1','prop2':[true,false]}";
|
||||||
actual = "{'prop1':'val1','prop2':[true,false]}";
|
actual = "{'prop1':'val1','prop2':[true,false]}";
|
||||||
executeCheck(expected, actual, true, true, true);
|
executeCheck(expected, actual, true, true, true);
|
||||||
Assert.assertThrows(Exception.class, () -> {
|
Assertions.assertThrows(Exception.class, () -> {
|
||||||
String expected2 = "{'prop1':'val1','prop2':[false,true]}";
|
String expected2 = "{'prop1':'val1','prop2':[false,true]}";
|
||||||
String actual2 = "{'prop1':'val1','prop2':[true,false]}";
|
String actual2 = "{'prop1':'val1','prop2':[true,false]}";
|
||||||
executeCheck(expected2, actual2, true, true, true);
|
executeCheck(expected2, actual2, true, true, true);
|
||||||
});
|
});
|
||||||
Assert.assertThrows(Exception.class, () -> {
|
Assertions.assertThrows(Exception.class, () -> {
|
||||||
String expected2 = "{'prop1':'val1','prop2':[false,true]}";
|
String expected2 = "{'prop1':'val1','prop2':[false,true]}";
|
||||||
String actual2 = "{'prop1':'val1','prop2':[true,false]}";
|
String actual2 = "{'prop1':'val1','prop2':[true,false]}";
|
||||||
executeCheck(expected2, actual2, true, true, true);
|
executeCheck(expected2, actual2, true, true, true);
|
||||||
|
@ -93,7 +93,7 @@ public class CustomHttpClientTest {
|
||||||
expected = "{'prop1':'val1','prop2':[false,true]}";
|
expected = "{'prop1':'val1','prop2':[false,true]}";
|
||||||
actual = "{'prop1':'val1','prop2':[]}";
|
actual = "{'prop1':'val1','prop2':[]}";
|
||||||
executeCheck(expected, actual, true, false, true);
|
executeCheck(expected, actual, true, false, true);
|
||||||
Assert.assertThrows(Exception.class, () -> {
|
Assertions.assertThrows(Exception.class, () -> {
|
||||||
String expected2 = "{'prop1':'val1','prop2':[false,true]}";
|
String expected2 = "{'prop1':'val1','prop2':[false,true]}";
|
||||||
String actual2 = "{'prop1':'val1','prop2':[],'prop3':false}";
|
String actual2 = "{'prop1':'val1','prop2':[],'prop3':false}";
|
||||||
executeCheck(expected2, actual2, false, true, true);
|
executeCheck(expected2, actual2, false, true, true);
|
||||||
|
@ -101,12 +101,12 @@ public class CustomHttpClientTest {
|
||||||
expected = "{'prop1':1,'prop2':[]}";
|
expected = "{'prop1':1,'prop2':[]}";
|
||||||
actual = "{'prop1':1,'prop2':[{'prop2':'val2'}]}";
|
actual = "{'prop1':1,'prop2':[{'prop2':'val2'}]}";
|
||||||
executeCheck(expected, actual, true, true, false);
|
executeCheck(expected, actual, true, true, false);
|
||||||
Assert.assertThrows(Exception.class, () -> {
|
Assertions.assertThrows(Exception.class, () -> {
|
||||||
String expected2 = "{'prop1':1,'prop2':[]}";
|
String expected2 = "{'prop1':1,'prop2':[]}";
|
||||||
String actual2 = "{'prop1':0,'prop2':[{'prop2':'val2'}]}";
|
String actual2 = "{'prop1':0,'prop2':[{'prop2':'val2'}]}";
|
||||||
executeCheck(expected2, actual2, true, true, false);
|
executeCheck(expected2, actual2, true, true, false);
|
||||||
});
|
});
|
||||||
Assert.assertThrows(Exception.class, () -> {
|
Assertions.assertThrows(Exception.class, () -> {
|
||||||
String expected2 = "{'prop1':1,'prop2':[]}";
|
String expected2 = "{'prop1':1,'prop2':[]}";
|
||||||
String actual2 = "{'prop1':1,'prop2':[{'prop2':'val2'}]}";
|
String actual2 = "{'prop1':1,'prop2':[{'prop2':'val2'}]}";
|
||||||
executeCheck(expected2, actual2, true, true, true);
|
executeCheck(expected2, actual2, true, true, true);
|
||||||
|
|
Loading…
Reference in New Issue