Package org.apache.james.mailbox.hbase.mail.model

Examples of org.apache.james.mailbox.hbase.mail.model.HBaseMailbox


                mboxPath = new MailboxPath("gsoc", "ieugen" + i, "INBOX");
            } else {
                mboxPath = new MailboxPath("gsoc", "ieugen" + i, "INBOX.box" + i);
            }
            MBOX_PATHS.add(mboxPath);
            MBOXES.add(new HBaseMailbox(MBOX_PATHS.get(i), random.nextLong()));
            propBuilder.setProperty("gsoc", "prop" + i, "value");
        }
        propBuilder.setMediaType("text");
        propBuilder.setSubType("html");
        propBuilder.setTextualLineCount(2L);
View Full Code Here


    /**
     * Test of findMailboxByPath method, of class HBaseMailboxMapper.
     */
    private void testFindMailboxByPath() throws Exception {
        LOG.info("findMailboxByPath");
        HBaseMailbox mailbox;
        for (MailboxPath path : pathsList) {
            LOG.info("Searching for " + path);
            mailbox = (HBaseMailbox) mapper.findMailboxByPath(path);
            assertEquals(path, new MailboxPath(mailbox.getNamespace(), mailbox.getUser(), mailbox.getName()));
        }
    }
View Full Code Here

            newPath.setName(i + newPath.getName() + " " + i);
            // test for paths with null user
            if (i % 2 == 0) {
                newPath.setUser(null);
            }
            addMailbox(new HBaseMailbox(newPath, 1234));
        }
        result = mapper.findMailboxWithPathLike(path);
        assertEquals(end - start + 1, result.size());
    }
View Full Code Here

     */
    private void testSave() throws Exception {
        LOG.info("save and mailboxFromResult");
        final HTable mailboxes = new HTable(conf, MAILBOXES_TABLE);

        final HBaseMailbox mlbx = mailboxList.get(mailboxList.size() / 2);

        final Get get = new Get(mailboxRowKey(mlbx.getMailboxId()));
        // get all columns for the DATA column family
        get.addFamily(MAILBOX_CF);

        final Result result = mailboxes.get(get);
        final HBaseMailbox newValue = (HBaseMailbox) mailboxFromResult(result);
        assertEquals(mlbx, newValue);
        assertEquals(mlbx.getUser(), newValue.getUser());
        assertEquals(mlbx.getName(), newValue.getName());
        assertEquals(mlbx.getNamespace(), newValue.getNamespace());
        assertEquals(mlbx.getMailboxId(), newValue.getMailboxId());
        assertEquals(mlbx.getLastUid(), newValue.getLastUid());
        assertEquals(mlbx.getUidValidity(), newValue.getUidValidity());
        assertEquals(mlbx.getHighestModSeq(), newValue.getHighestModSeq());
        assertArrayEquals(mailboxRowKey(mlbx.getMailboxId()), mailboxRowKey(newValue.getMailboxId()));
    }
View Full Code Here

        int notFoundCount = 0;

        Iterator<HBaseMailbox> iterator = mailboxList.subList(mailboxList.size() - offset, mailboxList.size()).iterator();

        while (iterator.hasNext()) {
            HBaseMailbox mailbox = iterator.next();
            mapper.delete(mailbox);
            iterator.remove();
            MailboxPath path = new MailboxPath(mailbox.getNamespace(), mailbox.getUser(), mailbox.getName());
            pathsList.remove(path);
            LOG.info("Removing mailbox: {}", path);
            try {
                mapper.findMailboxByPath(path);
            } catch (MailboxNotFoundException e) {
View Full Code Here

     */
    private void testHasChildren() throws Exception {
        LOG.info("hasChildren");
        String oldName;
        for (MailboxPath path : pathsList) {
            final HBaseMailbox mailbox = new HBaseMailbox(path, 12455);
            oldName = mailbox.getName();
            if (path.getUser().equals("user3")) {
                mailbox.setName("test");
            }
            boolean result = mapper.hasChildren(mailbox, SEPARATOR);
            mailbox.setName(oldName);
            if (path.getUser().equals("user3")) {
                assertTrue(result);
            } else {
                assertFalse(result);
            }
View Full Code Here

                    } else {
                        name = "mailbox" + k;
                    }
                    path = new MailboxPath("namespace" + i, "user" + j, name);
                    pathsList.add(path);
                    mailboxList.add(new HBaseMailbox(path, 13));
                }
            }
        }
        LOG.info("Created test case with {} mailboxes and {} paths",
                mailboxList.size(), pathsList.size());
View Full Code Here

                    } else {
                        name = "mailbox" + k;
                    }
                    path = new MailboxPath("namespace" + i, "user" + j, name);
                    pathsList.add(path);
                    mailboxList.add(new HBaseMailbox(path, 13));
                }
            }
        }

        LOG.info("Created test case with {} mailboxes and {} paths", mailboxList.size(),
View Full Code Here

     */
    @Test
    public void testLastUid() throws Exception {
        LOG.info("lastUid");
        final MailboxPath path = new MailboxPath("gsoc", "ieugen", "Trash");
        final HBaseMailbox newBox = new HBaseMailbox(path, 1234);
        mapper.save(newBox);
        mailboxList.add(newBox);
        pathsList.add(path);

        final long result = uidProvider.lastUid(null, newBox);
View Full Code Here

     * Test of nextUid method, of class HBaseUidProvider.
     */
    @Test
    public void testNextUid() throws Exception {
        LOG.info("nextUid");
        final HBaseMailbox mailbox = mailboxList.get(mailboxList.size() / 2);
        final long lastUid = uidProvider.lastUid(null, mailbox);
        long result;
        for (int i = (int) lastUid + 1; i < (lastUid + 10); i++) {
            result = uidProvider.nextUid(null, mailbox);
            assertEquals(i, result);
View Full Code Here

TOP

Related Classes of org.apache.james.mailbox.hbase.mail.model.HBaseMailbox

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.