geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1620683 [15/17] - in /geronimo/specs/trunk: ./ geronimo-javamail_1.5_spec/ geronimo-javamail_1.5_spec/src/ geronimo-javamail_1.5_spec/src/main/ geronimo-javamail_1.5_spec/src/main/java/ geronimo-javamail_1.5_spec/src/main/java/javax/ geron...
Date Tue, 26 Aug 2014 18:17:09 GMT
Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/HeaderTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/HeaderTest.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/HeaderTest.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/HeaderTest.java Tue Aug 26 18:17:06 2014
@@ -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.
+ */
+
+package javax.mail;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HeaderTest extends TestCase {
+    public HeaderTest(final String name) {
+        super(name);
+    }
+    public void testHeader() {
+        final Header header = new Header("One", "Two");
+        assertEquals("One", header.getName());
+        assertEquals("Two", header.getValue());
+    }
+}

Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/MessageContextTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/MessageContextTest.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/MessageContextTest.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/MessageContextTest.java Tue Aug 26 18:17:06 2014
@@ -0,0 +1,272 @@
+/*
+ * 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 javax.mail;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MessageContextTest extends TestCase {
+    public void testNothing() {
+    }
+    /*
+    public void testMessageContext() {
+        Part p;
+        MessageContext mc;
+        p = new TestPart();
+        mc = new MessageContext(p);
+        assertSame(p, mc.getPart());
+        assertNull(mc.getMessage());
+        assertNull(mc.getSession());
+
+        Session s = Session.getDefaultInstance(null);
+        MimeMessage m = new MimeMessage(s);
+        p = new TestMultipart(m);
+        mc = new MessageContext(p);
+        assertSame(p, mc.getPart());
+        assertSame(m,mc.getMessage());
+        assertSame(s,mc.getSession());
+
+    }
+    private static class TestMultipart extends Multipart implements Part {
+        public TestMultipart(Part p) {
+            parent = p;
+        }
+        public void writeTo(OutputStream out) throws IOException, MessagingException {
+        }
+        public void addHeader(String name, String value) throws MessagingException {
+        }
+        public Enumeration getAllHeaders() throws MessagingException {
+            return null;
+        }
+        public Object getContent() throws IOException, MessagingException {
+            return null;
+        }
+        public DataHandler getDataHandler() throws MessagingException {
+            return null;
+        }
+        public String getDescription() throws MessagingException {
+            return null;
+        }
+        public String getDisposition() throws MessagingException {
+            return null;
+        }
+        public String getFileName() throws MessagingException {
+            return null;
+        }
+        public String[] getHeader(String name) throws MessagingException {
+            return null;
+        }
+        public InputStream getInputStream() throws IOException, MessagingException {
+            return null;
+        }
+        public int getLineCount() throws MessagingException {
+            return 0;
+        }
+        public Enumeration getMatchingHeaders(String[] names) throws MessagingException {
+            return null;
+        }
+        public Enumeration getNonMatchingHeaders(String[] names) throws MessagingException {
+            return null;
+        }
+        public int getSize() throws MessagingException {
+            return 0;
+        }
+        public boolean isMimeType(String mimeType) throws MessagingException {
+            return false;
+        }
+        public void removeHeader(String name) throws MessagingException {
+        }
+        public void setContent(Multipart content) throws MessagingException {
+        }
+        public void setContent(Object content, String type) throws MessagingException {
+        }
+        public void setDataHandler(DataHandler handler) throws MessagingException {
+        }
+        public void setDescription(String description) throws MessagingException {
+        }
+        public void setDisposition(String disposition) throws MessagingException {
+        }
+        public void setFileName(String name) throws MessagingException {
+        }
+        public void setHeader(String name, String value) throws MessagingException {
+        }
+        public void setText(String content) throws MessagingException {
+        }
+    }
+    private static class TestBodyPart extends BodyPart {
+        public TestBodyPart(Multipart p) {
+            super();
+            parent = p;
+        }
+        public void addHeader(String name, String value)
+            throws MessagingException {
+        }
+        public Enumeration getAllHeaders() throws MessagingException {
+            return null;
+        }
+        public Object getContent() throws IOException, MessagingException {
+            return null;
+        }
+        public String getContentType() throws MessagingException {
+            return null;
+        }
+        public DataHandler getDataHandler() throws MessagingException {
+            return null;
+        }
+        public String getDescription() throws MessagingException {
+            return null;
+        }
+        public String getDisposition() throws MessagingException {
+            return null;
+        }
+        public String getFileName() throws MessagingException {
+            return null;
+        }
+        public String[] getHeader(String name) throws MessagingException {
+            return null;
+        }
+        public InputStream getInputStream()
+            throws IOException, MessagingException {
+            return null;
+        }
+        public int getLineCount() throws MessagingException {
+            return 0;
+        }
+        public Enumeration getMatchingHeaders(String[] names)
+            throws MessagingException {
+            return null;
+        }
+        public Enumeration getNonMatchingHeaders(String[] names)
+            throws MessagingException {
+            return null;
+        }
+        public int getSize() throws MessagingException {
+            return 0;
+        }
+        public boolean isMimeType(String mimeType) throws MessagingException {
+            return false;
+        }
+        public void removeHeader(String name) throws MessagingException {
+        }
+        public void setContent(Multipart content) throws MessagingException {
+        }
+        public void setContent(Object content, String type)
+            throws MessagingException {
+        }
+        public void setDataHandler(DataHandler handler)
+            throws MessagingException {
+        }
+        public void setDescription(String description)
+            throws MessagingException {
+        }
+        public void setDisposition(String disposition)
+            throws MessagingException {
+        }
+        public void setFileName(String name) throws MessagingException {
+        }
+        public void setHeader(String name, String value)
+            throws MessagingException {
+        }
+        public void setText(String content) throws MessagingException {
+        }
+        public void writeTo(OutputStream out)
+            throws IOException, MessagingException {
+        }
+    }
+    private static class TestPart implements Part {
+        public void addHeader(String name, String value)
+            throws MessagingException {
+        }
+        public Enumeration getAllHeaders() throws MessagingException {
+            return null;
+        }
+        public Object getContent() throws IOException, MessagingException {
+            return null;
+        }
+        public String getContentType() throws MessagingException {
+            return null;
+        }
+        public DataHandler getDataHandler() throws MessagingException {
+            return null;
+        }
+        public String getDescription() throws MessagingException {
+            return null;
+        }
+        public String getDisposition() throws MessagingException {
+            return null;
+        }
+        public String getFileName() throws MessagingException {
+            return null;
+        }
+        public String[] getHeader(String name) throws MessagingException {
+            return null;
+        }
+        public InputStream getInputStream()
+            throws IOException, MessagingException {
+            return null;
+        }
+        public int getLineCount() throws MessagingException {
+            return 0;
+        }
+        public Enumeration getMatchingHeaders(String[] names)
+            throws MessagingException {
+            return null;
+        }
+        public Enumeration getNonMatchingHeaders(String[] names)
+            throws MessagingException {
+            return null;
+        }
+        public int getSize() throws MessagingException {
+            return 0;
+        }
+        public boolean isMimeType(String mimeType) throws MessagingException {
+            return false;
+        }
+        public void removeHeader(String name) throws MessagingException {
+        }
+        public void setContent(Multipart content) throws MessagingException {
+        }
+        public void setContent(Object content, String type)
+            throws MessagingException {
+        }
+        public void setDataHandler(DataHandler handler)
+            throws MessagingException {
+        }
+        public void setDescription(String description)
+            throws MessagingException {
+        }
+        public void setDisposition(String disposition)
+            throws MessagingException {
+        }
+        public void setFileName(String name) throws MessagingException {
+        }
+        public void setHeader(String name, String value)
+            throws MessagingException {
+        }
+        public void setText(String content) throws MessagingException {
+        }
+        public void writeTo(OutputStream out)
+            throws IOException, MessagingException {
+        }
+    }
+    */
+}

Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/MessagingExceptionTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/MessagingExceptionTest.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/MessagingExceptionTest.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/MessagingExceptionTest.java Tue Aug 26 18:17:06 2014
@@ -0,0 +1,99 @@
+/*
+ * 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 javax.mail;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Revision $ $Date$
+ */
+public class MessagingExceptionTest extends TestCase {
+    private RuntimeException e;
+    private MessagingException d;
+    private MessagingException c;
+    private MessagingException b;
+    private MessagingException a;
+    public MessagingExceptionTest(final String name) {
+        super(name);
+    }
+    
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        
+        //Initialize cause with null, make sure the getCause will not be affected
+        a = new MessagingException("A", null);
+        b = new MessagingException("B");
+        c = new MessagingException("C");
+        d = new MessagingException("D");
+        e = new RuntimeException("E");
+    }
+    
+    public void testMessagingExceptionString() {
+        assertEquals("A", a.getMessage());
+    }
+    
+    public void testNextException() {
+        assertTrue(a.setNextException(b));
+        assertEquals(b, a.getNextException());
+        assertEquals(b, a.getCause());
+        
+        assertTrue(a.setNextException(c));
+        assertEquals(b, a.getNextException());
+        assertEquals(c, b.getNextException());
+        assertEquals(c, b.getCause());
+        
+        assertTrue(a.setNextException(d));
+        
+        assertEquals(b, a.getNextException());
+        assertEquals(b, a.getCause());
+        
+        assertEquals(c, b.getNextException());
+        assertEquals(c, b.getCause());
+        
+        assertEquals(d, c.getNextException());
+        assertEquals(d, c.getCause());
+        
+        final String message = a.getMessage();
+        final int ap = message.indexOf("A");
+        final int bp = message.indexOf("B");
+        final int cp = message.indexOf("C");
+        assertTrue("A does not contain 'A'", ap != -1);
+        assertTrue("B does not contain 'B'", bp != -1);
+        assertTrue("C does not contain 'C'", cp != -1);
+    }
+    
+    public void testNextExceptionWrong() {
+        assertTrue(a.setNextException(e));
+        assertFalse(a.setNextException(b));
+    }
+    
+    public void testNextExceptionWrong2() {
+        assertTrue(a.setNextException(e));
+        assertFalse(a.setNextException(b));
+    }
+    
+    public void testMessagingExceptionStringException() {
+        final MessagingException x = new MessagingException("X", a);
+        assertEquals("X (javax.mail.MessagingException: A)", x.getMessage());
+        assertEquals(a, x.getNextException());
+        assertEquals(a, x.getCause());
+    }
+}

Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/PasswordAuthenticationTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/PasswordAuthenticationTest.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/PasswordAuthenticationTest.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/PasswordAuthenticationTest.java Tue Aug 26 18:17:06 2014
@@ -0,0 +1,43 @@
+/*
+ * 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 javax.mail;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PasswordAuthenticationTest extends TestCase {
+    public PasswordAuthenticationTest(final String name) {
+        super(name);
+    }
+    public void testPA() {
+        final String user = String.valueOf(System.currentTimeMillis());
+        final String password = "JobbyJobbyJobby" + user;
+        final PasswordAuthentication pa = new PasswordAuthentication(user, password);
+        assertEquals(user, pa.getUserName());
+        assertEquals(password, pa.getPassword());
+    }
+    public void testPasswordAuthentication() {
+        final PasswordAuthentication pa = new PasswordAuthentication("Alex", "xelA");
+        assertEquals("Alex", pa.getUserName());
+        assertEquals("xelA", pa.getPassword());
+    }
+}

Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/QuotaTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/QuotaTest.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/QuotaTest.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/QuotaTest.java Tue Aug 26 18:17:06 2014
@@ -0,0 +1,66 @@
+/*
+ * 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 javax.mail;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class QuotaTest extends TestCase {
+
+    public void testQuota() throws MessagingException {
+        final Quota quota = new Quota("Fred");
+
+        assertEquals(quota.quotaRoot, "Fred");
+        assertNull(quota.resources);
+
+        quota.setResourceLimit("Storage", 20000);
+
+        assertNotNull(quota.resources);
+        assertTrue(quota.resources.length == 1);
+        assertEquals(quota.resources[0].name, "Storage");
+        assertEquals(quota.resources[0].usage, 0);
+        assertEquals(quota.resources[0].limit, 20000);
+
+        quota.setResourceLimit("Storage", 30000);
+
+        assertNotNull(quota.resources);
+        assertTrue(quota.resources.length == 1);
+        assertEquals(quota.resources[0].name, "Storage");
+        assertEquals(quota.resources[0].usage, 0);
+        assertEquals(quota.resources[0].limit, 30000);
+
+        quota.setResourceLimit("Folders", 5);
+
+        assertNotNull(quota.resources);
+        assertTrue(quota.resources.length == 2);
+        assertEquals(quota.resources[0].name, "Storage");
+        assertEquals(quota.resources[0].usage, 0);
+        assertEquals(quota.resources[0].limit, 30000);
+
+        assertEquals(quota.resources[1].name, "Folders");
+        assertEquals(quota.resources[1].usage, 0);
+        assertEquals(quota.resources[1].limit, 5);
+    }
+
+}
+
+

Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/SessionTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/SessionTest.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/SessionTest.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/SessionTest.java Tue Aug 26 18:17:06 2014
@@ -0,0 +1,87 @@
+/*
+ * 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 javax.mail;
+
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SessionTest extends TestCase {
+    public void testAddProvider() throws MessagingException {
+        final Properties props = System.getProperties();
+         // Get a Session object
+        final Session mailSession = Session.getDefaultInstance(props, null);
+
+        mailSession.addProvider(new Provider(Provider.Type.TRANSPORT, "foo", NullTransport.class.getName(), "Apache", "Java 1.4 Test"));
+
+        // retrieve the transport
+        Transport trans = mailSession.getTransport("foo");
+
+        assertTrue(trans instanceof NullTransport);
+
+        mailSession.setProtocolForAddress("foo", "foo");
+
+        trans = mailSession.getTransport(new FooAddress());
+
+        assertTrue(trans instanceof NullTransport);
+    }
+
+    static public class NullTransport extends Transport {
+        public NullTransport(final Session session, final URLName urlName) {
+            super(session, urlName);
+        }
+
+        @Override
+        public void sendMessage(final Message message, final Address[] addresses) throws MessagingException {
+            // do nothing
+        }
+
+        @Override
+        protected boolean protocolConnect(final String host, final int port, final String user, final String password) throws MessagingException {
+            return true; // always connect
+        }
+
+    }
+
+    static public class FooAddress extends Address {
+        public FooAddress() {
+        }
+
+        @Override
+        public String getType() {
+            return "foo";
+        }
+
+        @Override
+        public String toString() {
+            return "yada";
+        }
+
+
+        @Override
+        public boolean equals(final Object other) {
+            return true;
+        }
+    }
+}
+

Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/SimpleFolder.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/SimpleFolder.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/SimpleFolder.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/SimpleFolder.java Tue Aug 26 18:17:06 2014
@@ -0,0 +1,207 @@
+/*
+ * 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 javax.mail;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SimpleFolder extends Folder {
+    private static final Message[] MESSAGE_ARRAY = new Message[0];
+    private List _messages = new LinkedList();
+    private String _name;
+    public SimpleFolder(final Store store) {
+        this(store, "SimpleFolder");
+    }
+    SimpleFolder(final Store store, final String name) {
+        super(store);
+        _name = name;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#appendMessages(javax.mail.Message[])
+     */
+    @Override
+    public void appendMessages(final Message[] messages) throws MessagingException {
+        for (int i = 0; i < messages.length; i++) {
+            final Message message = messages[i];
+            _messages.add(message);
+        }
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#close(boolean)
+     */
+    @Override
+    public void close(final boolean expunge) throws MessagingException {
+        if (expunge) {
+            expunge();
+        }
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#create(int)
+     */
+    @Override
+    public boolean create(final int type) throws MessagingException {
+        if (type == HOLDS_MESSAGES) {
+            return true;
+        } else {
+            throw new MessagingException("Cannot create folders that hold folders");
+        }
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#delete(boolean)
+     */
+    @Override
+    public boolean delete(final boolean recurse) throws MessagingException {
+        _messages = new LinkedList();
+        return true;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#exists()
+     */
+    @Override
+    public boolean exists() throws MessagingException {
+        return true;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#expunge()
+     */
+    @Override
+    public Message[] expunge() throws MessagingException {
+        final Iterator it = _messages.iterator();
+        final List result = new LinkedList();
+        while (it.hasNext()) {
+            final Message message = (Message) it.next();
+            if (message.isSet(Flags.Flag.DELETED)) {
+                it.remove();
+                result.add(message);
+            }
+        }
+        // run through and renumber the messages
+        for (int i = 0; i < _messages.size(); i++) {
+            final Message message = (Message) _messages.get(i);
+            message.setMessageNumber(i);
+        }
+        return (Message[]) result.toArray(MESSAGE_ARRAY);
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#getFolder(java.lang.String)
+     */
+    @Override
+    public Folder getFolder(final String name) throws MessagingException {
+        return null;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#getFullName()
+     */
+    @Override
+    public String getFullName() {
+        return getName();
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#getMessage(int)
+     */
+    @Override
+    public Message getMessage(final int id) throws MessagingException {
+        return (Message) _messages.get(id);
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#getMessageCount()
+     */
+    @Override
+    public int getMessageCount() throws MessagingException {
+        return _messages.size();
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#getName()
+     */
+    @Override
+    public String getName() {
+        return _name;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#getParent()
+     */
+    @Override
+    public Folder getParent() throws MessagingException {
+        return null;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#getPermanentFlags()
+     */
+    @Override
+    public Flags getPermanentFlags() {
+        return null;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#getSeparator()
+     */
+    @Override
+    public char getSeparator() throws MessagingException {
+        return '/';
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#getType()
+     */
+    @Override
+    public int getType() throws MessagingException {
+        return HOLDS_MESSAGES;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#hasNewMessages()
+     */
+    @Override
+    public boolean hasNewMessages() throws MessagingException {
+        return false;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#isOpen()
+     */
+    @Override
+    public boolean isOpen() {
+        return true;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#list(java.lang.String)
+     */
+    @Override
+    public Folder[] list(final String pattern) throws MessagingException {
+        return null;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#open(int)
+     */
+    @Override
+    public void open(final int mode) throws MessagingException {
+        if (mode != HOLDS_MESSAGES) {
+            throw new MessagingException("SimpleFolder can only be opened with HOLDS_MESSAGES");
+        }
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Folder#renameTo(javax.mail.Folder)
+     */
+    @Override
+    public boolean renameTo(final Folder newName) throws MessagingException {
+        _name = newName.getName();
+        return true;
+    }
+}

Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/SimpleTextMessage.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/SimpleTextMessage.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/SimpleTextMessage.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/SimpleTextMessage.java Tue Aug 26 18:17:06 2014
@@ -0,0 +1,357 @@
+/*
+ * 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 javax.mail;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.activation.DataHandler;
+import javax.mail.internet.InternetAddress;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SimpleTextMessage extends Message {
+    public static final Address[] ADDRESS_ARRAY = new Address[0];
+    private final List _bcc = new LinkedList();
+    private final List _cc = new LinkedList();
+    private String _description;
+    private final Flags _flags = new Flags();
+    private final List _from = new LinkedList();
+    private Date _received;
+    private Date _sent;
+    private String _subject;
+    private String _text;
+    private List _to = new LinkedList();
+    /**
+     * @param folder
+     * @param number
+     */
+    public SimpleTextMessage(final Folder folder, final int number) {
+        super(folder, number);
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Message#addFrom(javax.mail.Address[])
+     */
+    @Override
+    public void addFrom(final Address[] addresses) throws MessagingException {
+        _from.addAll(Arrays.asList(addresses));
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#addHeader(java.lang.String, java.lang.String)
+     */
+    public void addHeader(final String name, final String value)
+        throws MessagingException {
+        throw new UnsupportedOperationException("Method not implemented");
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Message#addRecipients(javax.mail.Message.RecipientType, javax.mail.Address[])
+     */
+    @Override
+    public void addRecipients(final RecipientType type, final Address[] addresses)
+        throws MessagingException {
+        getList(type).addAll(Arrays.asList(addresses));
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#getAllHeaders()
+     */
+    public Enumeration getAllHeaders() throws MessagingException {
+        throw new UnsupportedOperationException("Method not implemented");
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#getContent()
+     */
+    public Object getContent() throws IOException, MessagingException {
+        return _text;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#getContentType()
+     */
+    public String getContentType() throws MessagingException {
+        return "text/plain";
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#getDataHandler()
+     */
+    public DataHandler getDataHandler() throws MessagingException {
+        throw new UnsupportedOperationException("Method not implemented");
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#getDescription()
+     */
+    public String getDescription() throws MessagingException {
+        return _description;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#getDisposition()
+     */
+    public String getDisposition() throws MessagingException {
+        return Part.INLINE;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#getFileName()
+     */
+    public String getFileName() throws MessagingException {
+        return null;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Message#getFlags()
+     */
+    @Override
+    public Flags getFlags() throws MessagingException {
+        return _flags;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Message#getFrom()
+     */
+    @Override
+    public Address[] getFrom() throws MessagingException {
+        return (Address[]) _from.toArray(ADDRESS_ARRAY);
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#getHeader(java.lang.String)
+     */
+    public String[] getHeader(final String name) throws MessagingException {
+        throw new UnsupportedOperationException("Method not implemented");
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#getInputStream()
+     */
+    public InputStream getInputStream()
+        throws IOException, MessagingException {
+        throw new UnsupportedOperationException("Method not implemented");
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#getLineCount()
+     */
+    public int getLineCount() throws MessagingException {
+        throw new UnsupportedOperationException("Method not implemented");
+    }
+    private List getList(final RecipientType type) throws MessagingException {
+        List list;
+        if (type == RecipientType.TO) {
+            list = _to;
+        } else if (type == RecipientType.CC) {
+            list = _cc;
+        } else if (type == RecipientType.BCC) {
+            list = _bcc;
+        } else {
+            throw new MessagingException("Address type not understood");
+        }
+        return list;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#getMatchingHeaders(java.lang.String[])
+     */
+    public Enumeration getMatchingHeaders(final String[] names)
+        throws MessagingException {
+        throw new UnsupportedOperationException("Method not implemented");
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#getNonMatchingHeaders(java.lang.String[])
+     */
+    public Enumeration getNonMatchingHeaders(final String[] names)
+        throws MessagingException {
+        throw new UnsupportedOperationException("Method not implemented");
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Message#getReceivedDate()
+     */
+    @Override
+    public Date getReceivedDate() throws MessagingException {
+        return _received;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Message#getRecipients(javax.mail.Message.RecipientType)
+     */
+    @Override
+    public Address[] getRecipients(final RecipientType type)
+        throws MessagingException {
+        return (Address[]) getList(type).toArray(ADDRESS_ARRAY);
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Message#getSentDate()
+     */
+    @Override
+    public Date getSentDate() throws MessagingException {
+        return _sent;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#getSize()
+     */
+    public int getSize() throws MessagingException {
+        return _text.length();
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Message#getSubject()
+     */
+    @Override
+    public String getSubject() throws MessagingException {
+        return _subject;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#isMimeType(java.lang.String)
+     */
+    public boolean isMimeType(final String mimeType) throws MessagingException {
+        return mimeType.equals("text/plain") || mimeType.equals("text/*");
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#removeHeader(java.lang.String)
+     */
+    public void removeHeader(final String name) throws MessagingException {
+        throw new UnsupportedOperationException("Method not implemented");
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Message#reply(boolean)
+     */
+    @Override
+    public Message reply(final boolean replyToAll) throws MessagingException {
+        try {
+            final SimpleTextMessage reply = (SimpleTextMessage) this.clone();
+            reply._to = new LinkedList(_from);
+            if (replyToAll) {
+                reply._to.addAll(_cc);
+            }
+            return reply;
+        } catch (final CloneNotSupportedException e) {
+            throw new MessagingException(e.getMessage());
+        }
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Message#saveChanges()
+     */
+    @Override
+    public void saveChanges() throws MessagingException {
+        throw new UnsupportedOperationException("Method not implemented");
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#setContent(javax.mail.Multipart)
+     */
+    public void setContent(final Multipart content) throws MessagingException {
+        throw new UnsupportedOperationException("Method not implemented");
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#setContent(java.lang.Object, java.lang.String)
+     */
+    public void setContent(final Object content, final String type)
+        throws MessagingException {
+        setText((String) content);
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#setDataHandler(javax.activation.DataHandler)
+     */
+    public void setDataHandler(final DataHandler handler) throws MessagingException {
+        throw new UnsupportedOperationException("Method not implemented");
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#setDescription(java.lang.String)
+     */
+    public void setDescription(final String description) throws MessagingException {
+        _description = description;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#setDisposition(java.lang.String)
+     */
+    public void setDisposition(final String disposition) throws MessagingException {
+        throw new UnsupportedOperationException("Method not implemented");
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#setFileName(java.lang.String)
+     */
+    public void setFileName(final String name) throws MessagingException {
+        throw new UnsupportedOperationException("Method not implemented");
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Message#setFlags(javax.mail.Flags, boolean)
+     */
+    @Override
+    public void setFlags(final Flags flags, final boolean set) throws MessagingException {
+        if (set) {
+            _flags.add(flags);
+        } else {
+            _flags.remove(flags);
+        }
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Message#setFrom()
+     */
+    @Override
+    public void setFrom() throws MessagingException {
+        setFrom(new InternetAddress("root@localhost"));
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Message#setFrom(javax.mail.Address)
+     */
+    @Override
+    public void setFrom(final Address address) throws MessagingException {
+        _from.clear();
+        _from.add(address);
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#setHeader(java.lang.String, java.lang.String)
+     */
+    public void setHeader(final String name, final String value)
+        throws MessagingException {
+        throw new UnsupportedOperationException("Method not implemented");
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Message#setRecipients(javax.mail.Message.RecipientType, javax.mail.Address[])
+     */
+    @Override
+    public void setRecipients(final RecipientType type, final Address[] addresses)
+        throws MessagingException {
+        final List list = getList(type);
+        list.clear();
+        list.addAll(Arrays.asList(addresses));
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Message#setSentDate(java.util.Date)
+     */
+    @Override
+    public void setSentDate(final Date sent) throws MessagingException {
+        _sent = sent;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Message#setSubject(java.lang.String)
+     */
+    @Override
+    public void setSubject(final String subject) throws MessagingException {
+        _subject = subject;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#setText(java.lang.String)
+     */
+    public void setText(final String content) throws MessagingException {
+        _text = content;
+    }
+    /* (non-Javadoc)
+     * @see javax.mail.Part#writeTo(java.io.OutputStream)
+     */
+    public void writeTo(final OutputStream out)
+        throws IOException, MessagingException {
+        throw new UnsupportedOperationException("Method not implemented");
+    }
+}

Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/TestData.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/TestData.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/TestData.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/TestData.java Tue Aug 26 18:17:06 2014
@@ -0,0 +1,146 @@
+/*
+ * 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 javax.mail;
+
+import javax.mail.internet.MimeMessage;
+
+public class TestData {
+    public static Store getTestStore() {
+        return new Store(
+            getTestSession(),
+            new URLName("http://alex@test.com")) {
+            @Override
+            public Folder getDefaultFolder() throws MessagingException {
+                return getTestFolder();
+            }
+            @Override
+            public Folder getFolder(final String name) throws MessagingException {
+                if (name.equals("test")) {
+                    return getTestFolder();
+                } else {
+                    return null;
+                }
+            }
+            @Override
+            public Folder getFolder(final URLName name) throws MessagingException {
+                return getTestFolder();
+            }
+        };
+    }
+    public static Session getTestSession() {
+        return Session.getDefaultInstance(System.getProperties());
+    }
+    public static Folder getTestFolder() {
+        return new Folder(getTestStore()) {
+            @Override
+            public void appendMessages(final Message[] messages)
+                throws MessagingException {
+            }
+            @Override
+            public void close(final boolean expunge) throws MessagingException {
+            }
+            @Override
+            public boolean create(final int type) throws MessagingException {
+                return false;
+            }
+            @Override
+            public boolean delete(final boolean recurse) throws MessagingException {
+                return false;
+            }
+            @Override
+            public boolean exists() throws MessagingException {
+                return false;
+            }
+            @Override
+            public Message[] expunge() throws MessagingException {
+                return null;
+            }
+            @Override
+            public Folder getFolder(final String name) throws MessagingException {
+                return null;
+            }
+            @Override
+            public String getFullName() {
+                return null;
+            }
+            @Override
+            public Message getMessage(final int id) throws MessagingException {
+                return null;
+            }
+            @Override
+            public int getMessageCount() throws MessagingException {
+                return 0;
+            }
+            @Override
+            public String getName() {
+                return null;
+            }
+            @Override
+            public Folder getParent() throws MessagingException {
+                return null;
+            }
+            @Override
+            public Flags getPermanentFlags() {
+                return null;
+            }
+            @Override
+            public char getSeparator() throws MessagingException {
+                return 0;
+            }
+            @Override
+            public int getType() throws MessagingException {
+                return 0;
+            }
+            @Override
+            public boolean hasNewMessages() throws MessagingException {
+                return false;
+            }
+            @Override
+            public boolean isOpen() {
+                return false;
+            }
+            @Override
+            public Folder[] list(final String pattern) throws MessagingException {
+                return null;
+            }
+            @Override
+            public void open(final int mode) throws MessagingException {
+            }
+            @Override
+            public boolean renameTo(final Folder newName) throws MessagingException {
+                return false;
+            }
+        };
+    }
+    public static Transport getTestTransport() {
+        return new Transport(
+            getTestSession(),
+            new URLName("http://host.name")) {
+            @Override
+            public void sendMessage(final Message message, final Address[] addresses)
+                throws MessagingException {
+            }
+        };
+    }
+    public static Message getMessage() {
+        return new MimeMessage(getTestFolder(), 1) {
+        };
+    }
+}

Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/URLNameTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/URLNameTest.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/URLNameTest.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/URLNameTest.java Tue Aug 26 18:17:06 2014
@@ -0,0 +1,392 @@
+/*
+ * 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 javax.mail;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class URLNameTest extends TestCase {
+    public URLNameTest(final String name) {
+        super(name);
+    }
+
+    public void testURLNameString() {
+        String s;
+        URLName name;
+
+        s = "http://www.apache.org";
+        name = new URLName(s);
+        assertEquals(s, name.toString());
+        assertEquals("http", name.getProtocol());
+        assertEquals("www.apache.org", name.getHost());
+        assertEquals(-1, name.getPort());
+        assertNull(name.getFile());
+        assertNull(name.getRef());
+        assertNull(name.getUsername());
+        assertNull(name.getPassword());
+        try {
+            assertEquals(new URL(s), name.getURL());
+        } catch (final MalformedURLException e) {
+            fail();
+        }
+
+        s = "http://www.apache.org/file/file1#ref";
+        name = new URLName(s);
+        assertEquals(s, name.toString());
+        assertEquals("http", name.getProtocol());
+        assertEquals("www.apache.org", name.getHost());
+        assertEquals(-1, name.getPort());
+        assertEquals("file/file1", name.getFile());
+        assertEquals("ref", name.getRef());
+        assertNull(name.getUsername());
+        assertNull(name.getPassword());
+        try {
+            assertEquals(new URL(s), name.getURL());
+        } catch (final MalformedURLException e) {
+            fail();
+        }
+
+        s = "http://www.apache.org/file/";
+        name = new URLName(s);
+        assertEquals(s, name.toString());
+        assertEquals("http", name.getProtocol());
+        assertEquals("www.apache.org", name.getHost());
+        assertEquals(-1, name.getPort());
+        assertEquals("file/", name.getFile());
+        assertNull(name.getRef());
+        assertNull(name.getUsername());
+        assertNull(name.getPassword());
+        try {
+            assertEquals(new URL(s), name.getURL());
+        } catch (final MalformedURLException e) {
+            fail();
+        }
+
+        s = "http://john@www.apache.org/file/";
+        name = new URLName(s);
+        assertEquals(s, name.toString());
+        assertEquals("http", name.getProtocol());
+        assertEquals("www.apache.org", name.getHost());
+        assertEquals(-1, name.getPort());
+        assertEquals("file/", name.getFile());
+        assertNull(name.getRef());
+        assertEquals("john", name.getUsername());
+        assertNull(name.getPassword());
+        try {
+            assertEquals(new URL(s), name.getURL());
+        } catch (final MalformedURLException e) {
+            fail();
+        }
+
+        s = "http://john:doe@www.apache.org/file/";
+        name = new URLName(s);
+        assertEquals(s, name.toString());
+        assertEquals("http", name.getProtocol());
+        assertEquals("www.apache.org", name.getHost());
+        assertEquals(-1, name.getPort());
+        assertEquals("file/", name.getFile());
+        assertNull(name.getRef());
+        assertEquals("john", name.getUsername());
+        assertEquals("doe", name.getPassword());
+        try {
+            assertEquals(new URL(s), name.getURL());
+        } catch (final MalformedURLException e) {
+            fail();
+        }
+        
+        s = "http://john%40gmail.com:doe@www.apache.org/file/";
+        name = new URLName(s);
+        assertEquals(s, name.toString());
+        assertEquals("http", name.getProtocol());
+        assertEquals("www.apache.org", name.getHost());
+        assertEquals(-1, name.getPort());
+        assertEquals("file/", name.getFile());
+        assertNull(name.getRef());
+        assertEquals("john@gmail.com", name.getUsername());
+        assertEquals("doe", name.getPassword());
+        try {
+            assertEquals(new URL(s), name.getURL());
+        } catch (final MalformedURLException e) {
+            fail();
+        }
+
+        s = "file/file2";
+        name = new URLName(s);
+        assertNull(name.getProtocol());
+        assertNull(name.getHost());
+        assertEquals(-1, name.getPort());
+        assertEquals("file/file2", name.getFile());
+        assertNull(name.getRef());
+        assertNull(name.getUsername());
+        assertNull(name.getPassword());
+        try {
+            name.getURL();
+            fail();
+        } catch (final MalformedURLException e) {
+            // OK
+        }
+
+        name = new URLName((String) null);
+        assertNull( name.getProtocol());
+        assertNull(name.getHost());
+        assertEquals(-1, name.getPort());
+        assertNull(name.getFile());
+        assertNull(name.getRef());
+        assertNull(name.getUsername());
+        assertNull(name.getPassword());
+        try {
+            name.getURL();
+            fail();
+        } catch (final MalformedURLException e) {
+            // OK
+        }
+
+        name = new URLName("");
+        assertNull( name.getProtocol());
+        assertNull(name.getHost());
+        assertEquals(-1, name.getPort());
+        assertNull(name.getFile());
+        assertNull(name.getRef());
+        assertNull(name.getUsername());
+        assertNull(name.getPassword());
+        try {
+            name.getURL();
+            fail();
+        } catch (final MalformedURLException e) {
+            // OK
+        }
+    }
+
+    public void testURLNameAll() {
+        URLName name;
+        name = new URLName(null, null, -1, null, null, null);
+        assertNull(name.getProtocol());
+        assertNull(name.getHost());
+        assertEquals(-1, name.getPort());
+        assertNull(name.getFile());
+        assertNull(name.getRef());
+        assertNull(name.getUsername());
+        assertNull(name.getPassword());
+        try {
+            name.getURL();
+            fail();
+        } catch (final MalformedURLException e) {
+            // OK
+        }
+
+        name = new URLName("", "", -1, "", "", "");
+        assertNull(name.getProtocol());
+        assertNull(name.getHost());
+        assertEquals(-1, name.getPort());
+        assertNull(name.getFile());
+        assertNull(name.getRef());
+        assertNull(name.getUsername());
+        assertNull(name.getPassword());
+        try {
+            name.getURL();
+            fail();
+        } catch (final MalformedURLException e) {
+            // OK
+        }
+
+        name = new URLName("http", "www.apache.org", -1, null, null, null);
+        assertEquals("http://www.apache.org", name.toString());
+        assertEquals("http", name.getProtocol());
+        assertEquals("www.apache.org", name.getHost());
+        assertEquals(-1, name.getPort());
+        assertNull(name.getFile());
+        assertNull(name.getRef());
+        assertNull(name.getUsername());
+        assertNull(name.getPassword());
+        try {
+            assertEquals(new URL("http://www.apache.org"), name.getURL());
+        } catch (final MalformedURLException e) {
+            fail();
+        }
+
+        name = new URLName("http", "www.apache.org", 8080, "", "", "");
+        assertEquals("http://www.apache.org:8080", name.toString());
+        assertEquals("http", name.getProtocol());
+        assertEquals("www.apache.org", name.getHost());
+        assertEquals(8080, name.getPort());
+        assertNull(name.getFile());
+        assertNull(name.getRef());
+        assertNull(name.getUsername());
+        assertNull(name.getPassword());
+        try {
+            assertEquals(new URL("http://www.apache.org:8080"), name.getURL());
+        } catch (final MalformedURLException e) {
+            fail();
+        }
+
+        name = new URLName("http", "www.apache.org", -1, "file/file2", "", "");
+        assertEquals("http://www.apache.org/file/file2", name.toString());
+        assertEquals("http", name.getProtocol());
+        assertEquals("www.apache.org", name.getHost());
+        assertEquals(-1, name.getPort());
+        assertEquals("file/file2", name.getFile());
+        assertNull(name.getRef());
+        assertNull(name.getUsername());
+        assertNull(name.getPassword());
+        try {
+            assertEquals(new URL("http://www.apache.org/file/file2"), name.getURL());
+        } catch (final MalformedURLException e) {
+            fail();
+        }
+
+        name = new URLName("http", "www.apache.org", -1, "file/file2", "john", "");
+        assertEquals("http://john@www.apache.org/file/file2", name.toString());
+        assertEquals("http", name.getProtocol());
+        assertEquals("www.apache.org", name.getHost());
+        assertEquals(-1, name.getPort());
+        assertEquals("file/file2", name.getFile());
+        assertNull(name.getRef());
+        assertEquals("john", name.getUsername());
+        assertNull(name.getPassword());
+        try {
+            assertEquals(new URL("http://john@www.apache.org/file/file2"), name.getURL());
+        } catch (final MalformedURLException e) {
+            fail();
+        }
+
+        name = new URLName("http", "www.apache.org", -1, "file/file2", "john", "doe");
+        assertEquals("http://john:doe@www.apache.org/file/file2", name.toString());
+        assertEquals("http", name.getProtocol());
+        assertEquals("www.apache.org", name.getHost());
+        assertEquals(-1, name.getPort());
+        assertEquals("file/file2", name.getFile());
+        assertNull(name.getRef());
+        assertEquals("john", name.getUsername());
+        assertEquals("doe", name.getPassword());
+        try {
+            assertEquals(new URL("http://john:doe@www.apache.org/file/file2"), name.getURL());
+        } catch (final MalformedURLException e) {
+            fail();
+        }
+
+        name = new URLName("http", "www.apache.org", -1, "file/file2", "john@gmail.com", "doe");
+        assertEquals("http://john%40gmail.com:doe@www.apache.org/file/file2", name.toString());
+        assertEquals("http", name.getProtocol());
+        assertEquals("www.apache.org", name.getHost());
+        assertEquals(-1, name.getPort());
+        assertEquals("file/file2", name.getFile());
+        assertNull(name.getRef());
+        assertEquals("john@gmail.com", name.getUsername());
+        assertEquals("doe", name.getPassword());
+        try {
+            assertEquals(new URL("http://john%40gmail.com:doe@www.apache.org/file/file2"), name.getURL());
+        } catch (final MalformedURLException e) {
+            fail();
+        }
+
+        name = new URLName("http", "www.apache.org", -1, "file/file2", "", "doe");
+        assertEquals("http://www.apache.org/file/file2", name.toString());
+        assertEquals("http", name.getProtocol());
+        assertEquals("www.apache.org", name.getHost());
+        assertEquals(-1, name.getPort());
+        assertEquals("file/file2", name.getFile());
+        assertNull(name.getRef());
+        assertNull(name.getUsername());
+        assertNull(name.getPassword());
+        try {
+            assertEquals(new URL("http://www.apache.org/file/file2"), name.getURL());
+        } catch (final MalformedURLException e) {
+            fail();
+        }
+    }
+
+    public void testURLNameURL() throws MalformedURLException {
+        URL url;
+        URLName name;
+
+        url = new URL("http://www.apache.org");
+        name = new URLName(url);
+        assertEquals("http", name.getProtocol());
+        assertEquals("www.apache.org", name.getHost());
+        assertEquals(-1, name.getPort());
+        assertNull(name.getFile());
+        assertNull(name.getRef());
+        assertNull(name.getUsername());
+        assertNull(name.getPassword());
+        try {
+            assertEquals(url, name.getURL());
+        } catch (final MalformedURLException e) {
+            fail();
+        }
+    }
+
+    public void testEquals() throws MalformedURLException {
+        URLName name1 = new URLName("http://www.apache.org");
+        assertEquals(name1, new URLName("http://www.apache.org"));
+        assertEquals(name1, new URLName(new URL("http://www.apache.org")));
+        assertEquals(name1, new URLName("http", "www.apache.org", -1, null, null, null));
+        assertEquals(name1, new URLName("http://www.apache.org#foo")); // wierd but ref is not part of the equals contract
+        assertTrue(!name1.equals(new URLName("http://www.apache.org:8080")));
+        assertTrue(!name1.equals(new URLName("http://cvs.apache.org")));
+        assertTrue(!name1.equals(new URLName("https://www.apache.org")));
+
+        name1 = new URLName("http://john:doe@www.apache.org");
+        assertEquals(name1, new URLName(new URL("http://john:doe@www.apache.org")));
+        assertEquals(name1, new URLName("http", "www.apache.org", -1, null, "john", "doe"));
+        assertTrue(!name1.equals(new URLName("http://john:xxx@www.apache.org")));
+        assertTrue(!name1.equals(new URLName("http://xxx:doe@www.apache.org")));
+        assertTrue(!name1.equals(new URLName("http://www.apache.org")));
+
+        assertEquals(new URLName("http://john@www.apache.org"), new URLName("http", "www.apache.org", -1, null, "john", null));
+        assertEquals(new URLName("http://www.apache.org"), new URLName("http", "www.apache.org", -1, null, null, "doe"));
+    }
+
+    public void testHashCode() {
+        final URLName name1 = new URLName("http://www.apache.org/file");
+        final URLName name2 = new URLName("http://www.apache.org/file#ref");
+        assertTrue(name1.equals(name2));
+        assertTrue(name1.hashCode() == name2.hashCode());
+    }
+
+    public void testNullProtocol() {
+        final URLName name1 = new URLName(null, "www.apache.org", -1, null, null, null);
+        final URLName name2 = new URLName(null, "www.apache.org", -1, null, null, null);
+        assertTrue(!name2.equals(name1));
+    }
+
+    public void testOpaqueSchemes() {
+        String s;
+        URLName name;
+
+        // not strictly opaque but no protocol handler installed
+        s = "foo://jdoe@apache.org/INBOX";
+        name = new URLName(s);
+        assertEquals(s, name.toString());
+        assertEquals("foo", name.getProtocol());
+        assertEquals("apache.org", name.getHost());
+        assertEquals(-1, name.getPort());
+        assertEquals("INBOX", name.getFile());
+        assertNull(name.getRef());
+        assertEquals("jdoe", name.getUsername());
+        assertNull(name.getPassword());
+
+        // TBD as I am not sure what other URL formats to use
+    }
+}

Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/AllEventTests.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/AllEventTests.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/AllEventTests.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/AllEventTests.java Tue Aug 26 18:17:06 2014
@@ -0,0 +1,41 @@
+/*
+ * 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 javax.mail.event;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AllEventTests {
+    public static Test suite() {
+        final TestSuite suite = new TestSuite("Test for javax.mail.event");
+        //$JUnit-BEGIN$
+        suite.addTest(new TestSuite(ConnectionEventTest.class));
+        suite.addTest(new TestSuite(FolderEventTest.class));
+        suite.addTest(new TestSuite(MessageChangedEventTest.class));
+        suite.addTest(new TestSuite(StoreEventTest.class));
+        suite.addTest(new TestSuite(MessageCountEventTest.class));
+        suite.addTest(new TestSuite(TransportEventTest.class));
+        //$JUnit-END$
+        return suite;
+    }
+}

Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/ConnectionEventTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/ConnectionEventTest.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/ConnectionEventTest.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/ConnectionEventTest.java Tue Aug 26 18:17:06 2014
@@ -0,0 +1,68 @@
+/*
+ * 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 javax.mail.event;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConnectionEventTest extends TestCase {
+    public static class ConnectionListenerTest implements ConnectionListener {
+        private int state = 0;
+        public void closed(final ConnectionEvent event) {
+            if (state != 0) {
+                fail("Recycled ConnectionListener");
+            }
+            state = ConnectionEvent.CLOSED;
+        }
+        public void disconnected(final ConnectionEvent event) {
+            if (state != 0) {
+                fail("Recycled ConnectionListener");
+            }
+            state = ConnectionEvent.DISCONNECTED;
+        }
+        public int getState() {
+            return state;
+        }
+        public void opened(final ConnectionEvent event) {
+            if (state != 0) {
+                fail("Recycled ConnectionListener");
+            }
+            state = ConnectionEvent.OPENED;
+        }
+    }
+    public ConnectionEventTest(final String name) {
+        super(name);
+    }
+    private void doEventTests(final int type) {
+        final ConnectionEvent event = new ConnectionEvent(this, type);
+        assertEquals(this, event.getSource());
+        assertEquals(type, event.getType());
+        final ConnectionListenerTest listener = new ConnectionListenerTest();
+        event.dispatch(listener);
+        assertEquals("Unexpcted method dispatched", type, listener.getState());
+    }
+    public void testEvent() {
+        doEventTests(ConnectionEvent.CLOSED);
+        doEventTests(ConnectionEvent.OPENED);
+        doEventTests(ConnectionEvent.DISCONNECTED);
+    }
+}

Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/FolderEventTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/FolderEventTest.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/FolderEventTest.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/FolderEventTest.java Tue Aug 26 18:17:06 2014
@@ -0,0 +1,68 @@
+/*
+ * 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 javax.mail.event;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class FolderEventTest extends TestCase {
+    public FolderEventTest(final String name) {
+        super(name);
+    }
+    public void testEvent() {
+        doEventTests(FolderEvent.CREATED);
+        doEventTests(FolderEvent.RENAMED);
+        doEventTests(FolderEvent.DELETED);
+    }
+    private void doEventTests(final int type) {
+        final FolderEvent event = new FolderEvent(this, null, type);
+        assertEquals(this, event.getSource());
+        assertEquals(type, event.getType());
+        final FolderListenerTest listener = new FolderListenerTest();
+        event.dispatch(listener);
+        assertEquals("Unexpcted method dispatched", type, listener.getState());
+    }
+    public static class FolderListenerTest implements FolderListener {
+        private int state = 0;
+        public void folderCreated(final FolderEvent event) {
+            if (state != 0) {
+                fail("Recycled Listener");
+            }
+            state = FolderEvent.CREATED;
+        }
+        public void folderDeleted(final FolderEvent event) {
+            if (state != 0) {
+                fail("Recycled Listener");
+            }
+            state = FolderEvent.DELETED;
+        }
+        public void folderRenamed(final FolderEvent event) {
+            if (state != 0) {
+                fail("Recycled Listener");
+            }
+            state = FolderEvent.RENAMED;
+        }
+        public int getState() {
+            return state;
+        }
+    }
+}

Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/MessageChangedEventTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/MessageChangedEventTest.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/MessageChangedEventTest.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/MessageChangedEventTest.java Tue Aug 26 18:17:06 2014
@@ -0,0 +1,56 @@
+/*
+ * 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 javax.mail.event;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MessageChangedEventTest extends TestCase {
+    public MessageChangedEventTest(final String name) {
+        super(name);
+    }
+    public void testEvent() {
+        doEventTests(MessageChangedEvent.ENVELOPE_CHANGED);
+        doEventTests(MessageChangedEvent.FLAGS_CHANGED);
+    }
+    private void doEventTests(final int type) {
+        final MessageChangedEvent event = new MessageChangedEvent(this, type, null);
+        assertEquals(this, event.getSource());
+        assertEquals(type, event.getMessageChangeType());
+        final MessageChangedListenerTest listener = new MessageChangedListenerTest();
+        event.dispatch(listener);
+        assertEquals("Unexpcted method dispatched", type, listener.getState());
+    }
+    public static class MessageChangedListenerTest
+        implements MessageChangedListener {
+        private int state = 0;
+        public void messageChanged(final MessageChangedEvent event) {
+            if (state != 0) {
+                fail("Recycled Listener");
+            }
+            state = event.getMessageChangeType();
+        }
+        public int getState() {
+            return state;
+        }
+    }
+}

Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/MessageCountEventTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/MessageCountEventTest.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/MessageCountEventTest.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/MessageCountEventTest.java Tue Aug 26 18:17:06 2014
@@ -0,0 +1,72 @@
+/*
+ * 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 javax.mail.event;
+
+import javax.mail.Folder;
+import javax.mail.TestData;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MessageCountEventTest extends TestCase {
+    public MessageCountEventTest(final String name) {
+        super(name);
+    }
+    public void testEvent() {
+        doEventTests(MessageCountEvent.ADDED);
+        doEventTests(MessageCountEvent.REMOVED);
+        try {
+            doEventTests(-12345);
+            fail("Expected exception due to invalid type -12345");
+        } catch (final IllegalArgumentException e) {
+        }
+    }
+    private void doEventTests(final int type) {
+        final Folder folder = TestData.getTestFolder();
+        final MessageCountEvent event =
+            new MessageCountEvent(folder, type, false, null);
+        assertEquals(folder, event.getSource());
+        assertEquals(type, event.getType());
+        final MessageCountListenerTest listener = new MessageCountListenerTest();
+        event.dispatch(listener);
+        assertEquals("Unexpcted method dispatched", type, listener.getState());
+    }
+    public static class MessageCountListenerTest
+        implements MessageCountListener {
+        private int state = 0;
+        public void messagesAdded(final MessageCountEvent event) {
+            if (state != 0) {
+                fail("Recycled Listener");
+            }
+            state = MessageCountEvent.ADDED;
+        }
+        public void messagesRemoved(final MessageCountEvent event) {
+            if (state != 0) {
+                fail("Recycled Listener");
+            }
+            state = MessageCountEvent.REMOVED;
+        }
+        public int getState() {
+            return state;
+        }
+    }
+}

Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/StoreEventTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/StoreEventTest.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/StoreEventTest.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/StoreEventTest.java Tue Aug 26 18:17:06 2014
@@ -0,0 +1,67 @@
+/*
+ * 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 javax.mail.event;
+
+import javax.mail.Store;
+import javax.mail.TestData;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class StoreEventTest extends TestCase {
+    public StoreEventTest(final String name) {
+        super(name);
+    }
+    public void testEvent() {
+        doEventTests(StoreEvent.ALERT);
+        doEventTests(StoreEvent.NOTICE);
+        try {
+            final StoreEvent event = new StoreEvent(null, -12345, "Hello World");
+            fail(
+                "Expected exception due to invalid type "
+                    + event.getMessageType());
+        } catch (final IllegalArgumentException e) {
+        }
+    }
+    private void doEventTests(final int type) {
+        final Store source = TestData.getTestStore();
+        final StoreEvent event = new StoreEvent(source, type, "Hello World");
+        assertEquals(source, event.getSource());
+        assertEquals("Hello World", event.getMessage());
+        assertEquals(type, event.getMessageType());
+        final StoreListenerTest listener = new StoreListenerTest();
+        event.dispatch(listener);
+        assertEquals("Unexpcted method dispatched", type, listener.getState());
+    }
+    public static class StoreListenerTest implements StoreListener {
+        private int state = 0;
+        public void notification(final StoreEvent event) {
+            if (state != 0) {
+                fail("Recycled Listener");
+            }
+            state = event.getMessageType();
+        }
+        public int getState() {
+            return state;
+        }
+    }
+}

Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/TransportEventTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/TransportEventTest.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/TransportEventTest.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/event/TransportEventTest.java Tue Aug 26 18:17:06 2014
@@ -0,0 +1,82 @@
+/*
+ * 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 javax.mail.event;
+
+import javax.mail.Address;
+import javax.mail.Folder;
+import javax.mail.Message;
+import javax.mail.TestData;
+import javax.mail.Transport;
+import javax.mail.internet.AddressException;
+import javax.mail.internet.InternetAddress;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransportEventTest extends TestCase {
+    public TransportEventTest(final String name) {
+        super(name);
+    }
+    public void testEvent() throws AddressException {
+        doEventTests(TransportEvent.MESSAGE_DELIVERED);
+        doEventTests(TransportEvent.MESSAGE_PARTIALLY_DELIVERED);
+        doEventTests(TransportEvent.MESSAGE_NOT_DELIVERED);
+    }
+    private void doEventTests(final int type) throws AddressException {
+        final Folder folder = TestData.getTestFolder();
+        final Message message = TestData.getMessage();
+        final Transport transport = TestData.getTestTransport();
+        final Address[] sent = new Address[] { new InternetAddress("alex@here.com")};
+        final Address[] empty = new Address[0];
+        final TransportEvent event =
+            new TransportEvent(transport, type, sent, empty, empty, message);
+        assertEquals(transport, event.getSource());
+        assertEquals(type, event.getType());
+        final TransportListenerTest listener = new TransportListenerTest();
+        event.dispatch(listener);
+        assertEquals("Unexpcted method dispatched", type, listener.getState());
+    }
+    public static class TransportListenerTest implements TransportListener {
+        private int state = 0;
+        public void messageDelivered(final TransportEvent event) {
+            if (state != 0) {
+                fail("Recycled Listener");
+            }
+            state = TransportEvent.MESSAGE_DELIVERED;
+        }
+        public void messagePartiallyDelivered(final TransportEvent event) {
+            if (state != 0) {
+                fail("Recycled Listener");
+            }
+            state = TransportEvent.MESSAGE_PARTIALLY_DELIVERED;
+        }
+        public void messageNotDelivered(final TransportEvent event) {
+            if (state != 0) {
+                fail("Recycled Listener");
+            }
+            state = TransportEvent.MESSAGE_NOT_DELIVERED;
+        }
+        public int getState() {
+            return state;
+        }
+    }
+}

Added: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/internet/AllInternetTests.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/internet/AllInternetTests.java?rev=1620683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/internet/AllInternetTests.java (added)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/internet/AllInternetTests.java Tue Aug 26 18:17:06 2014
@@ -0,0 +1,38 @@
+/*
+ * 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 javax.mail.internet;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AllInternetTests {
+    public static Test suite() {
+        final TestSuite suite = new TestSuite("Test for javax.mail.internet");
+        //$JUnit-BEGIN$
+        suite.addTest(new TestSuite(ContentTypeTest.class));
+        suite.addTest(new TestSuite(ParameterListTest.class));
+        suite.addTest(new TestSuite(InternetAddressTest.class));
+        //$JUnit-END$
+        return suite;
+    }
+}



Mime
View raw message