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 rd...@apache.org on 2008/09/18 23:45:03 UTC
svn commit: r696828 [31/32] - in /james/protocols/imap/trunk:
api/src/main/java/org/apache/james/api/imap/
api/src/main/java/org/apache/james/api/imap/display/
api/src/main/java/org/apache/james/api/imap/imap4rev1/
api/src/main/java/org/apache/james/ap...
Modified: james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MailboxmanagerMapInit.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MailboxmanagerMapInit.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MailboxmanagerMapInit.java (original)
+++ james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MailboxmanagerMapInit.java Thu Sep 18 14:44:56 2008
@@ -3,22 +3,25 @@
import org.apache.torque.TorqueException;
/**
- * This is a Torque Generated class that is used to load all database map
- * information at once. This is useful because Torque's default behaviour
- * is to do a "lazy" load of mapping information, e.g. loading it only
- * when it is needed.<p>
- *
- * @see org.apache.torque.map.DatabaseMap#initialize() DatabaseMap.initialize()
+ * This is a Torque Generated class that is used to load all database map
+ * information at once. This is useful because Torque's default behaviour is to
+ * do a "lazy" load of mapping information, e.g. loading it only when it is
+ * needed.
+ * <p>
+ *
+ * @see org.apache.torque.map.DatabaseMap#initialize() DatabaseMap.initialize()
*/
-public class MailboxmanagerMapInit
-{
- public static final void init()
- throws TorqueException
- {
- org.apache.james.mailboxmanager.torque.om.MailboxRowPeer.getMapBuilder();
- org.apache.james.mailboxmanager.torque.om.MessageRowPeer.getMapBuilder();
- org.apache.james.mailboxmanager.torque.om.MessageFlagsPeer.getMapBuilder();
- org.apache.james.mailboxmanager.torque.om.MessageHeaderPeer.getMapBuilder();
- org.apache.james.mailboxmanager.torque.om.MessageBodyPeer.getMapBuilder();
+public class MailboxmanagerMapInit {
+ public static final void init() throws TorqueException {
+ org.apache.james.mailboxmanager.torque.om.MailboxRowPeer
+ .getMapBuilder();
+ org.apache.james.mailboxmanager.torque.om.MessageRowPeer
+ .getMapBuilder();
+ org.apache.james.mailboxmanager.torque.om.MessageFlagsPeer
+ .getMapBuilder();
+ org.apache.james.mailboxmanager.torque.om.MessageHeaderPeer
+ .getMapBuilder();
+ org.apache.james.mailboxmanager.torque.om.MessageBodyPeer
+ .getMapBuilder();
}
}
Modified: james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageBodyMapBuilder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageBodyMapBuilder.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageBodyMapBuilder.java (original)
+++ james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageBodyMapBuilder.java Thu Sep 18 14:44:56 2008
@@ -8,18 +8,16 @@
import org.apache.torque.map.TableMap;
/**
- * This class was autogenerated by Torque on:
- *
- * [Sun Dec 09 17:45:09 GMT 2007]
- *
- */
-public class MessageBodyMapBuilder implements MapBuilder
-{
+ * This class was autogenerated by Torque on:
+ *
+ * [Sun Dec 09 17:45:09 GMT 2007]
+ *
+ */
+public class MessageBodyMapBuilder implements MapBuilder {
/**
* The name of this class
*/
- public static final String CLASS_NAME =
- "org.apache.james.mailboxmanager.torque.om.map.MessageBodyMapBuilder";
+ public static final String CLASS_NAME = "org.apache.james.mailboxmanager.torque.om.map.MessageBodyMapBuilder";
/**
* The database map.
@@ -27,34 +25,31 @@
private DatabaseMap dbMap = null;
/**
- * Tells us if this DatabaseMapBuilder is built so that we
- * don't have to re-build it every time.
- *
+ * Tells us if this DatabaseMapBuilder is built so that we don't have to
+ * re-build it every time.
+ *
* @return true if this DatabaseMapBuilder is built
*/
- public boolean isBuilt()
- {
+ public boolean isBuilt() {
return (dbMap != null);
}
/**
* Gets the databasemap this map builder built.
- *
+ *
* @return the databasemap
*/
- public DatabaseMap getDatabaseMap()
- {
+ public DatabaseMap getDatabaseMap() {
return this.dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
- *
+ *
* @throws TorqueException
*/
- public synchronized void doBuild() throws TorqueException
- {
- if ( isBuilt() ) {
+ public synchronized void doBuild() throws TorqueException {
+ if (isBuilt()) {
return;
}
dbMap = Torque.getDatabaseMap("mailboxmanager");
@@ -62,57 +57,58 @@
dbMap.addTable("message_body");
TableMap tMap = dbMap.getTable("message_body");
tMap.setJavaName("MessageBody");
- tMap.setOMClass( org.apache.james.mailboxmanager.torque.om.MessageBody.class );
- tMap.setPeerClass( org.apache.james.mailboxmanager.torque.om.MessageBodyPeer.class );
+ tMap
+ .setOMClass(org.apache.james.mailboxmanager.torque.om.MessageBody.class);
+ tMap
+ .setPeerClass(org.apache.james.mailboxmanager.torque.om.MessageBodyPeer.class);
tMap.setPrimaryKeyMethod("none");
ColumnMap cMap = null;
-
- // ------------- Column: mailbox_id --------------------
- cMap = new ColumnMap( "mailbox_id", tMap);
- cMap.setType( new Long(0) );
- cMap.setTorqueType( "BIGINT" );
+ // ------------- Column: mailbox_id --------------------
+ cMap = new ColumnMap("mailbox_id", tMap);
+ cMap.setType(new Long(0));
+ cMap.setTorqueType("BIGINT");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(true);
cMap.setNotNull(true);
- cMap.setJavaName( "MailboxId" );
+ cMap.setJavaName("MailboxId");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("Mailbox Id");
- cMap.setInheritance("false");
- cMap.setForeignKey("message", "mailbox_id");
- cMap.setPosition(1);
- tMap.addColumn(cMap);
- // ------------- Column: uid --------------------
- cMap = new ColumnMap( "uid", tMap);
- cMap.setType( new Long(0) );
- cMap.setTorqueType( "BIGINT" );
+ cMap.setDescription("Mailbox Id");
+ cMap.setInheritance("false");
+ cMap.setForeignKey("message", "mailbox_id");
+ cMap.setPosition(1);
+ tMap.addColumn(cMap);
+ // ------------- Column: uid --------------------
+ cMap = new ColumnMap("uid", tMap);
+ cMap.setType(new Long(0));
+ cMap.setTorqueType("BIGINT");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(true);
cMap.setNotNull(true);
- cMap.setJavaName( "Uid" );
+ cMap.setJavaName("Uid");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("");
- cMap.setInheritance("false");
- cMap.setForeignKey("message", "uid");
- cMap.setPosition(2);
- tMap.addColumn(cMap);
- // ------------- Column: body --------------------
- cMap = new ColumnMap( "body", tMap);
- cMap.setType( new Object() );
- cMap.setTorqueType( "BLOB" );
+ cMap.setDescription("");
+ cMap.setInheritance("false");
+ cMap.setForeignKey("message", "uid");
+ cMap.setPosition(2);
+ tMap.addColumn(cMap);
+ // ------------- Column: body --------------------
+ cMap = new ColumnMap("body", tMap);
+ cMap.setType(new Object());
+ cMap.setTorqueType("BLOB");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(false);
cMap.setNotNull(true);
- cMap.setJavaName( "Body" );
+ cMap.setJavaName("Body");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("value");
- cMap.setInheritance("false");
- cMap.setPosition(3);
- tMap.addColumn(cMap);
+ cMap.setDescription("value");
+ cMap.setInheritance("false");
+ cMap.setPosition(3);
+ tMap.addColumn(cMap);
tMap.setUseInheritance(false);
}
}
Modified: james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageFlagsMapBuilder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageFlagsMapBuilder.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageFlagsMapBuilder.java (original)
+++ james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageFlagsMapBuilder.java Thu Sep 18 14:44:56 2008
@@ -8,18 +8,16 @@
import org.apache.torque.map.TableMap;
/**
- * This class was autogenerated by Torque on:
- *
- * [Sun Dec 09 17:45:09 GMT 2007]
- *
- */
-public class MessageFlagsMapBuilder implements MapBuilder
-{
+ * This class was autogenerated by Torque on:
+ *
+ * [Sun Dec 09 17:45:09 GMT 2007]
+ *
+ */
+public class MessageFlagsMapBuilder implements MapBuilder {
/**
* The name of this class
*/
- public static final String CLASS_NAME =
- "org.apache.james.mailboxmanager.torque.om.map.MessageFlagsMapBuilder";
+ public static final String CLASS_NAME = "org.apache.james.mailboxmanager.torque.om.map.MessageFlagsMapBuilder";
/**
* The database map.
@@ -27,34 +25,31 @@
private DatabaseMap dbMap = null;
/**
- * Tells us if this DatabaseMapBuilder is built so that we
- * don't have to re-build it every time.
- *
+ * Tells us if this DatabaseMapBuilder is built so that we don't have to
+ * re-build it every time.
+ *
* @return true if this DatabaseMapBuilder is built
*/
- public boolean isBuilt()
- {
+ public boolean isBuilt() {
return (dbMap != null);
}
/**
* Gets the databasemap this map builder built.
- *
+ *
* @return the databasemap
*/
- public DatabaseMap getDatabaseMap()
- {
+ public DatabaseMap getDatabaseMap() {
return this.dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
- *
+ *
* @throws TorqueException
*/
- public synchronized void doBuild() throws TorqueException
- {
- if ( isBuilt() ) {
+ public synchronized void doBuild() throws TorqueException {
+ if (isBuilt()) {
return;
}
dbMap = Torque.getDatabaseMap("mailboxmanager");
@@ -62,133 +57,134 @@
dbMap.addTable("message_flags");
TableMap tMap = dbMap.getTable("message_flags");
tMap.setJavaName("MessageFlags");
- tMap.setOMClass( org.apache.james.mailboxmanager.torque.om.MessageFlags.class );
- tMap.setPeerClass( org.apache.james.mailboxmanager.torque.om.MessageFlagsPeer.class );
+ tMap
+ .setOMClass(org.apache.james.mailboxmanager.torque.om.MessageFlags.class);
+ tMap
+ .setPeerClass(org.apache.james.mailboxmanager.torque.om.MessageFlagsPeer.class);
tMap.setPrimaryKeyMethod("none");
ColumnMap cMap = null;
-
- // ------------- Column: mailbox_id --------------------
- cMap = new ColumnMap( "mailbox_id", tMap);
- cMap.setType( new Long(0) );
- cMap.setTorqueType( "BIGINT" );
+ // ------------- Column: mailbox_id --------------------
+ cMap = new ColumnMap("mailbox_id", tMap);
+ cMap.setType(new Long(0));
+ cMap.setTorqueType("BIGINT");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(true);
cMap.setNotNull(true);
- cMap.setJavaName( "MailboxId" );
+ cMap.setJavaName("MailboxId");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("Mailbox Id");
- cMap.setInheritance("false");
- cMap.setForeignKey("message", "mailbox_id");
- cMap.setPosition(1);
- tMap.addColumn(cMap);
- // ------------- Column: uid --------------------
- cMap = new ColumnMap( "uid", tMap);
- cMap.setType( new Long(0) );
- cMap.setTorqueType( "BIGINT" );
+ cMap.setDescription("Mailbox Id");
+ cMap.setInheritance("false");
+ cMap.setForeignKey("message", "mailbox_id");
+ cMap.setPosition(1);
+ tMap.addColumn(cMap);
+ // ------------- Column: uid --------------------
+ cMap = new ColumnMap("uid", tMap);
+ cMap.setType(new Long(0));
+ cMap.setTorqueType("BIGINT");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(true);
cMap.setNotNull(true);
- cMap.setJavaName( "Uid" );
+ cMap.setJavaName("Uid");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("");
- cMap.setInheritance("false");
- cMap.setForeignKey("message", "uid");
- cMap.setPosition(2);
- tMap.addColumn(cMap);
- // ------------- Column: answered --------------------
- cMap = new ColumnMap( "answered", tMap);
- cMap.setType( new Integer(0) );
- cMap.setTorqueType( "BOOLEANINT" );
+ cMap.setDescription("");
+ cMap.setInheritance("false");
+ cMap.setForeignKey("message", "uid");
+ cMap.setPosition(2);
+ tMap.addColumn(cMap);
+ // ------------- Column: answered --------------------
+ cMap = new ColumnMap("answered", tMap);
+ cMap.setType(new Integer(0));
+ cMap.setTorqueType("BOOLEANINT");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(false);
cMap.setNotNull(true);
- cMap.setJavaName( "Answered" );
+ cMap.setJavaName("Answered");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("");
- cMap.setDefault("0");
- cMap.setInheritance("false");
- cMap.setPosition(3);
- tMap.addColumn(cMap);
- // ------------- Column: deleted --------------------
- cMap = new ColumnMap( "deleted", tMap);
- cMap.setType( new Integer(0) );
- cMap.setTorqueType( "BOOLEANINT" );
+ cMap.setDescription("");
+ cMap.setDefault("0");
+ cMap.setInheritance("false");
+ cMap.setPosition(3);
+ tMap.addColumn(cMap);
+ // ------------- Column: deleted --------------------
+ cMap = new ColumnMap("deleted", tMap);
+ cMap.setType(new Integer(0));
+ cMap.setTorqueType("BOOLEANINT");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(false);
cMap.setNotNull(true);
- cMap.setJavaName( "Deleted" );
+ cMap.setJavaName("Deleted");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("");
- cMap.setDefault("0");
- cMap.setInheritance("false");
- cMap.setPosition(4);
- tMap.addColumn(cMap);
- // ------------- Column: draft --------------------
- cMap = new ColumnMap( "draft", tMap);
- cMap.setType( new Integer(0) );
- cMap.setTorqueType( "BOOLEANINT" );
+ cMap.setDescription("");
+ cMap.setDefault("0");
+ cMap.setInheritance("false");
+ cMap.setPosition(4);
+ tMap.addColumn(cMap);
+ // ------------- Column: draft --------------------
+ cMap = new ColumnMap("draft", tMap);
+ cMap.setType(new Integer(0));
+ cMap.setTorqueType("BOOLEANINT");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(false);
cMap.setNotNull(true);
- cMap.setJavaName( "Draft" );
+ cMap.setJavaName("Draft");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("");
- cMap.setDefault("0");
- cMap.setInheritance("false");
- cMap.setPosition(5);
- tMap.addColumn(cMap);
- // ------------- Column: flagged --------------------
- cMap = new ColumnMap( "flagged", tMap);
- cMap.setType( new Integer(0) );
- cMap.setTorqueType( "BOOLEANINT" );
+ cMap.setDescription("");
+ cMap.setDefault("0");
+ cMap.setInheritance("false");
+ cMap.setPosition(5);
+ tMap.addColumn(cMap);
+ // ------------- Column: flagged --------------------
+ cMap = new ColumnMap("flagged", tMap);
+ cMap.setType(new Integer(0));
+ cMap.setTorqueType("BOOLEANINT");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(false);
cMap.setNotNull(true);
- cMap.setJavaName( "Flagged" );
+ cMap.setJavaName("Flagged");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("");
- cMap.setDefault("0");
- cMap.setInheritance("false");
- cMap.setPosition(6);
- tMap.addColumn(cMap);
- // ------------- Column: recent --------------------
- cMap = new ColumnMap( "recent", tMap);
- cMap.setType( new Integer(0) );
- cMap.setTorqueType( "BOOLEANINT" );
+ cMap.setDescription("");
+ cMap.setDefault("0");
+ cMap.setInheritance("false");
+ cMap.setPosition(6);
+ tMap.addColumn(cMap);
+ // ------------- Column: recent --------------------
+ cMap = new ColumnMap("recent", tMap);
+ cMap.setType(new Integer(0));
+ cMap.setTorqueType("BOOLEANINT");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(false);
cMap.setNotNull(true);
- cMap.setJavaName( "Recent" );
+ cMap.setJavaName("Recent");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("");
- cMap.setDefault("0");
- cMap.setInheritance("false");
- cMap.setPosition(7);
- tMap.addColumn(cMap);
- // ------------- Column: seen --------------------
- cMap = new ColumnMap( "seen", tMap);
- cMap.setType( new Integer(0) );
- cMap.setTorqueType( "BOOLEANINT" );
+ cMap.setDescription("");
+ cMap.setDefault("0");
+ cMap.setInheritance("false");
+ cMap.setPosition(7);
+ tMap.addColumn(cMap);
+ // ------------- Column: seen --------------------
+ cMap = new ColumnMap("seen", tMap);
+ cMap.setType(new Integer(0));
+ cMap.setTorqueType("BOOLEANINT");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(false);
cMap.setNotNull(true);
- cMap.setJavaName( "Seen" );
+ cMap.setJavaName("Seen");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("");
- cMap.setDefault("0");
- cMap.setInheritance("false");
- cMap.setPosition(8);
- tMap.addColumn(cMap);
+ cMap.setDescription("");
+ cMap.setDefault("0");
+ cMap.setInheritance("false");
+ cMap.setPosition(8);
+ tMap.addColumn(cMap);
tMap.setUseInheritance(false);
}
}
Modified: james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageHeaderMapBuilder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageHeaderMapBuilder.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageHeaderMapBuilder.java (original)
+++ james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageHeaderMapBuilder.java Thu Sep 18 14:44:56 2008
@@ -8,18 +8,16 @@
import org.apache.torque.map.TableMap;
/**
- * This class was autogenerated by Torque on:
- *
- * [Sun Dec 09 17:45:09 GMT 2007]
- *
- */
-public class MessageHeaderMapBuilder implements MapBuilder
-{
+ * This class was autogenerated by Torque on:
+ *
+ * [Sun Dec 09 17:45:09 GMT 2007]
+ *
+ */
+public class MessageHeaderMapBuilder implements MapBuilder {
/**
* The name of this class
*/
- public static final String CLASS_NAME =
- "org.apache.james.mailboxmanager.torque.om.map.MessageHeaderMapBuilder";
+ public static final String CLASS_NAME = "org.apache.james.mailboxmanager.torque.om.map.MessageHeaderMapBuilder";
/**
* The database map.
@@ -27,34 +25,31 @@
private DatabaseMap dbMap = null;
/**
- * Tells us if this DatabaseMapBuilder is built so that we
- * don't have to re-build it every time.
- *
+ * Tells us if this DatabaseMapBuilder is built so that we don't have to
+ * re-build it every time.
+ *
* @return true if this DatabaseMapBuilder is built
*/
- public boolean isBuilt()
- {
+ public boolean isBuilt() {
return (dbMap != null);
}
/**
* Gets the databasemap this map builder built.
- *
+ *
* @return the databasemap
*/
- public DatabaseMap getDatabaseMap()
- {
+ public DatabaseMap getDatabaseMap() {
return this.dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
- *
+ *
* @throws TorqueException
*/
- public synchronized void doBuild() throws TorqueException
- {
- if ( isBuilt() ) {
+ public synchronized void doBuild() throws TorqueException {
+ if (isBuilt()) {
return;
}
dbMap = Torque.getDatabaseMap("mailboxmanager");
@@ -62,87 +57,88 @@
dbMap.addTable("message_header");
TableMap tMap = dbMap.getTable("message_header");
tMap.setJavaName("MessageHeader");
- tMap.setOMClass( org.apache.james.mailboxmanager.torque.om.MessageHeader.class );
- tMap.setPeerClass( org.apache.james.mailboxmanager.torque.om.MessageHeaderPeer.class );
+ tMap
+ .setOMClass(org.apache.james.mailboxmanager.torque.om.MessageHeader.class);
+ tMap
+ .setPeerClass(org.apache.james.mailboxmanager.torque.om.MessageHeaderPeer.class);
tMap.setPrimaryKeyMethod("none");
ColumnMap cMap = null;
-
- // ------------- Column: mailbox_id --------------------
- cMap = new ColumnMap( "mailbox_id", tMap);
- cMap.setType( new Long(0) );
- cMap.setTorqueType( "BIGINT" );
+ // ------------- Column: mailbox_id --------------------
+ cMap = new ColumnMap("mailbox_id", tMap);
+ cMap.setType(new Long(0));
+ cMap.setTorqueType("BIGINT");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(true);
cMap.setNotNull(true);
- cMap.setJavaName( "MailboxId" );
+ cMap.setJavaName("MailboxId");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("Mailbox Id");
- cMap.setInheritance("false");
- cMap.setForeignKey("message", "mailbox_id");
- cMap.setPosition(1);
- tMap.addColumn(cMap);
- // ------------- Column: uid --------------------
- cMap = new ColumnMap( "uid", tMap);
- cMap.setType( new Long(0) );
- cMap.setTorqueType( "BIGINT" );
+ cMap.setDescription("Mailbox Id");
+ cMap.setInheritance("false");
+ cMap.setForeignKey("message", "mailbox_id");
+ cMap.setPosition(1);
+ tMap.addColumn(cMap);
+ // ------------- Column: uid --------------------
+ cMap = new ColumnMap("uid", tMap);
+ cMap.setType(new Long(0));
+ cMap.setTorqueType("BIGINT");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(true);
cMap.setNotNull(true);
- cMap.setJavaName( "Uid" );
+ cMap.setJavaName("Uid");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("");
- cMap.setInheritance("false");
- cMap.setForeignKey("message", "uid");
- cMap.setPosition(2);
- tMap.addColumn(cMap);
- // ------------- Column: line_number --------------------
- cMap = new ColumnMap( "line_number", tMap);
- cMap.setType( new Integer(0) );
- cMap.setTorqueType( "INTEGER" );
+ cMap.setDescription("");
+ cMap.setInheritance("false");
+ cMap.setForeignKey("message", "uid");
+ cMap.setPosition(2);
+ tMap.addColumn(cMap);
+ // ------------- Column: line_number --------------------
+ cMap = new ColumnMap("line_number", tMap);
+ cMap.setType(new Integer(0));
+ cMap.setTorqueType("INTEGER");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(true);
cMap.setNotNull(true);
- cMap.setJavaName( "LineNumber" );
+ cMap.setJavaName("LineNumber");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("");
- cMap.setInheritance("false");
- cMap.setPosition(3);
- tMap.addColumn(cMap);
- // ------------- Column: field --------------------
- cMap = new ColumnMap( "field", tMap);
- cMap.setType( "" );
- cMap.setTorqueType( "VARCHAR" );
+ cMap.setDescription("");
+ cMap.setInheritance("false");
+ cMap.setPosition(3);
+ tMap.addColumn(cMap);
+ // ------------- Column: field --------------------
+ cMap = new ColumnMap("field", tMap);
+ cMap.setType("");
+ cMap.setTorqueType("VARCHAR");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(false);
cMap.setNotNull(true);
- cMap.setJavaName( "Field" );
+ cMap.setJavaName("Field");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("field");
- cMap.setInheritance("false");
- cMap.setSize( 256 );
- cMap.setPosition(4);
- tMap.addColumn(cMap);
- // ------------- Column: value --------------------
- cMap = new ColumnMap( "value", tMap);
- cMap.setType( "" );
- cMap.setTorqueType( "VARCHAR" );
+ cMap.setDescription("field");
+ cMap.setInheritance("false");
+ cMap.setSize(256);
+ cMap.setPosition(4);
+ tMap.addColumn(cMap);
+ // ------------- Column: value --------------------
+ cMap = new ColumnMap("value", tMap);
+ cMap.setType("");
+ cMap.setTorqueType("VARCHAR");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(false);
cMap.setNotNull(true);
- cMap.setJavaName( "Value" );
+ cMap.setJavaName("Value");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("value");
- cMap.setInheritance("false");
- cMap.setSize( 1024 );
- cMap.setPosition(5);
- tMap.addColumn(cMap);
+ cMap.setDescription("value");
+ cMap.setInheritance("false");
+ cMap.setSize(1024);
+ cMap.setPosition(5);
+ tMap.addColumn(cMap);
tMap.setUseInheritance(false);
}
}
Modified: james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageMapBuilder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageMapBuilder.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageMapBuilder.java (original)
+++ james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageMapBuilder.java Thu Sep 18 14:44:56 2008
@@ -9,18 +9,16 @@
import org.apache.torque.map.TableMap;
/**
- * This class was autogenerated by Torque on:
- *
- * [Wed Sep 06 08:50:08 CEST 2006]
- *
- */
-public class MessageMapBuilder implements MapBuilder
-{
+ * This class was autogenerated by Torque on:
+ *
+ * [Wed Sep 06 08:50:08 CEST 2006]
+ *
+ */
+public class MessageMapBuilder implements MapBuilder {
/**
* The name of this class
*/
- public static final String CLASS_NAME =
- "org.apache.james.mailboxmanager.torque.om.map.MessageMapBuilder";
+ public static final String CLASS_NAME = "org.apache.james.mailboxmanager.torque.om.map.MessageMapBuilder";
/**
* The database map.
@@ -28,33 +26,30 @@
private DatabaseMap dbMap = null;
/**
- * Tells us if this DatabaseMapBuilder is built so that we
- * don't have to re-build it every time.
- *
+ * Tells us if this DatabaseMapBuilder is built so that we don't have to
+ * re-build it every time.
+ *
* @return true if this DatabaseMapBuilder is built
*/
- public boolean isBuilt()
- {
+ public boolean isBuilt() {
return (dbMap != null);
}
/**
* Gets the databasemap this map builder built.
- *
+ *
* @return the databasemap
*/
- public DatabaseMap getDatabaseMap()
- {
+ public DatabaseMap getDatabaseMap() {
return this.dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
- *
+ *
* @throws TorqueException
*/
- public void doBuild() throws TorqueException
- {
+ public void doBuild() throws TorqueException {
dbMap = Torque.getDatabaseMap("mailboxmanager");
dbMap.addTable("message");
@@ -62,12 +57,10 @@
tMap.setPrimaryKeyMethod("none");
-
- tMap.addForeignPrimaryKey(
- "message.MAILBOX_ID", new Long(0) , "mailbox" ,
+ tMap.addForeignPrimaryKey("message.MAILBOX_ID", new Long(0), "mailbox",
"mailbox_id");
- tMap.addPrimaryKey("message.UID", new Long(0) );
- tMap.addColumn("message.FLAGS", new Integer(0) );
- tMap.addColumn("message.INTERNAL_DATE", new Date() );
- }
+ tMap.addPrimaryKey("message.UID", new Long(0));
+ tMap.addColumn("message.FLAGS", new Integer(0));
+ tMap.addColumn("message.INTERNAL_DATE", new Date());
+ }
}
Modified: james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageRowMapBuilder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageRowMapBuilder.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageRowMapBuilder.java (original)
+++ james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/om/map/MessageRowMapBuilder.java Thu Sep 18 14:44:56 2008
@@ -11,19 +11,17 @@
/**
*
- *
- * This class was autogenerated by Torque on:
- *
- * [Sun Dec 09 17:45:09 GMT 2007]
- *
- */
-public class MessageRowMapBuilder implements MapBuilder
-{
+ *
+ * This class was autogenerated by Torque on:
+ *
+ * [Sun Dec 09 17:45:09 GMT 2007]
+ *
+ */
+public class MessageRowMapBuilder implements MapBuilder {
/**
* The name of this class
*/
- public static final String CLASS_NAME =
- "org.apache.james.mailboxmanager.torque.om.map.MessageRowMapBuilder";
+ public static final String CLASS_NAME = "org.apache.james.mailboxmanager.torque.om.map.MessageRowMapBuilder";
/**
* The database map.
@@ -31,34 +29,31 @@
private DatabaseMap dbMap = null;
/**
- * Tells us if this DatabaseMapBuilder is built so that we
- * don't have to re-build it every time.
- *
+ * Tells us if this DatabaseMapBuilder is built so that we don't have to
+ * re-build it every time.
+ *
* @return true if this DatabaseMapBuilder is built
*/
- public boolean isBuilt()
- {
+ public boolean isBuilt() {
return (dbMap != null);
}
/**
* Gets the databasemap this map builder built.
- *
+ *
* @return the databasemap
*/
- public DatabaseMap getDatabaseMap()
- {
+ public DatabaseMap getDatabaseMap() {
return this.dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
- *
+ *
* @throws TorqueException
*/
- public synchronized void doBuild() throws TorqueException
- {
- if ( isBuilt() ) {
+ public synchronized void doBuild() throws TorqueException {
+ if (isBuilt()) {
return;
}
dbMap = Torque.getDatabaseMap("mailboxmanager");
@@ -66,71 +61,72 @@
dbMap.addTable("message");
TableMap tMap = dbMap.getTable("message");
tMap.setJavaName("MessageRow");
- tMap.setOMClass( org.apache.james.mailboxmanager.torque.om.MessageRow.class );
- tMap.setPeerClass( org.apache.james.mailboxmanager.torque.om.MessageRowPeer.class );
+ tMap
+ .setOMClass(org.apache.james.mailboxmanager.torque.om.MessageRow.class);
+ tMap
+ .setPeerClass(org.apache.james.mailboxmanager.torque.om.MessageRowPeer.class);
tMap.setDescription("");
tMap.setPrimaryKeyMethod("none");
ColumnMap cMap = null;
-
- // ------------- Column: mailbox_id --------------------
- cMap = new ColumnMap( "mailbox_id", tMap);
- cMap.setType( new Long(0) );
- cMap.setTorqueType( "BIGINT" );
+ // ------------- Column: mailbox_id --------------------
+ cMap = new ColumnMap("mailbox_id", tMap);
+ cMap.setType(new Long(0));
+ cMap.setTorqueType("BIGINT");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(true);
cMap.setNotNull(true);
- cMap.setJavaName( "MailboxId" );
+ cMap.setJavaName("MailboxId");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("Mailbox Id");
- cMap.setInheritance("false");
- cMap.setForeignKey("mailbox", "mailbox_id");
- cMap.setPosition(1);
- tMap.addColumn(cMap);
- // ------------- Column: uid --------------------
- cMap = new ColumnMap( "uid", tMap);
- cMap.setType( new Long(0) );
- cMap.setTorqueType( "BIGINT" );
+ cMap.setDescription("Mailbox Id");
+ cMap.setInheritance("false");
+ cMap.setForeignKey("mailbox", "mailbox_id");
+ cMap.setPosition(1);
+ tMap.addColumn(cMap);
+ // ------------- Column: uid --------------------
+ cMap = new ColumnMap("uid", tMap);
+ cMap.setType(new Long(0));
+ cMap.setTorqueType("BIGINT");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(true);
cMap.setNotNull(true);
- cMap.setJavaName( "Uid" );
+ cMap.setJavaName("Uid");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("the last used uid (default 0)");
- cMap.setInheritance("false");
- cMap.setPosition(2);
- tMap.addColumn(cMap);
- // ------------- Column: internal_date --------------------
- cMap = new ColumnMap( "internal_date", tMap);
- cMap.setType( new Date() );
- cMap.setTorqueType( "DATE" );
+ cMap.setDescription("the last used uid (default 0)");
+ cMap.setInheritance("false");
+ cMap.setPosition(2);
+ tMap.addColumn(cMap);
+ // ------------- Column: internal_date --------------------
+ cMap = new ColumnMap("internal_date", tMap);
+ cMap.setType(new Date());
+ cMap.setTorqueType("DATE");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(false);
cMap.setNotNull(false);
- cMap.setJavaName( "InternalDate" );
+ cMap.setJavaName("InternalDate");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("internal date");
- cMap.setInheritance("false");
- cMap.setPosition(3);
- tMap.addColumn(cMap);
- // ------------- Column: size --------------------
- cMap = new ColumnMap( "size", tMap);
- cMap.setType( new Integer(0) );
- cMap.setTorqueType( "INTEGER" );
+ cMap.setDescription("internal date");
+ cMap.setInheritance("false");
+ cMap.setPosition(3);
+ tMap.addColumn(cMap);
+ // ------------- Column: size --------------------
+ cMap = new ColumnMap("size", tMap);
+ cMap.setType(new Integer(0));
+ cMap.setTorqueType("INTEGER");
cMap.setUsePrimitive(true);
cMap.setPrimaryKey(false);
cMap.setNotNull(false);
- cMap.setJavaName( "Size" );
+ cMap.setJavaName("Size");
cMap.setAutoIncrement(false);
cMap.setProtected(false);
- cMap.setDescription("message size");
- cMap.setInheritance("false");
- cMap.setPosition(4);
- tMap.addColumn(cMap);
+ cMap.setDescription("message size");
+ cMap.setInheritance("false");
+ cMap.setPosition(4);
+ tMap.addColumn(cMap);
tMap.setUseInheritance(false);
}
}
Modified: james/protocols/imap/trunk/torque/src/main/java/org/apache/torque/linkage/MailboxmanagerMapInit.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/torque/src/main/java/org/apache/torque/linkage/MailboxmanagerMapInit.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/torque/src/main/java/org/apache/torque/linkage/MailboxmanagerMapInit.java (original)
+++ james/protocols/imap/trunk/torque/src/main/java/org/apache/torque/linkage/MailboxmanagerMapInit.java Thu Sep 18 14:44:56 2008
@@ -1,15 +1,14 @@
package org.apache.torque.linkage;
/**
- * This Torque generated class is used to link the runtime code
- * in org.apache.torque.* packages to the Database specific MapInit
- * classes generated in the user defined packages. It resided in
- * the org.apache.torque.linkage so that the runtime code can
- * locate it regardless of the user build properties.
- *
- * @see org.apache.torque.map.DatabaseMap#initialize() DatabaseMap.initialize()
+ * This Torque generated class is used to link the runtime code in
+ * org.apache.torque.* packages to the Database specific MapInit classes
+ * generated in the user defined packages. It resided in the
+ * org.apache.torque.linkage so that the runtime code can locate it regardless
+ * of the user build properties.
+ *
+ * @see org.apache.torque.map.DatabaseMap#initialize() DatabaseMap.initialize()
*/
-public class MailboxmanagerMapInit
- extends org.apache.james.mailboxmanager.torque.om.map.MailboxmanagerMapInit
-{
+public class MailboxmanagerMapInit extends
+ org.apache.james.mailboxmanager.torque.om.map.MailboxmanagerMapInit {
}
Modified: james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/MessageRowUtilsTest.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/MessageRowUtilsTest.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/MessageRowUtilsTest.java (original)
+++ james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/MessageRowUtilsTest.java Thu Sep 18 14:44:56 2008
@@ -32,23 +32,25 @@
protected void tearDown() throws Exception {
super.tearDown();
}
-
- public void testShouldReturnPositiveWhenFirstGreaterThanSecond() throws Exception {
+
+ public void testShouldReturnPositiveWhenFirstGreaterThanSecond()
+ throws Exception {
MessageRow one = new MessageRow();
one.setUid(100);
MessageRow two = new MessageRow();
two.setUid(99);
assertTrue(MessageRowUtils.getUidComparator().compare(one, two) > 0);
}
-
- public void testShouldReturnNegativeWhenFirstLessThanSecond() throws Exception {
+
+ public void testShouldReturnNegativeWhenFirstLessThanSecond()
+ throws Exception {
MessageRow one = new MessageRow();
one.setUid(98);
MessageRow two = new MessageRow();
two.setUid(99);
assertTrue(MessageRowUtils.getUidComparator().compare(one, two) < 0);
}
-
+
public void testShouldReturnZeroWhenFirstEqualsSecond() throws Exception {
MessageRow one = new MessageRow();
one.setUid(90);
Modified: james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/MessageUtilsCountUnnormalLinesTest.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/MessageUtilsCountUnnormalLinesTest.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/MessageUtilsCountUnnormalLinesTest.java (original)
+++ james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/MessageUtilsCountUnnormalLinesTest.java Thu Sep 18 14:44:56 2008
@@ -30,32 +30,36 @@
}
public void testEmpty() throws Exception {
- assertEquals("Check processing of empty array", 0, MessageUtils.countUnnormalLines("".getBytes()));
+ assertEquals("Check processing of empty array", 0, MessageUtils
+ .countUnnormalLines("".getBytes()));
}
-
+
public void testNormal() throws Exception {
- assertEquals("Check processing of normal data", 0,
- MessageUtils.countUnnormalLines("One\r\nTwo\r\nThree\r\n".getBytes()));
+ assertEquals("Check processing of normal data", 0, MessageUtils
+ .countUnnormalLines("One\r\nTwo\r\nThree\r\n".getBytes()));
}
-
+
public void testMissing() throws Exception {
- assertEquals("Check processing simple data containing unnormal lines", 2,
- MessageUtils.countUnnormalLines("One\rTwo\nThree\r\n".getBytes()));
+ assertEquals("Check processing simple data containing unnormal lines",
+ 2, MessageUtils.countUnnormalLines("One\rTwo\nThree\r\n"
+ .getBytes()));
}
-
+
public void testBoundaries() throws Exception {
- assertEquals("CR at end", 1,
- MessageUtils.countUnnormalLines("One\r\nTwo\r\nThree\r".getBytes()));
- assertEquals("LF at end", 1,
- MessageUtils.countUnnormalLines("One\r\nTwo\r\nThree\n".getBytes()));
- assertEquals("CR at start", 1,
- MessageUtils.countUnnormalLines("\rOne\r\nTwo\r\nThree".getBytes()));
- assertEquals("LF at start", 1,
- MessageUtils.countUnnormalLines("\nOne\r\nTwo\r\nThree".getBytes()));
+ assertEquals("CR at end", 1, MessageUtils
+ .countUnnormalLines("One\r\nTwo\r\nThree\r".getBytes()));
+ assertEquals("LF at end", 1, MessageUtils
+ .countUnnormalLines("One\r\nTwo\r\nThree\n".getBytes()));
+ assertEquals("CR at start", 1, MessageUtils
+ .countUnnormalLines("\rOne\r\nTwo\r\nThree".getBytes()));
+ assertEquals("LF at start", 1, MessageUtils
+ .countUnnormalLines("\nOne\r\nTwo\r\nThree".getBytes()));
}
-
+
public void testSwitchOrder() throws Exception {
- assertEquals("Check processing simple data containing unnormal lines", 8,
- MessageUtils.countUnnormalLines("\n\rOne\n\rTwo\n\rThree\n\r".getBytes()));
+ assertEquals("Check processing simple data containing unnormal lines",
+ 8, MessageUtils
+ .countUnnormalLines("\n\rOne\n\rTwo\n\rThree\n\r"
+ .getBytes()));
}
}
Modified: james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/MessageUtilsNormalisedWriteToTest.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/MessageUtilsNormalisedWriteToTest.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/MessageUtilsNormalisedWriteToTest.java (original)
+++ james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/MessageUtilsNormalisedWriteToTest.java Thu Sep 18 14:44:56 2008
@@ -24,7 +24,7 @@
public class MessageUtilsNormalisedWriteToTest extends TestCase {
StringBuffer buffer;
-
+
protected void setUp() throws Exception {
super.setUp();
buffer = new StringBuffer();
@@ -38,48 +38,52 @@
MessageUtils.normalisedWriteTo("".getBytes(), buffer);
assertEquals("Check processing of empty array", "", buffer.toString());
}
-
+
public void testNormal() throws Exception {
- MessageUtils.normalisedWriteTo("One\r\nTwo\r\nThree\r\n".getBytes(), buffer);
- assertEquals("Check processing of normal data", "One\r\nTwo\r\nThree\r\n", buffer.toString());
+ MessageUtils.normalisedWriteTo("One\r\nTwo\r\nThree\r\n".getBytes(),
+ buffer);
+ assertEquals("Check processing of normal data",
+ "One\r\nTwo\r\nThree\r\n", buffer.toString());
}
-
+
public void testMissing() throws Exception {
- MessageUtils.normalisedWriteTo("One\rTwo\nThree\r\n".getBytes(), buffer);
- assertEquals("Check processing simple data containing unnormal lines", "One\r\nTwo\r\nThree\r\n",
- buffer.toString());
+ MessageUtils
+ .normalisedWriteTo("One\rTwo\nThree\r\n".getBytes(), buffer);
+ assertEquals("Check processing simple data containing unnormal lines",
+ "One\r\nTwo\r\nThree\r\n", buffer.toString());
}
-
+
public void testCRAtEnd() throws Exception {
- MessageUtils.normalisedWriteTo("One\r\nTwo\r\nThree\r".getBytes(), buffer);
- assertEquals("CR at end", "One\r\nTwo\r\nThree\r\n",
- buffer.toString());
+ MessageUtils.normalisedWriteTo("One\r\nTwo\r\nThree\r".getBytes(),
+ buffer);
+ assertEquals("CR at end", "One\r\nTwo\r\nThree\r\n", buffer.toString());
}
-
-
+
public void testLFAtEnd() throws Exception {
- MessageUtils.normalisedWriteTo("One\r\nTwo\r\nThree\n".getBytes(), buffer);
- assertEquals("LF at end", "One\r\nTwo\r\nThree\r\n",
- buffer.toString());
+ MessageUtils.normalisedWriteTo("One\r\nTwo\r\nThree\n".getBytes(),
+ buffer);
+ assertEquals("LF at end", "One\r\nTwo\r\nThree\r\n", buffer.toString());
}
-
-
+
public void testCRAtStart() throws Exception {
- MessageUtils.normalisedWriteTo("\rOne\r\nTwo\r\nThree\r".getBytes(), buffer);
- assertEquals("CR at start", "\r\nOne\r\nTwo\r\nThree\r\n",
- buffer.toString());
+ MessageUtils.normalisedWriteTo("\rOne\r\nTwo\r\nThree\r".getBytes(),
+ buffer);
+ assertEquals("CR at start", "\r\nOne\r\nTwo\r\nThree\r\n", buffer
+ .toString());
}
-
-
+
public void testLFAtStart() throws Exception {
- MessageUtils.normalisedWriteTo("\nOne\r\nTwo\r\nThree".getBytes(), buffer);
- assertEquals("CR at start", "\r\nOne\r\nTwo\r\nThree",
- buffer.toString());
+ MessageUtils.normalisedWriteTo("\nOne\r\nTwo\r\nThree".getBytes(),
+ buffer);
+ assertEquals("CR at start", "\r\nOne\r\nTwo\r\nThree", buffer
+ .toString());
}
-
+
public void testSwitchOrder() throws Exception {
- MessageUtils.normalisedWriteTo("\n\rOne\n\rTwo\n\rThree\n\r".getBytes(), buffer);
- assertEquals("Check processing simple data containing unnormal lines", "\r\n\r\nOne\r\n\r\nTwo\r\n\r\nThree\r\n\r\n",
- buffer.toString());
+ MessageUtils.normalisedWriteTo(
+ "\n\rOne\n\rTwo\n\rThree\n\r".getBytes(), buffer);
+ assertEquals("Check processing simple data containing unnormal lines",
+ "\r\n\r\nOne\r\n\r\nTwo\r\n\r\nThree\r\n\r\n", buffer
+ .toString());
}
}
Modified: james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/PartContentBuilderComplexMultipartTest.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/PartContentBuilderComplexMultipartTest.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/PartContentBuilderComplexMultipartTest.java (original)
+++ james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/PartContentBuilderComplexMultipartTest.java Thu Sep 18 14:44:56 2008
@@ -29,67 +29,83 @@
import junit.framework.TestCase;
public class PartContentBuilderComplexMultipartTest extends TestCase {
-
+
private static final String PREAMBLE = "This is the preamble";
+
private static final String CONTENT_TYPE = "Content-Type";
+
private static final String CONTENT_TYPE_HTML = "text/html;charset=us-ascii";
+
private static final String CONTENT_TYPE_PLAIN = "text/plain;charset=us-ascii";
+
private static final String CONTENT_TYPE_RFC822 = "message/rfc822";
+
private static final String OUTER_HTML_BODY = "<html><head><title>Rhubard!</title></head><body><p>Rhubarb!Rhubard!Rhubard!</p></body></html>\r\n";
- private static final String FULL_OUTER_HTML = CONTENT_TYPE + ": " + CONTENT_TYPE_HTML + "\r\n\r\n" +
- OUTER_HTML_BODY;
+
+ private static final String FULL_OUTER_HTML = CONTENT_TYPE + ": "
+ + CONTENT_TYPE_HTML + "\r\n\r\n" + OUTER_HTML_BODY;
+
private static final String OUTER_PLAIN_BODY = "Rhubarb!Rhubard!Rhubard!\r\n";
- private static final String FULL_OUTER_PLAIN = CONTENT_TYPE + ": " + CONTENT_TYPE_PLAIN + "\r\n\r\n" +
- OUTER_PLAIN_BODY;
+
+ private static final String FULL_OUTER_PLAIN = CONTENT_TYPE + ": "
+ + CONTENT_TYPE_PLAIN + "\r\n\r\n" + OUTER_PLAIN_BODY;
+
private static final String INNER_HTML_BODY = "<html><head><title>Custard!</title></head><body><p>Custard!Custard!Custard!</p></body></html>\r\n";
- private static final String FULL_INNER_HTML = CONTENT_TYPE + ": " + CONTENT_TYPE_HTML + "\r\n\r\n" +
- INNER_HTML_BODY;
+
+ private static final String FULL_INNER_HTML = CONTENT_TYPE + ": "
+ + CONTENT_TYPE_HTML + "\r\n\r\n" + INNER_HTML_BODY;
+
private static final String INNER_PLAIN_BODY = "Custard!Custard!Custard!\r\n";
- private static final String FULL_INNER_TXT = CONTENT_TYPE + ": " + CONTENT_TYPE_PLAIN + "\r\n\r\n" +
- INNER_PLAIN_BODY;
+
+ private static final String FULL_INNER_TXT = CONTENT_TYPE + ": "
+ + CONTENT_TYPE_PLAIN + "\r\n\r\n" + INNER_PLAIN_BODY;
+
private static final String INNERMOST_BODY = "Da!Da!Da!Dah!\r\n";
- private static final String RFC822_PLAIN_MAIL = "From: Samual Smith <sa...@example.org>\r\n" +
- "To: John Smith <jo...@example.org>\r\n" +
- "Date: Thu, 1 Feb 2007 08:00:00 -0800 (PST)\r\n" +
- "Subject: Rhubard And Custard!\r\n" +
- CONTENT_TYPE + ": " + CONTENT_TYPE_PLAIN + "\r\n" +
- "\r\n" +
- INNERMOST_BODY;
- private static final String FULL_INNERMOST_EMAIL = CONTENT_TYPE + ": " + CONTENT_TYPE_RFC822 + "\r\n\r\n" +
- RFC822_PLAIN_MAIL;
- private static final String INNER_MAIL = "From: John Smith <jo...@example.org>\r\n" +
- "To: Samual Smith <sa...@example.org>\r\n" +
- "Date: Fri, 1 Feb 2008 08:00:00 -0800 (PST)\r\n" +
- "Subject: Custard!\r\n" +
- "Content-Type: multipart/mixed;boundary=1729\r\n\r\n" +
- PREAMBLE +
- "\r\n--1729\r\n" +
- FULL_INNER_TXT +
- "\r\n--1729\r\n" +
- FULL_INNER_HTML +
- "\r\n--1729\r\n" +
- FULL_INNERMOST_EMAIL +
- "\r\n--1729--\r\n";
- private static final String FULL_INNER_MAIL = CONTENT_TYPE + ": " + CONTENT_TYPE_RFC822 + "\r\n\r\n" +
- INNER_MAIL;
-
- private static final String MULTIPART_MIXED =
- "From: Samual Smith <sa...@example.org>\r\n" +
- "To: John Smith <jo...@example.org>\r\n" +
- "Date: Sun, 10 Feb 2008 08:00:00 -0800 (PST)\r\n" +
- "Subject: Rhubarb!\r\n" +
- "Content-Type: multipart/mixed;boundary=4242\r\n\r\n" +
- PREAMBLE +
- "\r\n--4242\r\n" +
- FULL_OUTER_HTML +
- "\r\n--4242\r\n" +
- FULL_INNER_MAIL +
- "\r\n--4242\r\n" +
- FULL_OUTER_PLAIN +
- "\r\n--4242--\r\n";
-
+
+ private static final String RFC822_PLAIN_MAIL = "From: Samual Smith <sa...@example.org>\r\n"
+ + "To: John Smith <jo...@example.org>\r\n"
+ + "Date: Thu, 1 Feb 2007 08:00:00 -0800 (PST)\r\n"
+ + "Subject: Rhubard And Custard!\r\n"
+ + CONTENT_TYPE
+ + ": "
+ + CONTENT_TYPE_PLAIN + "\r\n" + "\r\n" + INNERMOST_BODY;
+
+ private static final String FULL_INNERMOST_EMAIL = CONTENT_TYPE + ": "
+ + CONTENT_TYPE_RFC822 + "\r\n\r\n" + RFC822_PLAIN_MAIL;
+
+ private static final String INNER_MAIL = "From: John Smith <jo...@example.org>\r\n"
+ + "To: Samual Smith <sa...@example.org>\r\n"
+ + "Date: Fri, 1 Feb 2008 08:00:00 -0800 (PST)\r\n"
+ + "Subject: Custard!\r\n"
+ + "Content-Type: multipart/mixed;boundary=1729\r\n\r\n"
+ + PREAMBLE
+ + "\r\n--1729\r\n"
+ + FULL_INNER_TXT
+ + "\r\n--1729\r\n"
+ + FULL_INNER_HTML
+ + "\r\n--1729\r\n"
+ + FULL_INNERMOST_EMAIL
+ + "\r\n--1729--\r\n";
+
+ private static final String FULL_INNER_MAIL = CONTENT_TYPE + ": "
+ + CONTENT_TYPE_RFC822 + "\r\n\r\n" + INNER_MAIL;
+
+ private static final String MULTIPART_MIXED = "From: Samual Smith <sa...@example.org>\r\n"
+ + "To: John Smith <jo...@example.org>\r\n"
+ + "Date: Sun, 10 Feb 2008 08:00:00 -0800 (PST)\r\n"
+ + "Subject: Rhubarb!\r\n"
+ + "Content-Type: multipart/mixed;boundary=4242\r\n\r\n"
+ + PREAMBLE
+ + "\r\n--4242\r\n"
+ + FULL_OUTER_HTML
+ + "\r\n--4242\r\n"
+ + FULL_INNER_MAIL
+ + "\r\n--4242\r\n"
+ + FULL_OUTER_PLAIN
+ + "\r\n--4242--\r\n";
+
PartContentBuilder builder;
-
+
protected void setUp() throws Exception {
super.setUp();
builder = new PartContentBuilder();
@@ -98,53 +114,55 @@
protected void tearDown() throws Exception {
super.tearDown();
}
-
- public void testShouldNotFoundSubPartOfNonMultiPartTopLevel() throws Exception {
- int[] path = {1, 1};
- for (int i=1;i<10;i++) {
+
+ public void testShouldNotFoundSubPartOfNonMultiPartTopLevel()
+ throws Exception {
+ int[] path = { 1, 1 };
+ for (int i = 1; i < 10; i++) {
path[1] = i;
checkNotPartFound(path);
}
}
-
+
public void testShouldNotFoundSubPartOfNonMultiInnerPart() throws Exception {
- int[] path = {2, 2, 1};
- for (int i=1;i<10;i++) {
+ int[] path = { 2, 2, 1 };
+ for (int i = 1; i < 10; i++) {
path[2] = i;
checkNotPartFound(path);
}
}
-
+
public void testShouldLocateOuterHtml() throws Exception {
- int[] path = {1};
+ int[] path = { 1 };
check(FULL_OUTER_HTML, OUTER_HTML_BODY, CONTENT_TYPE_HTML, path);
}
public void testShouldLocateOuterMail() throws Exception {
- int[] path = {2};
+ int[] path = { 2 };
check(FULL_INNER_MAIL, INNER_MAIL, CONTENT_TYPE_RFC822, path);
}
-
+
public void testShouldLocateOuterPlain() throws Exception {
- int[] path = {3};
+ int[] path = { 3 };
check(FULL_OUTER_PLAIN, OUTER_PLAIN_BODY, CONTENT_TYPE_PLAIN, path);
}
-
+
public void testShouldLocateInnerHtml() throws Exception {
- int[] path = {2, 2};
+ int[] path = { 2, 2 };
check(FULL_INNER_HTML, INNER_HTML_BODY, CONTENT_TYPE_HTML, path);
}
public void testShouldLocateInnerMail() throws Exception {
- int[] path = {2, 3};
- check(FULL_INNERMOST_EMAIL, RFC822_PLAIN_MAIL, CONTENT_TYPE_RFC822, path);
+ int[] path = { 2, 3 };
+ check(FULL_INNERMOST_EMAIL, RFC822_PLAIN_MAIL, CONTENT_TYPE_RFC822,
+ path);
}
-
+
public void testShouldLocateInnerPlain() throws Exception {
- int[] path = {2, 1};
+ int[] path = { 2, 1 };
check(FULL_INNER_TXT, INNER_PLAIN_BODY, CONTENT_TYPE_PLAIN, path);
}
-
+
private void checkNotPartFound(int[] position) throws Exception {
try {
to(position);
@@ -153,44 +171,47 @@
// expected
}
}
-
- private void check(String full, String body, String contentType, int[] position) throws Exception {
+
+ private void check(String full, String body, String contentType,
+ int[] position) throws Exception {
checkContentType(contentType, position);
assertEquals(body, bodyContent(position));
- assertEquals(full, fullContent(position));
+ assertEquals(full, fullContent(position));
}
-
+
private String fullContent(int[] position) throws Exception {
to(position);
StringBuffer buffer = new StringBuffer();
builder.getFullContent().writeTo(buffer);
return buffer.toString();
}
-
+
private String bodyContent(int[] position) throws Exception {
to(position);
StringBuffer buffer = new StringBuffer();
builder.getMimeBodyContent().writeTo(buffer);
return buffer.toString();
}
-
- private void checkContentType(String contentType, int[] position) throws Exception {
+
+ private void checkContentType(String contentType, int[] position)
+ throws Exception {
List headers = headers(position);
assertEquals(1, headers.size());
Header header = (Header) headers.get(0);
assertEquals(CONTENT_TYPE, header.getName());
assertEquals(contentType, header.getValue());
}
-
+
private List headers(int[] position) throws Exception {
to(position);
return builder.getMimeHeaders();
}
-
+
private void to(int[] path) throws Exception {
- InputStream in = new ByteArrayInputStream(Charset.forName("us-ascii").encode(MULTIPART_MIXED).array());
+ InputStream in = new ByteArrayInputStream(Charset.forName("us-ascii")
+ .encode(MULTIPART_MIXED).array());
builder.parse(in);
- for (int i=0;i<path.length;i++) {
+ for (int i = 0; i < path.length; i++) {
builder.to(path[i]);
}
}
Modified: james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/PartContentBuilderMultipartAlternativeTest.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/PartContentBuilderMultipartAlternativeTest.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/PartContentBuilderMultipartAlternativeTest.java (original)
+++ james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/PartContentBuilderMultipartAlternativeTest.java Thu Sep 18 14:44:56 2008
@@ -27,7 +27,7 @@
import junit.framework.TestCase;
public class PartContentBuilderMultipartAlternativeTest extends TestCase {
-
+
private static final String CONTENT_TYPE_PLAIN = "text/plain;charset=us-ascii";
private static final String CONTENT_TYPE_HTML = "text/html;charset=us-ascii";
@@ -38,40 +38,34 @@
private static final String ALT_PLAIN_BODY = "Rhubarb!Rhubard!Rhubard!\r\n";
- private static final String ALT_XHTML_BODY = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>" +
- "<html><head><title>Rhubard!</title></head><body><p>Rhubarb!Rhubard!Rhubard!</p></body></html>\r\n";
+ private static final String ALT_XHTML_BODY = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>"
+ + "<html><head><title>Rhubard!</title></head><body><p>Rhubarb!Rhubard!Rhubard!</p></body></html>\r\n";
private static final String ALT_HTML_BODY = "<html><head><title>Rhubard!</title></head><body><p>Rhubarb!Rhubard!Rhubard!</p></body></html>\r\n";
- private static final String ALT_PART_XHTML = CONTENT_TYPE + ": " + CONTENT_TYPE_XHTML + "\r\n" +
- "\r\n" +
- ALT_XHTML_BODY;
-
- private static final String ALT_PART_HTML = CONTENT_TYPE + ": " + CONTENT_TYPE_HTML + "\r\n" +
- "\r\n" +
- ALT_HTML_BODY;
-
- private static final String ALT_PART_PLAIN = CONTENT_TYPE + ": " + CONTENT_TYPE_PLAIN + "\r\n" +
- "\r\n" +
- ALT_PLAIN_BODY;
-
- private static final String MULTIPART_ALTERNATIVE =
- "From: Samual Smith <sa...@example.org>\r\n" +
- "To: John Smith <jo...@example.org>\r\n" +
- "Date: Sun, 10 Feb 2008 08:00:00 -0800 (PST)\r\n" +
- "Subject: Rhubarb!\r\n" +
- "Content-Type: multipart/alternative;boundary=4242\r\n" +
- "\r\n" +
- "--4242\r\n" +
- ALT_PART_PLAIN +
- "\r\n--4242\r\n" +
- ALT_PART_HTML +
- "\r\n--4242\r\n" +
- ALT_PART_XHTML +
- "\r\n--4242\r\n";
-
+ private static final String ALT_PART_XHTML = CONTENT_TYPE + ": "
+ + CONTENT_TYPE_XHTML + "\r\n" + "\r\n" + ALT_XHTML_BODY;
+
+ private static final String ALT_PART_HTML = CONTENT_TYPE + ": "
+ + CONTENT_TYPE_HTML + "\r\n" + "\r\n" + ALT_HTML_BODY;
+
+ private static final String ALT_PART_PLAIN = CONTENT_TYPE + ": "
+ + CONTENT_TYPE_PLAIN + "\r\n" + "\r\n" + ALT_PLAIN_BODY;
+
+ private static final String MULTIPART_ALTERNATIVE = "From: Samual Smith <sa...@example.org>\r\n"
+ + "To: John Smith <jo...@example.org>\r\n"
+ + "Date: Sun, 10 Feb 2008 08:00:00 -0800 (PST)\r\n"
+ + "Subject: Rhubarb!\r\n"
+ + "Content-Type: multipart/alternative;boundary=4242\r\n"
+ + "\r\n"
+ + "--4242\r\n"
+ + ALT_PART_PLAIN
+ + "\r\n--4242\r\n"
+ + ALT_PART_HTML
+ + "\r\n--4242\r\n" + ALT_PART_XHTML + "\r\n--4242\r\n";
+
PartContentBuilder builder;
-
+
protected void setUp() throws Exception {
super.setUp();
builder = new PartContentBuilder();
@@ -86,48 +80,52 @@
assertEquals(ALT_HTML_BODY, bodyContent(MULTIPART_ALTERNATIVE, 2));
assertEquals(ALT_XHTML_BODY, bodyContent(MULTIPART_ALTERNATIVE, 3));
}
-
+
public void testShouldLocateHeadersOfMultipartAlterative() throws Exception {
checkContentType(CONTENT_TYPE_PLAIN, MULTIPART_ALTERNATIVE, 1);
checkContentType(CONTENT_TYPE_HTML, MULTIPART_ALTERNATIVE, 2);
checkContentType(CONTENT_TYPE_XHTML, MULTIPART_ALTERNATIVE, 3);
}
-
- public void testShouldLocateFullContentOfMultipartAlterative() throws Exception {
+
+ public void testShouldLocateFullContentOfMultipartAlterative()
+ throws Exception {
assertEquals(ALT_PART_PLAIN, fullContent(MULTIPART_ALTERNATIVE, 1));
assertEquals(ALT_PART_HTML, fullContent(MULTIPART_ALTERNATIVE, 2));
assertEquals(ALT_PART_XHTML, fullContent(MULTIPART_ALTERNATIVE, 3));
}
-
-
+
private String fullContent(String mail, int position) throws Exception {
- InputStream in = new ByteArrayInputStream(Charset.forName("us-ascii").encode(mail).array());
+ InputStream in = new ByteArrayInputStream(Charset.forName("us-ascii")
+ .encode(mail).array());
builder.parse(in);
builder.to(position);
StringBuffer buffer = new StringBuffer();
builder.getFullContent().writeTo(buffer);
return buffer.toString();
}
-
+
private String bodyContent(String mail, int position) throws Exception {
- InputStream in = new ByteArrayInputStream(Charset.forName("us-ascii").encode(mail).array());
+ InputStream in = new ByteArrayInputStream(Charset.forName("us-ascii")
+ .encode(mail).array());
builder.parse(in);
builder.to(position);
StringBuffer buffer = new StringBuffer();
builder.getMimeBodyContent().writeTo(buffer);
return buffer.toString();
}
-
- private void checkContentType(String contentType, String mail, int position) throws Exception {
+
+ private void checkContentType(String contentType, String mail, int position)
+ throws Exception {
List headers = headers(mail, position);
assertEquals(1, headers.size());
Header header = (Header) headers.get(0);
assertEquals(CONTENT_TYPE, header.getName());
assertEquals(contentType, header.getValue());
}
-
+
private List headers(String mail, int position) throws Exception {
- InputStream in = new ByteArrayInputStream(Charset.forName("us-ascii").encode(mail).array());
+ InputStream in = new ByteArrayInputStream(Charset.forName("us-ascii")
+ .encode(mail).array());
builder.parse(in);
builder.to(position);
return builder.getMimeHeaders();
Modified: james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsMultipartMixedTest.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsMultipartMixedTest.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsMultipartMixedTest.java (original)
+++ james/protocols/imap/trunk/torque/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsMultipartMixedTest.java Thu Sep 18 14:44:56 2008
@@ -34,92 +34,98 @@
public class SearchUtilsMultipartMixedTest extends TestCase {
private static final String SAMPLE_INNER_MAIL_BODY_ONE = "far a modern quill doth come too";
+
private static final String SAMPLE_PART_ONE = "The better angel is a man right fair,\r\n";
+
private static final String SAMPLE_PART_TWO = "My bonds in thee are all determinate.";
+
private static final String SAMPLE_PART_TWO_FIELD = "948523475273457234952345";
+
private static final String SAMPLE_INNER_MAIL_FIELD = "Inner mail sample";
+
private static final String SAMPLE_INNER_MAIL_MIME_FIELD = "8347673450223534587232312221";
+
private static final String PREMABLE = "This is the premable.";
- private static final String BODY = PREMABLE +
- "\r\n--1729\r\n" +
- "Content-Type: text/plain; charset=US-ASCII\r\n\r\n" +
- "Two loves I have of comfort and despair,\r\n" +
- "Which like two spirits do suggest me still:\r\n" +
- SAMPLE_PART_ONE +
- "The worser spirit a woman colour'd ill.\r\n" +
- "To win me soon to hell, my female evil,\r\n" +
- "Tempteth my better angel from my side,\r\n" +
- "And would corrupt my saint to be a devil,\r\n" +
- "Wooing his purity with her foul pride.\r\n" +
- "And whether that my angel be turn'd fiend,\r\n" +
- "Suspect I may, yet not directly tell;\r\n" +
- "But being both from me, both to each friend,\r\n" +
- "I guess one angel in another's hell:\r\n" +
- " Yet this shall I ne'er know, but live in doubt,\r\n" +
- " Till my bad angel fire my good one out.\r\n" +
- "r\n" +
- "By William Shakespere\r\n" +
- "\r\n--1729\r\n" +
- "Content-Type: text/plain; charset=US-ASCII\r\n" +
- "Content-Transfer-Encoding: 7bit\r\n" +
- "Content-ID: 45" + SAMPLE_PART_TWO_FIELD +"\r\n\r\n" +
- "Farewell! thou art too dear for my possessing,\r\n" +
- "And like enough thou know'st thy estimate,\r\n" +
- "The charter of thy worth gives thee releasing;\r\n" +
- SAMPLE_PART_TWO + "\r\n" +
- "For how do I hold thee but by thy granting?\r\n" +
- "And for that riches where is my deserving?\r\n" +
- "The cause of this fair gift in me is wanting,\r\n" +
- "And so my patent back again is swerving.\r\n" +
- "Thy self thou gav'st, thy own worth then not knowing,\r\n" +
- "Or me to whom thou gav'st it, else mistaking;\r\n" +
- "So thy great gift, upon misprision growing,\r\n" +
- "Comes home again, on better judgement making.\r\n" +
- " Thus have I had thee, as a dream doth flatter,\r\n" +
- " In sleep a king, but waking no such matter.\r\n" +
- "r\n" +
- "By William Shakespere\r\n" +
- "\r\n--1729\r\n" +
- "Content-Type: message/rfc822\r\n\r\n" +
- "From: Timothy Tayler <ti...@example.org>\r\n" +
- "To: John Smith <jo...@example.org>\r\n" +
- "Date: Sat, 16 Feb 2008 12:00:00 +0000 (GMT)\r\n" +
- "Subject: Custard " + SAMPLE_INNER_MAIL_FIELD + " \r\n" +
- "Content-Type: multipart/mixed;boundary=2.50290787509\r\n\r\n" +
- "--2.50290787509\r\n" +
- "Content-Type: text/plain\r\n" +
- "Content-ID: 4657" + SAMPLE_INNER_MAIL_MIME_FIELD + "\r\n\r\n" +
- "I never saw that you did painting need,\r\n" +
- "And therefore to your fair no painting set;\r\n" +
- "I found, or thought I found, you did exceed\r\n" +
- "That barren tender of a poet's debt:\r\n" +
- "And therefore have I slept in your report,\r\n" +
- "That you yourself, being extant, well might show\r\n" +
- "How " + SAMPLE_INNER_MAIL_BODY_ONE + " short,\r\n" +
- "Speaking of worth, what worth in you doth grow.\r\n" +
- "This silence for my sin you did impute,\r\n" +
- "Which shall be most my glory being dumb;\r\n" +
- "For I impair not beauty being mute,\r\n" +
- "When others would give life, and bring a tomb.\r\n" +
- " There lives more life in one of your fair eyes\r\n" +
- " Than both your poets can in praise devise.\r\n" +
- "\r\n--2.50290787509--\r\n" +
- "\r\n--1729--\r\n" ;
-
-
+
+ private static final String BODY = PREMABLE + "\r\n--1729\r\n"
+ + "Content-Type: text/plain; charset=US-ASCII\r\n\r\n"
+ + "Two loves I have of comfort and despair,\r\n"
+ + "Which like two spirits do suggest me still:\r\n"
+ + SAMPLE_PART_ONE + "The worser spirit a woman colour'd ill.\r\n"
+ + "To win me soon to hell, my female evil,\r\n"
+ + "Tempteth my better angel from my side,\r\n"
+ + "And would corrupt my saint to be a devil,\r\n"
+ + "Wooing his purity with her foul pride.\r\n"
+ + "And whether that my angel be turn'd fiend,\r\n"
+ + "Suspect I may, yet not directly tell;\r\n"
+ + "But being both from me, both to each friend,\r\n"
+ + "I guess one angel in another's hell:\r\n"
+ + " Yet this shall I ne'er know, but live in doubt,\r\n"
+ + " Till my bad angel fire my good one out.\r\n" + "r\n"
+ + "By William Shakespere\r\n" + "\r\n--1729\r\n"
+ + "Content-Type: text/plain; charset=US-ASCII\r\n"
+ + "Content-Transfer-Encoding: 7bit\r\n" + "Content-ID: 45"
+ + SAMPLE_PART_TWO_FIELD + "\r\n\r\n"
+ + "Farewell! thou art too dear for my possessing,\r\n"
+ + "And like enough thou know'st thy estimate,\r\n"
+ + "The charter of thy worth gives thee releasing;\r\n"
+ + SAMPLE_PART_TWO + "\r\n"
+ + "For how do I hold thee but by thy granting?\r\n"
+ + "And for that riches where is my deserving?\r\n"
+ + "The cause of this fair gift in me is wanting,\r\n"
+ + "And so my patent back again is swerving.\r\n"
+ + "Thy self thou gav'st, thy own worth then not knowing,\r\n"
+ + "Or me to whom thou gav'st it, else mistaking;\r\n"
+ + "So thy great gift, upon misprision growing,\r\n"
+ + "Comes home again, on better judgement making.\r\n"
+ + " Thus have I had thee, as a dream doth flatter,\r\n"
+ + " In sleep a king, but waking no such matter.\r\n" + "r\n"
+ + "By William Shakespere\r\n" + "\r\n--1729\r\n"
+ + "Content-Type: message/rfc822\r\n\r\n"
+ + "From: Timothy Tayler <ti...@example.org>\r\n"
+ + "To: John Smith <jo...@example.org>\r\n"
+ + "Date: Sat, 16 Feb 2008 12:00:00 +0000 (GMT)\r\n"
+ + "Subject: Custard " + SAMPLE_INNER_MAIL_FIELD + " \r\n"
+ + "Content-Type: multipart/mixed;boundary=2.50290787509\r\n\r\n"
+ + "--2.50290787509\r\n" + "Content-Type: text/plain\r\n"
+ + "Content-ID: 4657" + SAMPLE_INNER_MAIL_MIME_FIELD + "\r\n\r\n"
+ + "I never saw that you did painting need,\r\n"
+ + "And therefore to your fair no painting set;\r\n"
+ + "I found, or thought I found, you did exceed\r\n"
+ + "That barren tender of a poet's debt:\r\n"
+ + "And therefore have I slept in your report,\r\n"
+ + "That you yourself, being extant, well might show\r\n" + "How "
+ + SAMPLE_INNER_MAIL_BODY_ONE + " short,\r\n"
+ + "Speaking of worth, what worth in you doth grow.\r\n"
+ + "This silence for my sin you did impute,\r\n"
+ + "Which shall be most my glory being dumb;\r\n"
+ + "For I impair not beauty being mute,\r\n"
+ + "When others would give life, and bring a tomb.\r\n"
+ + " There lives more life in one of your fair eyes\r\n"
+ + " Than both your poets can in praise devise.\r\n"
+ + "\r\n--2.50290787509--\r\n" + "\r\n--1729--\r\n";
+
MessageRow row;
+
MessageSearches searches;
+
Collection recent;
-
+
protected void setUp() throws Exception {
super.setUp();
- row = new MessageRow();
- row.addMessageHeader(new MessageHeader(ImapConstants.RFC822_FROM, "Alex <alex@example.org"));
- row.addMessageHeader(new MessageHeader(ImapConstants.RFC822_TO, "Harry <harry@example.org"));
- row.addMessageHeader(new MessageHeader(ImapConstants.RFC822_SUBJECT, "A Mixed Multipart Mail"));
- row.addMessageHeader(new MessageHeader(ImapConstants.RFC822_DATE, "Thu, 14 Feb 2008 12:00:00 +0000 (GMT)"));
- row.addMessageHeader(new MessageHeader("Content-Type", "multipart/mixed;boundary=1729"));
- row.addMessageBody(new MessageBody(Charset.forName("us-ascii").encode(BODY).array()));
+ row = new MessageRow();
+ row.addMessageHeader(new MessageHeader(ImapConstants.RFC822_FROM,
+ "Alex <alex@example.org"));
+ row.addMessageHeader(new MessageHeader(ImapConstants.RFC822_TO,
+ "Harry <harry@example.org"));
+ row.addMessageHeader(new MessageHeader(ImapConstants.RFC822_SUBJECT,
+ "A Mixed Multipart Mail"));
+ row.addMessageHeader(new MessageHeader(ImapConstants.RFC822_DATE,
+ "Thu, 14 Feb 2008 12:00:00 +0000 (GMT)"));
+ row.addMessageHeader(new MessageHeader("Content-Type",
+ "multipart/mixed;boundary=1729"));
+ row.addMessageBody(new MessageBody(Charset.forName("us-ascii").encode(
+ BODY).array()));
searches = new MessageSearches();
recent = new ArrayList();
}
@@ -127,56 +133,91 @@
protected void tearDown() throws Exception {
super.tearDown();
}
-
+
public void testShouldNotFindWhatIsNotThere() throws Exception {
- assertFalse(searches.isMatch(SearchQuery.bodyContains("BOGUS"), row, recent));
- assertFalse(searches.isMatch(SearchQuery.mailContains("BOGUS"), row, recent));
+ assertFalse(searches.isMatch(SearchQuery.bodyContains("BOGUS"), row,
+ recent));
+ assertFalse(searches.isMatch(SearchQuery.mailContains("BOGUS"), row,
+ recent));
}
-
+
public void testBodyShouldFindTextInBody() throws Exception {
- assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_INNER_MAIL_BODY_ONE), row, recent));
- assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_ONE), row, recent));
- assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO), row, recent));
+ assertTrue(searches.isMatch(SearchQuery
+ .bodyContains(SAMPLE_INNER_MAIL_BODY_ONE), row, recent));
+ assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_ONE),
+ row, recent));
+ assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO),
+ row, recent));
}
-
+
public void testBodyShouldFindTextInBodyCaseInsensitive() throws Exception {
- assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_INNER_MAIL_BODY_ONE), row, recent));
- assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_ONE), row, recent));
- assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO), row, recent));
- assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_INNER_MAIL_BODY_ONE.toLowerCase()), row, recent));
- assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_ONE.toLowerCase()), row, recent));
- assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO.toLowerCase()), row, recent));
- assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_INNER_MAIL_BODY_ONE.toUpperCase()), row, recent));
- assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_ONE.toUpperCase()), row, recent));
- assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO.toUpperCase()), row, recent));
+ assertTrue(searches.isMatch(SearchQuery
+ .bodyContains(SAMPLE_INNER_MAIL_BODY_ONE), row, recent));
+ assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_ONE),
+ row, recent));
+ assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO),
+ row, recent));
+ assertTrue(searches.isMatch(SearchQuery
+ .bodyContains(SAMPLE_INNER_MAIL_BODY_ONE.toLowerCase()), row,
+ recent));
+ assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_ONE
+ .toLowerCase()), row, recent));
+ assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO
+ .toLowerCase()), row, recent));
+ assertTrue(searches.isMatch(SearchQuery
+ .bodyContains(SAMPLE_INNER_MAIL_BODY_ONE.toUpperCase()), row,
+ recent));
+ assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_ONE
+ .toUpperCase()), row, recent));
+ assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO
+ .toUpperCase()), row, recent));
}
-
+
public void testBodyShouldNotFindTextInHeaders() throws Exception {
- assertFalse(searches.isMatch(SearchQuery.bodyContains(SAMPLE_INNER_MAIL_FIELD), row, recent));
- assertFalse(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO_FIELD), row, recent));
+ assertFalse(searches.isMatch(SearchQuery
+ .bodyContains(SAMPLE_INNER_MAIL_FIELD), row, recent));
+ assertFalse(searches.isMatch(SearchQuery
+ .bodyContains(SAMPLE_PART_TWO_FIELD), row, recent));
}
-
+
public void testTextShouldFindTextInBody() throws Exception {
- assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_BODY_ONE), row, recent));
- assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_ONE), row, recent));
- assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO), row, recent));
+ assertTrue(searches.isMatch(SearchQuery
+ .mailContains(SAMPLE_INNER_MAIL_BODY_ONE), row, recent));
+ assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_ONE),
+ row, recent));
+ assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO),
+ row, recent));
}
-
+
public void testTextShouldFindTextInBodyCaseInsensitive() throws Exception {
- assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_BODY_ONE), row, recent));
- assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_ONE), row, recent));
- assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO), row, recent));
- assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_BODY_ONE.toLowerCase()), row, recent));
- assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_ONE.toLowerCase()), row, recent));
- assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO.toLowerCase()), row, recent));
- assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_BODY_ONE.toUpperCase()), row, recent));
- assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_ONE.toUpperCase()), row, recent));
- assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO.toUpperCase()), row, recent));
+ assertTrue(searches.isMatch(SearchQuery
+ .mailContains(SAMPLE_INNER_MAIL_BODY_ONE), row, recent));
+ assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_ONE),
+ row, recent));
+ assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO),
+ row, recent));
+ assertTrue(searches.isMatch(SearchQuery
+ .mailContains(SAMPLE_INNER_MAIL_BODY_ONE.toLowerCase()), row,
+ recent));
+ assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_ONE
+ .toLowerCase()), row, recent));
+ assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO
+ .toLowerCase()), row, recent));
+ assertTrue(searches.isMatch(SearchQuery
+ .mailContains(SAMPLE_INNER_MAIL_BODY_ONE.toUpperCase()), row,
+ recent));
+ assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_ONE
+ .toUpperCase()), row, recent));
+ assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO
+ .toUpperCase()), row, recent));
}
-
+
public void testTextShouldFindTextInHeaders() throws Exception {
- assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_FIELD), row, recent));
- assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_BODY_ONE), row, recent));
- assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO_FIELD), row, recent));
+ assertTrue(searches.isMatch(SearchQuery
+ .mailContains(SAMPLE_INNER_MAIL_FIELD), row, recent));
+ assertTrue(searches.isMatch(SearchQuery
+ .mailContains(SAMPLE_INNER_MAIL_BODY_ONE), row, recent));
+ assertTrue(searches.isMatch(SearchQuery
+ .mailContains(SAMPLE_PART_TWO_FIELD), row, recent));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org