You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by do...@apache.org on 2013/08/22 17:29:58 UTC
svn commit: r1516486 [4/4] - in /james/hupa/trunk: ./ client/
client/src/main/java/org/apache/hupa/
client/src/main/java/org/apache/hupa/client/
client/src/main/java/org/apache/hupa/client/activity/
client/src/main/java/org/apache/hupa/client/ioc/ clie...
Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java?rev=1516486&r1=1516485&r2=1516486&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java Thu Aug 22 15:29:57 2013
@@ -34,20 +34,16 @@ import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.mail.Address;
import javax.mail.BodyPart;
-import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.Part;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeUtility;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.logging.Log;
-import org.apache.hupa.shared.data.MessageAttachmentImpl;
-import org.apache.hupa.shared.domain.MessageAttachment;
@@ -124,104 +120,6 @@ public class MessageUtils {
}
return ret;
}
-
- /**
- * Handle the parts of the given message. The method will call itself
- * recursively to handle all nested parts
- *
- * @param message the MimeMessage
- * @param content the current processing Content
- * @param sbPlain the StringBuffer to fill with text
- * @param attachmentList ArrayList with attachments
- * @throws UnsupportedEncodingException
- * @throws MessagingException
- * @throws IOException
- */
- public static boolean handleParts(Message message, Object content, StringBuffer sbPlain,
- ArrayList<MessageAttachment> attachmentList) throws UnsupportedEncodingException, MessagingException,
- IOException {
- boolean isHTML = false;
- if (content instanceof String) {
- if (message.getContentType().toLowerCase().startsWith("text/html")) {
- isHTML = true;
- } else {
- isHTML = false;
- }
- sbPlain.append((String) content);
-
- } else if (content instanceof Multipart) {
-
- Multipart mp = (Multipart) content;
- String multipartContentType = mp.getContentType().toLowerCase();
-
- String text = null;
-
- if (multipartContentType.startsWith("multipart/alternative")) {
- isHTML = handleMultiPartAlternative(mp, sbPlain);
- } else {
- for (int i = 0; i < mp.getCount(); i++) {
- Part part = mp.getBodyPart(i);
-
- String contentType = part.getContentType().toLowerCase();
-
- Boolean bodyRead = sbPlain.length() > 0;
-
- if (!bodyRead && contentType.startsWith("text/plain")) {
- isHTML = false;
- text = (String) part.getContent();
- } else if (!bodyRead && contentType.startsWith("text/html")) {
- isHTML = true;
- text = (String) part.getContent();
- } else if (!bodyRead && contentType.startsWith("message/rfc822")) {
- // Extract the message and pass it
- MimeMessage msg = (MimeMessage) part.getDataHandler().getContent();
- isHTML = handleParts(msg, msg.getContent(), sbPlain, attachmentList);
- } else {
- if (part.getFileName() != null) {
- // Inline images are not added to the attachment
- // list
- // TODO: improve the in-line images detection
- if (part.getHeader("Content-ID") == null) {
- MessageAttachment attachment = new MessageAttachmentImpl();
- attachment.setName(MimeUtility.decodeText(part.getFileName()));
- attachment.setContentType(part.getContentType());
- attachment.setSize(part.getSize());
- attachmentList.add(attachment);
- }
- } else {
- isHTML = handleParts(message, part.getContent(), sbPlain, attachmentList);
- }
- }
-
- }
- if (text != null)
- sbPlain.append(text);
- }
-
- }
- return isHTML;
- }
-
- private static boolean handleMultiPartAlternative(Multipart mp, StringBuffer sbPlain) throws MessagingException, IOException {
- String text = null;
- boolean isHTML = false;
- for (int i = 0; i < mp.getCount(); i++) {
- Part part = mp.getBodyPart(i);
-
- String contentType = part.getContentType().toLowerCase();
-
- // we prefer html
- if (text == null && contentType.startsWith("text/plain")) {
- isHTML = false;
- text = (String) part.getContent();
- } else if (contentType.startsWith("text/html")) {
- isHTML = true;
- text = (String) part.getContent();
- }
- }
- sbPlain.append(text);
- return isHTML;
- }
/**
* Loop over MuliPart and write the content to the Outputstream if a
Added: james/hupa/trunk/server/src/test/java/com/chiaramail/hupa/helper/EcsUtilityTest.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/com/chiaramail/hupa/helper/EcsUtilityTest.java?rev=1516486&view=auto
==============================================================================
--- james/hupa/trunk/server/src/test/java/com/chiaramail/hupa/helper/EcsUtilityTest.java (added)
+++ james/hupa/trunk/server/src/test/java/com/chiaramail/hupa/helper/EcsUtilityTest.java Thu Aug 22 15:29:57 2013
@@ -0,0 +1,194 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package com.chiaramail.hupa.helper;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Session;
+
+import junit.framework.Assert;
+
+import org.apache.hupa.server.InMemoryIMAPStoreCache;
+import org.apache.hupa.server.guice.providers.JavaMailSessionProvider;
+import org.apache.hupa.server.mock.MockIMAPStore;
+import org.apache.hupa.server.mock.MockLog;
+import org.apache.hupa.shared.data.UserImpl;
+import org.apache.hupa.shared.domain.User;
+import org.junit.Test;
+
+import com.sun.mail.imap.IMAPFolder;
+import com.sun.mail.imap.IMAPStore;
+
+public class EcsUtilityTest {
+
+ static final String imapServer = "imap.gmail.com";
+ static final int imapPort = 993;
+ static final boolean isSSl = true;
+ static final String truststore = "";
+ static final String truststorePassword = "";
+
+ static final String imapUser = "mcdodot@gmail.com";
+ static final String imapPass = "5233manuel";
+
+ static final String ecsUser = "mcdodot@gmail.com";
+ static final String ecsPass = "PNP*8M*!";
+
+ static final String testKey = "92210546391265182698995644151691";
+ static final String testCryptedText = "ta9WViD2NGlGXbMwiCwz5czVzq+4inQl2RCBFjLOs/rCIbPg1lLcemKaEYRwlxKHajbBi+jKJy6NHd/4Kw6diHLhQ/QVs2C9lTz2toV8SAabr1+sKwGXVqOqtyJLACIP0Hu5Jo7E6t0y3muJGVXgq5leA41kd2z/g9ViXXyuXwCSNImcsA4QFxBm+i/9DAACqrwi3uUR9wbVSOkAfHjEwT3Qpr/O8ClH/82miMsgusq/NcoRFx5TAgf0UFbTZ2mUGbMNFFcD/ZBkzEiDOUlwRlyfP+cYAFJWuXp8W6GAFsE=";
+
+
+ Session session = Session.getDefaultInstance(new Properties(), null);
+ static InMemoryIMAPStoreCache cache = new InMemoryIMAPStoreCache(new MockLog(), imapServer, imapPort, isSSl, 2, 60000, false,
+ truststore, truststorePassword, new JavaMailSessionProvider().get());
+
+ static User user = new UserImpl() {
+ {setName(imapUser); setPassword(imapPass);}
+ };
+
+ static Account ecsAccount = new Account() {
+ {email = ecsUser; password = ecsPass;}
+ };
+
+ @Test
+ public void testEncryptDecrypt() throws Exception {
+ String clear = "Hello world";
+ String key = Utility.generateEncryptionKey();
+ String b64Encrypted = Utility.encrypt(key.getBytes(), clear.getBytes());
+ byte[] encrypted = Utility.base64DecodeToBytes(b64Encrypted);
+ byte[] result = Utility.decrypt(key.getBytes(), encrypted);
+ Assert.assertEquals(clear, new String(result));
+ }
+
+ @Test
+ public void testDecryptEcsData() throws Exception {
+ byte[] encrypted = Utility.base64DecodeToBytes(testCryptedText);
+ byte[] result = Utility.decrypt(testKey.getBytes(), encrypted);
+ Assert.assertEquals(215, result.length);
+ Assert.assertTrue(new String(result).contains("Manolo"));
+ }
+
+ @Test
+ public void testIsUserRegistered() throws Exception {
+ Assert.assertEquals("true", Utility.isUserRegistered(ecsAccount, ecsAccount.email));
+ }
+
+ @Test
+ public void testFetchContent() throws Exception {
+
+ IMAPStore store = getStore(true);
+ List<Message> messages = getAllEcsMessagesInInbox(store);
+
+ Assert.assertTrue(messages.size() > 0);
+
+ for (Message m : messages) {
+ // Important: Remove RealName part from the email since ECS server understands just the sender email address
+ String fromEmail = m.getFrom()[0].toString().replaceFirst("^.*<(.*)>.*$", "$1").trim();
+
+ String[] tmp = m.getHeader(Utility.CONTENT_SERVER_NAME);
+ String serverName = tmp != null && tmp.length > 0 ? tmp[0] : Utility.DEFAULT_CONTENT_SERVER_NAME;
+
+ tmp = m.getHeader(Utility.CONTENT_SERVER_PORT);
+ String serverPort = tmp != null && tmp.length > 0 ? tmp[0] : Utility.DEFAULT_CONTENT_SERVER_PORT;
+
+ tmp = m.getHeader(Utility.ENCRYPTION_KEY);
+ String key = tmp != null && tmp.length > 0 ? tmp[0] : null;
+
+ tmp = m.getHeader(Utility.CONTENT_POINTER);
+ String pointer = tmp != null && tmp.length > 0 ? tmp[0] : "";
+ String[] pointers = pointer.split("\\s+");
+
+ // Getting just the content using utility method in Utility class
+ System.out.println("+++ Fetching Content for Message: " + fromEmail + " " + pointer + " " + key);
+ String s = Utility.fetchBodyContent(m, ecsAccount, pointers, serverName, serverPort, key);
+ Assert.assertNotNull(s);
+ // System.out.println(s);
+
+ // Demonstration of how to get body and attachments using directly the askServer method
+
+
+
+ for (int i = 0; i < pointers.length; i++) {
+ String[] responseLines = Utility.askServer(
+ "https://" + serverName + ":" + serverPort + Utility.CONTENT_SERVER_APP,
+ Utility.FETCH_CONTENT + Utility.BLANK + fromEmail + Utility.BLANK + pointers[i],
+ ecsAccount.getEmail(), Utility.base64Encode(ecsAccount.getPassword()),
+ i > 0, fromEmail + "_" + pointers[0] + "_" + pointers[i] + ".ecs", key);
+
+ Assert.assertEquals("3", responseLines[0]);
+ // System.out.println("++ Ecs server Response for part: " + i + " " + pointers[i]);
+ // for (String t : responseLines) {
+ // System.out.println(t);
+ //}
+ }
+ }
+ }
+
+ private List<Message> getAllEcsMessagesInInbox(IMAPStore store) throws MessagingException, IOException {
+
+ String folder = store instanceof MockIMAPStore ? MockIMAPStore.MOCK_INBOX_FOLDER : "INBOX";
+
+ final IMAPFolder imapFolder = (IMAPFolder) store.getFolder(folder);
+ imapFolder.open(IMAPFolder.READ_WRITE);
+
+ // Get all Messages in folder (light-weight references)
+ // Warning: if you run the test with a real IMAP account you could have thousands of messages.
+ int count = imapFolder.getMessageCount();
+ Message[] messages = imapFolder.getMessages(1, count);
+
+ // Filter all messages to return only valid ECS messages
+ List<Message> ret = new ArrayList<Message>();
+ for (Message m : messages) {
+ if (Utility.validateHeaders(m)) {
+ ret.add(m);
+ }
+ }
+ return ret;
+ }
+
+ // Create a new imap store connection (mock or real)
+ private IMAPStore getStore(boolean mock) throws Exception {
+ IMAPStore store = null;
+ if (mock) {
+ store = new MockIMAPStore(session);
+ } else {
+ // Configure session
+ session.setDebug(false);
+ Properties props = session.getProperties();
+ props.setProperty("mail.mime.decodetext.strict", "false");
+ props.setProperty("mail.imap.connectionpoolsize", 2 + "");
+ props.setProperty("mail.imap.connectionpooltimeout", 30000 + "");
+ props.setProperty("mail.imaps.connectionpoolsize", 2 + "");
+ props.setProperty("mail.imaps.connectionpooltimeout", 30000 + "");
+ System.setProperty("mail.mime.decodetext.strict", "false");
+ // Create the imap connection
+ store = (IMAPStore)session.getStore(isSSl ? "imaps" : "imap");
+ store.connect(imapServer, imapPort, imapUser, imapPass);
+ }
+ return store;
+ }
+}
Modified: james/hupa/trunk/server/src/test/java/org/apache/hupa/server/HupaGuiceTestCase.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/HupaGuiceTestCase.java?rev=1516486&r1=1516485&r2=1516486&view=diff
==============================================================================
--- james/hupa/trunk/server/src/test/java/org/apache/hupa/server/HupaGuiceTestCase.java (original)
+++ james/hupa/trunk/server/src/test/java/org/apache/hupa/server/HupaGuiceTestCase.java Thu Aug 22 15:29:57 2013
@@ -1,112 +1,112 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.hupa.server;
-
-import javax.mail.Session;
-import javax.servlet.http.HttpSession;
-
-import org.apache.commons.logging.Log;
-import org.apache.hupa.server.guice.GuiceServerTestModule;
-import org.apache.hupa.server.preferences.UserPreferencesStorage;
-import org.apache.hupa.server.service.CreateFolderService;
-import org.apache.hupa.server.service.CreateFolderServiceImpl;
-import org.apache.hupa.server.service.DeleteFolderService;
-import org.apache.hupa.server.service.DeleteFolderServiceImpl;
-import org.apache.hupa.server.service.DeleteMessageByUidService;
-import org.apache.hupa.server.service.DeleteMessageByUidServiceImpl;
-import org.apache.hupa.server.service.FetchFoldersService;
-import org.apache.hupa.server.service.FetchFoldersServiceImpl;
-import org.apache.hupa.server.service.FetchMessagesService;
-import org.apache.hupa.server.service.FetchMessagesServiceImpl;
-import org.apache.hupa.server.service.GetMessageDetailsServiceImpl;
-import org.apache.hupa.server.service.IdleService;
-import org.apache.hupa.server.service.IdleServiceImpl;
-import org.apache.hupa.server.service.LoginUserService;
-import org.apache.hupa.server.service.LoginUserServiceImpl;
-import org.apache.hupa.server.service.LogoutUserService;
-import org.apache.hupa.server.service.LogoutUserServiceImpl;
-import org.apache.hupa.server.service.SendReplyMessageServiceImpl;
-import org.apache.hupa.server.utils.SessionUtils;
-import org.apache.hupa.shared.SConsts;
-import org.apache.hupa.shared.domain.User;
-import org.junit.Before;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-import com.sun.mail.imap.IMAPStore;
-
-public class HupaGuiceTestCase{
-
- protected Injector injector = Guice.createInjector(getModules());
-
- protected CreateFolderService createFolderService;
- protected FetchFoldersService fetchFoldersService;
- protected FetchMessagesService fetchMessagesService;
- protected DeleteFolderService deleteFolderService;
- protected DeleteMessageByUidService deleteMessageByUidService;
- protected GetMessageDetailsServiceImpl getMessageDetailsService;
- protected IdleService idleService;
- protected LoginUserService loginUserService;
- protected LogoutUserService logoutUserService;
- protected SendReplyMessageServiceImpl sendReplyMessageService;
-
- protected Log logger;
- protected IMAPStoreCache storeCache;
- protected User testUser;
- protected UserPreferencesStorage userPreferences;
- protected IMAPStore store;
- protected HttpSession httpSession;
- protected Session session;
- protected Module[] getModules() {
- return new Module[]{new GuiceServerTestModule()};
- }
-
-
- @Before
- public void setUp(){
-
- try {
- createFolderService = injector.getInstance(CreateFolderServiceImpl.class);
- fetchFoldersService = injector.getInstance(FetchFoldersServiceImpl.class);
- fetchMessagesService = injector.getInstance(FetchMessagesServiceImpl.class);
- deleteFolderService = injector.getInstance(DeleteFolderServiceImpl.class);
- deleteMessageByUidService = injector.getInstance(DeleteMessageByUidServiceImpl.class);
- getMessageDetailsService = injector.getInstance(GetMessageDetailsServiceImpl.class);
- idleService = injector.getInstance(IdleServiceImpl.class);
- loginUserService = injector.getInstance(LoginUserServiceImpl.class);
- logoutUserService = injector.getInstance(LogoutUserServiceImpl.class);
- sendReplyMessageService = injector.getInstance(SendReplyMessageServiceImpl.class);
-
- logger = injector.getInstance(Log.class);
- session = injector.getInstance(Session.class);
- storeCache = injector.getInstance(IMAPStoreCache.class);
- userPreferences = injector.getInstance(UserPreferencesStorage.class);
-
- httpSession = injector.getInstance(HttpSession.class);
- SessionUtils.cleanSessionAttributes(httpSession);
- testUser = injector.getInstance(User.class);
- store = storeCache.get(testUser);
- httpSession.setAttribute(SConsts.USER_SESS_ATTR, testUser);
- }catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.hupa.server;
+
+import javax.mail.Session;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.logging.Log;
+import org.apache.hupa.server.guice.GuiceServerTestModule;
+import org.apache.hupa.server.preferences.UserPreferencesStorage;
+import org.apache.hupa.server.service.CreateFolderService;
+import org.apache.hupa.server.service.CreateFolderServiceImpl;
+import org.apache.hupa.server.service.DeleteFolderService;
+import org.apache.hupa.server.service.DeleteFolderServiceImpl;
+import org.apache.hupa.server.service.DeleteMessageByUidService;
+import org.apache.hupa.server.service.DeleteMessageByUidServiceImpl;
+import org.apache.hupa.server.service.FetchFoldersService;
+import org.apache.hupa.server.service.FetchFoldersServiceImpl;
+import org.apache.hupa.server.service.FetchMessagesService;
+import org.apache.hupa.server.service.FetchMessagesServiceImpl;
+import org.apache.hupa.server.service.GetMessageDetailsServiceImpl;
+import org.apache.hupa.server.service.IdleService;
+import org.apache.hupa.server.service.IdleServiceImpl;
+import org.apache.hupa.server.service.LoginUserService;
+import org.apache.hupa.server.service.LoginUserServiceImpl;
+import org.apache.hupa.server.service.LogoutUserService;
+import org.apache.hupa.server.service.LogoutUserServiceImpl;
+import org.apache.hupa.server.service.SendReplyMessageServiceImpl;
+import org.apache.hupa.server.utils.SessionUtils;
+import org.apache.hupa.shared.SConsts;
+import org.apache.hupa.shared.domain.User;
+import org.junit.Before;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+import com.sun.mail.imap.IMAPStore;
+
+public class HupaGuiceTestCase{
+
+ protected Injector injector = Guice.createInjector(getModules());
+
+ protected CreateFolderService createFolderService;
+ protected FetchFoldersService fetchFoldersService;
+ protected FetchMessagesService fetchMessagesService;
+ protected DeleteFolderService deleteFolderService;
+ protected DeleteMessageByUidService deleteMessageByUidService;
+ protected GetMessageDetailsServiceImpl getMessageDetailsService;
+ protected IdleService idleService;
+ protected LoginUserService loginUserService;
+ protected LogoutUserService logoutUserService;
+ protected SendReplyMessageServiceImpl sendReplyMessageService;
+
+ protected Log logger;
+ protected IMAPStoreCache storeCache;
+ protected User testUser;
+ protected UserPreferencesStorage userPreferences;
+ protected IMAPStore store;
+ protected HttpSession httpSession;
+ protected Session session;
+ protected Module[] getModules() {
+ return new Module[]{new GuiceServerTestModule()};
+ }
+
+
+ @Before
+ public void setUp(){
+
+ try {
+ createFolderService = injector.getInstance(CreateFolderServiceImpl.class);
+ fetchFoldersService = injector.getInstance(FetchFoldersServiceImpl.class);
+ fetchMessagesService = injector.getInstance(FetchMessagesServiceImpl.class);
+ deleteFolderService = injector.getInstance(DeleteFolderServiceImpl.class);
+ deleteMessageByUidService = injector.getInstance(DeleteMessageByUidServiceImpl.class);
+ getMessageDetailsService = injector.getInstance(GetMessageDetailsServiceImpl.class);
+ idleService = injector.getInstance(IdleServiceImpl.class);
+ loginUserService = injector.getInstance(LoginUserServiceImpl.class);
+ logoutUserService = injector.getInstance(LogoutUserServiceImpl.class);
+ sendReplyMessageService = injector.getInstance(SendReplyMessageServiceImpl.class);
+
+ logger = injector.getInstance(Log.class);
+ session = injector.getInstance(Session.class);
+ storeCache = injector.getInstance(IMAPStoreCache.class);
+ userPreferences = injector.getInstance(UserPreferencesStorage.class);
+
+ httpSession = injector.getInstance(HttpSession.class);
+ SessionUtils.cleanSessionAttributes(httpSession);
+ testUser = injector.getInstance(User.class);
+ store = storeCache.get(testUser);
+ httpSession.setAttribute(SConsts.USER_SESS_ATTR, testUser);
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
Modified: james/hupa/trunk/server/src/test/java/org/apache/hupa/server/utils/RegexPatternsTest.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/utils/RegexPatternsTest.java?rev=1516486&r1=1516485&r2=1516486&view=diff
==============================================================================
--- james/hupa/trunk/server/src/test/java/org/apache/hupa/server/utils/RegexPatternsTest.java (original)
+++ james/hupa/trunk/server/src/test/java/org/apache/hupa/server/utils/RegexPatternsTest.java Thu Aug 22 15:29:57 2013
@@ -53,7 +53,7 @@ public class RegexPatternsTest extends T
String txt, res;
txt = ".. <img\nsrc=\"cid:abcd\"\nwhatever=/>click</a\n> ..";
res = RegexPatterns.replaceAll(txt, RegexPatterns.regex_inlineImg, RegexPatterns.repl_inlineImg);
- assertEquals(".. <img\nsrc='hupa/downloadAttachmentServlet?mode=inline&folder=%%FOLDER%%&uid=%%UID%%&name=abcd' name='cid:abcd'\nwhatever=/>click</a\n> ..", res);
+ assertEquals(".. <img\nsrc='hupa/downloadAttachmentServlet?folder=%%FOLDER%%&uid=%%UID%%&name=abcd' name='cid:abcd'\nwhatever=/>click</a\n> ..", res);
}
public void testRegexRestoreInlineLinks() {
Modified: james/hupa/trunk/shared/pom.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/shared/pom.xml?rev=1516486&r1=1516485&r2=1516486&view=diff
==============================================================================
--- james/hupa/trunk/shared/pom.xml (original)
+++ james/hupa/trunk/shared/pom.xml Thu Aug 22 15:29:57 2013
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.james.hupa</groupId>
<artifactId>hupa-parent</artifactId>
- <version>0.0.5-SNAPSHOT</version>
+ <version>0.0.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>hupa-shared</artifactId>
Modified: james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/MoveMessageEvent.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/MoveMessageEvent.java?rev=1516486&r1=1516485&r2=1516486&view=diff
==============================================================================
--- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/MoveMessageEvent.java (original)
+++ james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/MoveMessageEvent.java Thu Aug 22 15:29:57 2013
@@ -41,15 +41,11 @@ public class MoveMessageEvent extends Gw
this.message = message;
}
-<<<<<<< HEAD
- public User getUser() {
-=======
public MoveMessageEvent(ImapFolder newFolder) {
this.newFolder = newFolder;
}
public User getUser() {
->>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
return user;
}
Modified: james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java?rev=1516486&r1=1516485&r2=1516486&view=diff
==============================================================================
--- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java (original)
+++ james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java Thu Aug 22 15:29:57 2013
@@ -1,29 +1,29 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.hupa.shared.exception;
-
-public class InvalidSessionException extends HupaException{
-
- private static final long serialVersionUID = 995112620968798947L;
-
- public InvalidSessionException(String message) {
- super(message);
- }
-}
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.hupa.shared.exception;
+
+public class InvalidSessionException extends HupaException{
+
+ private static final long serialVersionUID = 995112620968798947L;
+
+ public InvalidSessionException(String message) {
+ super(message);
+ }
+}
Modified: james/hupa/trunk/widgets/pom.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/pom.xml?rev=1516486&r1=1516485&r2=1516486&view=diff
==============================================================================
--- james/hupa/trunk/widgets/pom.xml (original)
+++ james/hupa/trunk/widgets/pom.xml Thu Aug 22 15:29:57 2013
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.james.hupa</groupId>
<artifactId>hupa-parent</artifactId>
- <version>0.0.5-SNAPSHOT</version>
+ <version>0.0.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>hupa-widgets</artifactId>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org