directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1602614 - in /directory/studio/trunk/plugins/ldapbrowser.common: ./ src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ src/test/java/org/ src/test/java/org/apache/ src/test/java/org/apache/directory/ src/test/java...
Date Sat, 14 Jun 2014 18:25:38 GMT
Author: seelmann
Date: Sat Jun 14 18:25:38 2014
New Revision: 1602614

URL: http://svn.apache.org/r1602614
Log:
DIRSTUDIO-985: Allow '=' (for value range) in returning attributes widget

Added:
    directory/studio/trunk/plugins/ldapbrowser.common/src/test/java/org/
    directory/studio/trunk/plugins/ldapbrowser.common/src/test/java/org/apache/
    directory/studio/trunk/plugins/ldapbrowser.common/src/test/java/org/apache/directory/
    directory/studio/trunk/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/
    directory/studio/trunk/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/
    directory/studio/trunk/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/
    directory/studio/trunk/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/
    directory/studio/trunk/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/
    directory/studio/trunk/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidgetTest.java
Modified:
    directory/studio/trunk/plugins/ldapbrowser.common/pom.xml
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidget.java

Modified: directory/studio/trunk/plugins/ldapbrowser.common/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/pom.xml?rev=1602614&r1=1602613&r2=1602614&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/pom.xml (original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/pom.xml Sat Jun 14 18:25:38 2014
@@ -139,14 +139,6 @@
           </execution>
         </executions>
       </plugin>
-      <!-- No tests to run -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <skip>true</skip>
-        </configuration>
-      </plugin>
     </plugins>
   </build>
 
@@ -284,6 +276,13 @@
       <artifactId>x86</artifactId>
       <scope>provided</scope>
     </dependency>
+    
+    <!-- JUnit for test only -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
 </project>

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidget.java?rev=1602614&r1=1602613&r2=1602614&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidget.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidget.java
Sat Jun 14 18:25:38 2014
@@ -44,7 +44,7 @@ import org.eclipse.swt.widgets.Composite
 
 /**
  * The ReturningAttributesWidget could be used to enter a list of attribute types
- * return by an LDPA search. It is composed of a combo with content assist
+ * return by an LDAP search. It is composed of a combo with content assist
  * and a history.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -230,12 +230,13 @@ public class ReturningAttributesWidget e
      * <li>A-Z
      * <li>0-9
      * <li>-
-     * <li>.
-     * <li>;
-     * <li>_
-     * <li>*
-     * <li>+
+     * <li>. (part of numeric OID)
+     * <li>; (attribute option)
+     * <li>_ (some directory servers allow underscore in attribute name)
+     * <li>* (all user attributes)
+     * <li>+ (all operational attributes)
      * <li>@
+     * <li>= (range option, DIRSTUDIO-985)
      * 
      * @param s the string to split
      * 
@@ -257,7 +258,7 @@ public class ReturningAttributesWidget e
                 char c = s.charAt( i );
 
                 if ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c
<= 'Z' ) || ( c >= '0' && c <= '9' ) || c == '-'
-                    || c == '.' || c == ';' || c == '_' || c == '*' || c == '+' || c == '@'
)
+                    || c == '.' || c == ';' || c == '_' || c == '*' || c == '+' || c == '@'
|| c == '=' )
                 {
                     temp.append( c );
                 }

Added: directory/studio/trunk/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidgetTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidgetTest.java?rev=1602614&view=auto
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidgetTest.java
(added)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidgetTest.java
Sat Jun 14 18:25:38 2014
@@ -0,0 +1,130 @@
+package org.apache.directory.studio.ldapbrowser.common.widgets.search;
+
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+
+
+public class ReturningAttributesWidgetTest
+{
+
+    @Test
+    public void testStringToArrayNull()
+    {
+        String[] attributes = ReturningAttributesWidget.stringToArray( null );
+        assertNull( attributes );
+    }
+
+
+    @Test
+    public void testStringToArrayEmpty()
+    {
+        String[] attributes = ReturningAttributesWidget.stringToArray( "" );
+        assertNotNull( attributes );
+        assertArrayEquals( new String[0], attributes );
+    }
+
+
+    @Test
+    public void testStringToArrayNoAttrs()
+    {
+        String[] attributes = ReturningAttributesWidget.stringToArray( "1.1" );
+        assertNotNull( attributes );
+        assertArrayEquals( new String[]
+            { "1.1" }, attributes );
+    }
+
+
+    @Test
+    public void testStringToArraySingleAttribute()
+    {
+        String[] attributes = ReturningAttributesWidget.stringToArray( "cn" );
+        assertNotNull( attributes );
+        assertArrayEquals( new String[]
+            { "cn" }, attributes );
+    }
+
+
+    @Test
+    public void testStringToArrayStingleAttributeWithTrailingWhitespace()
+    {
+        String[] attributes = ReturningAttributesWidget.stringToArray( " cn\t " );
+        assertNotNull( attributes );
+        assertArrayEquals( new String[]
+            { "cn" }, attributes );
+    }
+
+
+    @Test
+    public void testStringToArrayStingleAttributeWithTrailingCommas()
+    {
+        String[] attributes = ReturningAttributesWidget.stringToArray( " , ,cn,," );
+        assertNotNull( attributes );
+        assertArrayEquals( new String[]
+            { "cn" }, attributes );
+    }
+
+
+    @Test
+    public void testStringToArrayMultipleAttributes()
+    {
+        String[] attributes = ReturningAttributesWidget.stringToArray( "cn, sn uid" );
+        assertNotNull( attributes );
+        assertArrayEquals( new String[]
+            { "cn", "sn", "uid" }, attributes );
+    }
+
+
+    @Test
+    public void testStringToArrayMultiplwWithAllUserAndOperationalAttributes()
+    {
+        String[] attributes = ReturningAttributesWidget.stringToArray( "cn, sn uid, * +"
);
+        assertNotNull( attributes );
+        assertArrayEquals( new String[]
+            { "cn", "sn", "uid", "*", "+" }, attributes );
+    }
+
+
+    @Test
+    public void testStringToArrayMultipleAttributesWithOptions()
+    {
+        String[] attributes = ReturningAttributesWidget.stringToArray( "cn, sn;lang-de;lang-en
uid" );
+        assertNotNull( attributes );
+        assertArrayEquals( new String[]
+            { "cn", "sn;lang-de;lang-en", "uid" }, attributes );
+    }
+
+
+    @Test
+    public void testStringToArrayMultipleAttributesAsOid()
+    {
+        String[] attributes = ReturningAttributesWidget.stringToArray( "2.5.4.3, 2.5.4.4
0.9.2342.19200300.100.1.1" );
+        assertNotNull( attributes );
+        assertArrayEquals( new String[]
+            { "2.5.4.3", "2.5.4.4", "0.9.2342.19200300.100.1.1" }, attributes );
+    }
+
+
+    @Test
+    public void testStringToArrayMultipleAttributesWithUnderscore()
+    {
+        String[] attributes = ReturningAttributesWidget.stringToArray( "cn, s_n u_i_d" );
+        assertNotNull( attributes );
+        assertArrayEquals( new String[]
+            { "cn", "s_n", "u_i_d" }, attributes );
+    }
+
+
+    @Test
+    public void testStringToArrayMultipleAttributesWithRangeOption()
+    {
+        String[] attributes = ReturningAttributesWidget.stringToArray( "cn, member;Range=0-*
objectClass" );
+        assertNotNull( attributes );
+        assertArrayEquals( new String[]
+            { "cn", "member;Range=0-*", "objectClass" }, attributes );
+    }
+
+}



Mime
View raw message