/****************************************************************
 * Licensed to the Apache Software Foundation (ASF) under one   *
 * or more contributor license agreements.  See the NOTICE file *
 * distributed with this work for additional information        *
 * regarding copyright ownership.  The ASF licenses this file   *
 * to you under the Apache License, Version 2.0 (the            *
 * "License"); you may not use this file except in compliance   *
 * with the License.  You may obtain a copy of the License at   *
 *                                                              *
 *   http://www.apache.org/licenses/LICENSE-2.0                 *
 *                                                              *
 * Unless required by applicable law or agreed to in writing,   *
 * software distributed under the License is distributed on an  *
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
 * KIND, either express or implied.  See the License for the    *
 * specific language governing permissions and limitations      *
 * under the License.                                           *
 ****************************************************************/


package org.apache.james.mailrepository;

import java.util.Iterator;

import junit.framework.TestCase;

import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.configuration.DefaultConfiguration;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.james.services.MailRepository;
import org.apache.james.test.mock.avalon.MockLogger;

/**
 * NOTE NOTE NOTE: this test is disabled because MBoxMailRepository does not
 * currently support most simple operations for the MailRepository interface.
 */
public class MBoxMailRepositoryTest extends TestCase {

    
    protected MailRepository getMailRepository() throws ServiceException, ConfigurationException, Exception {
        MBoxMailRepository mr = new MBoxMailRepository();

        mr.enableLogging(new MockLogger());
        DefaultConfiguration defaultConfiguration = new DefaultConfiguration("ReposConf");
        defaultConfiguration.setAttribute("destinationURL","mbox://src/test/org/apache/james/mailrepository/testdata/inbox");
        defaultConfiguration.setAttribute("type","MAIL");
        mr.configure(defaultConfiguration);
        return mr;
    }

    // Try to write a unit test for JAMES-744. At the moment it seems that we cannot reproduce it.
    public void testReadMboxrdFile() throws ServiceException, ConfigurationException, Exception {
        MailRepository mr = getMailRepository();
    
        Iterator keys = mr.list();
    
        assertTrue("Two messages in list", keys.hasNext());
        keys.next();
    
        assertTrue("One messages in list", keys.hasNext());
        keys.next();
    
        assertFalse("No messages", keys.hasNext());
    }

}


@@ -1611,19 +1611,8 @@
 NOTE
- NOTE NOTE:
  thi
@@ -1618,18 +1618,21 @@
 is test 
-is
+*WAS*
  disable
@@ -1747,16 +1747,158 @@
 erface.%0A
+ * %0A * NOTE this previously extended AbstractMailRepositoryTest to run all of the%0A * common mail repository tests on the MBox implementation.%0A
  */%0Apubl
@@ -2375,17 +2375,17 @@
 estdata/
-i
+I
 nbox%22);%0A
@@ -3027,18 +3027,246 @@
 ext());%0A
-
     %7D%0A%0A
+    /*%0A    public void runBare() throws Throwable %7B%0A        System.err.println(%22TEST DISABLED!%22);%0A        // Decomment this or remove this method to re-enable the MBoxRepository testing%0A        // super.runBare();%0A    %7D%0A    */%0A%0A
 %7D%0A%0A

Fix case for repository url and added a comment about MBoxMailRepositoryTest history.