Search in sources :

Example 1 with FileUidRule

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

the class FileSystemVerification method checkUID.

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

Example 2 with FileUidRule

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

the class FileSystemVerification method checkUIDDifferent.

/**
     * Add rule to check that the UID of the received file is different
     * than the UID 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 checkUIDDifferent(String srcAtsAgent, String srcFile) throws RbvException {
    FileUidRule rule = new FileUidRule(srcAtsAgent, srcFile, "checkUIDDifferent", false);
    rootRule.addRule(rule);
}
Also used : FileUidRule(com.axway.ats.rbv.filesystem.rules.FileUidRule) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 3 with FileUidRule

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

the class Test_FileUIDRule method performMatchNotSupported.

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

Example 4 with FileUidRule

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

the class Test_FileUIDRule method performMatchOtherFileException.

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

Example 5 with FileUidRule

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

the class Test_FileUIDRule method performMatch.

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

Aggregations

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