You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by er...@apache.org on 2010/12/21 09:27:01 UTC

svn commit: r1051413 - in /james/mailbox/trunk/jcr: pom.xml src/test/java/org/apache/james/mailbox/jcr/JCRMailboxManagerTest.java

Author: eric
Date: Tue Dec 21 08:27:01 2010
New Revision: 1051413

URL: http://svn.apache.org/viewvc?rev=1051413&view=rev
Log:
Add list() test for JCR - TODO fix the jcr list test

Added:
    james/mailbox/trunk/jcr/src/test/java/org/apache/james/mailbox/jcr/JCRMailboxManagerTest.java
Modified:
    james/mailbox/trunk/jcr/pom.xml

Modified: james/mailbox/trunk/jcr/pom.xml
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/jcr/pom.xml?rev=1051413&r1=1051412&r2=1051413&view=diff
==============================================================================
--- james/mailbox/trunk/jcr/pom.xml (original)
+++ james/mailbox/trunk/jcr/pom.xml Tue Dec 21 08:27:01 2010
@@ -87,7 +87,6 @@
       <artifactId>xml-apis</artifactId>
       <scope>test</scope>
     </dependency>
-
     <dependency>
       <groupId>org.apache.james</groupId>
       <artifactId>apache-james-imap-protocol-tester</artifactId>
@@ -103,5 +102,11 @@
       <artifactId>slf4j-log4j12</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.james</groupId>
+      <artifactId>apache-james-mailbox-api</artifactId>
+      <scope>test</scope>
+      <type>test-jar</type>
+    </dependency>
   </dependencies>
 </project>

Added: james/mailbox/trunk/jcr/src/test/java/org/apache/james/mailbox/jcr/JCRMailboxManagerTest.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/jcr/src/test/java/org/apache/james/mailbox/jcr/JCRMailboxManagerTest.java?rev=1051413&view=auto
==============================================================================
--- james/mailbox/trunk/jcr/src/test/java/org/apache/james/mailbox/jcr/JCRMailboxManagerTest.java (added)
+++ james/mailbox/trunk/jcr/src/test/java/org/apache/james/mailbox/jcr/JCRMailboxManagerTest.java Tue Dec 21 08:27:01 2010
@@ -0,0 +1,96 @@
+/****************************************************************
+ * 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.mailbox.jcr;
+
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+
+import org.apache.commons.logging.impl.SimpleLog;
+import org.apache.jackrabbit.core.RepositoryImpl;
+import org.apache.jackrabbit.core.config.RepositoryConfig;
+import org.apache.james.mailbox.BadCredentialsException;
+import org.apache.james.mailbox.MailboxException;
+import org.apache.james.mailbox.MailboxManagerTest;
+import org.apache.james.mailbox.MailboxSession;
+import org.apache.james.mailbox.jcr.mail.JCRCachingUidProvider;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.xml.sax.InputSource;
+
+/**
+ * JCRMailboxManagerTest that extends the StoreMailboxManagerTest.
+ */
+public class JCRMailboxManagerTest extends MailboxManagerTest {
+    
+    private static final String JACKRABBIT_HOME = "target/jackrabbit";
+    
+    public static final String META_DATA_DIRECTORY = "target/user-meta-data";
+
+    private static RepositoryImpl repository;
+   
+    /**
+     * Setup the mailboxManager.
+     * 
+     * @throws Exception
+     */
+    @BeforeClass
+    public static void setup() throws Exception {
+    
+        new File(JACKRABBIT_HOME).delete();
+
+        String user = "user";
+        String pass = "pass";
+        String workspace = null;
+        RepositoryConfig config = RepositoryConfig.create(new InputSource(JCRMailboxManagerTest.class.getClassLoader().getResourceAsStream("test-repository.xml")), JACKRABBIT_HOME);
+        repository = RepositoryImpl.create(config);
+
+        // Register imap cnd file
+        JCRUtils.registerCnd(repository, workspace, user, pass);
+        MailboxSessionJCRRepository sessionRepos = new GlobalMailboxSessionJCRRepository(repository, workspace, user, pass);
+
+        JCRCachingUidProvider uidProvider = new JCRCachingUidProvider(sessionRepos);
+
+        JCRMailboxSessionMapperFactory mf = new JCRMailboxSessionMapperFactory(sessionRepos);
+        setMailboxManager(new JCRMailboxManager(mf, null, uidProvider));
+
+    }
+    
+    /* TODO list() does not seem to work for JCR atm
+     * 
+     * @see org.apache.james.mailbox.MailboxManagerTest#testList()
+     */
+    @Test
+    public void testList() throws MailboxException, UnsupportedEncodingException {
+        
+    }
+    
+    /**
+     * @throws BadCredentialsException
+     * @throws MailboxException
+     */
+    @AfterClass
+    public static void tearDown() throws BadCredentialsException, MailboxException {
+        MailboxSession session = getMailboxManager().createSystemSession("test", new SimpleLog("Test"));
+        session.close();
+        repository.shutdown();
+        new File(JACKRABBIT_HOME).delete();
+    }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org