james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r591794 - in /james/server/trunk: experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/ experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/ imap-codec-library/src/main/...
Date Sun, 04 Nov 2007 16:02:37 GMT
Author: rdonkin
Date: Sun Nov  4 08:02:36 2007
New Revision: 591794

URL: http://svn.apache.org/viewvc?rev=591794&view=rev
Log:
Corrected encoding for INTERNALDATE. Added tests for RFC822.

Added:
    james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchInternalDate.test
    james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchRFC822.test
    james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchRFC822Header.test
    james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchRFC822Text.test
    james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/encode/EncoderUtils.java
    james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/encode/EncoderUtilsDateTimeLocaleTest.java
    james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/encode/EncoderUtilsTest.java
Modified:
    james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/AbstractTestFetch.java
    james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/FetchProcessor.java

Modified: james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/AbstractTestFetch.java
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/AbstractTestFetch.java?rev=591794&r1=591793&r2=591794&view=diff
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/AbstractTestFetch.java
(original)
+++ james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/AbstractTestFetch.java
Sun Nov  4 08:02:36 2007
@@ -34,7 +34,7 @@
     public void testFetchBodyNoSectionUS() throws Exception {
         scriptTest("FetchBodyNoSection", Locale.US);
     }
-    
+
     public void testFetchTextIT() throws Exception {
         scriptTest("FetchText", Locale.ITALY);
     }
@@ -42,7 +42,7 @@
     public void testFetchBodyNoSectionIT() throws Exception {
         scriptTest("FetchBodyNoSection", Locale.ITALY);
     }
-    
+
     public void testFetchTextKOREA() throws Exception {
         scriptTest("FetchText", Locale.KOREA);
     }
@@ -50,4 +50,52 @@
     public void testFetchBodyNoSectionKOREA() throws Exception {
         scriptTest("FetchBodyNoSection", Locale.KOREA);
     }
+
+    public void testFetchRFC822US() throws Exception {
+        scriptTest("FetchRFC822", Locale.US);
+    }
+
+    public void testFetchRFC822TextUS() throws Exception {
+        scriptTest("FetchRFC822Text", Locale.US);
+    }
+
+    public void testFetchRFC822HeaderUS() throws Exception {
+        scriptTest("FetchRFC822Header", Locale.US);
+    }
+
+    public void testFetchRFC822KOREA() throws Exception {
+        scriptTest("FetchRFC822", Locale.KOREA);
+    }
+
+    public void testFetchRFC822TextKOREA() throws Exception {
+        scriptTest("FetchRFC822Text", Locale.KOREA);
+    }
+
+    public void testFetchRFC822HeaderKOREA() throws Exception {
+        scriptTest("FetchRFC822Header", Locale.KOREA);
+    }
+
+    public void testFetchRFC822ITALY() throws Exception {
+        scriptTest("FetchRFC822", Locale.ITALY);
+    }
+
+    public void testFetchRFC822TextITALY() throws Exception {
+        scriptTest("FetchRFC822Text", Locale.ITALY);
+    }
+
+    public void testFetchRFC822HeaderITALY() throws Exception {
+        scriptTest("FetchRFC822Header", Locale.ITALY);
+    }
+    
+  public void testFetchInternalDateUS() throws Exception {
+      scriptTest("FetchInternalDate", Locale.US);
+  }  
+  
+  public void testFetchInternalDateITALY() throws Exception {
+      scriptTest("FetchInternalDate", Locale.ITALY);
+  } 
+  
+  public void testFetchInternalDateKOREA() throws Exception {
+      scriptTest("FetchInternalDate", Locale.KOREA);
+  } 
 }

