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 sb...@apache.org on 2015/08/05 17:30:00 UTC
svn commit: r1694251 - in /james/server/tags/2_3_2_1: RELEASE_NOTES.txt
src/test/org/apache/james/userrepository/UsersFileRepositoryTest.java
userrepository/
Author: sbrewin
Date: Wed Aug 5 15:30:00 2015
New Revision: 1694251
URL: http://svn.apache.org/r1694251
Log:
Corrected the location of UsersFileRepository unit tests.
Updated release notes
Added:
james/server/tags/2_3_2_1/src/test/org/apache/james/userrepository/UsersFileRepositoryTest.java (with props)
Removed:
james/server/tags/2_3_2_1/userrepository/
Modified:
james/server/tags/2_3_2_1/RELEASE_NOTES.txt
Modified: james/server/tags/2_3_2_1/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/james/server/tags/2_3_2_1/RELEASE_NOTES.txt?rev=1694251&r1=1694250&r2=1694251&view=diff
==============================================================================
--- james/server/tags/2_3_2_1/RELEASE_NOTES.txt (original)
+++ james/server/tags/2_3_2_1/RELEASE_NOTES.txt Wed Aug 5 15:30:00 2015
@@ -11,6 +11,17 @@ applications for mail processing. This m
is one of James' strengths, and can allow administrators to produce powerful
applications surprisingly easily.
+Version 2.3.2.1
+=============
+Is a maintenance release which is compatible with 2.3.2 except for introduction of some constraints
+on user names when the UsersFileRepository is configured as the user repository. User names are now
+validated for RFC 3696 compliance.
+
+Bug Fixes
+ * JAMES-1600 - Javadocs task references obsolete URLs
+ * JAMES-1601 - Change the default RemoteManager password
+ * JAMES-1602 - Constrain users created in the UsersFileRepository to RFC 3696 compliant ones
+
Version 2.3.2
=============
Is a point release which is (almost) compatible with 2.3.1.
Added: james/server/tags/2_3_2_1/src/test/org/apache/james/userrepository/UsersFileRepositoryTest.java
URL: http://svn.apache.org/viewvc/james/server/tags/2_3_2_1/src/test/org/apache/james/userrepository/UsersFileRepositoryTest.java?rev=1694251&view=auto
==============================================================================
--- james/server/tags/2_3_2_1/src/test/org/apache/james/userrepository/UsersFileRepositoryTest.java (added)
+++ james/server/tags/2_3_2_1/src/test/org/apache/james/userrepository/UsersFileRepositoryTest.java Wed Aug 5 15:30:00 2015
@@ -0,0 +1,235 @@
+/****************************************************************
+ * 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.userrepository;
+
+import java.io.File;
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+import org.apache.avalon.cornerstone.services.store.ObjectRepository;
+import org.apache.avalon.cornerstone.services.store.Repository;
+import org.apache.avalon.cornerstone.services.store.Store;
+import org.apache.avalon.framework.configuration.DefaultConfiguration;
+import org.apache.avalon.framework.logger.ConsoleLogger;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.james.services.User;
+import org.apache.james.userrepository.UsersFileRepository.UsersFileRepositoryException;
+
+/**
+ * Unit Tests for <code>org.apache.james.userrepository.UsersFileRepository</code>
+ *
+ * @see org.apache.james.userrepository.UsersFileRepository
+ *
+ */
+public class UsersFileRepositoryTest extends TestCase {
+
+ private class MockUser implements User {
+
+ /**
+ * @param userName
+ */
+ public MockUser(String userName) {
+ super();
+ this.userName = userName;
+ }
+
+ private String userName;
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public boolean verifyPassword(String pass) {
+ return false;
+ }
+
+ public boolean setPassword(String newPass) {
+ return false;
+ }
+
+ }
+
+ private class MockServiceManager implements ServiceManager {
+
+ public boolean hasService(String arg0) {
+ return true;
+ }
+
+ public Object lookup(String arg0) throws ServiceException {
+ return new Store() {
+
+ public boolean isSelectable(Object arg0) {
+ return false;
+ }
+
+ public void release(Object arg0) {
+ }
+
+ public Object select(Object arg0) throws ServiceException {
+ return new MockObjectRepository();
+ }};
+ }
+
+ public void release(Object arg0) {
+ }
+
+ }
+
+ private class MockObjectRepository implements ObjectRepository {
+
+ public Repository getChildRepository(String arg0) {
+ return null;
+ }
+
+ public boolean containsKey(String arg0) {
+ return false;
+ }
+
+ public Object get(String arg0) {
+ return null;
+ }
+
+ public Object get(String arg0, ClassLoader arg1) {
+ return null;
+ }
+
+ public Iterator list() {
+ return null;
+ }
+
+ public void put(String arg0, Object arg1) {
+ }
+
+ public void remove(String arg0) {
+ }}
+
+
+ private static final String destination = File.separator + "what" + File.separator + "ever";
+
+ private UsersFileRepository repo;
+
+ public UsersFileRepositoryTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Setup a <code>UsersFileRepository</code> in a mocked Avalon container.
+ *
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ repo = new UsersFileRepository();
+ repo.enableLogging(new ConsoleLogger());
+ DefaultConfiguration config = new DefaultConfiguration("");
+ DefaultConfiguration destConfig = new DefaultConfiguration("destination");
+ destConfig.setAttribute("URL", destination);
+ config.addChild(destConfig);
+ repo.configure(config);
+ repo.service(new MockServiceManager());
+ repo.initialize();
+ }
+
+ public final void testValidateUserPass() throws UsersFileRepositoryException {
+ User user = new MockUser("legal");
+ repo.validateUser(user);
+
+ user = new MockUser("legal" + File.separator + "legal" + File.separator + "legal");
+ repo.validateUser(user);
+
+ user = new MockUser("legal" + '.' + "legal" + '.' + "legal");
+ repo.validateUser(user);
+ }
+
+ public final void testValidateUserFail() {
+ boolean failed = false;
+ try {
+ User user = new MockUser(".legal");
+ repo.validateUser(user);
+ } catch (UsersFileRepositoryException e) {
+ failed = true;
+ }
+ assertTrue(failed);
+
+ failed = false;
+ try {
+ User user = new MockUser("legal.");;
+ repo.validateUser(user);
+ } catch (UsersFileRepositoryException e) {
+ failed = true;
+ }
+ assertTrue(failed);
+
+ failed = false;
+ try {
+ User user = new MockUser("..");
+ repo.validateUser(user);
+ } catch (UsersFileRepositoryException e) {
+ failed = true;
+ }
+ assertTrue(failed);
+
+ failed = false;
+ try {
+ User user = new MockUser("legal/../legal");
+ repo.validateUser(user);
+ } catch (UsersFileRepositoryException e) {
+ failed = true;
+ }
+ assertTrue(failed);
+
+ failed = false;
+ try {
+ User user = new MockUser(".");
+ repo.validateUser(user);
+ } catch (UsersFileRepositoryException e) {
+ failed = true;
+ }
+ assertTrue(failed);
+
+ failed = false;
+ try {
+ User user = new MockUser("legal" + File.separator);
+ repo.validateUser(user);
+ } catch (UsersFileRepositoryException e) {
+ failed = true;
+ }
+ assertTrue(failed);
+
+ }
+
+ public final void testAddUserPass() {
+ User user = new MockUser("legal");
+ repo.addUser(user);
+ }
+
+ public final void testAddUserFail() {
+ boolean failed = false;
+ try {
+ User user = new MockUser(".." + File.separator + "illegal");
+ repo.addUser(user);
+ } catch (RuntimeException e) {
+ failed = true;
+ }
+ assertTrue(failed);
+ }
+
+}
Propchange: james/server/tags/2_3_2_1/src/test/org/apache/james/userrepository/UsersFileRepositoryTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org