Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 83313 invoked from network); 13 Jun 2005 05:01:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 Jun 2005 05:01:58 -0000 Received: (qmail 36071 invoked by uid 500); 13 Jun 2005 05:01:56 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 35987 invoked by uid 500); 13 Jun 2005 05:01:56 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 35791 invoked by uid 99); 13 Jun 2005 05:01:55 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Sun, 12 Jun 2005 22:01:46 -0700 Received: (qmail 83210 invoked by uid 65534); 13 Jun 2005 05:01:36 -0000 Message-ID: <20050613050136.83209.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: svn commit: r190350 - in /directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/server: authn/ authz/ exception/ jndi/ operational/ prefs/ Date: Mon, 13 Jun 2005 05:01:34 -0000 To: commits@directory.apache.org From: trustin@apache.org X-Mailer: svnmailer-1.0.0-dev X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: trustin Date: Sun Jun 12 22:01:33 2005 New Revision: 190350 URL: http://svn.apache.org/viewcvs?rev=3D190350&view=3Drev Log: Fixed: DIREVE-162 Support multiple 'new InitialContext()' calls with differ= ent principle and root DN Added: directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/authz/AuthorizationServiceAsAdminTest.java (with props) directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/authz/AuthorizationServiceAsNonAdminTest.java (with props) directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ListAsAdminTest.java (with props) directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ListAsNonAdminTest.java (with props) Removed: directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/authz/AuthorizationServiceTest.java directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/AbstractMultiUserJndiTest.java directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ListTest.java Modified: directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/authn/SimpleAuthenticationTest.java directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/exception/ExceptionServiceTest.java directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ComparatorNPEBugTest.java directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/CreateContextTest.java directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/DestroyContextTest.java directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ModifyContextTest.java directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ObjStateFactoryTest.java directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/RFC2713Tests.java directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/SearchContextTest.java directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ShutdownTest.java directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/SyncTest.java directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/operational/BinaryAttributeFilterTest.java directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/operational/OperationalAttributeServiceTest.java directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/prefs/ServerPreferencesFactoryTest.java directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/prefs/ServerSystemPreferencesTest.java Modified: directory/apacheds/branches/direve-158/core/src/test/org/apache/l= dap/server/authn/SimpleAuthenticationTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/authn/SimpleAuthenticationTest.java?rev= =3D190350&r1=3D190349&r2=3D190350&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/authn/SimpleAuthenticationTest.java (original) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/authn/SimpleAuthenticationTest.java Sun Jun 12 22:01:33 2005 @@ -34,7 +34,7 @@ import org.apache.ldap.common.exception.LdapConfigurationException; import org.apache.ldap.common.exception.LdapNoPermissionException; import org.apache.ldap.common.util.ArrayUtils; -import org.apache.ldap.server.AbstractCoreTest; +import org.apache.ldap.server.AbstractAdminTestCase; =20 =20 /** @@ -44,7 +44,7 @@ * @author Apache Directory Pr= oject * @version $Rev$ */ -public class SimpleAuthenticationTest extends AbstractCoreTest +public class SimpleAuthenticationTest extends AbstractAdminTestCase { /** * Cleans up old database files on creation. Added: directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap= /server/authz/AuthorizationServiceAsAdminTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/authz/AuthorizationServiceAsAdminTest.j= ava?rev=3D190350&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/authz/AuthorizationServiceAsAdminTest.java (added) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/authz/AuthorizationServiceAsAdminTest.java Sun Jun 12 22:01:33 2005 @@ -0,0 +1,128 @@ +/* + * Copyright 2004 The Apache Software Foundation + * + * Licensed 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 impli= ed. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.ldap.server.authz; + + +import java.util.HashSet; + +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.directory.Attributes; +import javax.naming.directory.DirContext; +import javax.naming.directory.SearchControls; + +import org.apache.ldap.common.exception.LdapNoPermissionException; +import org.apache.ldap.common.message.LockableAttributesImpl; +import org.apache.ldap.server.AbstractAdminTestCase; +import org.apache.ldap.server.db.DbSearchResult; + + +/** + * Tests the Authorization service to make sure it is enforcing policies + * correctly. + * + * @author Apache Directory Pr= oject + * @version $Rev$ + */ +public class AuthorizationServiceAsAdminTest extends AbstractAdminTestCase +{ + /** + * Makes sure the admin cannot delete the admin account. + * + * @throws NamingException if there are problems + */ + public void testNoDeleteOnAdminByAdmin() throws NamingException + { + try + { + sysRoot.destroySubcontext( "uid=3Dadmin" ); + fail( "admin should not be able to delete his account" ); + } + catch ( LdapNoPermissionException e ) + { + assertNotNull( e ); + } + } + + + /** + * Makes sure the admin cannot rename the admin account. + * + * @throws NamingException if there are problems + */ + public void testNoRdnChangesOnAdminByAdmin() throws NamingException + { + try + { + sysRoot.rename( "uid=3Dadmin", "uid=3Dalex" ); + fail( "admin should not be able to rename his account" ); + } + catch ( LdapNoPermissionException e ) + { + assertNotNull( e ); + } + } + + + /** + * Makes sure the admin cannot rename the admin account. + * + * @throws NamingException if there are problems + */ + public void testModifyOnAdminByAdmin() throws NamingException + { + Attributes attributes =3D new LockableAttributesImpl(); + attributes.put( "userPassword", "replaced" ); + sysRoot.modifyAttributes( "uid=3Dadmin", DirContext.REPLACE_ATTRIB= UTE, attributes ); + Attributes newAttrs =3D sysRoot.getAttributes( "uid=3Dadmin" ); + assertEquals( "replaced", newAttrs.get( "userPassword" ).get() ); + } + + + /** + * Makes sure the admin can see all entries we know of on a subtree se= arch. + * + * @throws NamingException if there are problems + */ + public void testSearchSubtreeByAdmin() throws NamingException + { + SearchControls controls =3D new SearchControls(); + + controls.setSearchScope( SearchControls.SUBTREE_SCOPE ); + + HashSet set =3D new HashSet(); + + NamingEnumeration list =3D sysRoot.search( "", "(objectClass=3D*)"= , controls ); + + while ( list.hasMore() ) + { + DbSearchResult result =3D ( DbSearchResult ) list.next(); + + set.add( result.getName() ); + } + + assertTrue( set.contains( "ou=3Dsystem" ) ); + + assertTrue( set.contains( "ou=3Dgroups,ou=3Dsystem" ) ); + + assertTrue( set.contains( "ou=3Dusers,ou=3Dsystem" ) ); + + assertTrue( set.contains( "uid=3Dakarasulu,ou=3Dusers,ou=3Dsystem"= ) ); + + assertTrue( set.contains( "uid=3Dadmin,ou=3Dsystem" ) ); + } +} Propchange: directory/apacheds/branches/direve-158/core/src/test/org/apache= /ldap/server/authz/AuthorizationServiceAsAdminTest.java ---------------------------------------------------------------------------= --- svn:keywords =3D HeadURL Id LastChangedBy LastChangedDate LastChangedRe= vision Added: directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap= /server/authz/AuthorizationServiceAsNonAdminTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/authz/AuthorizationServiceAsNonAdminTes= t=2Ejava?rev=3D190350&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/authz/AuthorizationServiceAsNonAdminTest.java (added) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/authz/AuthorizationServiceAsNonAdminTest.java Sun Jun 12 22:01:33 2005 @@ -0,0 +1,123 @@ +/* + * Copyright 2004 The Apache Software Foundation + * + * Licensed 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 impli= ed. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.ldap.server.authz; + + +import org.apache.ldap.common.exception.LdapNoPermissionException; +import org.apache.ldap.common.message.LockableAttributesImpl; +import org.apache.ldap.server.AbstractNonAdminTestCase; +import org.apache.ldap.server.db.DbSearchResult; + +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.directory.Attributes; +import javax.naming.directory.DirContext; +import javax.naming.directory.SearchControls; +import java.util.HashSet; + + +/** + * Tests the Authorization service to make sure it is enforcing policies + * correctly. + * + * @author Apache Directory Pr= oject + * @version $Rev$ + */ +public class AuthorizationServiceAsNonAdminTest extends AbstractNonAdminTe= stCase +{ + /** + * Makes sure a non-admin user cannot delete the admin account. + * + * @throws NamingException if there are problems + */ + public void testNoDeleteOnAdminByNonAdmin() throws NamingException + { + try + { + sysRoot.destroySubcontext( "uid=3Dadmin" ); + fail( "User 'admin' should not be able to delete his account" = ); + } + catch ( LdapNoPermissionException e ) + { + assertNotNull( e ); + } + } + + + /** + * Makes sure a non-admin user cannot rename the admin account. + * + * @throws NamingException if there are problems + */ + public void testNoRdnChangesOnAdminByNonAdmin() throws NamingException + { + try + { + sysRoot.rename( "uid=3Dadmin", "uid=3Dalex" ); + fail( "admin should not be able to rename his account" ); + } + catch ( LdapNoPermissionException e ) + { + assertNotNull( e ); + } + } + + + /** + * Makes sure the a non-admin user cannot rename the admin account. + */ + public void testModifyOnAdminByNonAdmin() + { + Attributes attributes =3D new LockableAttributesImpl(); + attributes.put( "userPassword", "replaced" ); + + try + { + sysRoot.modifyAttributes( "uid=3Dadmin", + DirContext.REPLACE_ATTRIBUTE, attributes ); + fail( "User 'uid=3Dadmin' should not be able to modify attribu= tes on admin" ); + } catch( Exception e ) { } + } + + + /** + * Makes sure the admin can see all entries we know of on a subtree se= arch. + * + * @throws NamingException if there are problems + */ + public void testSearchSubtreeByNonAdmin() throws NamingException + { + SearchControls controls =3D new SearchControls(); + controls.setSearchScope( SearchControls.SUBTREE_SCOPE ); + + HashSet set =3D new HashSet(); + NamingEnumeration list =3D sysRoot.search( "", + "(objectClass=3D*)", controls ); + while ( list.hasMore() ) + { + DbSearchResult result =3D ( DbSearchResult ) list.next(); + set.add( result.getName() ); + } + + assertTrue( set.contains( "ou=3Dsystem" ) ); + assertTrue( set.contains( "ou=3Dgroups,ou=3Dsystem" ) ); + assertFalse( set.contains( "cn=3Dadministrators,ou=3Dgroups,ou=3Ds= ystem" ) ); + assertTrue( set.contains( "ou=3Dusers,ou=3Dsystem" ) ); + assertFalse( set.contains( "uid=3Dakarasulu,ou=3Dusers,ou=3Dsystem= " ) ); + assertFalse( set.contains( "uid=3Dadmin,ou=3Dsystem" ) ); + } +} Propchange: directory/apacheds/branches/direve-158/core/src/test/org/apache= /ldap/server/authz/AuthorizationServiceAsNonAdminTest.java ---------------------------------------------------------------------------= --- svn:keywords =3D HeadURL Id LastChangedBy LastChangedDate LastChangedRe= vision Modified: directory/apacheds/branches/direve-158/core/src/test/org/apache/l= dap/server/exception/ExceptionServiceTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/exception/ExceptionServiceTest.java?rev= =3D190350&r1=3D190349&r2=3D190350&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/exception/ExceptionServiceTest.java (original) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/exception/ExceptionServiceTest.java Sun Jun 12 22:01:33 2005 @@ -17,18 +17,25 @@ package org.apache.ldap.server.exception; =20 =20 +import javax.naming.Context; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import javax.naming.directory.BasicAttribute; +import javax.naming.directory.BasicAttributes; +import javax.naming.directory.DirContext; +import javax.naming.directory.ModificationItem; +import javax.naming.directory.SearchControls; +import javax.naming.directory.SearchResult; +import javax.naming.ldap.LdapContext; + import org.apache.ldap.common.exception.LdapContextNotEmptyException; import org.apache.ldap.common.exception.LdapNameAlreadyBoundException; import org.apache.ldap.common.exception.LdapNameNotFoundException; import org.apache.ldap.common.exception.LdapNamingException; import org.apache.ldap.common.message.ResultCodeEnum; -import org.apache.ldap.server.AbstractCoreTest; - -import javax.naming.Context; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.*; -import javax.naming.ldap.LdapContext; +import org.apache.ldap.server.AbstractAdminTestCase; =20 =20 /** @@ -37,7 +44,7 @@ * @author Apache Directory Pr= oject * @version $Rev$ */ -public class ExceptionServiceTest extends AbstractCoreTest +public class ExceptionServiceTest extends AbstractAdminTestCase { // -------------------------------------------------------------------= ----- // Search Operation Tests Modified: directory/apacheds/branches/direve-158/core/src/test/org/apache/l= dap/server/jndi/ComparatorNPEBugTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/jndi/ComparatorNPEBugTest.java?rev=3D19= 0350&r1=3D190349&r2=3D190350&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ComparatorNPEBugTest.java (original) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ComparatorNPEBugTest.java Sun Jun 12 22:01:33 2005 @@ -17,7 +17,7 @@ package org.apache.ldap.server.jndi; =20 =20 -import org.apache.ldap.server.AbstractCoreTest; +import org.apache.ldap.server.AbstractAdminTestCase; =20 =20 /** @@ -27,7 +27,7 @@ * @author Apache Directory Pr= oject * @version $Rev$ */ -public class ComparatorNPEBugTest extends AbstractCoreTest +public class ComparatorNPEBugTest extends AbstractAdminTestCase { public ComparatorNPEBugTest() { Modified: directory/apacheds/branches/direve-158/core/src/test/org/apache/l= dap/server/jndi/CreateContextTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/jndi/CreateContextTest.java?rev=3D19035= 0&r1=3D190349&r2=3D190350&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/CreateContextTest.java (original) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/CreateContextTest.java Sun Jun 12 22:01:33 2005 @@ -17,10 +17,14 @@ package org.apache.ldap.server.jndi; =20 =20 -import org.apache.ldap.server.AbstractCoreTest; - import javax.naming.NamingException; -import javax.naming.directory.*; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import javax.naming.directory.BasicAttribute; +import javax.naming.directory.BasicAttributes; +import javax.naming.directory.DirContext; + +import org.apache.ldap.server.AbstractAdminTestCase; =20 =20 /** @@ -29,7 +33,7 @@ * @author Apache Directory Pr= oject * @version $Rev$ */ -public class CreateContextTest extends AbstractCoreTest +public class CreateContextTest extends AbstractAdminTestCase { /** * Tests the creation and subsequent read of a new JNDI context under = the Modified: directory/apacheds/branches/direve-158/core/src/test/org/apache/l= dap/server/jndi/DestroyContextTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/jndi/DestroyContextTest.java?rev=3D1903= 50&r1=3D190349&r2=3D190350&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/DestroyContextTest.java (original) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/DestroyContextTest.java Sun Jun 12 22:01:33 2005 @@ -17,11 +17,15 @@ package org.apache.ldap.server.jndi; =20 =20 -import org.apache.ldap.common.exception.LdapNameNotFoundException; -import org.apache.ldap.server.AbstractCoreTest; - import javax.naming.NamingException; -import javax.naming.directory.*; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import javax.naming.directory.BasicAttribute; +import javax.naming.directory.BasicAttributes; +import javax.naming.directory.DirContext; + +import org.apache.ldap.common.exception.LdapNameNotFoundException; +import org.apache.ldap.server.AbstractAdminTestCase; =20 =20 /** @@ -30,7 +34,7 @@ * @author Apache Directory Pr= oject * @version $Rev$ */ -public class DestroyContextTest extends AbstractCoreTest +public class DestroyContextTest extends AbstractAdminTestCase { protected void setUp() throws Exception { Added: directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap= /server/jndi/ListAsAdminTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/jndi/ListAsAdminTest.java?rev=3D190350&= view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ListAsAdminTest.java (added) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ListAsAdminTest.java Sun Jun 12 22:01:33 2005 @@ -0,0 +1,75 @@ +/* + * Copyright 2004 The Apache Software Foundation + * + * Licensed 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 impli= ed. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.ldap.server.jndi; + + +import java.util.HashSet; + +import javax.naming.NameClassPair; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; + +import org.apache.ldap.server.AbstractAdminTestCase; + + +/** + * Tests our ability to list elements as the admin user and as a non admin= user + * on security sensitive values. We do not return results or name class p= airs + * for user accounts if the user is not the admin. + * + * @author Apache Directory Pr= oject + * @version $Rev$ + */ +public class ListAsAdminTest extends AbstractAdminTestCase +{ + public void testListSystemAsAdmin() throws NamingException + { + HashSet set =3D new HashSet(); + + NamingEnumeration list =3D sysRoot.list( "" ); + + while ( list.hasMore() ) + { + NameClassPair ncp =3D ( NameClassPair ) list.next(); + + set.add( ncp.getName() ); + } + + assertTrue( set.contains( "uid=3Dadmin,ou=3Dsystem" ) ); + + assertTrue( set.contains( "ou=3Dusers,ou=3Dsystem" ) ); + + assertTrue( set.contains( "ou=3Dgroups,ou=3Dsystem" ) ); + } + + + public void testListUsersAsAdmin() throws NamingException + { + HashSet set =3D new HashSet(); + + NamingEnumeration list =3D sysRoot.list( "ou=3Dusers" ); + + while ( list.hasMore() ) + { + NameClassPair ncp =3D ( NameClassPair ) list.next(); + + set.add( ncp.getName() ); + } + + assertTrue( set.contains( "uid=3Dakarasulu,ou=3Dusers,ou=3Dsystem"= ) ); + } +} Propchange: directory/apacheds/branches/direve-158/core/src/test/org/apache= /ldap/server/jndi/ListAsAdminTest.java ---------------------------------------------------------------------------= --- svn:keywords =3D HeadURL Id LastChangedBy LastChangedDate LastChangedRe= vision Added: directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap= /server/jndi/ListAsNonAdminTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/jndi/ListAsNonAdminTest.java?rev=3D1903= 50&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ListAsNonAdminTest.java (added) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ListAsNonAdminTest.java Sun Jun 12 22:01:33 2005 @@ -0,0 +1,75 @@ +/* + * Copyright 2004 The Apache Software Foundation + * + * Licensed 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 impli= ed. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.ldap.server.jndi; + + +import javax.naming.NameClassPair; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; + +import org.apache.ldap.server.AbstractNonAdminTestCase; + +import java.util.HashSet; + + +/** + * Tests our ability to list elements as the admin user and as a non admin= user + * on security sensitive values. We do not return results or name class p= airs + * for user accounts if the user is not the admin. + * + * @author Apache Directory Pr= oject + * @version $Rev$ + */ +public class ListAsNonAdminTest extends AbstractNonAdminTestCase +{ + public void testListSystemAsNonAdmin() throws NamingException + { + HashSet set =3D new HashSet(); + + NamingEnumeration list =3D sysRoot.list( "" ); + + while ( list.hasMore() ) + { + NameClassPair ncp =3D ( NameClassPair ) list.next(); + + set.add( ncp.getName() ); + } + + assertFalse( set.contains( "uid=3Dadmin,ou=3Dsystem" ) ); + + assertTrue( set.contains( "ou=3Dusers,ou=3Dsystem" ) ); + + assertTrue( set.contains( "ou=3Dgroups,ou=3Dsystem" ) ); + } + + + public void testListUsersAsNonAdmin() throws NamingException + { + HashSet set =3D new HashSet(); + + NamingEnumeration list =3D sysRoot.list( "ou=3Dusers" ); + + while ( list.hasMore() ) + { + NameClassPair ncp =3D ( NameClassPair ) list.next(); + + set.add( ncp.getName() ); + } + + assertFalse( set.contains( "uid=3Dakarasulu,ou=3Dusers,ou=3Dsystem= " ) ); + } +} Propchange: directory/apacheds/branches/direve-158/core/src/test/org/apache= /ldap/server/jndi/ListAsNonAdminTest.java ---------------------------------------------------------------------------= --- svn:keywords =3D HeadURL Id LastChangedBy LastChangedDate LastChangedRe= vision Modified: directory/apacheds/branches/direve-158/core/src/test/org/apache/l= dap/server/jndi/ModifyContextTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/jndi/ModifyContextTest.java?rev=3D19035= 0&r1=3D190349&r2=3D190350&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ModifyContextTest.java (original) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ModifyContextTest.java Sun Jun 12 22:01:33 2005 @@ -17,10 +17,14 @@ package org.apache.ldap.server.jndi; =20 =20 -import org.apache.ldap.server.AbstractCoreTest; - import javax.naming.NamingException; -import javax.naming.directory.*; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import javax.naming.directory.BasicAttribute; +import javax.naming.directory.BasicAttributes; +import javax.naming.directory.DirContext; + +import org.apache.ldap.server.AbstractAdminTestCase; =20 =20 /** @@ -30,7 +34,7 @@ * @author Apache Directory Pr= oject * @version $Rev$ */ -public class ModifyContextTest extends AbstractCoreTest +public class ModifyContextTest extends AbstractAdminTestCase { protected void setUp() throws Exception { Modified: directory/apacheds/branches/direve-158/core/src/test/org/apache/l= dap/server/jndi/ObjStateFactoryTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/jndi/ObjStateFactoryTest.java?rev=3D190= 350&r1=3D190349&r2=3D190350&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ObjStateFactoryTest.java (original) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ObjStateFactoryTest.java Sun Jun 12 22:01:33 2005 @@ -17,15 +17,20 @@ package org.apache.ldap.server.jndi; =20 =20 -import org.apache.ldap.server.AbstractCoreTest; +import java.util.Hashtable; =20 import javax.naming.Context; import javax.naming.Name; import javax.naming.NamingException; -import javax.naming.directory.*; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import javax.naming.directory.BasicAttribute; +import javax.naming.directory.BasicAttributes; +import javax.naming.directory.SchemaViolationException; import javax.naming.spi.DirObjectFactory; import javax.naming.spi.DirStateFactory; -import java.util.Hashtable; + +import org.apache.ldap.server.AbstractAdminTestCase; =20 =20 /** @@ -34,7 +39,7 @@ * @author Apache Directory Pr= oject * @version $Rev$ */ -public class ObjStateFactoryTest extends AbstractCoreTest +public class ObjStateFactoryTest extends AbstractAdminTestCase { public void testObjectFactory() throws NamingException { Modified: directory/apacheds/branches/direve-158/core/src/test/org/apache/l= dap/server/jndi/RFC2713Tests.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/jndi/RFC2713Tests.java?rev=3D190350&r1= =3D190349&r2=3D190350&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/RFC2713Tests.java (original) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/RFC2713Tests.java Sun Jun 12 22:01:33 2005 @@ -17,11 +17,12 @@ package org.apache.ldap.server.jndi; =20 =20 -import org.apache.ldap.server.AbstractCoreTest; +import java.util.ArrayList; =20 import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; -import java.util.ArrayList; + +import org.apache.ldap.server.AbstractAdminTestCase; =20 =20 /** @@ -31,7 +32,7 @@ * @author Apache Directory Pr= oject * @version $Rev$ */ -public class RFC2713Tests extends AbstractCoreTest +public class RFC2713Tests extends AbstractAdminTestCase { public void testSerialization() throws Exception { Modified: directory/apacheds/branches/direve-158/core/src/test/org/apache/l= dap/server/jndi/SearchContextTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/jndi/SearchContextTest.java?rev=3D19035= 0&r1=3D190349&r2=3D190350&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/SearchContextTest.java (original) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/SearchContextTest.java Sun Jun 12 22:01:33 2005 @@ -17,13 +17,20 @@ package org.apache.ldap.server.jndi; =20 =20 -import org.apache.ldap.common.message.DerefAliasesEnum; -import org.apache.ldap.server.AbstractCoreTest; +import java.util.HashMap; =20 import javax.naming.NamingEnumeration; import javax.naming.NamingException; -import javax.naming.directory.*; -import java.util.HashMap; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import javax.naming.directory.BasicAttribute; +import javax.naming.directory.BasicAttributes; +import javax.naming.directory.DirContext; +import javax.naming.directory.SearchControls; +import javax.naming.directory.SearchResult; + +import org.apache.ldap.common.message.DerefAliasesEnum; +import org.apache.ldap.server.AbstractAdminTestCase; =20 =20 /** @@ -32,7 +39,7 @@ * @author Apache Directory Pr= oject * @version $Rev$ */ -public class SearchContextTest extends AbstractCoreTest +public class SearchContextTest extends AbstractAdminTestCase { protected void setUp() throws Exception { Modified: directory/apacheds/branches/direve-158/core/src/test/org/apache/l= dap/server/jndi/ShutdownTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/jndi/ShutdownTest.java?rev=3D190350&r1= =3D190349&r2=3D190350&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ShutdownTest.java (original) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/ShutdownTest.java Sun Jun 12 22:01:33 2005 @@ -17,7 +17,7 @@ package org.apache.ldap.server.jndi; =20 =20 -import org.apache.ldap.server.AbstractCoreTest; +import org.apache.ldap.server.AbstractAdminTestCase; import org.apache.ldap.server.configuration.ShutdownConfiguration; =20 =20 @@ -27,7 +27,7 @@ * @author Apache Directory Pr= oject * @version $Rev$ */ -public class ShutdownTest extends AbstractCoreTest +public class ShutdownTest extends AbstractAdminTestCase { protected void tearDown() throws Exception { Modified: directory/apacheds/branches/direve-158/core/src/test/org/apache/l= dap/server/jndi/SyncTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/jndi/SyncTest.java?rev=3D190350&r1=3D19= 0349&r2=3D190350&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/SyncTest.java (original) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/jndi/SyncTest.java Sun Jun 12 22:01:33 2005 @@ -19,7 +19,7 @@ =20 import javax.naming.directory.Attributes; =20 -import org.apache.ldap.server.AbstractCoreTest; +import org.apache.ldap.server.AbstractAdminTestCase; import org.apache.ldap.server.configuration.SyncConfiguration; =20 =20 @@ -29,7 +29,7 @@ * @author Apache Directory Pr= oject * @version $Rev$ */ -public class SyncTest extends AbstractCoreTest +public class SyncTest extends AbstractAdminTestCase { /** * Makes sure the changes to the JNDI provider take effect where a syn= c op Modified: directory/apacheds/branches/direve-158/core/src/test/org/apache/l= dap/server/operational/BinaryAttributeFilterTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/operational/BinaryAttributeFilterTest.j= ava?rev=3D190350&r1=3D190349&r2=3D190350&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/operational/BinaryAttributeFilterTest.java (original) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/operational/BinaryAttributeFilterTest.java Sun Jun 12 22:01:33 2005 @@ -17,14 +17,14 @@ package org.apache.ldap.server.operational; =20 =20 -import org.apache.ldap.server.AbstractCoreTest; - import javax.naming.NamingException; import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import javax.naming.directory.BasicAttributes; import javax.naming.directory.DirContext; =20 +import org.apache.ldap.server.AbstractAdminTestCase; + =20 /** * Tests to see that the binary property filtering in the schema service's @@ -34,7 +34,7 @@ * @author Apache Directory Pr= oject * @version $Rev$ */ -public class BinaryAttributeFilterTest extends AbstractCoreTest +public class BinaryAttributeFilterTest extends AbstractAdminTestCase { private static final String BINARY_KEY =3D "java.naming.ldap.attribute= s=2Ebinary"; =20 Modified: directory/apacheds/branches/direve-158/core/src/test/org/apache/l= dap/server/operational/OperationalAttributeServiceTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/operational/OperationalAttributeService= Test.java?rev=3D190350&r1=3D190349&r2=3D190350&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/operational/OperationalAttributeServiceTest.java (original) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/operational/OperationalAttributeServiceTest.java Sun Jun 12 22:01:33 2= 005 @@ -17,12 +17,18 @@ package org.apache.ldap.server.operational; =20 =20 -import org.apache.ldap.common.message.DerefAliasesEnum; -import org.apache.ldap.server.AbstractCoreTest; - import javax.naming.NamingEnumeration; import javax.naming.NamingException; -import javax.naming.directory.*; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import javax.naming.directory.BasicAttribute; +import javax.naming.directory.BasicAttributes; +import javax.naming.directory.DirContext; +import javax.naming.directory.SearchControls; +import javax.naming.directory.SearchResult; + +import org.apache.ldap.common.message.DerefAliasesEnum; +import org.apache.ldap.server.AbstractAdminTestCase; =20 =20 /** @@ -32,7 +38,7 @@ * @author Apache Directory Pr= oject * @version $Rev$ */ -public class OperationalAttributeServiceTest extends AbstractCoreTest +public class OperationalAttributeServiceTest extends AbstractAdminTestCase { private static final String CREATORS_NAME =3D "creatorsName"; private static final String CREATE_TIMESTAMP =3D "createTimestamp"; Modified: directory/apacheds/branches/direve-158/core/src/test/org/apache/l= dap/server/prefs/ServerPreferencesFactoryTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/prefs/ServerPreferencesFactoryTest.java= ?rev=3D190350&r1=3D190349&r2=3D190350&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/prefs/ServerPreferencesFactoryTest.java (original) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/prefs/ServerPreferencesFactoryTest.java Sun Jun 12 22:01:33 2005 @@ -17,10 +17,10 @@ package org.apache.ldap.server.prefs; =20 =20 -import org.apache.ldap.server.AbstractCoreTest; - import java.util.prefs.Preferences; =20 +import org.apache.ldap.server.AbstractAdminTestCase; + =20 /** * Test cases for the server PreferencessFactory. @@ -28,16 +28,14 @@ * @author Apache Directory Pr= oject * @version $Rev$ */ -public class ServerPreferencesFactoryTest extends AbstractCoreTest +public class ServerPreferencesFactoryTest extends AbstractAdminTestCase { public void testSystemRoot() { ServerPreferencesFactory factory =3D new ServerPreferencesFactory(= ); - Preferences prefs =3D factory.systemRoot(); =20 assertNotNull( prefs ); - - assertEquals( "sysPrefRoot", prefs.get( "prefNodeName", "sysPrefRo= ot" ) ); + assertEquals( "sysPrefRoot", prefs.get( "prefNodeName", "default v= alue" ) ); } } Modified: directory/apacheds/branches/direve-158/core/src/test/org/apache/l= dap/server/prefs/ServerSystemPreferencesTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/c= ore/src/test/org/apache/ldap/server/prefs/ServerSystemPreferencesTest.java?= rev=3D190350&r1=3D190349&r2=3D190350&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/prefs/ServerSystemPreferencesTest.java (original) +++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/se= rver/prefs/ServerSystemPreferencesTest.java Sun Jun 12 22:01:33 2005 @@ -17,11 +17,11 @@ package org.apache.ldap.server.prefs; =20 =20 -import org.apache.ldap.server.AbstractCoreTest; - import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; =20 +import org.apache.ldap.server.AbstractAdminTestCase; + =20 /** * Tests the ServerSystemPreferences class. @@ -29,18 +29,24 @@ * @author Apache Directory Pr= oject * @version $Rev$ */ -public class ServerSystemPreferencesTest extends AbstractCoreTest +public class ServerSystemPreferencesTest extends AbstractAdminTestCase { + private ServerSystemPreferences prefs; + =20 + public void setUp() throws Exception + { + super.setUp(); + prefs =3D new ServerSystemPreferences(); + } + =20 /** * Tests to make sure the system preferences root has entry (test, abc= 123). */ public void testRoot() throws Exception { - ServerSystemPreferences prefs =3D new ServerSystemPreferences(); assertEquals( "sysPrefRoot", prefs.get( "prefNodeName", "not the v= alue" ) ); } =20 - /** * Tests the creation and use of a new preferences node. * @@ -48,7 +54,6 @@ */ public void testCreate() throws BackingStoreException { - Preferences prefs =3D new ServerSystemPreferences(); Preferences testNode =3D prefs.node( "testNode" ); =20 testNode.put( "testNodeKey", "testNodeValue" ); @@ -63,38 +68,25 @@ */ public void testCreateAndSet() throws BackingStoreException { - Preferences prefs =3D new ServerSystemPreferences(); - Preferences testNode =3D prefs.node( "testNode" ); =20 testNode.put( "testNodeKey", "testNodeValue" ); - testNode.sync(); =20 testNode.putBoolean( "boolKey", true ); - testNode.putByteArray( "arrayKey", new byte[10] ); - testNode.putDouble( "doubleKey", 3.14 ); - testNode.putFloat( "floatKey", ( float ) 3.14 ); - testNode.putInt( "intKey", 345 ); - testNode.putLong( "longKey", 75449559185447L ); - testNode.sync(); =20 testNode =3D prefs.node( "testNode" ); =20 assertEquals( true, testNode.getBoolean( "boolKey", false ) ); - assertTrue( 3.14 =3D=3D testNode.getDouble( "doubleKey", 9.20 ) ); - assertTrue( (float) 3.14 =3D=3D testNode.getFloat( "floatKey", (fl= oat) 3.90 ) ); - assertEquals( 345, testNode.getInt( "intKey", 87 ) ); - assertEquals( 75449559185447L, testNode.getLong( "longKey", 754495= 47L ) ); } =20 @@ -106,52 +98,36 @@ */ public void testCreateAndRemove() throws BackingStoreException { - Preferences prefs =3D new ServerSystemPreferences(); - Preferences testNode =3D prefs.node( "testNode" ); =20 testNode.put( "testNodeKey", "testNodeValue" ); - testNode.sync(); =20 testNode.putBoolean( "boolKey", true ); - testNode.putByteArray( "arrayKey", new byte[10] ); - testNode.putDouble( "doubleKey", 3.14 ); - testNode.putFloat( "floatKey", ( float ) 3.14 ); - testNode.putInt( "intKey", 345 ); - testNode.putLong( "longKey", 75449559185447L ); - testNode.sync(); =20 testNode =3D prefs.node( "testNode" ); =20 assertEquals( true, testNode.getBoolean( "boolKey", false ) ); - assertTrue( 3.14 =3D=3D testNode.getDouble( "doubleKey", 9.20 ) ); - assertTrue( (float) 3.14 =3D=3D testNode.getFloat( "floatKey", (fl= oat) 3.90 ) ); - assertEquals( 345, testNode.getInt( "intKey", 87 ) ); - assertEquals( 75449559185447L, testNode.getLong( "longKey", 754495= 47L ) ); =20 testNode.remove( "doubleKey" ); - testNode.remove( "arrayKey" ); =20 assertEquals( "no value", testNode.get( "doubleKey", "no value" ) = ); - assertEquals( "no value", testNode.get( "arrayKey", "no value" ) ); =20 testNode.sync(); =20 assertEquals( "no value", testNode.get( "doubleKey", "no value" ) = ); - assertEquals( "no value", testNode.get( "arrayKey", "no value" ) ); } }