Search in sources :

Example 1 with FileSystemMetaData

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

the class Test_FileSizeRule method isMatchConstructWithFileExpectFalseNegative.

@Test
public void isMatchConstructWithFileExpectFalseNegative() throws Exception {
    expectNew(FilePackage.class, null, null, testPath).andReturn(pack);
    expect(pack.getSize()).andReturn(100l).times(2);
    replayAll();
    FileSizeRule rule = new FileSizeRule(null, testPath, "isMatchConstructWithFileExpectFalseNegative", false);
    MetaData metaData = new FileSystemMetaData(pack);
    assertFalse(rule.isMatch(metaData));
    verifyAll();
}
Also used : FilePackage(com.axway.ats.action.objects.FilePackage) FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) MetaData(com.axway.ats.rbv.MetaData) FileSizeRule(com.axway.ats.rbv.filesystem.rules.FileSizeRule) 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 2 with FileSystemMetaData

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

the class Test_FileSizeRule method isMatchConstructWithSizeExpectFalseNegative.

@Test
public void isMatchConstructWithSizeExpectFalseNegative() throws Exception {
    expect(pack.getSize()).andReturn(100l);
    replayAll();
    FileSizeRule rule = new FileSizeRule(100l, "isMatchConstructWithSizeExpectFalseNegative", 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) FileSizeRule(com.axway.ats.rbv.filesystem.rules.FileSizeRule) 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 3 with FileSystemMetaData

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

the class Test_FileSizeRule method isMatchNullMetaDataContent.

@Test(expected = MetaDataIncorrectException.class)
public void isMatchNullMetaDataContent() throws Exception {
    expect(pack.getSize()).andReturn(100l);
    replayAll();
    FileSizeRule rule = new FileSizeRule(100l, "isMatchNullMetaDataContent", true);
    MetaData metaData = new FileSystemMetaData(null);
    assertFalse(rule.isMatch(metaData));
    verifyAll();
}
Also used : FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) MetaData(com.axway.ats.rbv.MetaData) FileSizeRule(com.axway.ats.rbv.filesystem.rules.FileSizeRule) 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 4 with FileSystemMetaData

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

the class Test_FileSizeRule method isMatchConstructWithFilePositive.

@Test
public void isMatchConstructWithFilePositive() throws Exception {
    expectNew(FilePackage.class, null, null, testPath).andReturn(pack);
    expect(pack.getSize()).andReturn(100l).times(2);
    replayAll();
    FileSizeRule rule = new FileSizeRule(null, testPath, "isMatchConstructWithFilePositive", true);
    MetaData metaData = new FileSystemMetaData(pack);
    assertTrue(rule.isMatch(metaData));
    verifyAll();
}
Also used : FilePackage(com.axway.ats.action.objects.FilePackage) FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) MetaData(com.axway.ats.rbv.MetaData) FileSizeRule(com.axway.ats.rbv.filesystem.rules.FileSizeRule) 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 5 with FileSystemMetaData

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

the class Test_FileSizeRule method isMatchConstructWithSizeExpectFalsePositive.

@Test
public void isMatchConstructWithSizeExpectFalsePositive() throws Exception {
    expect(pack.getSize()).andReturn(100l);
    replayAll();
    FileSizeRule rule = new FileSizeRule(11100l, "isMatchConstructWithSizeExpectFalsePositive", false);
    MetaData metaData = new FileSystemMetaData(pack);
    assertTrue(rule.isMatch(metaData));
    verifyAll();
}
Also used : FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) MetaData(com.axway.ats.rbv.MetaData) FileSizeRule(com.axway.ats.rbv.filesystem.rules.FileSizeRule) 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