You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2011/01/26 07:49:52 UTC
svn commit: r1063611 - in /directory:
apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/
apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/
apacheds/trunk/core/src/main/java/org/apache/directory...
Author: akarasulu
Date: Wed Jan 26 06:49:51 2011
New Revision: 1063611
URL: http://svn.apache.org/viewvc?rev=1063611&view=rev
Log:
setting up decorator pattern on Subentries Control
Added:
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/Subentries.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesContainer.java (contents, props changed)
- copied, changed from r1063551, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlContainer.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecoder.java (contents, props changed)
- copied, changed from r1063551, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlDecoder.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecorator.java (contents, props changed)
- copied, changed from r1063551, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesGrammar.java (contents, props changed)
- copied, changed from r1063551, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesStates.java (contents, props changed)
- copied, changed from r1063551, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlStatesEnum.java
Removed:
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControl.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlContainer.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlDecoder.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlStatesEnum.java
Modified:
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java
directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlEnum.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlFactory.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchDecorator.java
directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java
directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlTest.java
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java?rev=1063611&r1=1063610&r2=1063611&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java Wed Jan 26 06:49:51 2011
@@ -47,7 +47,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.server.core.integ.IntegrationUtils;
-import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControl;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesDecorator;
import org.apache.directory.shared.ldap.model.cursor.Cursor;
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.entry.EntryAttribute;
@@ -1267,7 +1267,7 @@ public class SubentryServiceIT extends A
// now add the control with visibility set to true where all entries
// except subentries disappear
- SubentriesControl ctl = new SubentriesControl();
+ SubentriesDecorator ctl = new SubentriesDecorator();
ctl.setVisibility( true );
sysRoot.setRequestControls( JndiUtils.toJndiControls(new Control[]
{ctl}) );
@@ -1373,7 +1373,7 @@ public class SubentryServiceIT extends A
addAdministrativeRole( "collectiveAttributeSpecificArea" );
connection.add( getTestSubentryWithExclusion( "cn=testsubentry,ou=system" ) );
- Entry result = connection.lookup( "cn=testsubentry,ou=system", new Control[]{ new SubentriesControl()},"subtreeSpecification" );
+ Entry result = connection.lookup( "cn=testsubentry,ou=system", new Control[]{ new SubentriesDecorator()},"subtreeSpecification" );
assertNotNull( result );
String ss = result.get( "SubtreeSpecification" ).getString();
Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=1063611&r1=1063610&r2=1063611&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Wed Jan 26 06:49:51 2011
@@ -110,9 +110,10 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearchContainer;
import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearchDecoder;
import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearchDecorator;
-import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControl;
-import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControlContainer;
-import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControlDecoder;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.Subentries;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesDecorator;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesContainer;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesDecoder;
import org.apache.directory.shared.ldap.model.constants.JndiPropertyConstants;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.cursor.EmptyCursor;
@@ -189,7 +190,7 @@ public abstract class ServerContext impl
ADS_CONTROLS.put( PagedResults.OID, ControlEnum.PAGED_RESULTS_CONTROL );
ADS_CONTROLS.put( PasswordPolicyRequestControl.CONTROL_OID, ControlEnum.PASSWORD_POLICY_REQUEST_CONTROL );
ADS_CONTROLS.put( PersistentSearch.CONTROL_OID, ControlEnum.PERSISTENT_SEARCH_CONTROL );
- ADS_CONTROLS.put( SubentriesControl.CONTROL_OID, ControlEnum.SUBENTRIES_CONTROL );
+ ADS_CONTROLS.put( Subentries.OID, ControlEnum.SUBENTRIES_CONTROL );
ADS_CONTROLS.put( SyncDoneValueControl.CONTROL_OID, ControlEnum.SYNC_DONE_VALUE_CONTROL );
ADS_CONTROLS.put( SyncInfoValueControl.CONTROL_OID, ControlEnum.SYNC_INFO_VALUE_CONTROL );
ADS_CONTROLS.put( SyncModifyDnControl.CONTROL_OID, ControlEnum.SYNC_MODIFY_DN_CONTROL );
@@ -454,14 +455,14 @@ public abstract class ServerContext impl
break;
case SUBENTRIES_CONTROL:
- control = new SubentriesControl();
- SubentriesControlDecoder controlDecoder = new SubentriesControlDecoder();
- SubentriesControlContainer subentriesControlContainer = new SubentriesControlContainer();
- subentriesControlContainer.setSubEntryControl( ( SubentriesControl ) control );
+ control = new SubentriesDecorator();
+ SubentriesDecoder decoder = new SubentriesDecoder();
+ SubentriesContainer subentriesContainer = new SubentriesContainer();
+ subentriesContainer.setSubEntryControl( ( SubentriesDecorator ) control );
bb = ByteBuffer.allocate( jndiControl.getEncodedValue().length );
bb.put( jndiControl.getEncodedValue() ).flip();
- controlDecoder.decode( bb, subentriesControlContainer );
+ decoder.decode( bb, subentriesContainer );
break;
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=1063611&r1=1063610&r2=1063611&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Wed Jan 26 06:49:51 2011
@@ -62,6 +62,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChange;
import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResults;
import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearch;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.Subentries;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.cursor.SingletonCursor;
import org.apache.directory.shared.ldap.model.exception.*;
@@ -76,7 +77,6 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueControl;
import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueControl;
import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueControl;
-import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControl;
import org.apache.directory.shared.ldap.model.cursor.EmptyCursor;
import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
import org.apache.directory.shared.ldap.model.entry.DefaultEntryAttribute;
@@ -175,7 +175,7 @@ public class DefaultPartitionNexus exten
// Add the supported controls
rootDSE.put( SchemaConstants.SUPPORTED_CONTROL_AT, PersistentSearch.CONTROL_OID,
- EntryChange.OID, SubentriesControl.CONTROL_OID, ManageDsaIT.OID,
+ EntryChange.OID, Subentries.OID, ManageDsaIT.OID,
Cascade.OID, PagedResults.OID,
// Replication controls
SyncDoneValueControl.CONTROL_OID, SyncInfoValueControl.CONTROL_OID, SyncRequestValueControl.CONTROL_OID,
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=1063611&r1=1063610&r2=1063611&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Wed Jan 26 06:49:51 2011
@@ -51,7 +51,8 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.partition.ByPassConstants;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.i18n.I18n;
-import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControl;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.Subentries;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesDecorator;
import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
@@ -97,7 +98,7 @@ public class SubentryInterceptor extends
private static final Logger LOG = LoggerFactory.getLogger( SubentryInterceptor.class );
/** the subentry control OID */
- private static final String SUBENTRY_CONTROL = SubentriesControl.CONTROL_OID;
+ private static final String SUBENTRY_CONTROL = Subentries.OID;
/** The set of Subentry operational attributes */
public static AttributeType[] SUBENTRY_OPATTRS;
@@ -314,9 +315,9 @@ public class SubentryInterceptor extends
// found the subentry request control so we return its value
if ( opContext.hasRequestControl( SUBENTRY_CONTROL ) )
{
- SubentriesControl subentriesControl = ( SubentriesControl ) opContext.getRequestControl( SUBENTRY_CONTROL );
+ SubentriesDecorator subentriesDecorator = ( SubentriesDecorator ) opContext.getRequestControl( SUBENTRY_CONTROL );
- return subentriesControl.isVisible();
+ return subentriesDecorator.isVisible();
}
return false;
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java?rev=1063611&r1=1063610&r2=1063611&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java Wed Jan 26 06:49:51 2011
@@ -69,7 +69,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChange;
import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResults;
import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearch;
-import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControl;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.Subentries;
import org.apache.directory.shared.ldap.model.constants.SaslQoP;
import org.apache.directory.shared.ldap.model.exception.LdapConfigurationException;
import org.apache.directory.shared.ldap.model.message.AbandonRequest;
@@ -237,7 +237,7 @@ public class LdapServer extends Director
this.supportedControls = new HashSet<String>();
this.supportedControls.add( PersistentSearch.CONTROL_OID );
this.supportedControls.add( EntryChange.OID );
- this.supportedControls.add( SubentriesControl.CONTROL_OID );
+ this.supportedControls.add( Subentries.OID );
this.supportedControls.add( ManageDsaIT.OID );
this.supportedControls.add( Cascade.OID );
this.supportedControls.add( PagedResults.OID );
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java?rev=1063611&r1=1063610&r2=1063611&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java Wed Jan 26 06:49:51 2011
@@ -54,7 +54,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.server.ldap.LdapServer;
-import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControl;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesDecorator;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.cursor.Cursor;
import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
@@ -735,10 +735,10 @@ public class SearchIT extends AbstractLd
+ " } " + " } " + " } " + " } " + "}" );
// prepare the subentry decorator to make the subentry visible
- SubentriesControl control = new SubentriesControl();
- control.setVisibility( true );
+ SubentriesDecorator decorator = new SubentriesDecorator();
+ decorator.setVisibility( true );
Control[] reqControls = new Control[]
- { control };
+ { decorator };
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlEnum.java?rev=1063611&r1=1063610&r2=1063611&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlEnum.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlEnum.java Wed Jan 26 06:49:51 2011
@@ -28,7 +28,8 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChange;
import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResults;
import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearch;
-import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControl;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.Subentries;
+
/**
* An enum listing all the existing controls
@@ -44,7 +45,7 @@ public enum ControlEnum
PAGED_RESULTS_CONTROL( PagedResults.OID ),
PASSWORD_POLICY_REQUEST_CONTROL( PasswordPolicyRequestControl.CONTROL_OID ),
PERSISTENT_SEARCH_CONTROL( PersistentSearch.CONTROL_OID),
- SUBENTRIES_CONTROL( SubentriesControl.CONTROL_OID ),
+ SUBENTRIES_CONTROL( Subentries.OID ),
SYNC_DONE_VALUE_CONTROL( SyncDoneValueControl.CONTROL_OID ),
SYNC_INFO_VALUE_CONTROL( SyncInfoValueControl.CONTROL_OID ),
SYNC_MODIFY_DN_CONTROL( SyncModifyDnControl.CONTROL_OID ),
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlFactory.java?rev=1063611&r1=1063610&r2=1063611&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlFactory.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlFactory.java Wed Jan 26 06:49:51 2011
@@ -28,7 +28,8 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsDecorator;
import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearch;
import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearchDecorator;
-import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControl;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.Subentries;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesDecorator;
import org.apache.directory.shared.ldap.model.message.Control;
@@ -78,9 +79,9 @@ public class ControlFactory
return new PersistentSearchDecorator();
}
- if ( SubentriesControl.CONTROL_OID.equals( oid ) )
+ if ( Subentries.OID.equals( oid ) )
{
- return new SubentriesControl();
+ return new SubentriesDecorator();
}
if ( SyncDoneValueControl.CONTROL_OID.equals( oid ) )
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchDecorator.java?rev=1063611&r1=1063610&r2=1063611&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchDecorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchDecorator.java Wed Jan 26 06:49:51 2011
@@ -38,35 +38,10 @@ import org.apache.directory.shared.ldap.
*/
public class PersistentSearchDecorator extends ControlDecorator
{
-
- /**
- * If changesOnly is TRUE, the server MUST NOT return any existing entries
- * that match the search criteria. Entries are only returned when they are
- * changed (added, modified, deleted, or subject to a modifyDN operation).
- */
- private boolean changesOnly = true;
-
- /**
- * If returnECs is TRUE, the server MUST return an Entry Change Notification
- * control with each entry returned as the result of changes.
- */
- private boolean returnECs = false;
-
- /**
- * As changes are made to the server, the effected entries MUST be returned
- * to the client if they match the standard search criteria and if the
- * operation that caused the change is included in the changeTypes field.
- * The changeTypes field is the logical OR of one or more of these values:
- * add (1),
- * delete (2),
- * modify (4),
- * modDN (8).
- */
- private int changeTypes = PersistentSearch.CHANGE_TYPES_MAX;
-
/** A temporary storage for a psearch length */
private int psearchSeqLength;
+
/**
* Default constructor
*
@@ -77,42 +52,6 @@ public class PersistentSearchDecorator e
}
- public void setChangesOnly( boolean changesOnly )
- {
- this.changesOnly = changesOnly;
- }
-
-
- public boolean isChangesOnly()
- {
- return changesOnly;
- }
-
-
- public void setReturnECs( boolean returnECs )
- {
- this.returnECs = returnECs;
- }
-
-
- public boolean isReturnECs()
- {
- return returnECs;
- }
-
-
- public void setChangeTypes( int changeTypes )
- {
- this.changeTypes = changeTypes;
- }
-
-
- public int getChangeTypes()
- {
- return changeTypes;
- }
-
-
/**
* Compute the PagedSearchControl length, which is the sum
* of the control length and the value length.
@@ -129,7 +68,7 @@ public class PersistentSearchDecorator e
*/
public int computeLength()
{
- int changeTypesLength = 1 + 1 + Value.getNbBytes( changeTypes );
+ int changeTypesLength = 1 + 1 + Value.getNbBytes( ( ( PersistentSearch ) getDecorated() ).getChangeTypes() );
int changesOnlyLength = 1 + 1 + 1;
int returnRCsLength = 1 + 1 + 1;
@@ -166,9 +105,9 @@ public class PersistentSearchDecorator e
buffer.put( UniversalTag.SEQUENCE.getValue() );
buffer.put( TLV.getBytes( psearchSeqLength ) );
- Value.encode( buffer, changeTypes );
- Value.encode( buffer, changesOnly );
- Value.encode( buffer, returnECs );
+ Value.encode( buffer, ( ( PersistentSearch ) getDecorated() ).getChangeTypes() );
+ Value.encode( buffer, ( ( PersistentSearch ) getDecorated() ).isChangesOnly() );
+ Value.encode( buffer, ( ( PersistentSearch ) getDecorated() ).isReturnECs() );
return buffer;
}
@@ -190,10 +129,10 @@ public class PersistentSearchDecorator e
buffer.put( UniversalTag.SEQUENCE.getValue() );
buffer.put( TLV.getBytes( psearchSeqLength ) );
- Value.encode( buffer, changeTypes );
- Value.encode( buffer, changesOnly );
- Value.encode( buffer, returnECs );
-
+ Value.encode( buffer, ( ( PersistentSearch ) getDecorated() ).getChangeTypes() );
+ Value.encode( buffer, ( ( PersistentSearch ) getDecorated() ).isChangesOnly() );
+ Value.encode( buffer, ( ( PersistentSearch ) getDecorated() ).isReturnECs() );
+
getDecorated().setValue( buffer.array() );
}
catch ( Exception e )
@@ -204,34 +143,4 @@ public class PersistentSearchDecorator e
return getDecorated().getValue();
}
-
-
- public boolean isNotificationEnabled( ChangeType changeType )
- {
- return ( changeType.getValue() & changeTypes ) > 0;
- }
-
-
- public void enableNotification( ChangeType changeType )
- {
- changeTypes |= changeType.getValue();
- }
-
-
- /**
- * Return a String representing this PSearchControl.
- */
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
-
- sb.append( " Persistant Search Control\n" );
- sb.append( " oid : " ).append( getOid() ).append( '\n' );
- sb.append( " critical : " ).append( isCritical() ).append( '\n' );
- sb.append( " changeTypes : '" ).append( changeTypes ).append( "'\n" );
- sb.append( " changesOnly : '" ).append( changesOnly ).append( "'\n" );
- sb.append( " returnECs : '" ).append( returnECs ).append( "'\n" );
-
- return sb.toString();
- }
}
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/Subentries.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/Subentries.java?rev=1063611&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/Subentries.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/Subentries.java Wed Jan 26 06:49:51 2011
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.codec.search.controls.subentries;
+
+
+import org.apache.directory.shared.ldap.codec.controls.BasicControlImpl;
+
+
+/**
+ * A searchRequest control : Subentries
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class Subentries extends BasicControlImpl
+{
+ /** Ths control OID */
+ public static final String OID = "1.3.6.1.4.1.4203.1.10.1";
+
+ private boolean visibility = false;
+
+
+ /**
+ * Default constructor
+ *
+ */
+ public Subentries()
+ {
+ super( OID );
+ }
+
+
+ /**
+ * Check if the subEntry is visible
+ *
+ * @return true or false.
+ */
+ public boolean isVisible()
+ {
+ return visibility;
+ }
+
+
+ /**
+ * Set the visibility flag
+ *
+ * @param visibility The visibility flag : true or false
+ */
+ public void setVisibility( boolean visibility )
+ {
+ this.visibility = visibility;
+ }
+
+
+ /**
+ * @see Object#equals(Object)
+ */
+ public boolean equals( Object o )
+ {
+ if ( !super.equals( o ) )
+ {
+ return false;
+ }
+
+ Subentries otherDecorator = ( Subentries ) o;
+
+ return ( visibility == otherDecorator.visibility );
+ }
+
+
+ /**
+ * Return a String representing this EntryChangeControl.
+ */
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append( " Subentries Control\n" );
+ sb.append( " oid : " ).append( getOid() ).append( '\n' );
+ sb.append( " critical : " ).append( isCritical() ).append( '\n' );
+ sb.append( " Visibility : '" ).append( visibility ).append( "'\n" );
+
+ return sb.toString();
+ }
+}
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesContainer.java (from r1063551, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlContainer.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesContainer.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesContainer.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlContainer.java&r1=1063551&r2=1063611&rev=1063611&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlContainer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesContainer.java Wed Jan 26 06:49:51 2011
@@ -26,30 +26,30 @@ import org.apache.directory.shared.asn1.
/**
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class SubentriesControlContainer extends AbstractContainer
+public class SubentriesContainer extends AbstractContainer
{
/** PSearchControl */
- private SubentriesControl control;
+ private SubentriesDecorator decorator;
/**
* Creates a new SubEntryControlContainer object.
*/
- public SubentriesControlContainer()
+ public SubentriesContainer()
{
super();
stateStack = new int[1];
- grammar = SubentriesControlGrammar.getInstance();
- setTransition( SubentriesControlStatesEnum.START_STATE );
+ grammar = SubentriesGrammar.getInstance();
+ setTransition( SubentriesStates.START_STATE );
}
/**
* @return Returns the persistent search control.
*/
- public SubentriesControl getSubEntryControl()
+ public SubentriesDecorator getSubEntryControl()
{
- return control;
+ return decorator;
}
@@ -57,11 +57,11 @@ public class SubentriesControlContainer
* Set a SubEntryControl Object into the container. It will be completed by
* the ldapDecoder.
*
- * @param control the SubEntryControl to set.
+ * @param decorator the SubEntryControl to set.
*/
- public void setSubEntryControl( SubentriesControl control )
+ public void setSubEntryControl( SubentriesDecorator decorator )
{
- this.control = control;
+ this.decorator = decorator;
}
/**
@@ -70,6 +70,6 @@ public class SubentriesControlContainer
public void clean()
{
super.clean();
- control = null;
+ decorator = null;
}
}
Propchange: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesContainer.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecoder.java (from r1063551, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlDecoder.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecoder.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecoder.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlDecoder.java&r1=1063551&r2=1063611&rev=1063611&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlDecoder.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecoder.java Wed Jan 26 06:49:51 2011
@@ -34,7 +34,7 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class SubentriesControlDecoder extends Asn1Decoder implements ControlDecoder
+public class SubentriesDecoder extends Asn1Decoder implements ControlDecoder
{
/** The sub entry decoder */
private static final Asn1Decoder decoder = new Asn1Decoder();
@@ -52,8 +52,8 @@ public class SubentriesControlDecoder ex
public Asn1Object decode( byte[] controlBytes, Control control ) throws DecoderException
{
ByteBuffer bb = ByteBuffer.wrap( controlBytes );
- SubentriesControlContainer container = new SubentriesControlContainer();
- container.setSubEntryControl( (SubentriesControl)control );
+ SubentriesContainer container = new SubentriesContainer();
+ container.setSubEntryControl( (SubentriesDecorator )control );
decoder.decode( bb, container );
return container.getSubEntryControl();
Propchange: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecoder.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecorator.java (from r1063551, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControl.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecorator.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecorator.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControl.java&r1=1063551&r2=1063611&rev=1063611&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecorator.java Wed Jan 26 06:49:51 2011
@@ -28,6 +28,7 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.asn1.ber.tlv.Value;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.codec.controls.AbstractControl;
+import org.apache.directory.shared.ldap.codec.controls.ControlDecorator;
/**
@@ -35,43 +36,15 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class SubentriesControl extends AbstractControl
+public class SubentriesDecorator extends ControlDecorator
{
- /** Ths control OID */
- public static final String CONTROL_OID = "1.3.6.1.4.1.4203.1.10.1";
-
- private boolean visibility = false;
-
/**
* Default constructor
*
*/
- public SubentriesControl()
- {
- super( CONTROL_OID );
-
- decoder = new SubentriesControlDecoder();
- }
-
- /**
- * Check if the subEntry is visible
- *
- * @return true or false.
- */
- public boolean isVisible()
+ public SubentriesDecorator()
{
- return visibility;
- }
-
-
- /**
- * Set the visibility flag
- *
- * @param visibility The visibility flag : true or false
- */
- public void setVisibility( boolean visibility )
- {
- this.visibility = visibility;
+ super( new Subentries(), new SubentriesDecoder() );
}
@@ -110,7 +83,7 @@ public class SubentriesControl extends A
buffer.put( TLV.getBytes( valueLength ) );
// Now encode the Subentries specific part
- Value.encode( buffer, visibility );
+ Value.encode( buffer, ( ( Subentries ) getDecorated() ).isVisible() );
return buffer;
}
@@ -121,7 +94,7 @@ public class SubentriesControl extends A
*/
public byte[] getValue()
{
- if ( value == null )
+ if ( getDecorated().getValue() == null )
{
try
{
@@ -129,9 +102,9 @@ public class SubentriesControl extends A
ByteBuffer buffer = ByteBuffer.allocate( valueLength );
// Now encode the Subentries specific part
- Value.encode( buffer, visibility );
+ Value.encode( buffer, ( ( Subentries ) getDecorated() ).isVisible() );
- value = buffer.array();
+ getDecorated().setValue( buffer.array() );
}
catch ( Exception e )
{
@@ -139,38 +112,6 @@ public class SubentriesControl extends A
}
}
- return value;
- }
-
-
- /**
- * @see Object#equals(Object)
- */
- public boolean equals( Object o )
- {
- if ( !super.equals( o ) )
- {
- return false;
- }
-
- SubentriesControl otherControl = ( SubentriesControl ) o;
-
- return ( visibility == otherControl.visibility );
- }
-
-
- /**
- * Return a String representing this EntryChangeControl.
- */
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
-
- sb.append( " Subentries Control\n" );
- sb.append( " oid : " ).append( getOid() ).append( '\n' );
- sb.append( " critical : " ).append( isCritical() ).append( '\n' );
- sb.append( " Visibility : '" ).append( visibility ).append( "'\n" );
-
- return sb.toString();
+ return getDecorated().getValue();
}
}
Propchange: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecorator.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesGrammar.java (from r1063551, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesGrammar.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesGrammar.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java&r1=1063551&r2=1063611&rev=1063611&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesGrammar.java Wed Jan 26 06:49:51 2011
@@ -43,34 +43,34 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public final class SubentriesControlGrammar extends AbstractGrammar
+public final class SubentriesGrammar extends AbstractGrammar
{
/** The logger */
- static final Logger LOG = LoggerFactory.getLogger( SubentriesControlGrammar.class );
+ static final Logger LOG = LoggerFactory.getLogger( SubentriesGrammar.class );
/** The instance of grammar. SubEntryControlGrammar is a singleton */
- private static Grammar instance = new SubentriesControlGrammar();
+ private static Grammar instance = new SubentriesGrammar();
/**
* Creates a new SubEntryGrammar object.
*/
- private SubentriesControlGrammar()
+ private SubentriesGrammar()
{
- setName( SubentriesControlGrammar.class.getName() );
+ setName( SubentriesGrammar.class.getName() );
// Create the transitions table
- super.transitions = new GrammarTransition[SubentriesControlStatesEnum.LAST_SUB_ENTRY_STATE.ordinal()][256];
+ super.transitions = new GrammarTransition[ SubentriesStates.LAST_SUB_ENTRY_STATE.ordinal()][256];
- super.transitions[SubentriesControlStatesEnum.START_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
- new GrammarTransition( SubentriesControlStatesEnum.START_STATE,
- SubentriesControlStatesEnum.SUB_ENTRY_VISIBILITY_STATE, UniversalTag.BOOLEAN.getValue(),
+ super.transitions[ SubentriesStates.START_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
+ new GrammarTransition( SubentriesStates.START_STATE,
+ SubentriesStates.SUB_ENTRY_VISIBILITY_STATE, UniversalTag.BOOLEAN.getValue(),
new GrammarAction( "SubEntryControl visibility" )
{
public void action( Asn1Container container ) throws DecoderException
{
- SubentriesControlContainer subEntryContainer = ( SubentriesControlContainer ) container;
- SubentriesControl control = subEntryContainer.getSubEntryControl();
+ SubentriesContainer subEntryContainer = ( SubentriesContainer ) container;
+ SubentriesDecorator decorator = subEntryContainer.getSubEntryControl();
TLV tlv = subEntryContainer.getCurrentTLV();
@@ -84,7 +84,7 @@ public final class SubentriesControlGram
try
{
- control.setVisibility( BooleanDecoder.parse( value ) );
+ ( ( Subentries ) decorator.getDecorated() ).setVisibility( BooleanDecoder.parse( value ) );
// We can have an END transition
container.setGrammarEndAllowed( true );
Propchange: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesGrammar.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesStates.java (from r1063551, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlStatesEnum.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesStates.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesStates.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlStatesEnum.java&r1=1063551&r2=1063611&rev=1063611&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlStatesEnum.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesStates.java Wed Jan 26 06:49:51 2011
@@ -30,7 +30,7 @@ import org.apache.directory.shared.asn1.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public enum SubentriesControlStatesEnum implements States
+public enum SubentriesStates implements States
{
// ~ Static fields/initializers
// -----------------------------------------------------------------
@@ -72,7 +72,7 @@ public enum SubentriesControlStatesEnum
*/
public String getGrammarName( Grammar grammar )
{
- if ( grammar instanceof SubentriesControlGrammar )
+ if ( grammar instanceof SubentriesGrammar )
{
return "SUB_ENTRY_GRAMMAR";
}
@@ -105,7 +105,7 @@ public enum SubentriesControlStatesEnum
/**
* {@inheritDoc}
*/
- public SubentriesControlStatesEnum getStartState()
+ public SubentriesStates getStartState()
{
return START_STATE;
}
Propchange: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesStates.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java?rev=1063611&r1=1063610&r2=1063611&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java Wed Jan 26 06:49:51 2011
@@ -44,7 +44,8 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
import org.apache.directory.shared.ldap.codec.ResponseCarryingException;
import org.apache.directory.shared.ldap.codec.decorators.SearchRequestDecorator;
-import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControl;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.Subentries;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesDecorator;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.filter.SearchScope;
import org.apache.directory.shared.ldap.model.message.AliasDerefMode;
@@ -1453,8 +1454,8 @@ public class SearchRequestTest
Control subEntryControl = searchRequest.getControl( subEntryControlOID );
assertEquals( subEntryControlOID, subEntryControl.getOid() );
assertTrue( subEntryControl.isCritical() );
- assertTrue( subEntryControl instanceof SubentriesControl );
- assertTrue( ( ( SubentriesControl ) subEntryControl ).isVisible() );
+ assertTrue( subEntryControl instanceof SubentriesDecorator );
+ assertTrue( ( ( Subentries ) ( ( SubentriesDecorator ) subEntryControl ).getDecorated() ).isVisible() );
assertEquals( "dc=my-domain,dc=com", searchRequest.getBase().toString() );
assertEquals( SearchScope.SUBTREE, searchRequest.getScope() );
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlTest.java?rev=1063611&r1=1063610&r2=1063611&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlTest.java Wed Jan 26 06:49:51 2011
@@ -32,9 +32,10 @@ import org.apache.directory.junit.tools.
import org.apache.directory.shared.asn1.DecoderException;
import org.apache.directory.shared.asn1.EncoderException;
import org.apache.directory.shared.asn1.ber.Asn1Decoder;
-import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControl;
-import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControlContainer;
-import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControlDecoder;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.Subentries;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesDecoder;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesDecorator;
+import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesContainer;
import org.apache.directory.shared.util.Strings;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -55,7 +56,7 @@ public class SubEntryControlTest
@Test
public void testDecodeSubEntryVisibilityTrue()
{
- Asn1Decoder decoder = new SubentriesControlDecoder();
+ Asn1Decoder decoder = new SubentriesDecoder();
ByteBuffer bb = ByteBuffer.allocate( 0x03 );
bb.put( new byte[]
{
@@ -63,8 +64,8 @@ public class SubEntryControlTest
} );
bb.flip();
- SubentriesControlContainer container = new SubentriesControlContainer();
- container.setSubEntryControl( new SubentriesControl() );
+ SubentriesContainer container = new SubentriesContainer();
+ container.setSubEntryControl( new SubentriesDecorator() );
try
{
@@ -76,8 +77,8 @@ public class SubEntryControlTest
fail( de.getMessage() );
}
- SubentriesControl control = container.getSubEntryControl();
- assertTrue( control.isVisible() );
+ SubentriesDecorator decorator = container.getSubEntryControl();
+ assertTrue( ( ( Subentries ) decorator.getDecorated() ).isVisible() );
// test encoding
try
{
@@ -95,7 +96,7 @@ public class SubEntryControlTest
buffer.flip();
- bb = control.encode( ByteBuffer.allocate( control.computeLength() ) );
+ bb = decorator.encode( ByteBuffer.allocate( decorator.computeLength() ) );
String expected = Strings.dumpBytes(buffer.array());
String decoded = Strings.dumpBytes(bb.array());
assertEquals( expected, decoded );
@@ -113,7 +114,7 @@ public class SubEntryControlTest
@Test
public void testDecodeSubEntryVisibilityFalse()
{
- Asn1Decoder decoder = new SubentriesControlDecoder();
+ Asn1Decoder decoder = new SubentriesDecoder();
ByteBuffer bb = ByteBuffer.allocate( 0x03 );
bb.put( new byte[]
{
@@ -121,8 +122,8 @@ public class SubEntryControlTest
} );
bb.flip();
- SubentriesControlContainer container = new SubentriesControlContainer();
- container.setSubEntryControl( new SubentriesControl() );
+ SubentriesContainer container = new SubentriesContainer();
+ container.setSubEntryControl( new SubentriesDecorator() );
try
{
@@ -134,8 +135,8 @@ public class SubEntryControlTest
fail( de.getMessage() );
}
- SubentriesControl control = container.getSubEntryControl();
- assertFalse( control.isVisible() );
+ SubentriesDecorator decorator = container.getSubEntryControl();
+ assertFalse( ( ( Subentries ) decorator.getDecorated() ).isVisible() );
// test encoding
try
@@ -154,7 +155,7 @@ public class SubEntryControlTest
buffer.flip();
- bb = control.encode( ByteBuffer.allocate( control.computeLength() ) );
+ bb = decorator.encode( ByteBuffer.allocate( decorator.computeLength() ) );
String expected = Strings.dumpBytes(buffer.array());
String decoded = Strings.dumpBytes(bb.array());
assertEquals( expected, decoded );
@@ -172,7 +173,7 @@ public class SubEntryControlTest
@Test
public void testDecodeSubEntryEmptyVisibility()
{
- Asn1Decoder decoder = new SubentriesControlDecoder();
+ Asn1Decoder decoder = new SubentriesDecoder();
ByteBuffer bb = ByteBuffer.allocate( 0x02 );
bb.put( new byte[]
@@ -183,8 +184,8 @@ public class SubEntryControlTest
bb.flip();
// Allocate a LdapMessage Container
- SubentriesControlContainer container = new SubentriesControlContainer();
- container.setSubEntryControl( new SubentriesControl() );
+ SubentriesContainer container = new SubentriesContainer();
+ container.setSubEntryControl( new SubentriesDecorator() );
// Decode a SubEntryControl PDU
try
@@ -205,7 +206,7 @@ public class SubEntryControlTest
@Test
public void testDecodeSubEntryBad()
{
- Asn1Decoder decoder = new SubentriesControlDecoder();
+ Asn1Decoder decoder = new SubentriesDecoder();
ByteBuffer bb = ByteBuffer.allocate( 0x03 );
bb.put( new byte[]
@@ -216,8 +217,8 @@ public class SubEntryControlTest
bb.flip();
// Allocate a LdapMessage Container
- SubentriesControlContainer container = new SubentriesControlContainer();
- container.setSubEntryControl( new SubentriesControl() );
+ SubentriesContainer container = new SubentriesContainer();
+ container.setSubEntryControl( new SubentriesDecorator() );
// Decode a SubEntryControl PDU
try