Search in sources :

Example 6 with SystemOperations

use of com.axway.ats.action.system.SystemOperations 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 7 with SystemOperations

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

Example 8 with SystemOperations

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

Example 9 with SystemOperations

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

Aggregations

SystemOperations (com.axway.ats.action.system.SystemOperations)9 FileSystemOperations (com.axway.ats.action.filesystem.FileSystemOperations)7 BaseTest (com.axway.ats.rbv.BaseTest)6 FileSystemFolder (com.axway.ats.rbv.filesystem.FileSystemFolder)6 Test (org.junit.Test)6 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)6 FileSystemFolderSearchTerm (com.axway.ats.rbv.filesystem.FileSystemFolderSearchTerm)4 FilePackage (com.axway.ats.action.objects.FilePackage)1 PackageException (com.axway.ats.action.objects.model.PackageException)1 RestClient (com.axway.ats.action.rest.RestClient)1 RestResponse (com.axway.ats.action.rest.RestResponse)1 FtpClient (com.axway.ats.core.filetransfer.FtpClient)1 SystemMonitor (com.axway.ats.monitoring.SystemMonitor)1 MetaData (com.axway.ats.rbv.MetaData)1 FileSystemMetaData (com.axway.ats.rbv.filesystem.FileSystemMetaData)1 FileSystemStorage (com.axway.ats.rbv.filesystem.FileSystemStorage)1 IOException (java.io.IOException)1 Before (org.junit.Before)1 BeforeSuite (org.testng.annotations.BeforeSuite)1 Test (org.testng.annotations.Test)1