Search in sources :

Example 6 with FileSystemFolderSearchTerm

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

the class Test_FileSystemFolder method openNegativeInvalidPath.

@Test
public void openNegativeInvalidPath() throws Exception {
    expectNew(SystemOperations.class, "localhost:0000").andReturn(systemOperations);
    expect(systemOperations.getOperatingSystemType()).andReturn(OperatingSystemType.LINUX);
    replayAll();
    //should pass - only warning should be logged
    FileSystemFolder folder = (FileSystemFolder) storage.getFolder(new FileSystemFolderSearchTerm(";;;", null, true));
    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)

Example 7 with FileSystemFolderSearchTerm

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

the class Test_FileSystemFolder method getMetadataCountsWithoutSubdirs.

@Test
public void getMetadataCountsWithoutSubdirs() throws Exception {
    expectNew(SystemOperations.class, "localhost:0000").andReturn(systemOperations).times(5);
    expect(systemOperations.getOperatingSystemType()).andReturn(OperatingSystemType.LINUX);
    // now we call getAllMetaData() 2 times
    expectNew(FileSystemOperations.class, "localhost:0000").andReturn(fileSystemOperations).times(5);
    expect(fileSystemOperations.findFiles(path, ".*", true, true, false)).andReturn(fileList).times(2);
    expect(fileSystemOperations.getFileUniqueId(file1)).andReturn(file1_hash).times(2);
    expect(fileSystemOperations.getFileUniqueId(file2)).andReturn(file2_hash).times(2);
    replayAll();
    FileSystemFolder folder = (FileSystemFolder) storage.getFolder(new FileSystemFolderSearchTerm(path, null, true, false));
    folder.open();
    folder.getAllMetaData();
    assertEquals("Total files: " + 2 + ", new files: " + 2, folder.getMetaDataCounts());
    folder.getAllMetaData();
    assertEquals("Total files: " + 2 + ", new files: " + 0, folder.getMetaDataCounts());
    verifyAll();
}
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 8 with FileSystemFolderSearchTerm

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

the class Test_FileSystemFolder method openNegativeFolderAlreadyOpen.

@Test(expected = MatchableAlreadyOpenException.class)
public void openNegativeFolderAlreadyOpen() 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();
    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)

Example 9 with FileSystemFolderSearchTerm

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

the class Test_FileSystemFolder method openNegativeInvalidHost.

@Test(expected = InvalidInputArgumentsException.class)
public void openNegativeInvalidHost() throws Exception {
    expectNew(SystemOperations.class, "invalid hosttt").andThrow(new RbvStorageException("Could not open File system folder '/tmp/test/' on server 'invalid hosttt'"));
    replayAll();
    FileSystemStorage invalidStorage = new FileSystemStorage("invalid hosttt");
    FileSystemFolder folder = (FileSystemFolder) invalidStorage.getFolder(new FileSystemFolderSearchTerm(path, null, true));
    folder.open();
    verifyAll();
}
Also used : FileSystemOperations(com.axway.ats.action.filesystem.FileSystemOperations) SystemOperations(com.axway.ats.action.system.SystemOperations) FileSystemStorage(com.axway.ats.rbv.filesystem.FileSystemStorage) RbvStorageException(com.axway.ats.rbv.model.RbvStorageException) 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 10 with FileSystemFolderSearchTerm

use of com.axway.ats.rbv.filesystem.FileSystemFolderSearchTerm 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)

Aggregations

BaseTest (com.axway.ats.rbv.BaseTest)16 FileSystemFolderSearchTerm (com.axway.ats.rbv.filesystem.FileSystemFolderSearchTerm)16 Test (org.junit.Test)16 FileSystemFolder (com.axway.ats.rbv.filesystem.FileSystemFolder)12 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)12 FileSystemOperations (com.axway.ats.action.filesystem.FileSystemOperations)5 SystemOperations (com.axway.ats.action.system.SystemOperations)5 FileSystemStorage (com.axway.ats.rbv.filesystem.FileSystemStorage)3 MetaData (com.axway.ats.rbv.MetaData)1 FileSystemMetaData (com.axway.ats.rbv.filesystem.FileSystemMetaData)1 RbvStorageException (com.axway.ats.rbv.model.RbvStorageException)1