Search in sources :

Example 11 with FileSystemFolder

use of com.axway.ats.rbv.filesystem.FileSystemFolder in project ats-framework by Axway.

the class Test_FileSystemFolder method closeNegativeFolderNotOpen.

@Test(expected = MatchableNotOpenException.class)
public void closeNegativeFolderNotOpen() throws Exception {
    FileSystemFolder folder = (FileSystemFolder) storage.getFolder(new FileSystemFolderSearchTerm(path, null, true, false));
    folder.close();
}
Also used : FileSystemFolder(com.axway.ats.rbv.filesystem.FileSystemFolder) FileSystemFolderSearchTerm(com.axway.ats.rbv.filesystem.FileSystemFolderSearchTerm) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 12 with FileSystemFolder

use of com.axway.ats.rbv.filesystem.FileSystemFolder in project ats-framework by Axway.

the class Test_FileSystemFolder method getNewMetaDataNegativeFolderNotOpen.

@Test(expected = MatchableNotOpenException.class)
public void getNewMetaDataNegativeFolderNotOpen() throws Exception {
    FileSystemFolder folder = (FileSystemFolder) storage.getFolder(new FileSystemFolderSearchTerm(path, null, true, false));
    folder.getNewMetaData();
}
Also used : FileSystemFolder(com.axway.ats.rbv.filesystem.FileSystemFolder) FileSystemFolderSearchTerm(com.axway.ats.rbv.filesystem.FileSystemFolderSearchTerm) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 13 with FileSystemFolder

use of com.axway.ats.rbv.filesystem.FileSystemFolder in project ats-framework by Axway.

the class Test_FileSystemFolder method getNewMetadataChangeLastModified.

@Test
public void getNewMetadataChangeLastModified() throws Exception {
    expectNew(SystemOperations.class, "localhost:0000").andReturn(systemOperations).times(7);
    expect(systemOperations.getOperatingSystemType()).andReturn(OperatingSystemType.LINUX);
    // now we call getNewMetaData() 3 times
    expect(fileSystemOperations.findFiles(path, ".*", true, true, false)).andReturn(fileList).times(3);
    // 3 times x 2 files
    expectNew(FileSystemOperations.class, "localhost:0000").andReturn(fileSystemOperations).times(7);
    expect(fileSystemOperations.getFileUniqueId(file1)).andReturn(file1_hash).times(2);
    expect(fileSystemOperations.getFileUniqueId(file2)).andReturn(file2_hash).times(3);
    // modify the modification timestamp of file1 for the last getNewMetaData() call
    expect(fileSystemOperations.getFileUniqueId(file1)).andReturn(file1_hash_changed);
    replayAll();
    FileSystemFolder folder = (FileSystemFolder) storage.getFolder(new FileSystemFolderSearchTerm(path, null, true, false));
    folder.open();
    List<MetaData> list = folder.getNewMetaData();
    assertEquals(2, list.size());
    for (MetaData metaData : list) {
        ((FileSystemMetaData) metaData).getFilePackage();
    }
    assertEquals(0, folder.getNewMetaData().size());
    assertEquals(1, folder.getNewMetaData().size());
    verifyAll();
}
Also used : MetaData(com.axway.ats.rbv.MetaData) FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) FileSystemFolder(com.axway.ats.rbv.filesystem.FileSystemFolder) FileSystemFolderSearchTerm(com.axway.ats.rbv.filesystem.FileSystemFolderSearchTerm) FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 14 with FileSystemFolder

use of com.axway.ats.rbv.filesystem.FileSystemFolder in project ats-framework by Axway.

the class Test_FileSystemFolder method getAllMetaDataNegativeFolderNotOpen.

@Test(expected = MatchableNotOpenException.class)
public void getAllMetaDataNegativeFolderNotOpen() throws Exception {
    FileSystemFolder folder = (FileSystemFolder) storage.getFolder(new FileSystemFolderSearchTerm(path, null, true, false));
    folder.getAllMetaData();
}
Also used : FileSystemFolder(com.axway.ats.rbv.filesystem.FileSystemFolder) FileSystemFolderSearchTerm(com.axway.ats.rbv.filesystem.FileSystemFolderSearchTerm) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 15 with FileSystemFolder

use of com.axway.ats.rbv.filesystem.FileSystemFolder in project ats-framework by Axway.

the class Test_FileSystemFolder method open.

@Test
public void open() throws Exception {
    expectNew(SystemOperations.class, "localhost:0000").andReturn(systemOperations);
    expect(systemOperations.getOperatingSystemType()).andReturn(OperatingSystemType.LINUX);
    replayAll();
    FileSystemFolder folder = (FileSystemFolder) storage.getFolder(new FileSystemFolderSearchTerm(path, null, true, false));
    folder.open();
    verifyAll();
}
Also used : FileSystemOperations(com.axway.ats.action.filesystem.FileSystemOperations) SystemOperations(com.axway.ats.action.system.SystemOperations) FileSystemFolder(com.axway.ats.rbv.filesystem.FileSystemFolder) FileSystemFolderSearchTerm(com.axway.ats.rbv.filesystem.FileSystemFolderSearchTerm) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Aggregations

BaseTest (com.axway.ats.rbv.BaseTest)15 FileSystemFolder (com.axway.ats.rbv.filesystem.FileSystemFolder)15 Test (org.junit.Test)15 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)15 FileSystemFolderSearchTerm (com.axway.ats.rbv.filesystem.FileSystemFolderSearchTerm)12 FileSystemOperations (com.axway.ats.action.filesystem.FileSystemOperations)8 SystemOperations (com.axway.ats.action.system.SystemOperations)7 MetaData (com.axway.ats.rbv.MetaData)3 FileSystemMetaData (com.axway.ats.rbv.filesystem.FileSystemMetaData)3 FilePackage (com.axway.ats.action.objects.FilePackage)1 PackageException (com.axway.ats.action.objects.model.PackageException)1 FileSystemStorage (com.axway.ats.rbv.filesystem.FileSystemStorage)1 RbvException (com.axway.ats.rbv.model.RbvException)1 RbvStorageException (com.axway.ats.rbv.model.RbvStorageException)1