Search in sources :

Example 11 with FilePackage

use of com.axway.ats.action.objects.FilePackage in project ats-framework by Axway.

the class Test_FileGIDRule method performMatchOtherFile.

@Test
public void performMatchOtherFile() throws Exception {
    FilePackage remotePack = createMock(FilePackage.class);
    expectNew(FilePackage.class, null, null, "/root/file.name").andReturn(remotePack);
    expect(remotePack.getGid()).andReturn(1L);
    expect(meta.getFilePackage()).andReturn(pack);
    expect(pack.getGid()).andReturn(1L);
    replayAll();
    rule = new FileGidRule(null, "/root/file.name", "ruleName", true);
    assertTrue(rule.performMatch(meta));
    verifyAll();
}
Also used : FilePackage(com.axway.ats.action.objects.FilePackage) FileGidRule(com.axway.ats.rbv.filesystem.rules.FileGidRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 12 with FilePackage

use of com.axway.ats.action.objects.FilePackage in project ats-framework by Axway.

the class FileModtimeRule method performMatch.

@Override
public boolean performMatch(MetaData metaData) throws RbvException {
    boolean actualResult = false;
    if (metaData instanceof FileSystemMetaData) {
        //get the file from the meta data
        FilePackage file = ((FileSystemMetaData) metaData).getFilePackage();
        try {
            //get destination file's size
            long destModtime = file.getModTime();
            actualResult = destModtime == this.srcModtime;
        } catch (PackageException pe) {
            throw new RbvStorageException(pe);
        }
    }
    return actualResult;
}
Also used : FilePackage(com.axway.ats.action.objects.FilePackage) PackageException(com.axway.ats.action.objects.model.PackageException) RbvStorageException(com.axway.ats.rbv.model.RbvStorageException) FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData)

Aggregations

FilePackage (com.axway.ats.action.objects.FilePackage)12 PackageException (com.axway.ats.action.objects.model.PackageException)7 BaseTest (com.axway.ats.rbv.BaseTest)7 Test (org.junit.Test)7 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)6 FileSystemMetaData (com.axway.ats.rbv.filesystem.FileSystemMetaData)5 RbvStorageException (com.axway.ats.rbv.model.RbvStorageException)4 FileGidRule (com.axway.ats.rbv.filesystem.rules.FileGidRule)3 FileUidRule (com.axway.ats.rbv.filesystem.rules.FileUidRule)2 FileSystemOperations (com.axway.ats.action.filesystem.FileSystemOperations)1 SystemOperations (com.axway.ats.action.system.SystemOperations)1 MetaData (com.axway.ats.rbv.MetaData)1 FileSystemFolder (com.axway.ats.rbv.filesystem.FileSystemFolder)1 FileFolderRule (com.axway.ats.rbv.filesystem.rules.FileFolderRule)1 FilePathRule (com.axway.ats.rbv.filesystem.rules.FilePathRule)1 MatchableAlreadyOpenException (com.axway.ats.rbv.model.MatchableAlreadyOpenException)1 MatchableNotOpenException (com.axway.ats.rbv.model.MatchableNotOpenException)1 RbvException (com.axway.ats.rbv.model.RbvException)1 AndRuleOperation (com.axway.ats.rbv.rules.AndRuleOperation)1 ArrayList (java.util.ArrayList)1