Package org.apache.james.mailbox.model

Examples of org.apache.james.mailbox.model.MailboxPath


     * Test of consumeUid method, of class HBaseMailbox.
     */
    @Test
    public void testConsumeUid() {
        System.out.println("consumeUid");
        final MailboxPath mailboxPath = new MailboxPath("gsoc", "ieugen", "INBOX");
        final HBaseMailbox instance = new HBaseMailbox(mailboxPath, 10);
        long expResult = instance.getLastUid() + 1;
        long result = instance.consumeUid();
        assertEquals(expResult, result);
    }
View Full Code Here


     * Test of consumeModSeq method, of class HBaseMailbox.
     */
    @Test
    public void testConsumeModSeq() {
        System.out.println("consumeModSeq");
        final MailboxPath mailboxPath = new MailboxPath("gsoc", "ieugen", "INBOX");
        final HBaseMailbox instance = new HBaseMailbox(mailboxPath, 10);
        long expResult = instance.getHighestModSeq() + 1;
        long result = instance.consumeModSeq();
        assertEquals(expResult, result);
    }
View Full Code Here

     * Test of mailboxRowKey method, of class HBaseMailbox.
     */
    @Test
    public void testRowKey_All() {
        System.out.println("getRowKey and UUIDFromRowKey");
        final HBaseMailbox mailbox = new HBaseMailbox(new MailboxPath("gsoc", "ieugen", "INBOX"), 1234);
        UUID uuid = mailbox.getMailboxId();
        byte[] expResult = mailboxRowKey(uuid);
        byte[] result = mailboxRowKey(mailbox.getMailboxId());
        assertArrayEquals(expResult, result);

View Full Code Here

     * Test of metadataToPut method, of class HBaseMailbox.
     */
    @Test
    public void testMailboxToPut() {
        System.out.println("mailboxToPut");
        final HBaseMailbox instance = new HBaseMailbox(new MailboxPath("gsoc", "ieugen", "INBOX"), 1234);

        Put result = toPut(instance);
        assertArrayEquals(mailboxRowKey(instance.getMailboxId()), result.getRow());
        assertTrue(result.has(MAILBOX_CF, MAILBOX_USER, Bytes.toBytes(instance.getUser())));
        assertTrue(result.has(MAILBOX_CF, MAILBOX_NAME, Bytes.toBytes(instance.getName())));
View Full Code Here

        client = CuratorFrameworkFactory.builder().connectString("localhost:" + ZOO_TEST_PORT).retryPolicy(retryPolicy).
                namespace("JAMES").build();
        client.start();
        uuidProvider = new ZooUidProvider<UUID>(client, retryPolicy);
        longProvider = new ZooUidProvider<Long>(client, retryPolicy);
        MailboxPath path1 = new MailboxPath("namespacetest", "namespaceuser", "UUID");
        MailboxPath path2 = new MailboxPath("namespacetest", "namespaceuser", "Long");
        mailboxUUID = new SimpleMailbox<UUID>(path1, 1L);
        mailboxUUID.setMailboxId(randomUUID);
        mailboxLong = new SimpleMailbox<Long>(path2, 2L);
        mailboxLong.setMailboxId(123L);
    }
View Full Code Here

     * @return a Mailbox object
     */
    public static Mailbox<UUID> mailboxFromResult(Result result) {
        NavigableMap<byte[], byte[]> rawMailbox = result.getFamilyMap(MAILBOX_CF);
        //TODO: should we test for null values?
        MailboxPath path = new MailboxPath(Bytes.toString(rawMailbox.get(MAILBOX_NAMESPACE)),
                Bytes.toString(rawMailbox.get(MAILBOX_USER)),
                Bytes.toString(rawMailbox.get(MAILBOX_NAME)));

        HBaseMailbox mailbox = new HBaseMailbox(path, Bytes.toLong(rawMailbox.get(MAILBOX_UIDVALIDITY)));
        mailbox.setMailboxId(UUIDFromRowKey(result.getRow()));
View Full Code Here

        final CountDownLatch latch = new CountDownLatch(APPEND_OPERATIONS);
        final ExecutorService pool = Executors.newFixedThreadPool(APPEND_OPERATIONS / 2);
        final List<Long> uList = new ArrayList<Long>();
        MailboxSession session = getMailboxManager().createSystemSession("test", LoggerFactory.getLogger("Test"));
        getMailboxManager().startProcessingRequest(session);
        final MailboxPath path = new MailboxPath(MailboxConstants.USER_NAMESPACE, "username", "INBOX");
        getMailboxManager().createMailbox(path, session);
        getMailboxManager().addListener(path, new MailboxListener() {


            @Override
View Full Code Here

        MailboxSession session = getMailboxManager().createSystemSession(USER_1, LoggerFactory.getLogger("Mock"));
        Assert.assertEquals(USER_1, session.getUser().getUserName());
       
        getMailboxManager().startProcessingRequest(session);
       
        MailboxPath inbox = MailboxPath.inbox(session);
        Assert.assertFalse(getMailboxManager().mailboxExists(inbox, session));
       
        getMailboxManager().createMailbox(inbox, session);
        Assert.assertTrue(getMailboxManager().mailboxExists(inbox, session));
       
        try {
            getMailboxManager().createMailbox(inbox, session);
            Assert.fail();
        } catch (MailboxException e) {
            // mailbox already exists!
        }
       
        MailboxPath inboxSubMailbox = new MailboxPath(inbox, "INBOX.Test");
        Assert.assertFalse(getMailboxManager().mailboxExists(inboxSubMailbox, session));
       
        getMailboxManager().createMailbox(inboxSubMailbox, session);
        Assert.assertTrue(getMailboxManager().mailboxExists(inboxSubMailbox, session));
       
View Full Code Here

   
    @Test
    public void testCreateSubFolderDirectly() throws BadCredentialsException, MailboxException {

        MailboxSession session = getMailboxManager().createSystemSession(USER_2, LoggerFactory.getLogger("Test"));
        getMailboxManager().createMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER_2, "Trash"), session);
        getMailboxManager().createMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, USER_2, "INBOX.testfolder"), session);
       
        getMailboxManager().getMailbox(MailboxPath.inbox(session), session).appendMessage(new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), session, false, new Flags());

    }
View Full Code Here

        assertEquals(BASE, expression.getCombinedName());
    }

    @Test
    public void testNullCombinedName() throws Exception {
        MailboxQuery expression = new MailboxQuery(new MailboxPath(null, null, null), null, '.');
        assertNotNull(expression.getCombinedName());
    }
View Full Code Here

TOP

Related Classes of org.apache.james.mailbox.model.MailboxPath

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.