Search in sources :

Example 1 with VideoStreamConstructor

use of com.att.aro.core.packetanalysis.impl.VideoStreamConstructor in project VideoOptimzer by attdevsupport.

the class FileManagerTest method findFiles.

@Test
public void findFiles() throws Exception {
    String[] foundFiles;
    VideoStreamConstructor videoStreamConstructor = context.getBean(VideoStreamConstructor.class);
    IFileManager filemanager = context.getBean(IFileManager.class);
    File tempFolder = Files.createTempDir();
    filemanager.createFile(tempFolder.toString(), "file1");
    String pathName1 = filemanager.createFile(tempFolder.toString(), "file1").toString();
    String pathName1exten = filemanager.createFile(tempFolder.toString(), "file1.xyz").toString();
    byte[] content = "dummy data".getBytes();
    videoStreamConstructor.savePayload(content, pathName1);
    videoStreamConstructor.savePayload(content, pathName1exten);
    foundFiles = fileManager.findFiles(tempFolder.toString(), ".xyz");
    assertThat(foundFiles).hasSize(1);
    assertThat(foundFiles).contains("file1.xyz");
    foundFiles = fileManager.findFiles(tempFolder.toString(), "child.xyz");
    assertThat(foundFiles).isEmpty();
    foundFiles = fileManager.findFiles(tempFolder.toString(), ".sh");
    assertThat(foundFiles).isEmpty();
    filemanager.directoryDeleteInnerFiles(tempFolder.toString());
    filemanager.deleteFile(tempFolder.toString());
}
Also used : File(java.io.File) VideoStreamConstructor(com.att.aro.core.packetanalysis.impl.VideoStreamConstructor) IFileManager(com.att.aro.core.fileio.IFileManager) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Aggregations

BaseTest (com.att.aro.core.BaseTest)1 IFileManager (com.att.aro.core.fileio.IFileManager)1 VideoStreamConstructor (com.att.aro.core.packetanalysis.impl.VideoStreamConstructor)1 File (java.io.File)1 Test (org.junit.Test)1