Search in sources :

Example 11 with FileSizeRule

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

the class Test_FileSizeRule method isMatchInvalidMetaDataContent.

@Test(expected = MetaDataIncorrectException.class)
public void isMatchInvalidMetaDataContent() throws Exception {
    expect(pack.getSize()).andReturn(100l);
    replayAll();
    FileSizeRule rule = new FileSizeRule(100l, "isMatchInvalidMetaDataContent", true);
    MetaData metaData = new MetaData();
    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) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 12 with FileSizeRule

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

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

the class Test_FileSizeRule method constructWithNullMachine.

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

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

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

the class FileSystemVerification method checkSize.

/**
     * Add rule to check that the size of the received file is the same
     * as the size of the source file
     *
     * @param srcAtsAgent       the remote ATS agent address on which the source file is located
     * @param srcFile           the full name of the file
     * @throws RbvException     thrown on error
     */
@PublicAtsApi
public void checkSize(String srcAtsAgent, String srcFile) throws RbvException {
    FileSizeRule rule = new FileSizeRule(srcAtsAgent, srcFile, "checkSize", true);
    rootRule.addRule(rule);
}
Also used : FileSizeRule(com.axway.ats.rbv.filesystem.rules.FileSizeRule) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

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