Search in sources :

Example 6 with FileSizeRule

use of com.axway.ats.rbv.filesystem.rules.FileSizeRule 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 7 with FileSizeRule

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

the class Test_FileSizeRule method isMatchNullMetaData.

@Test(expected = RbvException.class)
public void isMatchNullMetaData() throws Exception {
    expect(pack.getSize()).andReturn(100l);
    replayAll();
    FileSizeRule rule = new FileSizeRule(100l, "isMatchNullMetaData", true);
    assertFalse(rule.isMatch(null));
    verifyAll();
}
Also used : FileSizeRule(com.axway.ats.rbv.filesystem.rules.FileSizeRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 8 with FileSizeRule

use of com.axway.ats.rbv.filesystem.rules.FileSizeRule 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)

Example 9 with FileSizeRule

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

the class Test_FileSizeRule method constructWithMachine.

@Test
public void constructWithMachine() throws Exception {
    expectNew(FilePackage.class, null, null, testPath).andReturn(pack);
    expect(pack.getSize()).andReturn(100l);
    replayAll();
    FileSizeRule rule = new FileSizeRule(null, testPath, "constructWithMachine", true);
    assertTrue(rule != null);
    verifyAll();
}
Also used : FilePackage(com.axway.ats.action.objects.FilePackage) FileSizeRule(com.axway.ats.rbv.filesystem.rules.FileSizeRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 10 with FileSizeRule

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

the class Test_FileSizeRule method isMatchConstructWithFileExpectFalsePositive.

@Test
public void isMatchConstructWithFileExpectFalsePositive() throws Exception {
    expectNew(FilePackage.class, null, null, testPath).andReturn(pack);
    expect(pack.getSize()).andReturn(11100l);
    expect(pack.getSize()).andReturn(100l);
    replayAll();
    FileSizeRule rule = new FileSizeRule(null, testPath, "isMatchConstructWithFileExpectFalsePositive", false);
    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)

Aggregations

FileSizeRule (com.axway.ats.rbv.filesystem.rules.FileSizeRule)17 BaseTest (com.axway.ats.rbv.BaseTest)13 Test (org.junit.Test)13 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)13 MetaData (com.axway.ats.rbv.MetaData)10 FileSystemMetaData (com.axway.ats.rbv.filesystem.FileSystemMetaData)10 FilePackage (com.axway.ats.action.objects.FilePackage)6 PublicAtsApi (com.axway.ats.common.PublicAtsApi)4