Search in sources :

Example 26 with PackageException

use of com.axway.ats.action.objects.model.PackageException in project ats-framework by Axway.

the class Test_FileSystemFolder method getAllMetadataExceptionFetchingModTimePositive.

@Test
public void getAllMetadataExceptionFetchingModTimePositive() throws Exception {
    // constructors
    expectNew(SystemOperations.class, "localhost:0000").andReturn(systemOperations);
    expectNew(FileSystemOperations.class, "localhost:0000").andReturn(fileSystemOperations);
    // open()
    expect(systemOperations.getOperatingSystemType()).andReturn(OperatingSystemType.SOLARIS);
    // getAllMetaData()
    expect(fileSystemOperations.findFiles("some.path/", ".*", true, true, false)).andReturn(new String[] { "some.path/some.file1", "some.path/some.file2" });
    FilePackage pack1 = createMock(FilePackage.class);
    expectNew(FilePackage.class, "localhost:0000", "some.path/some.file1", OperatingSystemType.SOLARIS).andReturn(pack1);
    expect(pack1.getUniqueIdentifier()).andThrow(new PackageException(""));
    FilePackage pack2 = createMock(FilePackage.class);
    expectNew(FilePackage.class, "localhost:0000", "some.path/some.file2", OperatingSystemType.SOLARIS).andReturn(pack2);
    expect(pack2.getUniqueIdentifier()).andReturn("some.path/some.file1.1.1.1");
    replayAll();
    FileSystemFolder folder = new FileSystemFolder("localhost:0000", "some.path", null, true, false);
    folder.open();
    assertEquals(folder.getAllMetaData().size(), 1);
    verifyAll();
}
Also used : FilePackage(com.axway.ats.action.objects.FilePackage) FileSystemOperations(com.axway.ats.action.filesystem.FileSystemOperations) SystemOperations(com.axway.ats.action.system.SystemOperations) PackageException(com.axway.ats.action.objects.model.PackageException) FileSystemOperations(com.axway.ats.action.filesystem.FileSystemOperations) FileSystemFolder(com.axway.ats.rbv.filesystem.FileSystemFolder) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 27 with PackageException

use of com.axway.ats.action.objects.model.PackageException 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 28 with PackageException

use of com.axway.ats.action.objects.model.PackageException 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 29 with PackageException

use of com.axway.ats.action.objects.model.PackageException in project ats-framework by Axway.

the class Test_FileUIDRule method performMatchNegativeWxception.

@Test(expected = RbvException.class)
public void performMatchNegativeWxception() throws RbvException, PackageException {
    expect(meta.getFilePackage()).andReturn(pack);
    expect(pack.getUid()).andThrow(new PackageException(""));
    replayAll();
    rule = new FileUidRule(1, "ruleName", true);
    rule.performMatch(meta);
    verifyAll();
}
Also used : 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 30 with PackageException

use of com.axway.ats.action.objects.model.PackageException in project ats-framework by Axway.

the class Test_FileContentRule method isMatchNegativeException.

@Test(expected = RbvException.class)
public void isMatchNegativeException() throws Exception {
    expect(testFilePackage.grep(EXPRESSION, false)).andThrow(new PackageException(""));
    replayAll();
    FileContentRule rule = new FileContentRule(EXPRESSION, RULE_NAME, false, true);
    MetaData metaData = new FileSystemMetaData(testFilePackage);
    rule.isMatch(metaData);
    verifyAll();
}
Also used : FileContentRule(com.axway.ats.rbv.filesystem.rules.FileContentRule) FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) MetaData(com.axway.ats.rbv.MetaData) PackageException(com.axway.ats.action.objects.model.PackageException) FileSystemMetaData(com.axway.ats.rbv.filesystem.FileSystemMetaData) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Aggregations

PackageException (com.axway.ats.action.objects.model.PackageException)52 NoSuchMimePackageException (com.axway.ats.action.objects.model.NoSuchMimePackageException)34 MessagingException (javax.mail.MessagingException)32 PublicAtsApi (com.axway.ats.common.PublicAtsApi)31 MimePart (javax.mail.internet.MimePart)11 IOException (java.io.IOException)10 NoSuchMimePartException (com.axway.ats.action.objects.model.NoSuchMimePartException)9 FilePackage (com.axway.ats.action.objects.FilePackage)7 BaseTest (com.axway.ats.rbv.BaseTest)7 InternetAddress (javax.mail.internet.InternetAddress)7 Test (org.junit.Test)7 MimePackage (com.axway.ats.action.objects.MimePackage)6 RbvException (com.axway.ats.rbv.model.RbvException)6 InputStream (java.io.InputStream)6 RbvStorageException (com.axway.ats.rbv.model.RbvStorageException)5 ContentType (javax.mail.internet.ContentType)5 MimeBodyPart (javax.mail.internet.MimeBodyPart)5 MimeMultipart (javax.mail.internet.MimeMultipart)5 FileSystemMetaData (com.axway.ats.rbv.filesystem.FileSystemMetaData)4 ByteArrayInputStream (java.io.ByteArrayInputStream)4