Search in sources :

Example 1 with FileSystemOperations

use of com.axway.ats.action.filesystem.FileSystemOperations 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 FileSystemOperations

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

Example 3 with FileSystemOperations

use of com.axway.ats.action.filesystem.FileSystemOperations in project ats-framework by Axway.

the class Test_FileSystemOperations method setUpTest_FileSystemOperations.

/**
     * Setup method
     */
@Before
public void setUpTest_FileSystemOperations() {
    fileSystemOperationsLocal = new FileSystemOperations();
    fileSystemOperationsRemote = new FileSystemOperations(REMOTE_HOST_NAME_VALID);
    localFSOperationsMock = createMock(LocalFileSystemOperations.class);
    remoteFSOperationsMock = createMock(RemoteFileSystemOperations.class, REMOTE_HOST_NAME_VALID);
}
Also used : LocalFileSystemOperations(com.axway.ats.core.filesystem.LocalFileSystemOperations) LocalFileSystemOperations(com.axway.ats.core.filesystem.LocalFileSystemOperations) RemoteFileSystemOperations(com.axway.ats.action.filesystem.RemoteFileSystemOperations) FileSystemOperations(com.axway.ats.action.filesystem.FileSystemOperations) RemoteFileSystemOperations(com.axway.ats.action.filesystem.RemoteFileSystemOperations) Before(org.junit.Before)

Example 4 with FileSystemOperations

use of com.axway.ats.action.filesystem.FileSystemOperations in project ats-framework by Axway.

the class Test_FileSystemFolder method setUpTest_FileSystemFolder.

@Before
public void setUpTest_FileSystemFolder() throws Exception {
    fileSystemOperations = createMock(FileSystemOperations.class);
    systemOperations = createMock(SystemOperations.class);
    storage = new FileSystemStorage();
}
Also used : FileSystemOperations(com.axway.ats.action.filesystem.FileSystemOperations) SystemOperations(com.axway.ats.action.system.SystemOperations) FileSystemStorage(com.axway.ats.rbv.filesystem.FileSystemStorage) FileSystemOperations(com.axway.ats.action.filesystem.FileSystemOperations) Before(org.junit.Before)

Aggregations

FileSystemOperations (com.axway.ats.action.filesystem.FileSystemOperations)4 SystemOperations (com.axway.ats.action.system.SystemOperations)3 BaseTest (com.axway.ats.rbv.BaseTest)2 FileSystemFolder (com.axway.ats.rbv.filesystem.FileSystemFolder)2 Before (org.junit.Before)2 Test (org.junit.Test)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 RemoteFileSystemOperations (com.axway.ats.action.filesystem.RemoteFileSystemOperations)1 FilePackage (com.axway.ats.action.objects.FilePackage)1 PackageException (com.axway.ats.action.objects.model.PackageException)1 LocalFileSystemOperations (com.axway.ats.core.filesystem.LocalFileSystemOperations)1 MetaData (com.axway.ats.rbv.MetaData)1 FileSystemMetaData (com.axway.ats.rbv.filesystem.FileSystemMetaData)1 FileSystemStorage (com.axway.ats.rbv.filesystem.FileSystemStorage)1