Search in sources :

Example 1 with FileGidRule

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

the class FileSystemVerification method checkGID.

/**
     * Add rule to check that the GID of the received file is the same
     * as the GID of the source file (NOT SUPPORTED ON WINDOWS)
     *
     * @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 checkGID(String srcAtsAgent, String srcFile) throws RbvException {
    FileGidRule rule = new FileGidRule(srcAtsAgent, srcFile, "checkGID", true);
    rootRule.addRule(rule);
}
Also used : FileGidRule(com.axway.ats.rbv.filesystem.rules.FileGidRule) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 2 with FileGidRule

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

the class Test_FileGIDRule method performMatchNotSupported.

@Test
public void performMatchNotSupported() throws RbvException, PackageException {
    expect(meta.getFilePackage()).andReturn(pack);
    expect(pack.getGid()).andReturn(FilePackage.ATTRIBUTE_NOT_SUPPORTED);
    replayAll();
    rule = new FileGidRule(1, "ruleName", true);
    assertTrue(rule.performMatch(meta));
    verifyAll();
}
Also used : FileGidRule(com.axway.ats.rbv.filesystem.rules.FileGidRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 3 with FileGidRule

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

the class Test_FileGIDRule method performMatchOtherFileException.

@Test(expected = RbvException.class)
public void performMatchOtherFileException() throws Exception {
    FilePackage remotePack = createMock(FilePackage.class);
    expectNew(FilePackage.class, null, null, "/root/file.name").andReturn(remotePack);
    expect(remotePack.getGid()).andThrow(new PackageException(""));
    replayAll();
    rule = new FileGidRule(null, "/root/file.name", "ruleName", true);
    verifyAll();
}
Also used : FilePackage(com.axway.ats.action.objects.FilePackage) PackageException(com.axway.ats.action.objects.model.PackageException) FileGidRule(com.axway.ats.rbv.filesystem.rules.FileGidRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 4 with FileGidRule

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

the class Test_FileGIDRule method performMatch.

@Test
public void performMatch() throws RbvException, PackageException {
    expect(meta.getFilePackage()).andReturn(pack);
    expect(pack.getGid()).andReturn(1L);
    replayAll();
    rule = new FileGidRule(1, "ruleName", true);
    assertTrue(rule.performMatch(meta));
    verifyAll();
}
Also used : FileGidRule(com.axway.ats.rbv.filesystem.rules.FileGidRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 5 with FileGidRule

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

the class Test_FileGIDRule method performMatchOtherFileNull.

@Test
public void performMatchOtherFileNull() throws Exception {
    FilePackage remotePack = createMock(FilePackage.class);
    expectNew(FilePackage.class, null, null, "/root/file.name").andReturn(remotePack);
    expect(remotePack.getGid()).andReturn(1L);
    expect(meta.getFilePackage()).andReturn(pack);
    expect(pack.getGid()).andReturn(1L);
    replayAll();
    rule = new FileGidRule(null, "/root/file.name", "ruleName", true);
    assertTrue(rule.performMatch(meta));
    verifyAll();
}
Also used : FilePackage(com.axway.ats.action.objects.FilePackage) FileGidRule(com.axway.ats.rbv.filesystem.rules.FileGidRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

FileGidRule (com.axway.ats.rbv.filesystem.rules.FileGidRule)12 BaseTest (com.axway.ats.rbv.BaseTest)8 Test (org.junit.Test)8 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)8 PublicAtsApi (com.axway.ats.common.PublicAtsApi)4 FilePackage (com.axway.ats.action.objects.FilePackage)3 PackageException (com.axway.ats.action.objects.model.PackageException)2 ArrayList (java.util.ArrayList)1