Package org.apache.james.mailbox.exception

Examples of org.apache.james.mailbox.exception.MailboxNotFoundException


    @Test
    public void testInexistentMailboxName() throws Exception {
        Expectations expectations = prepareRightsExpectations();
       
        expectations.allowing(mailboxManagerStub).getMailbox(expectations.with(Expectations.any(MailboxPath.class)), expectations.with(Expectations.any(MailboxSession.class)));
        expectations.will(Expectations.throwException(new MailboxNotFoundException(MAILBOX_NAME)));

        mockery.checking(expectations);

        final Responder responderMock = mockery.mock(Responder.class);
        mockery.checking(new Expectations() {
View Full Code Here


    @Test
    public void testInexistentMailboxName() throws Exception {
        Expectations expectations = prepareRightsExpectations();
       
        expectations.allowing(mailboxManagerStub).getMailbox(expectations.with(Expectations.any(MailboxPath.class)), expectations.with(Expectations.any(MailboxSession.class)));
        expectations.will(Expectations.throwException(new MailboxNotFoundException(MAILBOX_NAME)));

        mockery.checking(expectations);

        final Responder responderMock = mockery.mock(Responder.class);
        mockery.checking(new Expectations() {
View Full Code Here

    @Test
    public void testInexistentMailboxName() throws Exception {
        Expectations expectations = prepareRightsExpectations();
       
        expectations.allowing(mailboxManagerStub).getMailbox(expectations.with(Expectations.any(MailboxPath.class)), expectations.with(Expectations.any(MailboxSession.class)));
        expectations.will(Expectations.throwException(new MailboxNotFoundException(MAILBOX_NAME)));

        mockery.checking(expectations);

        final Responder responderMock = mockery.mock(Responder.class);
        mockery.checking(new Expectations() {
View Full Code Here

    @Test
    public void testInexistentMailboxName() throws Exception {
        Expectations expectations = prepareRightsExpectations();
       
        expectations.allowing(mailboxManagerStub).getMailbox(expectations.with(Expectations.any(MailboxPath.class)), expectations.with(Expectations.any(MailboxSession.class)));
        expectations.will(Expectations.throwException(new MailboxNotFoundException(MAILBOX_NAME)));

        mockery.checking(expectations);

        final Responder responderMock = mockery.mock(Responder.class);
        mockery.checking(new Expectations() {
View Full Code Here

        final MailboxMapper<Id> mapper = mailboxSessionMapperFactory.getMailboxMapper(session);
        Mailbox<Id> mailboxRow = mapper.findMailboxByPath(mailboxPath);

        if (mailboxRow == null) {
            session.getLog().info("Mailbox '" + mailboxPath + "' not found.");
            throw new MailboxNotFoundException(mailboxPath);

        } else {
            session.getLog().debug("Loaded mailbox " + mailboxPath);

            StoreMessageManager<Id> m = createMessageManager(mailboxRow, session);
View Full Code Here

        Mailbox<Id> mailbox = mapper.execute(new Mapper.Transaction<Mailbox<Id>>() {

            public Mailbox<Id> run() throws MailboxException {
                final Mailbox<Id> mailbox = mapper.findMailboxByPath(mailboxPath);
                if (mailbox == null) {
                    throw new MailboxNotFoundException("Mailbox not found");
                }

                // We need to create a copy of the mailbox as maybe we can not refer to the real
                // mailbox once we remove it
                SimpleMailbox<Id> m = new SimpleMailbox<Id>(mailbox);
View Full Code Here

            public void runVoid() throws MailboxException {
                // TODO put this into a serilizable transaction
                final Mailbox<Id> mailbox = mapper.findMailboxByPath(from);
                if (mailbox == null) {
                    throw new MailboxNotFoundException(from);
                }
                mailbox.setNamespace(to.getNamespace());
                mailbox.setUser(to.getUser());
                mailbox.setName(to.getName());
                mapper.save(mailbox);
View Full Code Here

                return (JPAMailbox) getEntityManager().createNamedQuery("findMailboxByName").setParameter("nameParam", mailboxPath.getName()).setParameter("namespaceParam", mailboxPath.getNamespace()).getSingleResult();
            } else {
                return (JPAMailbox) getEntityManager().createNamedQuery("findMailboxByNameWithUser").setParameter("nameParam", mailboxPath.getName()).setParameter("namespaceParam", mailboxPath.getNamespace()).setParameter("userParam", mailboxPath.getUser()).getSingleResult();
            }
        } catch (NoResultException e) {
            throw new MailboxNotFoundException(mailboxPath);
        } catch (PersistenceException e) {
            throw new MailboxException("Search of mailbox " + mailboxPath + " failed", e);
        }
    }
View Full Code Here

                result = mailbox;
                break;
            }
        }
        if (result == null) {
            throw new MailboxNotFoundException(path);
        } else {
            return result;
        }
    }
View Full Code Here

    public Mailbox<Integer> loadMailbox(MailboxSession session, MailboxPath mailboxPath)
    throws MailboxNotFoundException, MailboxException {
        MaildirFolder folder = new MaildirFolder(getFolderName(mailboxPath), mailboxPath, locker);
        folder.setMessageNameStrictParse(isMessageNameStrictParse());
        if (!folder.exists())
            throw new MailboxNotFoundException(mailboxPath);
        return loadMailbox(session, folder.getRootFile(), mailboxPath);
    }
View Full Code Here

TOP

Related Classes of org.apache.james.mailbox.exception.MailboxNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.