directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lucasthei...@apache.org
Subject svn commit: r1656009 - in /directory/shared/trunk/ldap/client/api/src: main/java/org/apache/directory/ldap/client/api/search/ test/java/org/apache/directory/ldap/client/api/search/
Date Fri, 30 Jan 2015 13:23:43 GMT
Author: lucastheisen
Date: Fri Jan 30 13:23:43 2015
New Revision: 1656009

URL: http://svn.apache.org/r1656009
Log:
DIRAPI-165: renamed AttributeFilter to AttributeDescriptionFilter to match names used in RFC-4515
section 2

Added:
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/search/AttributeDescriptionFilter.java
  (with props)
    directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/AttributeDescriptionFilterTest.java
  (with props)
Modified:
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/search/FilterBuilder.java
    directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/SetOfFiltersFilterTest.java
    directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/UnaryFilterTest.java

Added: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/search/AttributeDescriptionFilter.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/search/AttributeDescriptionFilter.java?rev=1656009&view=auto
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/search/AttributeDescriptionFilter.java
(added)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/search/AttributeDescriptionFilter.java
Fri Jan 30 13:23:43 2015
@@ -0,0 +1,63 @@
+/*
+ *   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.ldap.client.api.search;
+
+
+/**
+ * This class is used to handle the Present filter (ie, attr =* )
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+/* No qualifier*/class AttributeDescriptionFilter extends AbstractFilter
+{
+    /** The attribute that must be prersent */
+    private String attribute;
+
+
+    /**
+     * Creates a new instance of AttributeDescription filter.
+     */
+    private AttributeDescriptionFilter( String attribute )
+    {
+        this.attribute = attribute;
+    }
+
+
+    /**
+     * Creates a new AttributeDescription 
+     *
+     * @param attribute The attribute that must be present
+     * @return The created PresenceFilter instance
+     */
+    public static AttributeDescriptionFilter present( String attribute )
+    {
+        return new AttributeDescriptionFilter( attribute );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public StringBuilder build( StringBuilder builder )
+    {
+        return builder.append( "(" ).append( attribute ).append( FilterOperator.PRESENT.operator()
).append( ")" );
+    }
+}
\ No newline at end of file

Propchange: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/search/AttributeDescriptionFilter.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/search/FilterBuilder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/search/FilterBuilder.java?rev=1656009&r1=1656008&r2=1656009&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/search/FilterBuilder.java
(original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/search/FilterBuilder.java
Fri Jan 30 13:23:43 2015
@@ -316,7 +316,7 @@ public class FilterBuilder
      */
     public static FilterBuilder present( String attribute )
     {
-        return new FilterBuilder( AttributeFilter.present( attribute ) );
+        return new FilterBuilder( AttributeDescriptionFilter.present( attribute ) );
     }
 
 

Added: directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/AttributeDescriptionFilterTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/AttributeDescriptionFilterTest.java?rev=1656009&view=auto
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/AttributeDescriptionFilterTest.java
(added)
+++ directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/AttributeDescriptionFilterTest.java
Fri Jan 30 13:23:43 2015
@@ -0,0 +1,45 @@
+/*
+ *   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.ldap.client.api.search;
+
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+
+/**
+ * 
+ * TODO AttributeFilterTest.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AttributeDescriptionFilterTest
+{
+    @Test
+    public void testPresent()
+    {
+        assertEquals( "(objectClass=*)", AttributeDescriptionFilter.present( "objectClass"
).build().toString() );
+        assertEquals( "(uid=*)", AttributeDescriptionFilter.present( "uid" ).build().toString()
);
+        assertEquals( "(userPassword=*)", AttributeDescriptionFilter.present( "userPassword"
).build().toString() );
+        assertEquals( "(cn=*)", AttributeDescriptionFilter.present( "cn" ).build().toString()
);
+    }
+}

Propchange: directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/AttributeDescriptionFilterTest.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/SetOfFiltersFilterTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/SetOfFiltersFilterTest.java?rev=1656009&r1=1656008&r2=1656009&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/SetOfFiltersFilterTest.java
(original)
+++ directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/SetOfFiltersFilterTest.java
Fri Jan 30 13:23:43 2015
@@ -52,7 +52,7 @@ public class SetOfFiltersFilterTest
     @Test
     public void testAnd()
     {
-        AttributeFilter attributeFilter = AttributeFilter.present( "objectClass" );
+        AttributeDescriptionFilter attributeFilter = AttributeDescriptionFilter.present(
"objectClass" );
         AttributeValueAssertionFilter attributeValueAssertionFilter =
             AttributeValueAssertionFilter.equal( "objectClass", "person" );
         String expected = expected( FilterOperator.AND, attributeFilter, attributeValueAssertionFilter
);
@@ -82,7 +82,7 @@ public class SetOfFiltersFilterTest
     @Test
     public void testOr()
     {
-        AttributeFilter attributeFilter = AttributeFilter.present( "objectClass" );
+        AttributeDescriptionFilter attributeFilter = AttributeDescriptionFilter.present(
"objectClass" );
         AttributeValueAssertionFilter attributeValueAssertionFilter =
             AttributeValueAssertionFilter.equal( "objectClass", "person" );
         String expected = expected( FilterOperator.OR, attributeFilter, attributeValueAssertionFilter
);

Modified: directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/UnaryFilterTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/UnaryFilterTest.java?rev=1656009&r1=1656008&r2=1656009&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/UnaryFilterTest.java
(original)
+++ directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/UnaryFilterTest.java
Fri Jan 30 13:23:43 2015
@@ -36,7 +36,7 @@ public class UnaryFilterTest
     @Test
     public void testNot()
     {
-        AttributeFilter attributeFilter = AttributeFilter.present( "objectClass" );
+        AttributeDescriptionFilter attributeFilter = AttributeDescriptionFilter.present(
"objectClass" );
         assertEquals( "(!" + attributeFilter.build().toString() + ")",
             UnaryFilter.not( attributeFilter ).build().toString() );
 



Mime
View raw message