Skip to content

Commit

Permalink
Fix setter/getter name and improve test stability
Browse files Browse the repository at this point in the history
  • Loading branch information
mekya committed Dec 31, 2024
1 parent 7074771 commit 85c3267
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
22 changes: 14 additions & 8 deletions src/main/java/io/antmedia/AppSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -4053,14 +4053,6 @@ public void setHlsSegmentType(String hlsSegmentType) {
this.hlsSegmentType = hlsSegmentType;
}

public String getHlsSegmentFileSuffixFormat() {
return hlsSegmentFileSuffixFormat;
}

public void setHlsSegmentFileNameFormat(String hlsSegmentFileSuffixFormat) {
this.hlsSegmentFileSuffixFormat = hlsSegmentFileSuffixFormat;
}

public String getRecordingSubfolder() {
return recordingSubfolder;
}
Expand Down Expand Up @@ -4249,4 +4241,18 @@ public Map<String, Map<String,String>> getEncoderParameters() {
public void setEncoderParameters(Map<String, Map<String,String>> encoderParameters) {
this.encoderParameters = encoderParameters;
}

/**
* @return the hlsSegmentFileSuffixFormat
*/
public String getHlsSegmentFileSuffixFormat() {
return hlsSegmentFileSuffixFormat;
}

/**
* @param hlsSegmentFileSuffixFormat the hlsSegmentFileSuffixFormat to set
*/
public void setHlsSegmentFileSuffixFormat(String hlsSegmentFileSuffixFormat) {
this.hlsSegmentFileSuffixFormat = hlsSegmentFileSuffixFormat;
}
}
4 changes: 2 additions & 2 deletions src/test/java/io/antmedia/integration/MuxingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ public void testHLSSegmentFileName() {
boolean hlsEnabled = appSettings.isHlsMuxingEnabled();
appSettings.setHlsMuxingEnabled(true);
String hlsSegmentFileNameFormat = appSettings.getHlsSegmentFileSuffixFormat();
appSettings.setHlsSegmentFileNameFormat("-%Y%m%d-%s");
appSettings.setHlsSegmentFileSuffixFormat("-%Y%m%d-%s");
result = ConsoleAppRestServiceTest.callSetAppSettings("LiveApp", appSettings);
assertTrue(result.isSuccess());

Expand Down Expand Up @@ -887,7 +887,7 @@ public void testHLSSegmentFileName() {
});

appSettings.setHlsMuxingEnabled(hlsEnabled);
appSettings.setHlsSegmentFileNameFormat(hlsSegmentFileNameFormat);
appSettings.setHlsSegmentFileSuffixFormat(hlsSegmentFileNameFormat);
ConsoleAppRestServiceTest.callSetAppSettings("LiveApp", appSettings);
} catch (Exception e) {
e.printStackTrace();
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/io/antmedia/test/AppSettingsUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ public void testUnsetAppSettings(AppSettings appSettings) {
assertFalse(appSettings.isWriteSubscriberEventsToDatastore());

assertEquals("%09d", appSettings.getHlsSegmentFileSuffixFormat());
appSettings.setHlsSegmentFileNameFormat("%s");
appSettings.setHlsSegmentFileSuffixFormat("%s");
assertEquals("%s", appSettings.getHlsSegmentFileSuffixFormat());


Expand Down
2 changes: 1 addition & 1 deletion src/test/java/io/antmedia/test/MuxerUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4006,7 +4006,7 @@ public void testHLSNaming() {
hlsMuxer.init(appScope, "test", 300, "", 400000);
assertEquals("./webapps/junit/streams/test_300p400kbps%09d.ts", hlsMuxer.getSegmentFilename());

getAppSettings().setHlsSegmentFileNameFormat("-%Y%m%d-%s");
getAppSettings().setHlsSegmentFileSuffixFormat("-%Y%m%d-%s");
hlsMuxer = new HLSMuxer(vertx, Mockito.mock(StorageClient.class), "", 7, null, false);
hlsMuxer.init(appScope, "test", 0, "", 0);
assertEquals("./webapps/junit/streams/test-%Y%m%d-%s.ts", hlsMuxer.getSegmentFilename());
Expand Down
4 changes: 3 additions & 1 deletion src/test/java/io/antmedia/test/StreamFetcherUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,9 @@ public void testHLSSourceFmp4() {

String[] filesInStreams = new File("webapps/junit/streams").list();
boolean initFileFound = false;
String regex = streamId + "_" + System.currentTimeMillis()/100000 + "\\d{5}_init.mp4";

//matches 13 digits because System.currentTimeMillis() is used in the file
String regex = streamId + "_\\d{13}_init.mp4";
System.out.println("regex:"+regex);

for (int i = 0; i < filesInStreams.length; i++) {
Expand Down

0 comments on commit 85c3267

Please sign in to comment.