Search in sources :

Example 36 with FileSystemMetaData

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

the class Test_FileMD5Rule method isMatchConstructWithMd5ExpectTrueNegativeEmptyMd5.

@Test
public void isMatchConstructWithMd5ExpectTrueNegativeEmptyMd5() throws PackageException, RbvException {
    expect(pack.getMd5sum(true)).andReturn(md5sum);
    replayAll();
    FileMd5Rule rule = new FileMd5Rule("", "isMatchConstructWithMd5ExpectTrueNegativeEmptyMd5", true);
    MetaData metaData = new FileSystemMetaData(pack);
    assertFalse(rule.isMatch(metaData));
    verifyAll();
}
Also used : FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) MetaData(com.axway.ats.rbv.MetaData) FileMd5Rule(com.axway.ats.rbv.filesystem.rules.FileMd5Rule) FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 37 with FileSystemMetaData

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

the class Test_FileMD5Rule method isMatchConstructWithMd5ExpectTrueNegativeNullMd5.

@Test
public void isMatchConstructWithMd5ExpectTrueNegativeNullMd5() throws PackageException, RbvException {
    expect(pack.getMd5sum(true)).andReturn(md5sum);
    replayAll();
    FileMd5Rule rule = new FileMd5Rule(null, "isMatchConstructWithMd5ExpectTrueNegativeNullMd5", true);
    MetaData metaData = new FileSystemMetaData(pack);
    assertFalse(rule.isMatch(metaData));
    verifyAll();
}
Also used : FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) MetaData(com.axway.ats.rbv.MetaData) FileMd5Rule(com.axway.ats.rbv.filesystem.rules.FileMd5Rule) FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 38 with FileSystemMetaData

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

the class Test_FileMD5Rule method isMatchConstructWithMd5ExpectFalseNegative.

@Test
public void isMatchConstructWithMd5ExpectFalseNegative() throws PackageException, RbvException {
    expect(pack.getMd5sum(true)).andReturn(md5sum);
    replayAll();
    FileMd5Rule rule = new FileMd5Rule(md5sum, "isMatchConstructWithMd5ExpectFalseNegative", false);
    MetaData metaData = new FileSystemMetaData(pack);
    assertFalse(rule.isMatch(metaData));
    verifyAll();
}
Also used : FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) MetaData(com.axway.ats.rbv.MetaData) FileMd5Rule(com.axway.ats.rbv.filesystem.rules.FileMd5Rule) FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 39 with FileSystemMetaData

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

the class Test_FileModtimeRule method isMatchConstructWithFileExpectTrueNegativeWrongFile.

@Test
public void isMatchConstructWithFileExpectTrueNegativeWrongFile() throws Exception {
    expectNew(FilePackage.class, null, null, testFilePath).andReturn(pack);
    expect(pack.getModTime()).andReturn(modtime);
    expect(pack.getModTime()).andReturn(123l);
    replayAll();
    FileModtimeRule rule = new FileModtimeRule(null, testFilePath, "isMatchConstructWithFileExpectTrueNegativeWrongFile", true);
    MetaData metaData = new FileSystemMetaData(pack);
    assertFalse(rule.isMatch(metaData));
    verifyAll();
}
Also used : FilePackage(com.axway.ats.action.objects.FilePackage) FileModtimeRule(com.axway.ats.rbv.filesystem.rules.FileModtimeRule) FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) MetaData(com.axway.ats.rbv.MetaData) FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 40 with FileSystemMetaData

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

the class Test_FilePathRule method isMatchExpectedTruePositive.

@Test
public void isMatchExpectedTruePositive() throws Exception {
    expect(pack.getAbsolutePath()).andReturn(testFileAbsPath);
    replayAll();
    FilePathRule rule = new FilePathRule(testFileAbsPath, "isMatchExpectedTruePositive", true);
    MetaData metaData = new FileSystemMetaData(pack);
    assertTrue(rule.isMatch(metaData));
    verifyAll();
}
Also used : FilePathRule(com.axway.ats.rbv.filesystem.rules.FilePathRule) FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) MetaData(com.axway.ats.rbv.MetaData) FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

FileSystemMetaData (com.axway.ats.rbv.filesystem.FileSystemMetaData)47 BaseTest (com.axway.ats.rbv.BaseTest)43 Test (org.junit.Test)43 MetaData (com.axway.ats.rbv.MetaData)42 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)38 FilePackage (com.axway.ats.action.objects.FilePackage)13 FilePathRule (com.axway.ats.rbv.filesystem.rules.FilePathRule)10 FileMd5Rule (com.axway.ats.rbv.filesystem.rules.FileMd5Rule)9 FileSizeRule (com.axway.ats.rbv.filesystem.rules.FileSizeRule)9 FileModtimeRule (com.axway.ats.rbv.filesystem.rules.FileModtimeRule)5 FilePermRule (com.axway.ats.rbv.filesystem.rules.FilePermRule)5 PackageException (com.axway.ats.action.objects.model.PackageException)4 FileContentRule (com.axway.ats.rbv.filesystem.rules.FileContentRule)4 RbvStorageException (com.axway.ats.rbv.model.RbvStorageException)3 FileSystemFolder (com.axway.ats.rbv.filesystem.FileSystemFolder)1 FileSystemFolderSearchTerm (com.axway.ats.rbv.filesystem.FileSystemFolderSearchTerm)1 FileFolderRule (com.axway.ats.rbv.filesystem.rules.FileFolderRule)1 AndRuleOperation (com.axway.ats.rbv.rules.AndRuleOperation)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1