use of com.axway.ats.action.objects.FilePackage in project ats-framework by Axway.
the class Test_FileUIDRule method performMatchOtherFile.
@Test
public void performMatchOtherFile() throws Exception {
FilePackage remotePack = createMock(FilePackage.class, null, "/root/file.name");
expectNew(FilePackage.class, null, null, "/root/file.name").andReturn(remotePack);
expect(remotePack.getUid()).andReturn(1L);
expect(meta.getFilePackage()).andReturn(pack);
expect(pack.getUid()).andReturn(1L);
replayAll();
rule = new FileUidRule(null, "/root/file.name", "ruleName", true);
assertTrue(rule.performMatch(meta));
verifyAll();
}
use of com.axway.ats.action.objects.FilePackage in project ats-framework by Axway.
the class Test_FileUIDRule method performMatchOtherFileException.
@Test(expected = RbvException.class)
public void performMatchOtherFileException() throws Exception {
FilePackage remotePack = createMock(FilePackage.class, null, "/root/file.name");
expectNew(FilePackage.class, null, null, "/root/file.name").andReturn(remotePack);
expect(remotePack.getUid()).andThrow(new PackageException("Test"));
replayAll();
rule = new FileUidRule(null, "/root/file.name", "ruleName", true);
verifyAll();
}
use of com.axway.ats.action.objects.FilePackage in project ats-framework by Axway.
the class Test_FileGIDRule method performMatchOtherFileNull.
@Test
public void performMatchOtherFileNull() 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();
}
use of com.axway.ats.action.objects.FilePackage in project ats-framework by Axway.
the class Test_FileGIDRule method performMatchOtherFileException.
@Test(expected = RbvException.class)
public void performMatchOtherFileException() throws Exception {
FilePackage remotePack = createMock(FilePackage.class);
expectNew(FilePackage.class, null, null, "/root/file.name").andReturn(remotePack);
expect(remotePack.getGid()).andThrow(new PackageException(""));
replayAll();
rule = new FileGidRule(null, "/root/file.name", "ruleName", true);
verifyAll();
}
use of com.axway.ats.action.objects.FilePackage in project ats-framework by Axway.
the class Test_AndRuleOperation method isMatchPriority.
@Test
public void isMatchPriority() throws RbvException, PackageException {
FileSystemMetaData meta = createMock(FileSystemMetaData.class);
FilePackage pack = createMock(FilePackage.class);
expect(meta.getFilePackage()).andReturn(pack);
expect(pack.isFile()).andReturn(true);
// at this point the evaluation should stop since this is the first rule to
// evaluate and it fails thus the second should not be evaluated at all
// if the priority does not work then the second rule would fail the unit test
// because we are not expecting any calls it would do to the mock objects
replayAll();
FilePathRule rule = new FilePathRule("some/path/some.file", "pathRule1", true, 2);
FileFolderRule anotherRule = new FileFolderRule(false, "folderRule", true, 1);
AndRuleOperation andRule = new AndRuleOperation();
andRule.addRule(rule);
andRule.addRule(anotherRule);
assertFalse(andRule.isMatch(meta));
verifyAll();
}
Aggregations