Added: james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchInternalDate.test
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchInternalDate.test?rev=591794&view=auto
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchInternalDate.test
(added)
+++ james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchInternalDate.test
Sun Nov  4 08:02:36 2007
@@ -0,0 +1,45 @@
+################################################################
+# 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.                                           #
+################################################################
+
+C: A004 APPEND selected (\Seen) "17-Jul-1996 02:44:25 -0700" {310+}
+# use synchronising literal
+C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+C: From: Fred Foobar <foobar@Blurdybloop.COM>
+C: Subject: afternoon meeting 2
+C: To: mooch@owatagu.siam.edu
+C: Message-Id: <B27397-0100000@Blurdybloop.COM>
+C: MIME-Version: 1.0
+C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+C:
+C: Hello Joe, could we change that to 4:00pm tomorrow?
+C:
+S: \* 5 EXISTS
+S: \* 1 RECENT
+# TODO: this looks wrong to me
+S: \* 1 FETCH \(FLAGS \(\)\)
+S: \* 2 FETCH \(FLAGS \(\)\)
+S: \* 3 FETCH \(FLAGS \(\)\)
+S: \* 4 FETCH \(FLAGS \(\)\)
+S: A004 OK APPEND completed.
+
+C: F11 FETCH 5 INTERNALDATE
+S: \* 5 FETCH \(INTERNALDATE \"17-Jul-1996 09:44:25 \+0000\"\)
+# TODO: this looks wrong to me
+S: \* 5 FETCH \(FLAGS \(\)\)
+S: F11 OK FETCH completed.
\ No newline at end of file

Added: james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchRFC822.test
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchRFC822.test?rev=591794&view=auto
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchRFC822.test
(added)
+++ james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchRFC822.test
Sun Nov  4 08:02:36 2007
@@ -0,0 +1,35 @@
+################################################################
+# 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.                                           #
+################################################################
+# RFC822
+# Not PEEK, so the Seen flag is implicitly set.
+C: f1 FETCH 1 (RFC822)
+S: \* 1 FETCH \(FLAGS \(\\Seen\) RFC822 \{254\}
+S: Date: Mon, 7 Feb 1994 21:52:25 -0800 \(PST\)
+S: From: Fred Foobar <foobar@Blurdybloop\.COM>
+S: Subject: Test 01
+S: To: mooch@owatagu\.siam\.edu
+S: Message-Id: <B27397-0100000@Blurdybloop\.COM>
+S: MIME-Version: 1\.0
+S: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+S:
+S: Test 01
+S: \)
+# TODO: this is wrong - need to fix event model
+S: \* 1 FETCH \(FLAGS \(\\Seen\)\)
+S: f1 OK FETCH completed.

Added: james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchRFC822Header.test
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchRFC822Header.test?rev=591794&view=auto
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchRFC822Header.test
(added)
+++ james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchRFC822Header.test
Sun Nov  4 08:02:36 2007
@@ -0,0 +1,36 @@
+################################################################
+# 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.                                           #
+################################################################
+# RFC822
+# Not PEEK, so the Seen flag is implicitly set.
+C: f1 FETCH 1 (RFC822.HEADER)
+S: \* 1 FETCH \(RFC822.HEADER \{245\}
+S: Date: Mon, 7 Feb 1994 21:52:25 -0800 \(PST\)
+S: From: Fred Foobar <foobar@Blurdybloop\.COM>
+S: Subject: Test 01
+S: To: mooch@owatagu\.siam\.edu
+S: Message-Id: <B27397-0100000@Blurdybloop\.COM>
+S: MIME-Version: 1\.0
+S: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+S:
+S: \)
+#
+# TODO: this is not correct
+# This event should not be dispatched!
+S: \* 1 FETCH \(FLAGS \(\)\)
+S: f1 OK FETCH completed.

Added: james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchRFC822Text.test
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchRFC822Text.test?rev=591794&view=auto
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchRFC822Text.test
(added)
+++ james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/imap/scripts/FetchRFC822Text.test
Sun Nov  4 08:02:36 2007
@@ -0,0 +1,26 @@
+################################################################
+# 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.                                           #
+################################################################
+# RFC822.TEXT
+C: f1 FETCH 1 (RFC822.TEXT)
+S: \* 1 FETCH \(FLAGS \(\\Seen\) RFC822.TEXT \{9\}
+S: Test 01
+S: \)
+# TODO: this is wrong - need to fix event model
+S: \* 1 FETCH \(FLAGS \(\\Seen\)\)
+S: f1 OK FETCH completed.
\ No newline at end of file

Added: james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/encode/EncoderUtils.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/encode/EncoderUtils.java?rev=591794&view=auto
==============================================================================
--- james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/encode/EncoderUtils.java
(added)
+++ james/server/trunk/imap-codec-library/src/main/java/org/apache/james/imapserver/codec/encode/EncoderUtils.java
Sun Nov  4 08:02:36 2007
@@ -0,0 +1,46 @@
+/****************************************************************
+ * 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.james.imapserver.codec.encode;
+
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
+
+import org.apache.commons.lang.time.FastDateFormat;
+
+/**
+ * Utility methods for IMAP encoding.
+ */
+public class EncoderUtils {
+
+    /**
+     * Encodes a date in IMAP <code>date-time</code> format.
+     * @param date <code>Date</code>, not null
+     * @return encoded IMAP <code>date-time</code>, not null
+     */
+    public static String encodeDateTime(final Date date) {
+        final FastDateFormat format 
+            = FastDateFormat.getInstance("dd-MMM-yyyy HH:mm:ss Z", 
+                    TimeZone.getTimeZone("GMT"), 
+                    Locale.US);
+        final String result = format.format(date);
+        return result;
+    }
+}

Added: james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/encode/EncoderUtilsDateTimeLocaleTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/encode/EncoderUtilsDateTimeLocaleTest.java?rev=591794&view=auto
==============================================================================
--- james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/encode/EncoderUtilsDateTimeLocaleTest.java
(added)
+++ james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/encode/EncoderUtilsDateTimeLocaleTest.java
Sun Nov  4 08:02:36 2007
@@ -0,0 +1,104 @@
+/****************************************************************
+ * 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.james.imapserver.codec.encode;
+
+import java.util.Date;
+import java.util.Locale;
+import java.util.Random;
+
+import junit.framework.TestCase;
+
+public class EncoderUtilsDateTimeLocaleTest extends TestCase {
+
+    private static final Locale BASE_DEFAULT_LOCALE = Locale.getDefault();
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        Locale.setDefault(BASE_DEFAULT_LOCALE);
+    }
+
+    public void testUS() throws Exception {
+        runTests(Locale.US);
+    }
+    
+    public void testUK() throws Exception {
+        runTests(Locale.UK);
+    }
+    
+    public void testITALY() throws Exception {
+        runTests(Locale.ITALY);
+    }
+    
+    public void testGERMANY() throws Exception {
+        runTests(Locale.GERMANY);
+    }
+    
+    public void testFRANCE() throws Exception {
+        runTests(Locale.FRANCE);
+    }
+    
+    public void testCANADA() throws Exception {
+        runTests(Locale.CANADA);
+    }
+    
+    public void testCHINA() throws Exception {
+        runTests(Locale.CHINA);
+    }
+    
+    public void testJAPAN() throws Exception {
+        runTests(Locale.JAPAN);
+    }
+    
+    public void testKOREA() throws Exception {
+        runTests(Locale.KOREA);
+    }
+    
+    public void testTAIWAN() throws Exception {
+        runTests(Locale.TAIWAN);
+    }
+    
+    private void runTests(Locale locale) {
+        Locale.setDefault(locale);
+        runEncodeDateTime();
+    }
+    
+    private void runEncodeDateTime() {
+        assertEquals("03-Sep-2004 05:08:43 +0000", EncoderUtils.encodeDateTime(new Date(1094188123661L)));
+        assertEquals("10-Dec-2005 04:15:23 +0000", EncoderUtils.encodeDateTime(new Date(1134188123661L)));
+        assertEquals("11-Jul-2007 21:08:43 +0000", EncoderUtils.encodeDateTime(new Date(1184188123661L)));
+        assertEquals("04-Nov-2007 14:55:23 +0000", EncoderUtils.encodeDateTime(new Date(1194188123661L)));
+        assertEquals("31-Aug-2353 20:32:24 +0000", EncoderUtils.encodeDateTime(new Date(12107305944309L)));
+        assertEquals("03-Jan-2322 11:42:52 +0000", EncoderUtils.encodeDateTime(new Date(11108230972614L)));
+        assertEquals("30-Oct-2321 21:19:44 +0000", EncoderUtils.encodeDateTime(new Date(11102649584790L)));
+        assertEquals("30-Sep-2321 05:22:54 +0000", EncoderUtils.encodeDateTime(new Date(11100000174728L)));
+        assertEquals("08-Jun-2353 08:38:17 +0000", EncoderUtils.encodeDateTime(new Date(12100005497072L)));
+        assertEquals("14-Jun-2353 01:11:35 +0000", EncoderUtils.encodeDateTime(new Date(12100497095056L)));
+        assertEquals("13-Jul-2353 18:06:29 +0000", EncoderUtils.encodeDateTime(new Date(12103063589157L)));
+        assertEquals("05-Feb-2290 02:32:14 +0000", EncoderUtils.encodeDateTime(new Date(10101292334681L)));
+        assertEquals("20-Oct-2321 06:24:33 +0000", EncoderUtils.encodeDateTime(new Date(11101731873573L)));
+        assertEquals("31-Jan-2290 02:12:49 +0000", EncoderUtils.encodeDateTime(new Date(10100859169426L)));
+        
+    }
+
+}

Added: james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/encode/EncoderUtilsTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/encode/EncoderUtilsTest.java?rev=591794&view=auto
==============================================================================
--- james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/encode/EncoderUtilsTest.java
(added)
+++ james/server/trunk/imap-codec-library/src/test/java/org/apache/james/imapserver/codec/encode/EncoderUtilsTest.java
Sun Nov  4 08:02:36 2007
@@ -0,0 +1,55 @@
+/****************************************************************
+ * 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.james.imapserver.codec.encode;
+
+import java.util.Date;
+import java.util.Random;
+
+import junit.framework.TestCase;
+
+public class EncoderUtilsTest extends TestCase {
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testSimpleEncodeDateTime() {
+        assertEquals("03-Sep-2004 05:08:43 +0000", EncoderUtils.encodeDateTime(new Date(1094188123661L)));
+        assertEquals("10-Dec-2005 04:15:23 +0000", EncoderUtils.encodeDateTime(new Date(1134188123661L)));
+        assertEquals("11-Jul-2007 21:08:43 +0000", EncoderUtils.encodeDateTime(new Date(1184188123661L)));
+        assertEquals("04-Nov-2007 14:55:23 +0000", EncoderUtils.encodeDateTime(new Date(1194188123661L)));
+        assertEquals("31-Aug-2353 20:32:24 +0000", EncoderUtils.encodeDateTime(new Date(12107305944309L)));
+        assertEquals("03-Jan-2322 11:42:52 +0000", EncoderUtils.encodeDateTime(new Date(11108230972614L)));
+        assertEquals("30-Oct-2321 21:19:44 +0000", EncoderUtils.encodeDateTime(new Date(11102649584790L)));
+        assertEquals("30-Sep-2321 05:22:54 +0000", EncoderUtils.encodeDateTime(new Date(11100000174728L)));
+        assertEquals("08-Jun-2353 08:38:17 +0000", EncoderUtils.encodeDateTime(new Date(12100005497072L)));
+        assertEquals("14-Jun-2353 01:11:35 +0000", EncoderUtils.encodeDateTime(new Date(12100497095056L)));
+        assertEquals("13-Jul-2353 18:06:29 +0000", EncoderUtils.encodeDateTime(new Date(12103063589157L)));
+        assertEquals("05-Feb-2290 02:32:14 +0000", EncoderUtils.encodeDateTime(new Date(10101292334681L)));
+        assertEquals("20-Oct-2321 06:24:33 +0000", EncoderUtils.encodeDateTime(new Date(11101731873573L)));
+        assertEquals("31-Jan-2290 02:12:49 +0000", EncoderUtils.encodeDateTime(new Date(10100859169426L)));
+        
+    }
+
+}

Modified: james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/FetchProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/FetchProcessor.java?rev=591794&r1=591793&r2=591794&view=diff
==============================================================================
--- james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/FetchProcessor.java
(original)
+++ james/server/trunk/imap-mailbox-processor-function/src/main/java/org/apache/james/imapserver/processor/imap4rev1/FetchProcessor.java
Sun Nov  4 08:02:36 2007
@@ -45,6 +45,7 @@
 import org.apache.james.core.MimeMessageWrapper;
 import org.apache.james.imap.message.request.imap4rev1.FetchRequest;
 import org.apache.james.imap.message.response.imap4rev1.legacy.FetchResponse;
+import org.apache.james.imapserver.codec.encode.EncoderUtils;
 import org.apache.james.imapserver.processor.base.AbstractImapRequestProcessor;
 import org.apache.james.imapserver.processor.base.AuthorizationException;
 import org.apache.james.imapserver.processor.base.ImapSessionUtils;
@@ -198,7 +199,7 @@
             if (fetch.isInternalDate()) {
                 response.append(" INTERNALDATE \"");
                 // TODO format properly
-                response.append(RFC822DateFormat.toString(result
+                response.append(EncoderUtils.encodeDateTime(result
                         .getInternalDate())); // not right format
                 response.append("\"");
 
@@ -329,20 +330,7 @@
         }
 
     }
-
-    private void addLiteral(byte[] bytes, StringBuffer response) {
-        response.append('{');
-        response.append(bytes.length); // TODO JD addLiteral: why was it
-                                        // bytes.length +1 here?
-        response.append('}');
-        response.append("\r\n");
-
-        for (int i = 0; i < bytes.length; i++) {
-            byte b = bytes[i];
-            response.append((char) b);
-        }
-    }
-
+    
     private void addLiteralContent(final MessageResult.Content content, final StringBuffer
response) throws MessagingException {
         response.append('{' );
         final long length = content.size();



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message