/** * 测试下载多封附件. * * @throws MessagingException */ @Test public void testDlAttachments() throws MessagingException { PropertiesDeploy propertiesDeploy = new PropertiesDeploy(); propertiesDeploy.init(); WebAccount account = new WebAccount(); setWebAccount(type, account); Clickoo_message message = new MessageService().selectMessageById(Long.parseLong(mid)); new PropertiesDeploy().init(); EmailCacheObject emailCache = EmailCacheManager.get(mid); if (emailCache == null) { emailCache = new EmailCacheObject(); } new DLEMailSupport() .dlMail(emailCache, Constant.DOWNLOAD_ALL_ATT, message, account, null, "2", mid); }
/** * 测试下载正文. * * @throws MessagingException */ @Test public void testDlBody() throws MessagingException { System.out.println(EmailCacheManager.removeEmail(mid)); PropertiesDeploy propertiesDeploy = new PropertiesDeploy(); propertiesDeploy.init(); WebAccount account = new WebAccount(); setWebAccount(type, account); Clickoo_message message = new MessageService().selectMessageById(Long.parseLong(mid)); Body body = (Body) new DLEMailSupport() .dlMail(null, Constant.DOWNLOAD_BODY, message, account, null, null, mid); System.out.println(body); }
static { JSONObject json = JSONObject.fromObject(PropertiesDeploy.getConfigureMap().get(Constant.OTHERS_HOST_NAME)); othersPooledExecutor.setKeepAliveTime( Integer.parseInt(json.getString(Constant.KEEP_ALIVE_TIME))); othersPooledExecutor.createThreads(Integer.parseInt(json.getString(Constant.CREATE_SIZE))); othersPooledExecutor.setMinimumPoolSize( Integer.parseInt(json.getString(Constant.MIN_POOL_SIZE))); othersPooledExecutor.setMaximumPoolSize( Integer.parseInt(json.getString(Constant.MAX_POOL_SIZE))); othersPooledExecutor.abortWhenBlocked(); }
/** * 测试下载整封邮件. * * @throws MessagingException */ @Test public void testDlEmail() throws MessagingException { PropertiesDeploy propertiesDeploy = new PropertiesDeploy(); propertiesDeploy.init(); WebAccount account = new WebAccount(); setWebAccount(type, account); Clickoo_message message = new MessageService().selectMessageById(Long.parseLong(mid)); new PropertiesDeploy().init(); EmailCacheObject emailCache = EmailCacheManager.get(mid); if (emailCache == null) { emailCache = new EmailCacheObject(); } else if (emailCache.getData() != null) { emailCache.setData(null); emailCache.setData_size(0); } Email email = (Email) new DLEMailSupport() .dlMail(emailCache, Constant.DOWNLOAD_EMAIL, message, account, null, "2", mid); System.out.println(email.getFrom()); // System.out.println(email.getBody()); System.out.println(email.getAttachList().size()); }
/** * 测试下载单封附件. * * @throws MessagingException */ @Test public void testDlAttachment() throws MessagingException { System.out.println(EmailCacheManager.removeEmail(mid)); PropertiesDeploy propertiesDeploy = new PropertiesDeploy(); propertiesDeploy.init(); WebAccount account = new WebAccount(); setWebAccount(type, account); // Clickoo_message message = new MessageService().selectMessageById(Long.parseLong(mid)); new PropertiesDeploy().init(); WebEmail webEmail = new WebEmail(); WebEmailhead header = new WebEmailhead(); header.setMessageId(mid); webEmail.setHead(header); WebEmailattachment attach = new WebEmailattachment(); attach.setName("373_193_test"); attach.setSize(166736); attach.setType("txt"); attach.setIsdown("0"); webEmail.setAttach(new WebEmailattachment[] {attach}); // Clickoo_message_attachment a = (Clickoo_message_attachment) new // DLEMailSupport().dlMail(null, Constant.DOWNLOAD_ATT, message, account, webEmail, "2", mid); // System.out.println(a.getIn()); }