Search in sources :

Example 6 with FilePathRule

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

the class Test_FilePathRule method isMatchExpectedTrueNegativeRegex.

@Test
public void isMatchExpectedTrueNegativeRegex() throws Exception {
    expect(pack.getAbsolutePath()).andReturn(testFileAbsPath);
    expect(pack.getName()).andReturn(testFileAbsPath.substring(testFileAbsPath.lastIndexOf('/') + 1));
    replayAll();
    FilePathRule rule = new FilePathRule(wrongFilePath, "p.*1.+xt", "isMatchExpectedTrueNegative", true, 1);
    MetaData metaData = new FileSystemMetaData(pack);
    assertFalse(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)

Example 7 with FilePathRule

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

Example 8 with FilePathRule

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

the class Test_FilePathRule method isMatchExpectedTrueNegativeNullPathregex.

@Test
public void isMatchExpectedTrueNegativeNullPathregex() throws Exception {
    expect(pack.getAbsolutePath()).andReturn(null);
    expect(pack.getName()).andReturn(testFileAbsPath.substring(testFileAbsPath.lastIndexOf('/') + 1));
    replayAll();
    FilePathRule rule = new FilePathRule(null, "p.*1.+xt", "isMatchExpectedTrueNegativeNullPath", true, 1);
    MetaData metaData = new FileSystemMetaData(pack);
    assertFalse(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)

Example 9 with FilePathRule

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

the class Test_FilePathRule method isMatchExpectedFalsePositive.

@Test
public void isMatchExpectedFalsePositive() throws Exception {
    expect(pack.getAbsolutePath()).andReturn(testFileAbsPath);
    replayAll();
    FilePathRule rule = new FilePathRule(wrongFilePath, "isMatchExpectedFalsePositive", false);
    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)

Example 10 with FilePathRule

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

the class Test_FilePathRule method priority.

@Test
public void priority() {
    FilePathRule rule = new FilePathRule(testFileAbsPath, "isMatchExpectedFalseNegative", false, 1);
    assertEquals(rule.getPriority(), 1);
}
Also used : FilePathRule(com.axway.ats.rbv.filesystem.rules.FilePathRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

BaseTest (com.axway.ats.rbv.BaseTest)14 FilePathRule (com.axway.ats.rbv.filesystem.rules.FilePathRule)14 Test (org.junit.Test)14 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)13 FileSystemMetaData (com.axway.ats.rbv.filesystem.FileSystemMetaData)11 MetaData (com.axway.ats.rbv.MetaData)10 FilePackage (com.axway.ats.action.objects.FilePackage)1 FileFolderRule (com.axway.ats.rbv.filesystem.rules.FileFolderRule)1 AndRuleOperation (com.axway.ats.rbv.rules.AndRuleOperation)1 ArrayList (java.util.ArrayList)1