Package org.apache.james.imapserver.store

Examples of org.apache.james.imapserver.store.ImapMailbox


     * Checks that a mailbox with the supplied name exists, and that its
     * NoSelect flag matches that expected.
     */
    private void assertMailbox( String name, boolean selectable ) throws MailboxException
    {
        ImapMailbox mailbox = imapHost.getMailbox( user, name );
        assertNotNull( "Mailbox <" + name + "> expected to exist in store.",
                       mailbox );
        if ( selectable )
        {
            assertTrue( "Mailbox <" + name + "> not selectable.",
                        mailbox.isSelectable() );
        }
        else
        {
            assertTrue( "Mailbox <" + name + "> should not be selectable.",
                        ! mailbox.isSelectable() );
        }
    }
View Full Code Here


    /**
     * Asserts that a mailbox with the supplied name doesn't exist.
     */
    private void assertNoMailbox( String name ) throws Exception
    {
        ImapMailbox mailbox = imapHost.getMailbox( user, name );
        assertNull( "Mailbox <" + name + "> should not exist.",
                    mailbox );
    }
View Full Code Here

                }
            }
        }

        if ( useIMAPstorage ) {
            ImapMailbox mbox = null;
            try {
                user = ( JamesUser ) localusers.getUserByName( username );
                mbox = imapHost.getInbox( user );
                MailImpl mail = new MailImpl( message );
                mbox.store( mail );
                getLogger().info( "Message " + message.getMessageID() +
                                  " stored in " +
                                  mbox.getFullName() );
                mbox = null;
            }
            catch ( Exception e ) {
                getLogger().error( "Exception storing mail: " + e );
                e.printStackTrace();
View Full Code Here

     * Tests creation of mailboxes in the Store.
     */
    public void testCreate() throws Exception
    {
        // Get the user namespace.
        ImapMailbox root = imapStore.getMailbox( ImapConstants.USER_NAMESPACE );

        // Create a single mailbox.
        ImapMailbox test = create( root, "test" );
        assertMailbox( "test", true );

        // Create a single mailbox as noselect.
        ImapMailbox noSelect = imapStore.createMailbox( root, "noSelect", false );
        assertMailbox( "noSelect", false );

        // Create children for these mailboxes.
        create( test, "child" );
        create( noSelect, "child" );
View Full Code Here

        delete( "test" );
        assertNoMailbox( "test");

        // Create a chain and attempt to delete the parent.
        ImapMailbox one = create( "one" );
        create( one, "two" );
        assertMailbox( "one", true );
        assertMailbox( "one.two", true );

        try {
View Full Code Here

        coll = list("*");
        assertTrue( coll.isEmpty() );
        coll = list("%");
        assertTrue( coll.isEmpty() );

        ImapMailbox test = create( "test" );
        ImapMailbox testOne = create( test, "one" );
        ImapMailbox testTwo = create( test, "two" );
        ImapMailbox testTwoAaa = create( testTwo, "aaa" );
        ImapMailbox different = create( "different" );
        ImapMailbox differentOne = create( different, "one" );
        ImapMailbox differentTwo = create( different, "two" );

        coll = list("*");
        assertContents( coll, new ImapMailbox[]{test, testOne, testTwo, testTwoAaa, different, differentOne, differentTwo});

        coll = list("%");
View Full Code Here

     * Checks that a mailbox with the supplied name exists, and that its
     * NoSelect flag matches that expected.
     */
    private void assertMailbox( String name, boolean selectable )
    {
        ImapMailbox mailbox = imapStore.getMailbox( prefixUserNamespace( name ) );
        assertNotNull( "Mailbox <" + name + "> expected to exist in store.",
                       mailbox );
        if ( selectable )
        {
            assertTrue( "Mailbox <" + name + "> not selectable.",
                        mailbox.isSelectable() );
        }
        else
        {
            assertTrue( "Mailbox <" + name + "> should not be selectable.",
                        ! mailbox.isSelectable() );
        }
    }
View Full Code Here

    /**
     * Asserts that a mailbox with the supplied name doesn't exist.
     */
    private void assertNoMailbox( String name )
    {
        ImapMailbox mailbox = imapStore.getMailbox( prefixUserNamespace( name ));
        assertNull( "Mailbox <" + name + "> should not exist.",
                    mailbox );
    }
View Full Code Here

    /**
     * Creates a mailbox with the specified name in the root user namespace.
     */
    private ImapMailbox create( String name ) throws Exception
    {
        ImapMailbox root = imapStore.getMailbox( USER_NAMESPACE );
        return create( root, name );
    }
View Full Code Here

    /**
     * Deletes a mailbox from the store.
     */
    private void delete( String name ) throws MailboxException
    {
        ImapMailbox mailbox = imapStore.getMailbox( prefixUserNamespace( name ) );
        imapStore.deleteMailbox( mailbox );
    }
View Full Code Here

TOP

Related Classes of org.apache.james.imapserver.store.ImapMailbox

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.