Search in sources :

Example 1 with FilePermRule

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

the class Test_FilePermRule method constructWithMachine.

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

Example 2 with FilePermRule

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

the class Test_FilePermRule method isMatchConstructorWithPermissionPositive.

@Test
public void isMatchConstructorWithPermissionPositive() throws Exception {
    expect(pack.getPermissions()).andReturn(FilePackage.ATTRIBUTE_NOT_SUPPORTED);
    replayAll();
    FilePermRule rule = new FilePermRule(FilePackage.ATTRIBUTE_NOT_SUPPORTED, "isMatchConstructorWithPermissionPositive", true);
    MetaData metaData = new FileSystemMetaData(pack);
    assertTrue(rule.isMatch(metaData));
    verifyAll();
}
Also used : FilePermRule(com.axway.ats.rbv.filesystem.rules.FilePermRule) 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 3 with FilePermRule

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

the class Test_FilePermRule method isMatchNullMetaDataContent.

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

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

the class Test_FilePermRule method isMatchConstructorWithPermissionNegative.

@Test
public void isMatchConstructorWithPermissionNegative() throws Exception {
    expect(pack.getPermissions()).andReturn(123l);
    replayAll();
    FilePermRule rule = new FilePermRule(456l, "isMatchConstructorWithPermissionNegative", true);
    MetaData metaData = new FileSystemMetaData(pack);
    assertFalse(rule.isMatch(metaData));
    verifyAll();
}
Also used : FilePermRule(com.axway.ats.rbv.filesystem.rules.FilePermRule) 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 5 with FilePermRule

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

the class Test_FilePermRule method constructWithNullMachine.

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

Aggregations

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