directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1063976 - in /directory: apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/ shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/ shared/trunk/ldap/sr...
Date Thu, 27 Jan 2011 03:49:17 GMT
Author: akarasulu
Date: Thu Jan 27 03:49:16 2011
New Revision: 1063976

URL: http://svn.apache.org/viewvc?rev=1063976&view=rev
Log:
moving cleaned up control interfaces and simple implementations to model

Added:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/SimplePersistentSearch.java
      - copied, changed from r1063975, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearch.java
Removed:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearch.java
Modified:
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ChangeType.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlTest.java

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java?rev=1063976&r1=1063975&r2=1063976&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java
Thu Jan 27 03:49:16 2011
@@ -50,6 +50,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.event.RegistrationEntry;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.SimplePersistentSearch;
 import org.apache.directory.shared.ldap.model.message.controls.ChangeType;
 import org.apache.directory.shared.ldap.model.message.controls.EntryChange;
 import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeDecorator;
@@ -119,7 +120,7 @@ public class PersistentSearchIT extends 
 
     private void setUpListenerReturnECs() throws Exception
     {
-        setUpListener( true, new PersistentSearch(), false );
+        setUpListener( true, new SimplePersistentSearch(), false );
     }
     
     
@@ -331,7 +332,7 @@ public class PersistentSearchIT extends 
     @Test
     public void testPsearchAddModifyEnabledWithEC() throws Exception
     {
-        PersistentSearch ctrl = new PersistentSearch();
+        PersistentSearch ctrl = new SimplePersistentSearch();
         ctrl.setReturnECs( true );
         ctrl.setChangeTypes( ChangeType.ADD.getValue() );
         ctrl.enableNotification( ChangeType.MODIFY );
@@ -527,7 +528,7 @@ public class PersistentSearchIT extends 
         
         PSearchListener()
         {
-            persistentSearch = new PersistentSearch();
+            persistentSearch = new SimplePersistentSearch();
         }
 
 

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=1063976&r1=1063975&r2=1063976&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
Thu Jan 27 03:49:16 2011
@@ -47,7 +47,7 @@ public class PersistentSearchDecorator e
      */
     public PersistentSearchDecorator()
     {
-        super( new PersistentSearch(), new PersistentSearchDecoder() );
+        super( new SimplePersistentSearch(), new PersistentSearchDecoder() );
     }
 
 

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/SimplePersistentSearch.java
(from r1063975, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearch.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/SimplePersistentSearch.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/SimplePersistentSearch.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearch.java&r1=1063975&r2=1063976&rev=1063976&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearch.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/SimplePersistentSearch.java
Thu Jan 27 03:49:16 2011
@@ -29,24 +29,8 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class PersistentSearch extends BasicControlImpl
+public class SimplePersistentSearch extends BasicControlImpl implements PersistentSearch
 {
-    /** This control OID */
-    public static final String OID = "2.16.840.1.113730.3.4.3";
-
-    /** Definition of the change types */
-    public static final int CHANGE_TYPE_ADD     = 1;
-
-    public static final int CHANGE_TYPE_DELETE  = 2;
-
-    public static final int CHANGE_TYPE_MODIFY  = 4;
-
-    public static final int CHANGE_TYPE_MODDN   = 8;
-
-    /** Min and Max values for the possible combined change types */
-    public static final int CHANGE_TYPES_MIN = CHANGE_TYPE_ADD;
-
-    public static final int CHANGE_TYPES_MAX = CHANGE_TYPE_ADD | CHANGE_TYPE_DELETE | CHANGE_TYPE_MODIFY
| CHANGE_TYPE_MODDN;
 
     /**
      * If changesOnly is TRUE, the server MUST NOT return any existing entries
@@ -78,7 +62,7 @@ public class PersistentSearch extends Ba
      * Default constructor
      *
      */
-    public PersistentSearch()
+    public SimplePersistentSearch()
     {
         super( OID );
     }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ChangeType.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ChangeType.java?rev=1063976&r1=1063975&r2=1063976&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ChangeType.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ChangeType.java
Thu Jan 27 03:49:16 2011
@@ -57,9 +57,9 @@ public enum ChangeType
      * 
      * Creates a new instance of ChangeType.
      *
-     * @param value
+     * @param value The value for the ChangeType.
      */
-    private ChangeType(int value)
+    private ChangeType( int value )
     {
         this.value = value;
     }
@@ -75,6 +75,19 @@ public enum ChangeType
 
 
     /**
+     * Checks via bitwise AND to see if this ChangeType value is within the
+     * supplied changeTypes.
+     *
+     * @param changeTypes The supplied changeTypes.
+     * @return true, if this ChangeType is present in the supplied changeTypes.
+     */
+    public boolean presentIn( int changeTypes )
+    {
+        return value == ( value & changeTypes );
+    }
+
+
+    /**
      * Gets the changeType enumeration type for an integer value.
      * 
      * @param value the value to get the enumeration for

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlTest.java?rev=1063976&r1=1063975&r2=1063976&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlTest.java
Thu Jan 27 03:49:16 2011
@@ -34,6 +34,7 @@ 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.model.message.controls.ChangeType;
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -50,6 +51,7 @@ public class PSearchControlTest
 {
     /**
      * Test encoding of a PSearchControl.
+     * @throws Exception on error
      */
     @Test
     public void testEncodePSearchControl() throws Exception
@@ -113,8 +115,8 @@ public class PSearchControlTest
 
         PersistentSearch ctrl = ( PersistentSearch ) container.getPSearchDecorator().getDecorated();
         int changeTypes = ctrl.getChangeTypes();
-        assertEquals( PersistentSearch.CHANGE_TYPE_ADD, changeTypes & PersistentSearch.CHANGE_TYPE_ADD
);
-        assertEquals( PersistentSearch.CHANGE_TYPE_MODDN, changeTypes & PersistentSearch.CHANGE_TYPE_MODDN
);
+        assertTrue( ChangeType.ADD.presentIn( changeTypes ) );
+        assertTrue( ChangeType.MODDN.presentIn( changeTypes ) );
         assertEquals( false, ctrl.isChangesOnly() );
         assertEquals( false, ctrl.isReturnECs() );
     }



Mime
View raw message