You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/08/14 02:22:40 UTC
svn commit: r985411 [4/11] - in /directory:
apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/
apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/admin/
apacheds...
Modified: directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java Sat Aug 14 00:22:38 2010
@@ -39,8 +39,6 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.SearchResponse;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
import org.apache.directory.server.core.annotations.CreateDS;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.integ.FrameworkRunner;
@@ -50,6 +48,8 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.DefaultEntry;
import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.filter.SearchScope;
+import org.apache.directory.shared.ldap.message.internal.InternalResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
import org.apache.directory.shared.ldap.name.DN;
import org.junit.After;
import org.junit.Before;
@@ -65,13 +65,14 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
@RunWith(FrameworkRunner.class)
-@CreateDS( enableAccessControl=true )
+@CreateDS(enableAccessControl = true)
public class SearchAuthorizationIT extends AbstractLdapTestUnit
{
// to avoid creating too many connections during recursive operations
private LdapConnection reusableAdminCon;
-
+
+
@Before
public void setService() throws Exception
{
@@ -79,13 +80,13 @@ public class SearchAuthorizationIT exten
reusableAdminCon = getAdminConnection();
}
+
@After
public void closeConnections()
{
IntegrationUtils.closeConnections();
}
-
-
+
/**
* The search results of tests are added to this map via put (<String, Entry>)
* the map is also cleared before each search test. This allows further inspections
@@ -104,11 +105,11 @@ public class SearchAuthorizationIT exten
private Entry[] getTestNodes( final int count )
{
Entry[] entries = new DefaultEntry[count];
-
+
for ( int i = 0; i < count; i++ )
{
Entry entry = new DefaultEntry();
-
+
try
{
entry.add( "objectClass", "organizationalUnit" );
@@ -119,7 +120,7 @@ public class SearchAuthorizationIT exten
{
e.printStackTrace();
}
-
+
entries[i] = entry;
}
@@ -190,11 +191,12 @@ public class SearchAuthorizationIT exten
*/
private void recursivelyDelete( DN rdn ) throws Exception
{
- Cursor<SearchResponse> results = reusableAdminCon.search( rdn.getName(), "(objectClass=*)", SearchScope.ONELEVEL, "*" );
+ Cursor<InternalResponse> results = reusableAdminCon.search( rdn.getName(), "(objectClass=*)",
+ SearchScope.ONELEVEL, "*" );
while ( results.next() )
{
- SearchResultEntry result = ( SearchResultEntry ) results.get();
+ InternalSearchResultEntry result = ( InternalSearchResultEntry ) results.get();
DN childRdn = result.getEntry().getDn();
recursivelyDelete( childRdn );
}
@@ -275,12 +277,12 @@ public class SearchAuthorizationIT exten
DN userDn = new DN( "uid=" + uid + ",ou=users,ou=system" );
results.clear();
LdapConnection userCtx = getConnectionAs( userDn, password );
- Cursor<SearchResponse> cursor = userCtx.search( base.getName(), filter, scope, "*" );
+ Cursor<InternalResponse> cursor = userCtx.search( base.getName(), filter, scope, "*" );
int counter = 0;
while ( cursor.next() )
{
- Entry result = ( ( SearchResultEntry ) cursor.get() ).getEntry();
+ Entry result = ( ( InternalSearchResultEntry ) cursor.get() ).getEntry();
results.put( result.getDn().getName(), result );
counter++;
}
@@ -315,12 +317,12 @@ public class SearchAuthorizationIT exten
results.clear();
LdapConnection userCtx = getConnectionAs( userDn, password );
- Cursor<SearchResponse> cursor = userCtx.search( base.getName(), "(objectClass=*)", scope, "*" );
+ Cursor<InternalResponse> cursor = userCtx.search( base.getName(), "(objectClass=*)", scope, "*" );
int counter = 0;
while ( cursor.next() )
{
- Entry result = ( ( SearchResultEntry ) cursor.get() ).getEntry();
+ Entry result = ( ( InternalSearchResultEntry ) cursor.get() ).getEntry();
results.put( result.getDn().getName(), result );
counter++;
}
@@ -344,8 +346,8 @@ public class SearchAuthorizationIT exten
LdapConnection connection = getAdminConnection();
DN base = addSearchData( new DN( "ou=system" ), 3, 10 );
- Cursor<SearchResponse> results = connection
- .search( base.getName(), "(objectClass=*)", SearchScope.SUBTREE, "+" );
+ Cursor<InternalResponse> results = connection.search( base.getName(), "(objectClass=*)", SearchScope.SUBTREE,
+ "+" );
int counter = 0;
while ( results.next() )
@@ -357,7 +359,7 @@ public class SearchAuthorizationIT exten
assertEquals( 10, counter );
recursivelyDelete( base );
- SearchResultEntry entry = ( SearchResultEntry ) connection.lookup( base.getName() );
+ InternalSearchResultEntry entry = ( InternalSearchResultEntry ) connection.lookup( base.getName() );
assertNull( entry );
}
@@ -382,27 +384,12 @@ public class SearchAuthorizationIT exten
// Gives search perms to all users in the Administrators group for
// entries and all attribute types and values
- createAccessControlSubentry(
- "searchAdmin",
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses " +
- " { " +
- " userGroup { \"cn=Administrators,ou=groups,ou=system\" } " +
- " }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " +
- " } " +
- " } " +
- " } " +
- "}" );
+ createAccessControlSubentry( "searchAdmin", "{ " + " identificationTag \"searchAci\", " + " precedence 14, "
+ + " authenticationLevel none, " + " itemOrUserFirst userFirst: " + " { " + " userClasses " + " { "
+ + " userGroup { \"cn=Administrators,ou=groups,ou=system\" } " + " }, " + " userPermissions "
+ + " { " + " { " + " protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " } " + " } " + " } "
+ + "}" );
// see if we can now search that test entry which we could not before
// add or should still fail since billd is not in the admin group
@@ -431,27 +418,12 @@ public class SearchAuthorizationIT exten
assertFalse( checkCanSearchAs( "billyd", "billyd" ) );
// now add a subentry that enables user billyd to search an entry below ou=system
- createAccessControlSubentry(
- "billydSearch",
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses " +
- " { " +
- " name { \"uid=billyd,ou=users,ou=system\" } " +
- " }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " +
- " } " +
- " }" +
- " } " +
- "}" );
+ createAccessControlSubentry( "billydSearch", "{ " + " identificationTag \"searchAci\", " + " precedence 14, "
+ + " authenticationLevel none, " + " itemOrUserFirst userFirst: " + " { " + " userClasses " + " { "
+ + " name { \"uid=billyd,ou=users,ou=system\" } " + " }, " + " userPermissions " + " { "
+ + " { " + " protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " } " + " }" + " } "
+ + "}" );
// should work now that billyd is authorized by name
assertTrue( checkCanSearchAs( "billyd", "billyd" ) );
@@ -474,27 +446,12 @@ public class SearchAuthorizationIT exten
assertFalse( checkCanSearchAs( "BillyD", "billyd" ) );
// now add a subentry that enables user billyd to search an entry below ou=system
- createAccessControlSubentry(
- "billydSearch",
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses " +
- " { " +
- " name { \"uid=billyd,ou=users,ou=system\" } " +
- " }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " +
- " } " +
- " } " +
- " } " +
- "}" );
+ createAccessControlSubentry( "billydSearch", "{ " + " identificationTag \"searchAci\", " + " precedence 14, "
+ + " authenticationLevel none, " + " itemOrUserFirst userFirst: " + " { " + " userClasses " + " { "
+ + " name { \"uid=billyd,ou=users,ou=system\" } " + " }, " + " userPermissions " + " { "
+ + " { " + " protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " } " + " } " + " } "
+ + "}" );
// should work now that billyd is authorized by name
assertTrue( checkCanSearchAs( "BillyD", "billyd" ) );
@@ -516,30 +473,13 @@ public class SearchAuthorizationIT exten
assertFalse( checkCanSearchAs( "billyd", "billyd" ) );
// now add a subentry that enables user billyd to search an entry below ou=system
- createAccessControlSubentry(
- "billySearchBySubtree",
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses " +
- " { " +
- " subtree " +
- " { " +
- " { base \"ou=users,ou=system\" } " +
- " } " +
- " }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " +
- " } " +
- " } " +
- " } " +
- "}" );
+ createAccessControlSubentry( "billySearchBySubtree", "{ " + " identificationTag \"searchAci\", "
+ + " precedence 14, " + " authenticationLevel none, " + " itemOrUserFirst userFirst: " + " { "
+ + " userClasses " + " { " + " subtree " + " { "
+ + " { base \"ou=users,ou=system\" } " + " } " + " }, " + " userPermissions " + " { "
+ + " { " + " protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " } " + " } " + " } "
+ + "}" );
// should work now that billyd is authorized by the subtree userClass
assertTrue( checkCanSearchAs( "billyd", "billyd" ) );
@@ -561,24 +501,12 @@ public class SearchAuthorizationIT exten
assertFalse( checkCanSearchAs( "billyd", "billyd" ) );
// now add a subentry that enables anyone to search an entry below ou=system
- createAccessControlSubentry(
- "anybodySearch",
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " +
- " } " +
- " } " +
- " } " +
- "}" );
+ createAccessControlSubentry( "anybodySearch", "{ " + " identificationTag \"searchAci\", "
+ + " precedence 14, " + " authenticationLevel none, " + " itemOrUserFirst userFirst: " + " { "
+ + " userClasses { allUsers }, " + " userPermissions " + " { " + " { "
+ + " protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " } " + " } " + " } "
+ + "}" );
// see if we can now search that tree which we could not before
// should work now with billyd now that all users are authorized
@@ -607,25 +535,12 @@ public class SearchAuthorizationIT exten
// now add a subentry that enables anyone to search an entry below ou=system
// down two more rdns for DNs of a max size of 3
- createAccessControlSubentry(
- "anybodySearch",
- "{ maximum 2 }",
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " +
- " } " +
- " } " +
- " } " +
- "}" );
+ createAccessControlSubentry( "anybodySearch", "{ maximum 2 }", "{ " + " identificationTag \"searchAci\", "
+ + " precedence 14, " + " authenticationLevel none, " + " itemOrUserFirst userFirst: " + " { "
+ + " userClasses { allUsers }, " + " userPermissions " + " { " + " { "
+ + " protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " } " + " } " + " } "
+ + "}" );
// see if we can now search that test entry which we could not before
// should work now with billyd now that all users are authorized
@@ -651,25 +566,12 @@ public class SearchAuthorizationIT exten
// now add a subentry that enables anyone to search an entry below ou=system
// down two more rdns for DNs of a max size of 3. It only grants access to
// the ou and objectClass attributes however.
- createAccessControlSubentry(
- "excludeTelephoneNumber",
- "{ maximum 2 }",
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allAttributeValues { ou, objectClass } }, " +
- " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " +
- " } " +
- " } " +
- " } " +
- "}" );
+ createAccessControlSubentry( "excludeTelephoneNumber", "{ maximum 2 }", "{ "
+ + " identificationTag \"searchAci\", " + " precedence 14, " + " authenticationLevel none, "
+ + " itemOrUserFirst userFirst: " + " { " + " userClasses { allUsers }, " + " userPermissions "
+ + " { " + " { " + " protectedItems {entry, allAttributeValues { ou, objectClass } }, "
+ + " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " } " + " } " + " } "
+ + "}" );
// see if we can now search and find 4 entries
assertTrue( checkCanSearchAs( "billyd", "billyd", SearchScope.SUBTREE, 4 ) );
@@ -686,25 +588,12 @@ public class SearchAuthorizationIT exten
// now add a subentry that enables anyone to search an entry below ou=system
// down two more rdns for DNs of a max size of 3. This time we should be able
// to see the telephoneNumber attribute
- createAccessControlSubentry(
- "includeAllAttributeTypesAndValues",
- "{ maximum 2 }",
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues }, " +
- " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " +
- " } " +
- " }" +
- " } " +
- "}" );
+ createAccessControlSubentry( "includeAllAttributeTypesAndValues", "{ maximum 2 }", "{ "
+ + " identificationTag \"searchAci\", " + " precedence 14, " + " authenticationLevel none, "
+ + " itemOrUserFirst userFirst: " + " { " + " userClasses { allUsers }, " + " userPermissions "
+ + " { " + " { " + " protectedItems {entry, allUserAttributeTypesAndValues }, "
+ + " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " } " + " }" + " } "
+ + "}" );
// again we should find four entries
assertTrue( checkCanSearchAs( "billyd", "billyd", SearchScope.SUBTREE, 4 ) );
@@ -736,31 +625,13 @@ public class SearchAuthorizationIT exten
// now add a subentry that enables anyone to search an entry below ou=system
// down two more rdns for DNs of a max size of 3. It only grants access to
// the ou and objectClass attributes however.
- createAccessControlSubentry(
- "excludeOUValue",
- "{ maximum 2 }",
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems " +
- " {" +
- " entry, " +
- " attributeType { ou }, " +
- " allAttributeValues { objectClass }, " +
- " attributeValue { ou=0, ou=1, ou=2 } " +
- " }, " +
- " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " +
- " } " +
- " } " +
- " } " +
- "}" );
+ createAccessControlSubentry( "excludeOUValue", "{ maximum 2 }", "{ " + " identificationTag \"searchAci\", "
+ + " precedence 14, " + " authenticationLevel none, " + " itemOrUserFirst userFirst: " + " { "
+ + " userClasses { allUsers }, " + " userPermissions " + " { " + " { "
+ + " protectedItems " + " {" + " entry, " + " attributeType { ou }, "
+ + " allAttributeValues { objectClass }, " + " attributeValue { ou=0, ou=1, ou=2 } "
+ + " }, " + " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " } "
+ + " } " + " } " + "}" );
// see if we can now search and find 4 entries
assertTrue( checkCanSearchAs( "billyd", "billyd", 3 ) );
@@ -777,25 +648,12 @@ public class SearchAuthorizationIT exten
// now add a subentry that enables anyone to search an entry below ou=system
// down two more rdns for DNs of a max size of 3. This time we should be able
// to see the telephoneNumber attribute
- createAccessControlSubentry(
- "includeAllAttributeTypesAndValues",
- "{ maximum 2 }",
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues }, " +
- " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " +
- " } " +
- " } " +
- " }" +
- "}" );
+ createAccessControlSubentry( "includeAllAttributeTypesAndValues", "{ maximum 2 }", "{ "
+ + " identificationTag \"searchAci\", " + " precedence 14, " + " authenticationLevel none, "
+ + " itemOrUserFirst userFirst: " + " { " + " userClasses { allUsers }, " + " userPermissions "
+ + " { " + " { " + " protectedItems {entry, allUserAttributeTypesAndValues }, "
+ + " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " } " + " } " + " }"
+ + "}" );
// again we should find four entries
assertTrue( checkCanSearchAs( "billyd", "billyd", 3 ) );
@@ -822,23 +680,10 @@ public class SearchAuthorizationIT exten
createUser( "billyd", "billyd" );
// now add an entryACI denies browse, read and returnDN to a specific entry
- String aci =
- "{ " +
- " identificationTag \"denyAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials { denyRead, denyReturnDN, denyBrowse } " +
- " } " +
- " } " +
- " } " +
- "}";
+ String aci = "{ " + " identificationTag \"denyAci\", " + " precedence 14, " + " authenticationLevel none, "
+ + " itemOrUserFirst userFirst: " + " { " + " userClasses { allUsers }, " + " userPermissions "
+ + " { " + " { " + " protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + " grantsAndDenials { denyRead, denyReturnDN, denyBrowse } " + " } " + " } " + " } " + "}";
// try a search operation which should fail without any prescriptive ACI
DN testsDn = new DN( "ou=system" );
@@ -846,24 +691,12 @@ public class SearchAuthorizationIT exten
assertFalse( checkSearchAsWithEntryACI( "billyd", "billyd", SearchScope.SUBTREE, testsDn, aci, 9 ) );
// now add a subentry that enables anyone to search below ou=system
- createAccessControlSubentry(
- "anybodySearch",
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " +
- " } " +
- " } " +
- " } " +
- "}" );
+ createAccessControlSubentry( "anybodySearch", "{ " + " identificationTag \"searchAci\", "
+ + " precedence 14, " + " authenticationLevel none, " + " itemOrUserFirst userFirst: " + " { "
+ + " userClasses { allUsers }, " + " userPermissions " + " { " + " { "
+ + " protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " } " + " } " + " } "
+ + "}" );
// see if we can now search the tree which we could not before
// should work with billyd now that all users are authorized
@@ -892,23 +725,10 @@ public class SearchAuthorizationIT exten
createUser( "billyd", "billyd" );
// now add an entryACI denying browse, read and returnDN to a specific entry
- String aci =
- "{ " +
- " identificationTag \"denyAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials { denyRead, denyReturnDN, denyBrowse } " +
- " } " +
- " } " +
- " } " +
- "}";
+ String aci = "{ " + " identificationTag \"denyAci\", " + " precedence 14, " + " authenticationLevel none, "
+ + " itemOrUserFirst userFirst: " + " { " + " userClasses { allUsers }, " + " userPermissions "
+ + " { " + " { " + " protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + " grantsAndDenials { denyRead, denyReturnDN, denyBrowse } " + " } " + " } " + " } " + "}";
// try a search operation which should fail without any prescriptive ACI
DN testsDn = new DN( "ou=system" );
@@ -916,24 +736,12 @@ public class SearchAuthorizationIT exten
assertFalse( checkSearchAsWithEntryACI( "billyd", "billyd", SearchScope.SUBTREE, testsDn, aci, 9 ) );
// now add a subentry that enables anyone to search below ou=system
- createAccessControlSubentry(
- "anybodySearch",
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 15, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " +
- " } " +
- " } " +
- " } " +
- "}" );
+ createAccessControlSubentry( "anybodySearch", "{ " + " identificationTag \"searchAci\", "
+ + " precedence 15, " + " authenticationLevel none, " + " itemOrUserFirst userFirst: " + " { "
+ + " userClasses { allUsers }, " + " userPermissions " + " { " + " { "
+ + " protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " } " + " } " + " } "
+ + "}" );
// see if we can now search the tree which we could not before
// should work with billyd now that all users are authorized
@@ -945,23 +753,10 @@ public class SearchAuthorizationIT exten
// now add an entryACI denies browse, read and returnDN to a specific entry
// but this time the precedence will be higher than that of the grant
- aci =
- "{ " +
- " identificationTag \"denyAci\", " +
- " precedence 16, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials { denyRead, denyReturnDN, denyBrowse } " +
- " } " +
- " } " +
- " } " +
- "}";
+ aci = "{ " + " identificationTag \"denyAci\", " + " precedence 16, " + " authenticationLevel none, "
+ + " itemOrUserFirst userFirst: " + " { " + " userClasses { allUsers }, " + " userPermissions "
+ + " { " + " { " + " protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + " grantsAndDenials { denyRead, denyReturnDN, denyBrowse } " + " } " + " } " + " } " + "}";
// see if we can now search the tree which we could not before
// should work with billyd now that all users are authorized
@@ -982,16 +777,16 @@ public class SearchAuthorizationIT exten
* @return the single search result if access is allowed or null
* @throws Exception if the search fails w/ exception other than no permission
*/
- private SearchResultEntry checkCanSearhSubentryAs( String uid, String password, DN dn ) throws Exception
+ private InternalSearchResultEntry checkCanSearhSubentryAs( String uid, String password, DN dn ) throws Exception
{
LdapConnection userCtx = getConnectionAs( new DN( "uid=" + uid + ",ou=users,ou=system" ), password );
- SearchResultEntry result = null;
- Cursor<SearchResponse> list = null;
+ InternalSearchResultEntry result = null;
+ Cursor<InternalResponse> list = null;
list = userCtx.search( dn.getName(), "(objectClass=*)", SearchScope.OBJECT, "*" );
if ( list.next() )
{
- result = ( SearchResultEntry ) list.get();
+ result = ( InternalSearchResultEntry ) list.get();
}
list.close();
@@ -1007,46 +802,22 @@ public class SearchAuthorizationIT exten
createUser( "billyd", "billyd" );
// now add a subentry that enables anyone to search below ou=system
- createAccessControlSubentry(
- "anybodySearch",
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " +
- " } " +
- " } " +
- " } " +
- "}" );
+ createAccessControlSubentry( "anybodySearch", "{ " + " identificationTag \"searchAci\", "
+ + " precedence 14, " + " authenticationLevel none, " + " itemOrUserFirst userFirst: " + " { "
+ + " userClasses { allUsers }, " + " userPermissions " + " { " + " { "
+ + " protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " } " + " } " + " } "
+ + "}" );
// check and see if we can access the subentry now
assertNotNull( checkCanSearhSubentryAs( "billyd", "billyd", new DN( "cn=anybodySearch,ou=system" ) ) );
// now add a denial to prevent all users except the admin from accessing the subentry
- addSubentryACI(
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials { denyRead, denyReturnDN, denyBrowse } " +
- " } " +
- " } " +
- " } " +
- "}" );
+ addSubentryACI( "{ " + " identificationTag \"searchAci\", " + " precedence 14, "
+ + " authenticationLevel none, " + " itemOrUserFirst userFirst: " + " { "
+ + " userClasses { allUsers }, " + " userPermissions " + " { " + " { "
+ + " protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + " grantsAndDenials { denyRead, denyReturnDN, denyBrowse } " + " } " + " } " + " } " + "}" );
// now we should not be able to access the subentry with a search
assertNull( checkCanSearhSubentryAs( "billyd", "billyd", new DN( "cn=anybodySearch,ou=system" ) ) );
@@ -1061,70 +832,32 @@ public class SearchAuthorizationIT exten
// now add a subentry that enables anyone to search/lookup and disclose on error
// below ou=system, with the exclusion of ou=groups and everything below it
- createAccessControlSubentry(
- "selectiveDiscloseOnError",
- "{ specificExclusions " +
- " { chopBefore:\"ou=groups\" } " +
- "}",
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst:" +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials " +
- " { " +
- " grantRead, " +
- " grantReturnDN, " +
- " grantBrowse, " +
- " grantDiscloseOnError " +
- " } " +
- " } " +
- " } " +
- " } " +
- "}" );
+ createAccessControlSubentry( "selectiveDiscloseOnError", "{ specificExclusions "
+ + " { chopBefore:\"ou=groups\" } " + "}", "{ " + " identificationTag \"searchAci\", "
+ + " precedence 14, " + " authenticationLevel none, " + " itemOrUserFirst userFirst:" + " { "
+ + " userClasses { allUsers }, " + " userPermissions " + " { " + " { "
+ + " protectedItems {entry, allUserAttributeTypesAndValues}, " + " grantsAndDenials "
+ + " { " + " grantRead, " + " grantReturnDN, " + " grantBrowse, "
+ + " grantDiscloseOnError " + " } " + " } " + " } " + " } " + "}" );
// get a context as the user and try a lookup of a non-existant entry under ou=groups,ou=system
LdapConnection userCtx = getConnectionAs( "uid=billyd,ou=users,ou=system", "billyd" );
// we should not see ou=groups,ou=system for the remaining name
- SearchResultEntry entry = ( SearchResultEntry ) userCtx.lookup( "cn=blah,ou=groups" );
+ InternalSearchResultEntry entry = ( InternalSearchResultEntry ) userCtx.lookup( "cn=blah,ou=groups" );
assertNull( entry );
// now delete and replace subentry with one that does not excluse ou=groups,ou=system
deleteAccessControlSubentry( "selectiveDiscloseOnError" );
- createAccessControlSubentry(
- "selectiveDiscloseOnError",
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials " +
- " { " +
- " grantRead, " +
- " grantReturnDN, " +
- " grantBrowse, " +
- " grantDiscloseOnError " +
- " } " +
- " } " +
- " } " +
- " } " +
- "}" );
+ createAccessControlSubentry( "selectiveDiscloseOnError", "{ " + " identificationTag \"searchAci\", "
+ + " precedence 14, " + " authenticationLevel none, " + " itemOrUserFirst userFirst: " + " { "
+ + " userClasses { allUsers }, " + " userPermissions " + " { " + " { "
+ + " protectedItems {entry, allUserAttributeTypesAndValues}, " + " grantsAndDenials "
+ + " { " + " grantRead, " + " grantReturnDN, " + " grantBrowse, "
+ + " grantDiscloseOnError " + " } " + " } " + " } " + " } " + "}" );
// now try a lookup of a non-existant entry under ou=groups,ou=system again
- entry = ( SearchResultEntry ) userCtx.lookup( "cn=blah,ou=groups" );
+ entry = ( InternalSearchResultEntry ) userCtx.lookup( "cn=blah,ou=groups" );
assertNull( entry );
}
@@ -1143,48 +876,24 @@ public class SearchAuthorizationIT exten
getAdminConnection().add( phoneBook );
// now add a subentry that enables anyone to search below their own entries
- createAccessControlSubentry(
- "anybodySearchTheirSubordinates",
- "{ " +
- " identificationTag \"searchAci\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " +
- " } " +
- " } " +
- " } " +
- "}" );
+ createAccessControlSubentry( "anybodySearchTheirSubordinates", "{ " + " identificationTag \"searchAci\", "
+ + " precedence 14, " + " authenticationLevel none, " + " itemOrUserFirst userFirst: " + " { "
+ + " userClasses { allUsers }, " + " userPermissions " + " { " + " { "
+ + " protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " } " + " } " + " } "
+ + "}" );
// check and see if we can access the subentry now
assertNotNull( checkCanSearhSubentryAs( "billyd", "billyd", new DN(
"ou=phoneBook,uid=billyd,ou=users,ou=system" ) ) );
// now add a denial to prevent all users except the admin from accessing the subentry
- addPrescriptiveACI(
- "anybodySearchTheirSubordinates",
- "{ " +
- " identificationTag \"anybodyDontSearchTheirSubordinates\", " +
- " precedence 14, " +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { parentOfEntry }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems {entry, allUserAttributeTypesAndValues}, " +
- " grantsAndDenials { denyRead, denyReturnDN, denyBrowse } " +
- " } " +
- " } " +
- " } " +
- "}" );
+ addPrescriptiveACI( "anybodySearchTheirSubordinates", "{ "
+ + " identificationTag \"anybodyDontSearchTheirSubordinates\", " + " precedence 14, "
+ + " authenticationLevel none, " + " itemOrUserFirst userFirst: " + " { "
+ + " userClasses { parentOfEntry }, " + " userPermissions " + " { " + " { "
+ + " protectedItems {entry, allUserAttributeTypesAndValues}, "
+ + " grantsAndDenials { denyRead, denyReturnDN, denyBrowse } " + " } " + " } " + " } " + "}" );
// now we should not be able to access the subentry with a search
assertNull( checkCanSearhSubentryAs( "billyd", "billyd", new DN( "ou=phoneBook,uid=billyd,ou=users,ou=system" ) ) );
@@ -1207,28 +916,14 @@ public class SearchAuthorizationIT exten
assertFalse( checkCanSearchAs( "billyd", "billyd" ) );
// now add a subentry that allows a user to read the CN only
- createAccessControlSubentry(
- "rangeOfValues",
- "{ " +
- " identificationTag \"rangeOfValuesAci\", " +
- " precedence 14," +
- " authenticationLevel none, " +
- " itemOrUserFirst userFirst: " +
- " { " +
- " userClasses { allUsers }, " +
- " userPermissions " +
- " { " +
- " { " +
- " protectedItems { entry }, " +
- " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " +
- " }, " +
- " { " +
- " protectedItems { rangeOfValues (cn=billyd) }, " +
- " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " +
- " } " +
- " } " +
- " } " +
- "}" );
+ createAccessControlSubentry( "rangeOfValues", "{ " + " identificationTag \"rangeOfValuesAci\", "
+ + " precedence 14," + " authenticationLevel none, " + " itemOrUserFirst userFirst: " + " { "
+ + " userClasses { allUsers }, " + " userPermissions " + " { " + " { "
+ + " protectedItems { entry }, "
+ + " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " }, " + " { "
+ + " protectedItems { rangeOfValues (cn=billyd) }, "
+ + " grantsAndDenials { grantRead, grantReturnDN, grantBrowse } " + " } " + " } " + " } "
+ + "}" );
// see if we can now search and find 4 entries
assertTrue( checkCanSearchAs( "billyd", "billyd" ) );
Modified: directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/changelog/DefaultChangeLogIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/changelog/DefaultChangeLogIT.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/changelog/DefaultChangeLogIT.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/changelog/DefaultChangeLogIT.java Sat Aug 14 00:22:38 2010
@@ -29,7 +29,6 @@ import java.util.Arrays;
import org.apache.directory.ldap.client.api.LdapConnection;
import org.apache.directory.ldap.client.api.message.ModifyRequest;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
import org.apache.directory.server.core.annotations.CreateDS;
import org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
@@ -40,6 +39,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
import org.apache.directory.shared.ldap.name.DN;
import org.junit.After;
import org.junit.Test;
@@ -55,8 +55,8 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith ( FrameworkRunner.class )
-@CreateDS( factory=DefaultDirectoryServiceFactory.class, name="DefaultChangeLogIT-class" )
+@RunWith(FrameworkRunner.class)
+@CreateDS(factory = DefaultDirectoryServiceFactory.class, name = "DefaultChangeLogIT-class")
public class DefaultChangeLogIT extends AbstractLdapTestUnit
{
public static final Logger LOG = LoggerFactory.getLogger( DefaultChangeLogIT.class );
@@ -80,7 +80,7 @@ public class DefaultChangeLogIT extends
entry.add( SchemaConstants.OBJECT_CLASS_AT, "organizationalUnit" );
entry.add( SchemaConstants.OU_AT, "test0" );
sysRoot.add( entry );
-
+
assertEquals( revision + 1, service.getChangeLog().getCurrentRevision() );
Tag t0 = service.getChangeLog().tag();
@@ -134,7 +134,7 @@ public class DefaultChangeLogIT extends
// no sync this time but should happen automatically
service.shutdown();
service.startup();
-
+
sysRoot = getAdminConnection( service );
assertEquals( revision + 7, service.getChangeLog().getCurrentRevision() );
assertEquals( t1, service.getChangeLog().getLatest() );
@@ -168,7 +168,7 @@ public class DefaultChangeLogIT extends
service.shutdown();
service.startup();
-
+
sysRoot = getAdminConnection( service );
assertEquals( revision + 1, service.getChangeLog().getCurrentRevision() );
assertEquals( t0, service.getChangeLog().getLatest() );
@@ -293,7 +293,7 @@ public class DefaultChangeLogIT extends
modReq.add( "description", "a desc value" );
sysRoot.modify( modReq );
- Entry resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ Entry resusitated = ( ( InternalSearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
assertNotNull( resusitated );
EntryAttribute description = resusitated.get( "description" );
assertNotNull( description );
@@ -301,7 +301,7 @@ public class DefaultChangeLogIT extends
// now revert and assert that the added entry re-appears
service.revert( t0.getRevision() );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = ( ( InternalSearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
assertNotNull( resusitated );
assertNull( resusitated.get( "description" ) );
@@ -313,7 +313,7 @@ public class DefaultChangeLogIT extends
modReq = new ModifyRequest( resusitated.getDn() );
modReq.add( "description", "old value" );
sysRoot.modify( modReq );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = ( ( InternalSearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
assertNotNull( resusitated );
description = resusitated.get( "description" );
assertNotNull( description );
@@ -325,7 +325,7 @@ public class DefaultChangeLogIT extends
modReq.replace( "description", "new value" );
sysRoot.modify( modReq );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = ( ( InternalSearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
assertNotNull( resusitated );
description = resusitated.get( "description" );
assertNotNull( description );
@@ -333,13 +333,12 @@ public class DefaultChangeLogIT extends
// now revert and assert the old value is now reverted
service.revert( t1.getRevision() );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = ( ( InternalSearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
assertNotNull( resusitated );
description = resusitated.get( "description" );
assertNotNull( description );
assertEquals( description.getString(), "old value" );
-
// -------------------------------------------------------------------
// Modify REMOVE Test
// -------------------------------------------------------------------
@@ -349,14 +348,14 @@ public class DefaultChangeLogIT extends
modReq.remove( "description", "old value" );
sysRoot.modify( modReq );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = ( ( InternalSearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
assertNotNull( resusitated );
description = resusitated.get( "description" );
assertNull( description );
// now revert and assert the old value is now reverted
service.revert( t2.getRevision() );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = ( ( InternalSearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
assertNotNull( resusitated );
description = resusitated.get( "description" );
assertNotNull( description );
@@ -370,20 +369,20 @@ public class DefaultChangeLogIT extends
modReq = new ModifyRequest( resusitated.getDn() );
modReq.add( "userPassword", "to be replaced" );
sysRoot.modify( modReq );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = ( ( InternalSearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
assertPassword( resusitated, "to be replaced" );
modReq = new ModifyRequest( resusitated.getDn() );
modReq.remove( "description", "old value" );
modReq.add( "seeAlso", "ou=added" );
modReq.replace( "userPassword", "a replaced value" );
-
+
Tag t3 = service.getChangeLog().tag();
// now make the modification and check that description is gone,
// seeAlso is added, and that the userPassword has been replaced
sysRoot.modify( modReq );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = ( ( InternalSearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
assertNotNull( resusitated );
description = resusitated.get( "description" );
assertNull( description );
@@ -394,7 +393,7 @@ public class DefaultChangeLogIT extends
// now we revert and make sure the old values are as they were
service.revert( t3.getRevision() );
- resusitated = ( ( SearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
+ resusitated = ( ( InternalSearchResultEntry ) sysRoot.lookup( "ou=test5,ou=system" ) ).getEntry();
assertNotNull( resusitated );
description = resusitated.get( "description" );
assertNotNull( description );
@@ -415,14 +414,14 @@ public class DefaultChangeLogIT extends
private void assertNotPresent( LdapConnection connection, String dn ) throws LdapException
{
- SearchResultEntry se = ( SearchResultEntry ) connection.lookup( dn );
+ InternalSearchResultEntry se = ( InternalSearchResultEntry ) connection.lookup( dn );
assertNull( se );
}
-
-
+
+
private void assertPresent( LdapConnection connection, String dn ) throws LdapException
{
- Entry entry = ( ( SearchResultEntry ) connection.lookup( dn ) ).getEntry();
+ Entry entry = ( ( InternalSearchResultEntry ) connection.lookup( dn ) ).getEntry();
assertNotNull( entry );
}
}
Modified: directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java Sat Aug 14 00:22:38 2010
@@ -29,10 +29,6 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.AddResponse;
-import org.apache.directory.ldap.client.api.message.ModifyResponse;
-import org.apache.directory.ldap.client.api.message.SearchResponse;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.server.core.integ.IntegrationUtils;
@@ -48,6 +44,10 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.ldif.LdapLdifException;
import org.apache.directory.shared.ldap.ldif.LdifUtils;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.internal.InternalAddResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalModifyResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
import org.apache.directory.shared.ldap.name.DN;
import org.junit.After;
import org.junit.Before;
@@ -60,34 +60,26 @@ import org.junit.runner.RunWith;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith ( FrameworkRunner.class )
+@RunWith(FrameworkRunner.class)
public class CollectiveAttributeServiceIT extends AbstractLdapTestUnit
{
private static LdapConnection connection;
+
private Entry getTestEntry( String dn, String cn ) throws LdapLdifException, LdapException
{
- Entry subentry = LdifUtils.createEntry(
- new DN( dn ),
- "objectClass: top",
- "objectClass: person",
- "cn", cn ,
+ Entry subentry = LdifUtils.createEntry( new DN( dn ), "objectClass: top", "objectClass: person", "cn", cn,
"sn: testentry" );
return subentry;
}
- private Entry getTestSubentry( String dn ) throws LdapLdifException, LdapException
+ private Entry getTestSubentry( String dn ) throws LdapLdifException, LdapException
{
- Entry subentry = LdifUtils.createEntry(
- new DN( dn ),
- "objectClass: top",
- "objectClass: subentry",
- "objectClass: collectiveAttributeSubentry",
- "c-ou: configuration",
- "subtreeSpecification: { base \"ou=configuration\" }",
- "cn: testsubentry" );
+ Entry subentry = LdifUtils.createEntry( new DN( dn ), "objectClass: top", "objectClass: subentry",
+ "objectClass: collectiveAttributeSubentry", "c-ou: configuration",
+ "subtreeSpecification: { base \"ou=configuration\" }", "cn: testsubentry" );
return subentry;
}
@@ -95,14 +87,9 @@ public class CollectiveAttributeServiceI
private Entry getTestSubentry2( String dn ) throws LdapLdifException, LdapException
{
- Entry subentry = LdifUtils.createEntry(
- new DN( dn ),
- "objectClass: top",
- "objectClass: subentry",
- "objectClass: collectiveAttributeSubentry",
- "c-ou: configuration2",
- "subtreeSpecification: { base \"ou=configuration\" }",
- "cn: testsubentry2" );
+ Entry subentry = LdifUtils.createEntry( new DN( dn ), "objectClass: top", "objectClass: subentry",
+ "objectClass: collectiveAttributeSubentry", "c-ou: configuration2",
+ "subtreeSpecification: { base \"ou=configuration\" }", "cn: testsubentry2" );
return subentry;
}
@@ -110,14 +97,9 @@ public class CollectiveAttributeServiceI
private Entry getTestSubentry3( String dn ) throws LdapLdifException, LdapException
{
- Entry subentry = LdifUtils.createEntry(
- new DN( dn ),
- "objectClass: top",
- "objectClass: subentry",
- "objectClass: collectiveAttributeSubentry",
- "c-st: FL",
- "subtreeSpecification: { base \"ou=configuration\" }",
- "cn: testsubentry3" );
+ Entry subentry = LdifUtils.createEntry( new DN( dn ), "objectClass: top", "objectClass: subentry",
+ "objectClass: collectiveAttributeSubentry", "c-st: FL",
+ "subtreeSpecification: { base \"ou=configuration\" }", "cn: testsubentry3" );
return subentry;
}
@@ -135,16 +117,16 @@ public class CollectiveAttributeServiceI
{
Map<String, Entry> resultMap = new HashMap<String, Entry>();
- Cursor<SearchResponse> cursor =
- connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE, "+", "*" );
+ Cursor<InternalResponse> cursor = connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE, "+",
+ "*" );
while ( cursor.next() )
{
- SearchResponse result = cursor.get();
+ InternalResponse result = cursor.get();
- if ( result instanceof SearchResultEntry )
+ if ( result instanceof InternalSearchResultEntry )
{
- Entry entry = ((SearchResultEntry)result).getEntry();
+ Entry entry = ( ( InternalSearchResultEntry ) result ).getEntry();
resultMap.put( entry.getDn().getName(), entry );
}
}
@@ -157,16 +139,15 @@ public class CollectiveAttributeServiceI
{
Map<String, Entry> resultMap = new HashMap<String, Entry>();
- Cursor<SearchResponse> cursor =
- connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE, "cn" );
+ Cursor<InternalResponse> cursor = connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE, "cn" );
while ( cursor.next() )
{
- SearchResponse result = cursor.get();
+ InternalResponse result = cursor.get();
- if ( result instanceof SearchResultEntry )
+ if ( result instanceof InternalSearchResultEntry )
{
- Entry entry = ((SearchResultEntry)result).getEntry();
+ Entry entry = ( ( InternalSearchResultEntry ) result ).getEntry();
resultMap.put( entry.getDn().getName(), entry );
}
}
@@ -179,16 +160,16 @@ public class CollectiveAttributeServiceI
{
Map<String, Entry> resultMap = new HashMap<String, Entry>();
- Cursor<SearchResponse> cursor =
- connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE, "c-ou", "c-st" );
+ Cursor<InternalResponse> cursor = connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE,
+ "c-ou", "c-st" );
while ( cursor.next() )
{
- SearchResponse result = cursor.get();
+ InternalResponse result = cursor.get();
- if ( result instanceof SearchResultEntry )
+ if ( result instanceof InternalSearchResultEntry )
{
- Entry entry = ((SearchResultEntry)result).getEntry();
+ Entry entry = ( ( InternalSearchResultEntry ) result ).getEntry();
resultMap.put( entry.getDn().getName(), entry );
}
}
@@ -225,8 +206,8 @@ public class CollectiveAttributeServiceI
// test an entry that should show the collective attribute c-ou
// -------------------------------------------------------------------
- SearchResponse response = connection.lookup( "ou=services,ou=configuration,ou=system" );
- Entry entry = ((SearchResultEntry)response).getEntry();
+ InternalResponse response = connection.lookup( "ou=services,ou=configuration,ou=system" );
+ Entry entry = ( ( InternalSearchResultEntry ) response ).getEntry();
EntryAttribute c_ou = entry.get( "c-ou" );
assertNotNull( "a collective c-ou attribute should be present", c_ou );
assertEquals( "configuration", c_ou.getString() );
@@ -236,7 +217,7 @@ public class CollectiveAttributeServiceI
// -------------------------------------------------------------------
response = connection.lookup( "ou=users,ou=system" );
- entry = ((SearchResultEntry)response).getEntry();
+ entry = ( ( InternalSearchResultEntry ) response ).getEntry();
c_ou = entry.get( "c-ou" );
assertNull( "the c-ou collective attribute should not be present", c_ou );
@@ -249,7 +230,7 @@ public class CollectiveAttributeServiceI
// entry should not show the c-ou collective attribute anymore
response = connection.lookup( "ou=services,ou=configuration,ou=system" );
- entry = ((SearchResultEntry)response).getEntry();
+ entry = ( ( InternalSearchResultEntry ) response ).getEntry();
c_ou = entry.get( "c-ou" );
if ( c_ou != null )
@@ -262,7 +243,7 @@ public class CollectiveAttributeServiceI
connection.add( subentry2 );
response = connection.lookup( "ou=services,ou=configuration,ou=system" );
- entry = ((SearchResultEntry)response).getEntry();
+ entry = ( ( InternalSearchResultEntry ) response ).getEntry();
c_ou = entry.get( "c-ou" );
if ( c_ou != null )
@@ -272,7 +253,7 @@ public class CollectiveAttributeServiceI
// entries without the collectiveExclusion should still show both values of c-ou
response = connection.lookup( "ou=interceptors,ou=configuration,ou=system" );
- entry = ((SearchResultEntry)response).getEntry();
+ entry = ( ( InternalSearchResultEntry ) response ).getEntry();
c_ou = entry.get( "c-ou" );
assertNotNull( "a collective c-ou attribute should be present", c_ou );
@@ -281,7 +262,7 @@ public class CollectiveAttributeServiceI
// request the collective attribute specifically
response = connection.lookup( "ou=interceptors,ou=configuration,ou=system", "c-ou" );
- entry = ((SearchResultEntry)response).getEntry();
+ entry = ( ( InternalSearchResultEntry ) response ).getEntry();
c_ou = entry.get( "c-ou" );
assertNotNull( "a collective c-ou attribute should be present", c_ou );
@@ -290,7 +271,7 @@ public class CollectiveAttributeServiceI
// unspecify the collective attribute in the returning attribute list
response = connection.lookup( "ou=interceptors,ou=configuration,ou=system", "objectClass" );
- entry = ((SearchResultEntry)response).getEntry();
+ entry = ( ( InternalSearchResultEntry ) response ).getEntry();
c_ou = entry.get( "c-ou" );
assertNull( "a collective c-ou attribute should not be present", c_ou );
@@ -302,7 +283,7 @@ public class CollectiveAttributeServiceI
// the new attribute c-st should appear in the node with the c-ou exclusion
response = connection.lookup( "ou=services,ou=configuration,ou=system" );
- entry = ((SearchResultEntry)response).getEntry();
+ entry = ( ( InternalSearchResultEntry ) response ).getEntry();
EntryAttribute c_st = entry.get( "c-st" );
assertNotNull( "a collective c-st attribute should be present", c_st );
@@ -310,7 +291,7 @@ public class CollectiveAttributeServiceI
// in node without exclusions both values of c-ou should appear with c-st value
response = connection.lookup( "ou=interceptors,ou=configuration,ou=system" );
- entry = ((SearchResultEntry)response).getEntry();
+ entry = ( ( InternalSearchResultEntry ) response ).getEntry();
c_ou = entry.get( "c-ou" );
assertNotNull( "a collective c-ou attribute should be present", c_ou );
@@ -324,13 +305,13 @@ public class CollectiveAttributeServiceI
// -------------------------------------------------------------------
// now modify an entry to exclude all collective attributes
// -------------------------------------------------------------------
- modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
- new DefaultEntryAttribute( "collectiveExclusions", "excludeAllCollectiveAttributes" ) );
- connection.modify( "ou=interceptors,ou=configuration, ou=system" , modification );
+ modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultEntryAttribute(
+ "collectiveExclusions", "excludeAllCollectiveAttributes" ) );
+ connection.modify( "ou=interceptors,ou=configuration, ou=system", modification );
// none of the attributes should appear any longer
response = connection.lookup( "ou=interceptors,ou=configuration,ou=system" );
- entry = ((SearchResultEntry)response).getEntry();
+ entry = ( ( InternalSearchResultEntry ) response ).getEntry();
c_ou = entry.get( "c-ou" );
if ( c_ou != null )
@@ -368,12 +349,12 @@ public class CollectiveAttributeServiceI
// -------------------------------------------------------------------
// Test searching for subtypes
// -------------------------------------------------------------------
- Cursor<SearchResponse> responses = connection.search( "ou=services,ou=configuration,ou=system", "(ObjectClass=*)",
- SearchScope.OBJECT, "ou" );
+ Cursor<InternalResponse> responses = connection.search( "ou=services,ou=configuration,ou=system",
+ "(ObjectClass=*)", SearchScope.OBJECT, "ou" );
while ( responses.next() )
{
- SearchResultEntry resultEntry = (SearchResultEntry)responses.get();
+ InternalSearchResultEntry resultEntry = ( InternalSearchResultEntry ) responses.get();
entry = resultEntry.getEntry();
assertEquals( 2, entry.size() );
@@ -463,8 +444,8 @@ public class CollectiveAttributeServiceI
// -------------------------------------------------------------------
// now modify an entry to exclude all collective attributes
// -------------------------------------------------------------------
- modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
- new DefaultEntryAttribute( "collectiveExclusions", "excludeAllCollectiveAttributes" ) );
+ modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultEntryAttribute(
+ "collectiveExclusions", "excludeAllCollectiveAttributes" ) );
connection.modify( "ou=interceptors,ou=configuration, ou=system", modification );
entries = getAllEntries();
@@ -510,7 +491,7 @@ public class CollectiveAttributeServiceI
Entry entry = getTestEntry( "cn=Ersin Er,ou=system", "Ersin Er" );
entry.put( "c-l", "Turkiye" );
- AddResponse response = connection.add( entry );
+ InternalAddResponse response = connection.add( entry );
assertEquals( ResultCodeEnum.OBJECT_CLASS_VIOLATION, response.getLdapResult().getResultCode() );
}
@@ -522,9 +503,8 @@ public class CollectiveAttributeServiceI
Entry entry = getTestEntry( "cn=Ersin Er,ou=system", "Ersin Er" );
connection.add( entry );
- ModifyResponse response = connection.modify( "cn=Ersin Er,ou=system",
- new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
- new DefaultEntryAttribute( "c-l", "Turkiye" ) ) );
+ InternalModifyResponse response = connection.modify( "cn=Ersin Er,ou=system", new DefaultModification(
+ ModificationOperation.ADD_ATTRIBUTE, new DefaultEntryAttribute( "c-l", "Turkiye" ) ) );
assertEquals( ResultCodeEnum.OBJECT_CLASS_VIOLATION, response.getLdapResult().getResultCode() );
}
@@ -541,9 +521,9 @@ public class CollectiveAttributeServiceI
connection.add( subentry );
// request the collective attribute's super type specifically
- SearchResponse response = connection.lookup( "ou=interceptors,ou=configuration,ou=system", "ou" );
+ InternalResponse response = connection.lookup( "ou=interceptors,ou=configuration,ou=system", "ou" );
- Entry entry = ((SearchResultEntry)response).getEntry();
+ Entry entry = ( ( InternalSearchResultEntry ) response ).getEntry();
EntryAttribute c_ou = entry.get( "c-ou" );
assertNotNull( "a collective c-ou attribute should be present", c_ou );
Modified: directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java?rev=985411&r1=985410&r2=985411&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java Sat Aug 14 00:22:38 2010
@@ -28,13 +28,7 @@ import static org.junit.Assert.assertNul
import static org.junit.Assert.assertTrue;
import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.AddResponse;
-import org.apache.directory.ldap.client.api.message.DeleteResponse;
-import org.apache.directory.ldap.client.api.message.ModifyDnResponse;
import org.apache.directory.ldap.client.api.message.ModifyRequest;
-import org.apache.directory.ldap.client.api.message.ModifyResponse;
-import org.apache.directory.ldap.client.api.message.SearchResponse;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.server.core.annotations.CreateDS;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
@@ -47,6 +41,12 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.filter.SearchScope;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.internal.InternalAddResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalDeleteResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalModifyDnResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalModifyResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchResultEntry;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.name.RDN;
import org.junit.After;
@@ -59,18 +59,18 @@ import org.junit.runner.RunWith;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith ( FrameworkRunner.class )
-@CreateDS( name="ExceptionServiceIT-DS" )
+@RunWith(FrameworkRunner.class)
+@CreateDS(name = "ExceptionServiceIT-DS")
public class ExceptionServiceIT extends AbstractLdapTestUnit
{
-
- private AddResponse createSubContext( String type, String value ) throws Exception
+
+ private InternalAddResponse createSubContext( String type, String value ) throws Exception
{
return createSubContext( new DN( ServerDNConstants.SYSTEM_DN ), type, value );
}
-
- private AddResponse createSubContext( DN parent, String type, String value ) throws Exception
+
+ private InternalAddResponse createSubContext( DN parent, String type, String value ) throws Exception
{
DN dn = parent;
dn = dn.add( "ou=" + value );
@@ -79,9 +79,9 @@ public class ExceptionServiceIT extends
entry.add( SchemaConstants.OBJECT_CLASS_AT, "OrganizationalPerson" );
entry.add( SchemaConstants.CN_AT, value );
entry.add( SchemaConstants.SN_AT, value );
-
- AddResponse resp = getAdminConnection( service ).add( entry );
-
+
+ InternalAddResponse resp = getAdminConnection( service ).add( entry );
+
return resp;
}
@@ -97,7 +97,6 @@ public class ExceptionServiceIT extends
// Search Operation Tests
// ------------------------------------------------------------------------
-
/**
* Test search operation failure when the search base is non-existant.
*
@@ -106,7 +105,8 @@ public class ExceptionServiceIT extends
@Test
public void testFailSearchNoSuchObject() throws Exception
{
- Cursor<SearchResponse> cursor = getAdminConnection( service ).search( "ou=blah", "(objectClass=*)", SearchScope.ONELEVEL, "*" );
+ Cursor<InternalResponse> cursor = getAdminConnection( service ).search( "ou=blah", "(objectClass=*)",
+ SearchScope.ONELEVEL, "*" );
assertFalse( cursor.next() );
}
@@ -120,7 +120,8 @@ public class ExceptionServiceIT extends
@Test
public void testSearchControl() throws Exception
{
- Cursor<SearchResponse> cursor = getAdminConnection( service ).search( "ou=users,ou=system", "(objectClass=*)", SearchScope.ONELEVEL, "*" );
+ Cursor<InternalResponse> cursor = getAdminConnection( service ).search( "ou=users,ou=system",
+ "(objectClass=*)", SearchScope.ONELEVEL, "*" );
assertFalse( cursor.next() );
}
@@ -143,18 +144,18 @@ public class ExceptionServiceIT extends
Entry entry = new DefaultEntry( new DN( "ou=users,ou=groups,ou=system" ) );
entry.add( SchemaConstants.OBJECT_CLASS_AT, "OrganizationalUnit" );
entry.add( SchemaConstants.OU_AT, "users" );
-
+
connection.add( entry );
- ModifyDnResponse resp = connection.rename( entry.getDn(), new RDN( "ou=users" ) );
+ InternalModifyDnResponse resp = connection.rename( entry.getDn(), new RDN( "ou=users" ) );
assertEquals( ResultCodeEnum.ENTRY_ALREADY_EXISTS, resp.getLdapResult().getResultCode() );
Entry userzEntry = new DefaultEntry( new DN( "ou=userz,ou=groups,ou=system" ) );
userzEntry.add( SchemaConstants.OBJECT_CLASS_AT, "OrganizationalUnit" );
userzEntry.add( SchemaConstants.OU_AT, "userz" );
-
+
connection.add( userzEntry );
-
- ModifyDnResponse modResp = connection.rename( "ou=userz,ou=groups,ou=system", "ou=users", true );
+
+ InternalModifyDnResponse modResp = connection.rename( "ou=userz,ou=groups,ou=system", "ou=users", true );
assertEquals( ResultCodeEnum.ENTRY_ALREADY_EXISTS, modResp.getLdapResult().getResultCode() );
}
@@ -169,7 +170,7 @@ public class ExceptionServiceIT extends
{
LdapConnection connection = getAdminConnection( service );
- ModifyDnResponse resp = connection.rename( "ou=blah,ou=groups,ou=system", "ou=blah1" );
+ InternalModifyDnResponse resp = connection.rename( "ou=blah,ou=groups,ou=system", "ou=blah1" );
assertEquals( ResultCodeEnum.NO_SUCH_OBJECT, resp.getLdapResult().getResultCode() );
resp = connection.rename( "ou=blah,ou=groups,ou=system", "ou=blah1" );
@@ -189,10 +190,10 @@ public class ExceptionServiceIT extends
LdapConnection connection = getAdminConnection( service );
connection.move( "ou=users,ou=system", "ou=groups,ou=system" );
- Entry entry = ( ( SearchResultEntry ) connection.lookup( "ou=users,ou=groups,ou=system" ) ).getEntry();
+ Entry entry = ( ( InternalSearchResultEntry ) connection.lookup( "ou=users,ou=groups,ou=system" ) ).getEntry();
assertNotNull( entry );
- SearchResponse res = connection.lookup( "ou=users,ou=system" );
+ InternalResponse res = connection.lookup( "ou=users,ou=system" );
assertNull( res );
}
@@ -201,7 +202,6 @@ public class ExceptionServiceIT extends
// ModifyRdn Operation Tests
// ------------------------------------------------------------------------
-
/**
* Test modifyRdn operation failure when the object renamed is non-existant.
*
@@ -212,7 +212,7 @@ public class ExceptionServiceIT extends
{
LdapConnection connection = getAdminConnection( service );
- ModifyDnResponse resp = connection.rename( "ou=users,ou=system", "ou=groups" );
+ InternalModifyDnResponse resp = connection.rename( "ou=users,ou=system", "ou=groups" );
assertEquals( ResultCodeEnum.ENTRY_ALREADY_EXISTS, resp.getLdapResult().getResultCode() );
}
@@ -227,7 +227,7 @@ public class ExceptionServiceIT extends
{
LdapConnection connection = getAdminConnection( service );
- ModifyDnResponse resp = connection.rename( "ou=blah,ou=system", "ou=asdf" );
+ InternalModifyDnResponse resp = connection.rename( "ou=blah,ou=system", "ou=asdf" );
assertEquals( ResultCodeEnum.NO_SUCH_OBJECT, resp.getLdapResult().getResultCode() );
}
@@ -254,7 +254,6 @@ public class ExceptionServiceIT extends
// Modify Operation Tests
// ------------------------------------------------------------------------
-
/**
* Test modify operation failure when the object modified is non-existant.
*
@@ -267,8 +266,8 @@ public class ExceptionServiceIT extends
ModifyRequest modReq = new ModifyRequest( new DN( "ou=blah,ou=system" ) );
modReq.add( SchemaConstants.OU_AT, "another-value" );
-
- ModifyResponse modResp = connection.modify( modReq );
+
+ InternalModifyResponse modResp = connection.modify( modReq );
assertEquals( ResultCodeEnum.NO_SUCH_OBJECT, modResp.getLdapResult().getResultCode() );
}
@@ -286,9 +285,9 @@ public class ExceptionServiceIT extends
ModifyRequest modReq = new ModifyRequest( new DN( "ou=users,ou=system" ) );
modReq.add( SchemaConstants.OU_AT, "dummyValue" );
-
+
connection.modify( modReq );
- Entry entry = ( ( SearchResultEntry ) connection.lookup( "ou=users,ou=system" ) ).getEntry();
+ Entry entry = ( ( InternalSearchResultEntry ) connection.lookup( "ou=users,ou=system" ) ).getEntry();
EntryAttribute ou = entry.get( "ou" );
assertTrue( ou.contains( "users" ) );
assertTrue( ou.contains( "dummyValue" ) );
@@ -299,7 +298,6 @@ public class ExceptionServiceIT extends
// Lookup Operation Tests
// ------------------------------------------------------------------------
-
/**
* Test lookup operation failure when the object looked up is non-existant.
*
@@ -325,7 +323,7 @@ public class ExceptionServiceIT extends
{
LdapConnection connection = getAdminConnection( service );
- Entry entry = ( ( SearchResultEntry ) connection.lookup( "ou=users,ou=system" ) ).getEntry();
+ Entry entry = ( ( InternalSearchResultEntry ) connection.lookup( "ou=users,ou=system" ) ).getEntry();
assertNotNull( entry );
assertEquals( "users", entry.get( "ou" ).getString() );
}
@@ -335,7 +333,6 @@ public class ExceptionServiceIT extends
// List Operation Tests
// ------------------------------------------------------------------------
-
/**
* Test list operation failure when the base searched is non-existant.
*
@@ -386,7 +383,6 @@ public class ExceptionServiceIT extends
// Add Operation Tests
// ------------------------------------------------------------------------
-
/**
* Tests for add operation failure when the parent of the entry to add does
* not exist.
@@ -408,7 +404,7 @@ public class ExceptionServiceIT extends
aliasChild.add( SchemaConstants.OBJECT_CLASS_AT, "organizationalUnit" );
aliasChild.add( SchemaConstants.OU_AT, "blah" );
- AddResponse resp = connection.add( aliasChild );
+ InternalAddResponse resp = connection.add( aliasChild );
assertEquals( ResultCodeEnum.ALIAS_PROBLEM, resp.getLdapResult().getResultCode() );
}
@@ -421,9 +417,9 @@ public class ExceptionServiceIT extends
@Test
public void testFailAddEntryAlreadyExists() throws Exception
{
- createSubContext( "ou", "blah");
+ createSubContext( "ou", "blah" );
- AddResponse resp = createSubContext( "ou", "blah");
+ InternalAddResponse resp = createSubContext( "ou", "blah" );
assertEquals( ResultCodeEnum.ENTRY_ALREADY_EXISTS, resp.getLdapResult().getResultCode() );
}
@@ -438,9 +434,9 @@ public class ExceptionServiceIT extends
{
LdapConnection connection = getAdminConnection( service );
- AddResponse resp = createSubContext( "ou", "blah");
- resp = createSubContext( new DN( "ou=blah,ou=system" ), "ou", "subctx");
- Entry entry = ( ( SearchResultEntry ) connection.lookup( "ou=subctx,ou=blah,ou=system" ) ).getEntry();
+ InternalAddResponse resp = createSubContext( "ou", "blah" );
+ resp = createSubContext( new DN( "ou=blah,ou=system" ), "ou", "subctx" );
+ Entry entry = ( ( InternalSearchResultEntry ) connection.lookup( "ou=subctx,ou=blah,ou=system" ) ).getEntry();
assertNotNull( entry );
}
@@ -449,7 +445,6 @@ public class ExceptionServiceIT extends
// Delete Operation Tests
// ------------------------------------------------------------------------
-
/**
* Tests for delete failure when the entry to be deleted has child entires.
*
@@ -460,10 +455,10 @@ public class ExceptionServiceIT extends
{
LdapConnection connection = getAdminConnection( service );
- AddResponse resp = createSubContext( "ou", "blah" );
- resp = createSubContext( new DN( "ou=blah,ou=system" ), "ou", "subctx" );
+ InternalAddResponse resp = createSubContext( "ou", "blah" );
+ resp = createSubContext( new DN( "ou=blah,ou=system" ), "ou", "subctx" );
- DeleteResponse delResp = connection.delete( "ou=blah,ou=system" );
+ InternalDeleteResponse delResp = connection.delete( "ou=blah,ou=system" );
assertEquals( ResultCodeEnum.NOT_ALLOWED_ON_NON_LEAF, delResp.getLdapResult().getResultCode() );
}
@@ -479,7 +474,7 @@ public class ExceptionServiceIT extends
{
LdapConnection connection = getAdminConnection( service );
- DeleteResponse delResp = connection.delete( "ou=blah,ou=system" );
+ InternalDeleteResponse delResp = connection.delete( "ou=blah,ou=system" );
assertEquals( ResultCodeEnum.NO_SUCH_OBJECT, delResp.getLdapResult().getResultCode() );
}
@@ -494,9 +489,9 @@ public class ExceptionServiceIT extends
{
LdapConnection connection = getAdminConnection( service );
- AddResponse resp = createSubContext( "ou", "blah" );
+ InternalAddResponse resp = createSubContext( "ou", "blah" );
- Entry entry = ( ( SearchResultEntry ) connection.lookup( "ou=blah,ou=system" ) ).getEntry();
+ Entry entry = ( ( InternalSearchResultEntry ) connection.lookup( "ou=blah,ou=system" ) ).getEntry();
assertNotNull( entry );
connection.delete( entry.getDn() );