Search in sources :

Example 1 with MatchableAlreadyOpenException

use of com.axway.ats.rbv.model.MatchableAlreadyOpenException in project ats-framework by Axway.

the class ImapFolder method open.

/**
     *
     * @see com.axway.ats.rbv.storage.Matchable#open()
     */
public void open() throws RbvStorageException {
    //first check if the folder is already open
    if (isOpen) {
        throw new MatchableAlreadyOpenException(getDescription() + " is already open");
    }
    try {
        isInitialPass = true;
        // create and connect to the user's imap folder
        if (!store.isConnected()) {
            store.connect(serverHost, userName, password);
            log.debug("Connected to store '" + serverHost + "' with user '" + userName + "' and password '" + password + "'");
        }
        if (folder == null || !folder.isOpen()) {
            folder = store.getFolder(folderName);
            folder.open(Folder.READ_WRITE);
        }
        allMetaDataList.clear();
        newMetaDataList.clear();
        isOpen = true;
        log.info("Opened " + getDescription());
    } catch (MessagingException me) {
        throw new RbvStorageException("Could not open " + getDescription(), me);
    }
}
Also used : MatchableAlreadyOpenException(com.axway.ats.rbv.model.MatchableAlreadyOpenException) MessagingException(javax.mail.MessagingException) RbvStorageException(com.axway.ats.rbv.model.RbvStorageException)

Example 2 with MatchableAlreadyOpenException

use of com.axway.ats.rbv.model.MatchableAlreadyOpenException in project ats-framework by Axway.

the class Test_MatchableAlreadyOpenException method constructors.

@Test
public void constructors() {
    MatchableAlreadyOpenException exception;
    exception = new MatchableAlreadyOpenException("test");
    assertEquals("test", exception.getMessage());
    assertNull(exception.getCause());
    Exception helperException = new Exception();
    exception = new MatchableAlreadyOpenException("test", helperException);
    assertEquals("test", exception.getMessage());
    assertEquals(helperException, exception.getCause());
    exception = new MatchableAlreadyOpenException(helperException);
    assertEquals("java.lang.Exception", exception.getMessage());
    assertEquals(helperException, exception.getCause());
}
Also used : MatchableAlreadyOpenException(com.axway.ats.rbv.model.MatchableAlreadyOpenException) MatchableAlreadyOpenException(com.axway.ats.rbv.model.MatchableAlreadyOpenException) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 3 with MatchableAlreadyOpenException

use of com.axway.ats.rbv.model.MatchableAlreadyOpenException in project ats-framework by Axway.

the class FileSystemFolder method open.

public void open() throws RbvStorageException {
    //first check if the folder is already open
    if (isOpen) {
        throw new MatchableAlreadyOpenException("File system folder is already open");
    }
    try {
        //get the name of the OS
        this.osType = this.systemOperations.getOperatingSystemType();
        // provide path valid for the target host
        this.path = IoUtils.normalizeDirPath(path, this.osType);
    } catch (Exception e) {
        throw new RbvStorageException("Could not open " + getDescription(), e);
    }
    isOpen = true;
}
Also used : MatchableAlreadyOpenException(com.axway.ats.rbv.model.MatchableAlreadyOpenException) RbvStorageException(com.axway.ats.rbv.model.RbvStorageException) MatchableAlreadyOpenException(com.axway.ats.rbv.model.MatchableAlreadyOpenException) MatchableNotOpenException(com.axway.ats.rbv.model.MatchableNotOpenException) RbvException(com.axway.ats.rbv.model.RbvException) PackageException(com.axway.ats.action.objects.model.PackageException) RbvStorageException(com.axway.ats.rbv.model.RbvStorageException)

Aggregations

MatchableAlreadyOpenException (com.axway.ats.rbv.model.MatchableAlreadyOpenException)3 RbvStorageException (com.axway.ats.rbv.model.RbvStorageException)2 PackageException (com.axway.ats.action.objects.model.PackageException)1 BaseTest (com.axway.ats.rbv.BaseTest)1 MatchableNotOpenException (com.axway.ats.rbv.model.MatchableNotOpenException)1 RbvException (com.axway.ats.rbv.model.RbvException)1 MessagingException (javax.mail.MessagingException)1 Test (org.junit.Test)1