james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1058068 - in /james/mime4j/trunk/dom/src: main/java/org/apache/james/mime4j/dom/address/ main/java/org/apache/james/mime4j/field/address/parser/ test/java/org/apache/james/mime4j/field/address/
Date Wed, 12 Jan 2011 11:01:14 GMT
Author: olegk
Date: Wed Jan 12 11:01:13 2011
New Revision: 1058068

URL: http://svn.apache.org/viewvc?rev=1058068&view=rev
Log:
Removed test code from main code base; removed bogus interactive test

Modified:
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/address/AddressList.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/address/parser/AddressBuilder.java
    james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/address/AddressList.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/address/AddressList.java?rev=1058068&r1=1058067&r2=1058068&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/address/AddressList.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/address/AddressList.java
Wed Jan 12 11:01:13 2011
@@ -95,14 +95,4 @@ public class AddressList extends Abstrac
         return new MailboxList(results, false);
     }
 
-    /**
-     * Dumps a representation of this address list to stdout, for debugging
-     * purposes.
-     */
-    public void print() {
-        for (Address addr : addresses) {
-            System.out.println(addr.toString());
-        }
-    }
-
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/address/parser/AddressBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/address/parser/AddressBuilder.java?rev=1058068&r1=1058067&r2=1058068&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/address/parser/AddressBuilder.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/address/parser/AddressBuilder.java
Wed Jan 12 11:01:13 2011
@@ -71,30 +71,6 @@ public class AddressBuilder {
     }
 
     /**
-     * Test console for AddressList
-     */
-    public static void main(String[] args) throws Exception {
-        java.io.BufferedReader reader = new java.io.BufferedReader(
-                new java.io.InputStreamReader(System.in));
-        while (true) {
-            try {
-                System.out.print("> ");
-                String line = reader.readLine();
-                if (line.length() == 0 || line.toLowerCase().equals("exit")
-                        || line.toLowerCase().equals("quit")) {
-                    System.out.println("Goodbye.");
-                    return;
-                }
-                AddressList list = AddressBuilder.parseAddressList(line, DecodeMonitor.STRICT);
-                list.print();
-            } catch (Exception e) {
-                e.printStackTrace();
-                Thread.sleep(300);
-            }
-        }
-    }
-
-    /**
      * Parses the specified raw string into a mailbox address.
      * 
      * @param rawMailboxString

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java?rev=1058068&r1=1058067&r2=1058068&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java
(original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java
Wed Jan 12 11:01:13 2011
@@ -31,13 +31,6 @@ import org.apache.james.mime4j.field.add
 import org.apache.james.mime4j.field.address.parser.MailboxImpl;
 import org.apache.james.mime4j.field.address.parser.ParseException;
 
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.io.PrintStream;
-import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -218,72 +211,6 @@ public class AddressTest extends TestCas
         assertEquals(2, dlcopy.flatten().size());
     }
 
-    public void testInteractiveMain() throws Exception {
-        PrintStream out_orig = System.out;
-        InputStream in_orig = System.in;
-        PrintStream err_orig = System.err;
-        try {
-            PipedOutputStream piped = new PipedOutputStream();
-            PipedInputStream newInput = new PipedInputStream(piped);
-            
-            PipedInputStream inOut = new PipedInputStream();
-            PrintStream outPs = new PrintStream(new PipedOutputStream(inOut));
-            BufferedReader outReader = new BufferedReader(new InputStreamReader(inOut));
-            PipedInputStream inErr = new PipedInputStream();
-            PrintStream errPs = new PrintStream(new PipedOutputStream(inErr));
-            BufferedReader errReader = new BufferedReader(new InputStreamReader(inErr));
-            
-            
-            System.setIn(newInput);
-            System.setOut(outPs);
-            System.setErr(errPs);
-            Thread t = new Thread() {
-                @Override
-                public void run() {
-                    try {
-                        AddressBuilder.main(null);
-                    } catch (Exception e) {
-                        fail("Catched an exception in main: "+e);
-                    }
-                }
-            };
-            t.start();
-            
-            PrintWriter input = new PrintWriter(piped);
-            
-            input.write("Test <test@example.com>\r\n");
-            input.flush();
-
-            String out = outReader.readLine();
-            assertEquals("> Test <test@example.com>", out);
-
-            input.write("A <foo@example.com>\r\n");
-            input.flush();
-            
-            String out2 = outReader.readLine();
-            assertEquals("> A <foo@example.com>", out2);
-
-            input.write("\"Foo Bar\" <foo>\r\n");
-            input.flush();
-            
-            String out3 = errReader.readLine();
-            assertNotNull(out3);
-
-            input.write("quit\r\n");
-            input.flush();
-            
-            // we read 2 angular brackets because one was from the previous exception error.
-            String out4 = outReader.readLine();
-            assertEquals("> > Goodbye.", out4);
-
-            t.join();
-        } finally {
-            System.setIn(in_orig);
-            System.setOut(out_orig);
-            System.setErr(err_orig);
-        }
-    }
-
     public void testEmptyDomainList() {
         DomainList dl = new DomainList(null, false);
         assertEquals(0, dl.size());



Mime
View raw message