Search in sources :

Example 1 with FileSystemFolder

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

the class Test_FileSystemFolder method getAllMetadataExceptionFetchingModTimePositive.

@Test
public void getAllMetadataExceptionFetchingModTimePositive() throws Exception {
    // constructors
    expectNew(SystemOperations.class, "localhost:0000").andReturn(systemOperations);
    expectNew(FileSystemOperations.class, "localhost:0000").andReturn(fileSystemOperations);
    // open()
    expect(systemOperations.getOperatingSystemType()).andReturn(OperatingSystemType.SOLARIS);
    // getAllMetaData()
    expect(fileSystemOperations.findFiles("some.path/", ".*", true, true, false)).andReturn(new String[] { "some.path/some.file1", "some.path/some.file2" });
    FilePackage pack1 = createMock(FilePackage.class);
    expectNew(FilePackage.class, "localhost:0000", "some.path/some.file1", OperatingSystemType.SOLARIS).andReturn(pack1);
    expect(pack1.getUniqueIdentifier()).andThrow(new PackageException(""));
    FilePackage pack2 = createMock(FilePackage.class);
    expectNew(FilePackage.class, "localhost:0000", "some.path/some.file2", OperatingSystemType.SOLARIS).andReturn(pack2);
    expect(pack2.getUniqueIdentifier()).andReturn("some.path/some.file1.1.1.1");
    replayAll();
    FileSystemFolder folder = new FileSystemFolder("localhost:0000", "some.path", null, true, false);
    folder.open();
    assertEquals(folder.getAllMetaData().size(), 1);
    verifyAll();
}
Also used : FilePackage(com.axway.ats.action.objects.FilePackage) FileSystemOperations(com.axway.ats.action.filesystem.FileSystemOperations) SystemOperations(com.axway.ats.action.system.SystemOperations) PackageException(com.axway.ats.action.objects.model.PackageException) FileSystemOperations(com.axway.ats.action.filesystem.FileSystemOperations) FileSystemFolder(com.axway.ats.rbv.filesystem.FileSystemFolder) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 2 with FileSystemFolder

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

the class Test_FileSystemFolder method getDescription.

@Test
public void getDescription() {
    FileSystemFolder folder = (FileSystemFolder) storage.getFolder(new FileSystemFolderSearchTerm(path, null, true, false));
    assertEquals("File system folder '" + path + "' on the local machine", folder.getDescription());
}
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 3 with FileSystemFolder

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

the class Test_FileSystemFolder method close.

@Test
public void close() 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.close();
    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 4 with FileSystemFolder

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

the class Test_FileSystemFolder method getMetaDataCountsNegativeFolderNotOpen.

@Test(expected = MatchableNotOpenException.class)
public void getMetaDataCountsNegativeFolderNotOpen() throws Exception {
    FileSystemFolder folder = (FileSystemFolder) storage.getFolder(new FileSystemFolderSearchTerm(path, null, true, false));
    folder.getMetaDataCounts();
}
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 5 with FileSystemFolder

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

the class Test_FileSystemFolder method getAllMetadataNoSuchEntity.

@Test
public void getAllMetadataNoSuchEntity() throws Exception {
    // constructors
    expectNew(SystemOperations.class, "localhost:0000").andReturn(systemOperations);
    expectNew(FileSystemOperations.class, "localhost:0000").andReturn(fileSystemOperations);
    // open()
    expect(systemOperations.getOperatingSystemType()).andReturn(OperatingSystemType.SOLARIS);
    // getAllMetaData()
    expect(fileSystemOperations.findFiles("some.path/", ".*", true, true, false)).andReturn(new String[0]);
    replayAll();
    FileSystemFolder folder = new FileSystemFolder("localhost:0000", "some.path", null, true, false);
    folder.open();
    assertEquals(folder.getAllMetaData(), new ArrayList<MetaData>());
    verifyAll();
}
Also used : FileSystemOperations(com.axway.ats.action.filesystem.FileSystemOperations) SystemOperations(com.axway.ats.action.system.SystemOperations) MetaData(com.axway.ats.rbv.MetaData) FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) FileSystemOperations(com.axway.ats.action.filesystem.FileSystemOperations) FileSystemFolder(com.axway.ats.rbv.filesystem.FileSystemFolder) 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