# # Copyright (c) 2002, Marc Schiereck # # You may use and distribute under the terms of either the GNU Lesser # General Public License, either version 2 of the license or, # at your choice, any later version. Alternatively, you may use and # distribute under the terms of the XPL. # # See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of # the licenses. # # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the README # file for more details. # import StringIO import string import gzz import java mail1f = "From kanonensau@gmx.net Wed Oct 16 00:15:44 2002\n" mail1 = """Return-path: Envelope-to: mschiereck@taihoubuta Delivery-date: Wed, 16 Oct 2002 00:15:44 +0200 Received: from mschiereck by taihoubuta with local (Exim 3.35 #1 (Debian)) id 181ZyV-0003pD-00 for ; Wed, 16 Oct 2002 00:15:39 +0200 Date: Wed, 16 Oct 2002 00:15:35 +0200 To: Marc Schiereck Subject: TestMail Message-ID: <20021015221535.GB13515@taihoubuta> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i From: Marc Schiereck Status: RO Content-Length: 10 Lines: 1 TestMail. """ mail2f = "From kanonensau@gmx.net Wed Oct 16 00:17:32 2002\n" mail2 = """Return-path: Envelope-to: mschiereck@taihoubuta Delivery-date: Wed, 16 Oct 2002 00:17:32 +0200 Received: from mschiereck by taihoubuta with local (Exim 3.35 #1 (Debian)) id 181a0G-0003pY-00 for ; Wed, 16 Oct 2002 00:17:28 +0200 Date: Wed, 16 Oct 2002 00:17:24 +0200 To: Marc Schiereck Subject: TestMail 2 Message-ID: <20021015221724.GC13515@taihoubuta> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i From: Marc Schiereck Status: RO Content-Length: 51 Lines: 3 test test test test test test test test test test """ mail3f = "From kanonensau@gmx.net Wed Oct 16 00:19:04 2002\n" mail3 = """Return-path: Envelope-to: mschiereck@taihoubuta Delivery-date: Wed, 16 Oct 2002 00:19:04 +0200 Received: from mschiereck by taihoubuta with local (Exim 3.35 #1 (Debian)) id 181a1l-0003pz-00 for ; Wed, 16 Oct 2002 00:19:01 +0200 Date: Wed, 16 Oct 2002 00:18:57 +0200 To: Marc Schiereck Subject: Test Message-ID: <20021015221857.GD13515@taihoubuta> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="n8g4imXOkfNTN/H1" Content-Disposition: inline User-Agent: Mutt/1.3.28i From: Marc Schiereck Status: RO Content-Length: 1633 Lines: 59 --n8g4imXOkfNTN/H1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Text --n8g4imXOkfNTN/H1 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=testmbox >From kanonensau@gmx.net Wed Oct 16 00:15:44 2002 Return-path: Envelope-to: mschiereck@taihoubuta Delivery-date: Wed, 16 Oct 2002 00:15:44 +0200 Received: from mschiereck by taihoubuta with local (Exim 3.35 #1 (Debian)) id 181ZyV-0003pD-00 for ; Wed, 16 Oct 2002 00:15:39 +0200 Date: Wed, 16 Oct 2002 00:15:35 +0200 To: Marc Schiereck Subject: TestMail Message-ID: <20021015221535.GB13515@taihoubuta> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i From: Marc Schiereck Status: RO Content-Length: 10 Lines: 1 TestMail. >From kanonensau@gmx.net Wed Oct 16 00:17:32 2002 Return-path: Envelope-to: mschiereck@taihoubuta Delivery-date: Wed, 16 Oct 2002 00:17:32 +0200 Received: from mschiereck by taihoubuta with local (Exim 3.35 #1 (Debian)) id 181a0G-0003pY-00 for ; Wed, 16 Oct 2002 00:17:28 +0200 Date: Wed, 16 Oct 2002 00:17:24 +0200 To: Marc Schiereck Subject: TestMail 2 Message-ID: <20021015221724.GC13515@taihoubuta> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i From: Marc Schiereck Status: RO Content-Length: 51 Lines: 3 test test test test test test test test test test --n8g4imXOkfNTN/H1-- """ def testConverter(): """Test mailbox converter""" mbox = mail1f + mail1 + mail2f + mail2 + mail3f + mail3 mboxfile = StringIO.StringIO(mbox) medServ = gzz.mediaserver.SimpleMediaserver( gzz.mediaserver.storage.TransientStorer()) gzz.modules.email.converter.storeMailbox(mboxfile, medServ) mailIDs = medServ.getIDs() if mailIDs.size() != 3: raise java.lang.Error() m1 = m2 = m3 = 0 for mail in mailIDs.iterator(): tmail = java.lang.String(medServ.getDatum(mail).getBytes()) if tmail.equals(mail1): m1 = 1 if tmail.equals(mail2): m2 = 1 if tmail.equals(mail3): m3 = 1 if not (m1 and m2 and m3): raise java.lang.Error()