use of com.axway.ats.rbv.filesystem.FileSystemFolder in project ats-framework by Axway.
the class Test_FileSystemFolder method getAllMetadataExceptionExists.
@Test(expected = RbvException.class)
public void getAllMetadataExceptionExists() throws Exception {
// constructor
expectNew(FileSystemOperations.class, "localhost:0000").andThrow(new RbvException("Test"));
replayAll();
FileSystemFolder folder = new FileSystemFolder("localhost:0000", "some.path", null, true, false);
folder.open();
assertEquals(folder.getAllMetaData(), new ArrayList<MetaData>());
verifyAll();
}
use of com.axway.ats.rbv.filesystem.FileSystemFolder 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();
}
use of com.axway.ats.rbv.filesystem.FileSystemFolder 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();
}
use of com.axway.ats.rbv.filesystem.FileSystemFolder 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();
}
use of com.axway.ats.rbv.filesystem.FileSystemFolder 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();
}
Aggregations