directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r674999 - /directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterParserTest.java
Date Tue, 08 Jul 2008 22:10:50 GMT
Author: elecharny
Date: Tue Jul  8 15:10:50 2008
New Revision: 674999

URL: http://svn.apache.org/viewvc?rev=674999&view=rev
Log:
Used generics

Modified:
    directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterParserTest.java

Modified: directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterParserTest.java?rev=674999&r1=674998&r2=674999&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterParserTest.java
(original)
+++ directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterParserTest.java
Tue Jul  8 15:10:50 2008
@@ -78,10 +78,11 @@
         assertTrue( checkWrongFilter( "(&(cn=abc)" ) );
     }
 
+    @SuppressWarnings("unchecked")
     @Test
     public void testItemFilter() throws ParseException
     {
-        SimpleNode node = ( SimpleNode ) FilterParser.parse( "(ou~=people)" );
+        SimpleNode<String> node = ( SimpleNode<String> ) FilterParser.parse(
"(ou~=people)" );
         assertEquals( "ou", node.getAttribute() );
         assertEquals( "people", node.getValue().get() );
         assertTrue( node instanceof ApproximateNode );
@@ -133,28 +134,31 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     @Test
     public void testOptionAndEscapesFilter() throws ParseException
     {
-        SimpleNode node = ( SimpleNode ) FilterParser.parse( "(ou;lang-de>=\\23\\42asdl
fkajsd)" );
+        SimpleNode<String> node = ( SimpleNode<String> ) FilterParser.parse(
"(ou;lang-de>=\\23\\42asdl fkajsd)" );
         assertEquals( "ou;lang-de", node.getAttribute() );
         assertEquals( "\\23\\42asdl fkajsd", node.getValue().get() );
     }
 
 
+    @SuppressWarnings("unchecked")
     @Test
     public void testOptionsAndEscapesFilter() throws ParseException
     {
-        SimpleNode node = ( SimpleNode ) FilterParser.parse( "(ou;lang-de;version-124>=\\23\\42asdl
fkajsd)" );
+        SimpleNode<String> node = ( SimpleNode<String> ) FilterParser.parse(
"(ou;lang-de;version-124>=\\23\\42asdl fkajsd)" );
         assertEquals( "ou;lang-de;version-124", node.getAttribute() );
         assertEquals( "\\23\\42asdl fkajsd", node.getValue().get() );
     }
 
 
+    @SuppressWarnings("unchecked")
     @Test
     public void testNumericoidOptionsAndEscapesFilter() throws ParseException
     {
-        SimpleNode node = ( SimpleNode ) FilterParser.parse( "(1.3.4.2;lang-de;version-124>=\\23\\42asdl
fkajsd)" );
+        SimpleNode<String> node = ( SimpleNode<String> ) FilterParser.parse(
"(1.3.4.2;lang-de;version-124>=\\23\\42asdl fkajsd)" );
         assertEquals( "1.3.4.2;lang-de;version-124", node.getAttribute() );
         assertEquals( "\\23\\42asdl fkajsd", node.getValue().get() );
     }
@@ -178,10 +182,11 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     @Test
     public void testEqualsFilter() throws ParseException
     {
-        SimpleNode node = ( SimpleNode ) FilterParser.parse( "(ou=people)" );
+        SimpleNode<String> node = ( SimpleNode<String> ) FilterParser.parse(
"(ou=people)" );
         assertEquals( "ou", node.getAttribute() );
         assertEquals( "people", node.getValue().get() );
         assertTrue( node instanceof EqualityNode );
@@ -205,10 +210,11 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     @Test
     public void testEqualsWithForwardSlashFilter() throws ParseException
     {
-        SimpleNode node = ( SimpleNode ) FilterParser.parse( "(ou=people/in/my/company)"
);
+        SimpleNode<String> node = ( SimpleNode<String> ) FilterParser.parse(
"(ou=people/in/my/company)" );
         assertEquals( "ou", node.getAttribute() );
         assertEquals( "people/in/my/company", node.getValue().get() );
         assertTrue( node instanceof EqualityNode );
@@ -633,16 +639,31 @@
     }
     
     
+    @SuppressWarnings("unchecked")
     @Test
     public void testEqualsFilterNullValue() throws ParseException
     {
-        SimpleNode node = ( SimpleNode ) FilterParser.parse( "(ou=)" );
+        SimpleNode<String> node = ( SimpleNode<String> ) FilterParser.parse(
"(ou=)" );
         assertEquals( "ou", node.getAttribute() );
         assertEquals( "", node.getValue().get() );
         assertTrue( node instanceof EqualityNode );
     }
 
     
+    /**
+     * test a filter with a # in value
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testEqualsFilterWithPoundInValue() throws ParseException
+    {
+        SimpleNode<String> node = ( SimpleNode<String> ) FilterParser.parse(
"(uid=#f1)" );
+        assertEquals( "uid", node.getAttribute() );
+        assertEquals( "#f1", node.getValue().get() );
+        assertTrue( node instanceof EqualityNode );
+    }
+
+    
     /*
     @Test
     public void testPerf() throws ParseException



Mime
View raw message