Package com.alibaba.citrus.service.mail.session

Examples of com.alibaba.citrus.service.mail.session.MailStore


     * ȡ��ָ�����Ƶ�mail store��
     */
    public MailStore getMailStore(String id, Properties overrideProps) throws MailStoreNotFoundException {
        id = assertNotNull(trimToNull(id), "no mailStore id");

        MailStore store = mailStores.get(id);

        if (store == null) {
            throw new MailStoreNotFoundException("Could not find mail store: " + id);
        }

        // ���ظ���
        return new MailStore(store, overrideProps);
    }
View Full Code Here


        // set null
        mailService.setMailStores(null);

        // reset stores
        Map<String, MailStore> stores = createHashMap();
        stores.put("store1", new MailStore());
        stores.put("store2", new MailStore());
        mailService.setMailStores(stores);

        assertNotNull(mailService.getMailStore("store1"));
        assertNotNull(mailService.getMailStore("store2"));

        stores = createHashMap();
        stores.put("store3", new MailStore());
        stores.put("store4", new MailStore());
        mailService.setMailStores(stores);

        try {
            mailService.getMailStore("store1");
            fail();
View Full Code Here

    @Test
    public void getStore() {
        MailServiceImpl mailService = new MailServiceImpl();

        Map<String, MailStore> stores = createHashMap();
        stores.put("store1", new MailStore());
        mailService.setMailStores(stores);

        // id is null
        try {
            mailService.getMailStore((String) null);
            fail();
        } catch (IllegalArgumentException e) {
            assertThat(e, exception("no mailStore id"));
        }

        // clone
        MailStore store = mailService.getMailStore("store1");

        assertNotNull(store);
        assertNotSame(store, mailService.getMailStore("store1"));
    }
View Full Code Here

    public void getDefaultStore() {
        MailServiceImpl mailService = new MailServiceImpl();

        // 1 store
        Map<String, MailStore> stores = createHashMap();
        stores.put("store1", new MailStore());
        mailService.setMailStores(stores);

        assertNotNull(mailService.getMailStore()); // the only store is the default store

        // 2 stores
        stores.put("store2", new MailStore());
        mailService.setMailStores(stores);

        try {
            mailService.getMailStore();
            fail();
        } catch (MailStoreNotFoundException e) {
            assertThat(e, exception("Could not find mail store: _DEFAULT_"));
        }

        // with default store
        MailStore store3 = new MailStore();
        store3.setDefault(true);
        stores.put("store3", store3);
        mailService.setMailStores(stores);

        assertNotNull(mailService.getMailStore());
        assertNotNull(mailService.getMailStore("store3"));

        // 2 default stores
        MailStore store4 = new MailStore();
        store4.setDefault(true);
        stores.put("store4", store4);

        try {
            mailService.setMailStores(stores);
            fail();
View Full Code Here

        // set null
        mailService.setMailStores(null);

        // reset stores
        Map<String, MailStore> stores = createHashMap();
        stores.put("store1", new MailStore());
        stores.put("store2", new MailStore());
        mailService.setMailStores(stores);

        assertNotNull(mailService.getMailStore("store1"));
        assertNotNull(mailService.getMailStore("store2"));

        stores = createHashMap();
        stores.put("store3", new MailStore());
        stores.put("store4", new MailStore());
        mailService.setMailStores(stores);

        try {
            mailService.getMailStore("store1");
            fail();
View Full Code Here

    @Test
    public void getStore() {
        MailServiceImpl mailService = new MailServiceImpl();

        Map<String, MailStore> stores = createHashMap();
        stores.put("store1", new MailStore());
        mailService.setMailStores(stores);

        // id is null
        try {
            mailService.getMailStore((String) null);
            fail();
        } catch (IllegalArgumentException e) {
            assertThat(e, exception("no mailStore id"));
        }

        // clone
        MailStore store = mailService.getMailStore("store1");

        assertNotNull(store);
        assertNotSame(store, mailService.getMailStore("store1"));
    }
View Full Code Here

    public void getDefaultStore() {
        MailServiceImpl mailService = new MailServiceImpl();

        // 1 store
        Map<String, MailStore> stores = createHashMap();
        stores.put("store1", new MailStore());
        mailService.setMailStores(stores);

        assertNotNull(mailService.getMailStore()); // the only store is the default store

        // 2 stores
        stores.put("store2", new MailStore());
        mailService.setMailStores(stores);

        try {
            mailService.getMailStore();
            fail();
        } catch (MailStoreNotFoundException e) {
            assertThat(e, exception("Could not find mail store: _DEFAULT_"));
        }

        // with default store
        MailStore store3 = new MailStore();
        store3.setDefault(true);
        stores.put("store3", store3);
        mailService.setMailStores(stores);

        assertNotNull(mailService.getMailStore());
        assertNotNull(mailService.getMailStore("store3"));

        // 2 default stores
        MailStore store4 = new MailStore();
        store4.setDefault(true);
        stores.put("store4", store4);

        try {
            mailService.setMailStores(stores);
            fail();
View Full Code Here

    /** 取得指定名称的mail store。 */
    public MailStore getMailStore(String id, Properties overrideProps) throws MailStoreNotFoundException {
        id = assertNotNull(trimToNull(id), "no mailStore id");

        MailStore store = mailStores.get(id);

        if (store == null) {
            throw new MailStoreNotFoundException("Could not find mail store: " + id);
        }

        // 返回复本
        return new MailStore(store, overrideProps);
    }
View Full Code Here

     * ȡ��ָ�����Ƶ�mail store��
     */
    public MailStore getMailStore(String id, Properties overrideProps) throws MailStoreNotFoundException {
        id = assertNotNull(trimToNull(id), "no mailStore id");

        MailStore store = mailStores.get(id);

        if (store == null) {
            throw new MailStoreNotFoundException("Could not find mail store: " + id);
        }

        // ���ظ���
        return new MailStore(store, overrideProps);
    }
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.service.mail.session.MailStore

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.