directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r718293 - in /directory/shared/branches/shared-mina2/ldap: ./ src/main/java/org/apache/directory/shared/ldap/codec/ src/main/java/org/apache/directory/shared/ldap/filter/ src/main/java/org/apache/directory/shared/ldap/ldif/ src/main/java/or...
Date Mon, 17 Nov 2008 17:47:30 GMT
Author: elecharny
Date: Mon Nov 17 09:47:29 2008
New Revision: 718293

URL: http://svn.apache.org/viewvc?rev=718293&view=rev
Log:
o Switched to 0.9.14-SNAPSHOT
o Merged Kiran, Stefan and my modifications from trunk

Added:
    directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/schema/BooleanNormalizer.java
    directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/schema/BooleanNormalizerTest.java
Removed:
    directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/message/spi/TransformerSpi.java
Modified:
    directory/shared/branches/shared-mina2/ldap/pom.xml
    directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixProvider.java
    directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
    directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/filter/NotNode.java
    directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
    directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
    directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageEncoder.java
    directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/message/spi/Provider.java
    directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BooleanSyntaxChecker.java
    directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/util/DateUtils.java
    directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
    directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java
    directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/BooleanSyntaxCheckerTest.java
    directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java

Modified: directory/shared/branches/shared-mina2/ldap/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mina2/ldap/pom.xml?rev=718293&r1=718292&r2=718293&view=diff
==============================================================================
--- directory/shared/branches/shared-mina2/ldap/pom.xml (original)
+++ directory/shared/branches/shared-mina2/ldap/pom.xml Mon Nov 17 09:47:29 2008
@@ -24,7 +24,7 @@
   <parent>
     <groupId>org.apache.directory.shared</groupId>
     <artifactId>shared-parent</artifactId>
-    <version>0.9.13-SNAPSHOT</version>
+    <version>0.9.14-SNAPSHOT</version>
   </parent>
   <artifactId>shared-ldap</artifactId>
   <name>Apache Directory Protocol Ldap Shared</name>

Modified: directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixProvider.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixProvider.java?rev=718293&r1=718292&r2=718293&view=diff
==============================================================================
--- directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixProvider.java (original)
+++ directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixProvider.java Mon Nov 17 09:47:29 2008
@@ -24,7 +24,6 @@
 import org.apache.directory.shared.ldap.message.spi.ProviderDecoder;
 import org.apache.directory.shared.ldap.message.spi.ProviderEncoder;
 import org.apache.directory.shared.ldap.message.spi.ProviderException;
-import org.apache.directory.shared.ldap.message.spi.TransformerSpi;
 
 
 
@@ -37,17 +36,12 @@
  */
 public class TwixProvider extends Provider
 {
-    /** The Transformer for this provider */
-    private final TwixTransformer transformer;
-
-
     /**
      * Creates an instance of a Twix based LDAP BER Provider.
      */
     private TwixProvider()
     {
         super( "Twix LDAP BER Provider", "Apache Directory Project" );
-        transformer = new TwixTransformer( this );
     }
 
     /** the singleton TwixProvider instance */
@@ -95,17 +89,4 @@
     {
         return new TwixDecoder( this, binaryAttributeDetector );
     }
-
-
-    /**
-     * Gets the transformer associated with this provider.
-     * 
-     * @return the provider's transformer.
-     * @throws org.apache.directory.shared.ldap.message.spi.ProviderException
-     *             if the provider or its transformer cannot be found
-     */
-    public TransformerSpi getTransformer() throws ProviderException
-    {
-        return transformer;
-    }
 }

Modified: directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java?rev=718293&r1=718292&r2=718293&view=diff
==============================================================================
--- directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java (original)
+++ directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java Mon Nov 17 09:47:29 2008
@@ -76,6 +76,7 @@
 import org.apache.directory.shared.ldap.filter.NotNode;
 import org.apache.directory.shared.ldap.filter.OrNode;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
+import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
 import org.apache.directory.shared.ldap.message.AbandonRequestImpl;
 import org.apache.directory.shared.ldap.message.AddRequestImpl;
@@ -107,8 +108,6 @@
 import org.apache.directory.shared.ldap.message.control.PersistentSearchControl;
 import org.apache.directory.shared.ldap.message.control.SubentriesControl;
 import org.apache.directory.shared.ldap.message.extended.GracefulShutdownRequest;
-import org.apache.directory.shared.ldap.message.spi.Provider;
-import org.apache.directory.shared.ldap.message.spi.TransformerSpi;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.LdapURL;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -122,38 +121,13 @@
  * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
  * @version $Rev$, $Date$, 
  */
-public class TwixTransformer implements TransformerSpi
+public class TwixTransformer
 {
     /** The logger */
-    private static Logger log = LoggerFactory.getLogger( TwixTransformer.class );
+    private static Logger LOG = LoggerFactory.getLogger( TwixTransformer.class );
 
     /** A speedup for logger */
-    private static final boolean IS_DEBUG = log.isDebugEnabled();
-    
-    /** the provider this transformer is part of */
-    private final Provider provider;
-
-
-    /**
-     * Creates a passthrough transformer that really does nothing at all.
-     * 
-     * @param provider the provider for this transformer
-     */
-    public TwixTransformer(Provider provider)
-    {
-        this.provider = provider;
-    }
-
-
-    /**
-     * Gets the Provider associated with this SPI implementation object.
-     * 
-     * @return Provider.
-     */
-    public Provider getProvider()
-    {
-        return provider;
-    }
+    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
 
     /**
@@ -164,7 +138,7 @@
      * @param messageId The message Id
      * @return A Snickers AbandonRequestImpl
      */
-    private Message transformAbandonRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformAbandonRequest( LdapMessage twixMessage, int messageId )
     {
         AbandonRequestImpl snickersMessage = new AbandonRequestImpl( messageId );
         AbandonRequest abandonRequest = twixMessage.getAbandonRequest();
@@ -183,7 +157,7 @@
      * @param messageId The message Id
      * @return A Snickers AddRequestImpl
      */
-    private Message transformAddRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformAddRequest( LdapMessage twixMessage, int messageId )
     {
         AddRequestImpl snickersMessage = new AddRequestImpl( messageId );
         AddRequest addRequest = twixMessage.getAddRequest();
@@ -205,7 +179,7 @@
      * @param messageId The message Id
      * @return A Snickers BindRequestImpl
      */
-    private Message transformBindRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformBindRequest( LdapMessage twixMessage, int messageId )
     {
         BindRequestImpl snickersMessage = new BindRequestImpl( messageId );
         BindRequest bindRequest = twixMessage.getBindRequest();
@@ -248,7 +222,7 @@
      * @param messageId The message Id
      * @return a Snickers BindResponseImpl
      */
-    private Message transformBindResponse( LdapMessage twixMessage, int messageId )
+    public static Message transformBindResponse( LdapMessage twixMessage, int messageId )
     {
         BindResponseImpl snickersMessage = new BindResponseImpl( messageId );
         BindResponse bindResponse = twixMessage.getBindResponse();
@@ -268,7 +242,7 @@
      * @param twixResult the Twix LdapResult representation
      * @param snickersResult the Snickers LdapResult representation
      */
-    private void transformLdapResultTwixToSnickers( LdapResult twixResult, 
+    public static void transformLdapResultTwixToSnickers( LdapResult twixResult, 
         org.apache.directory.shared.ldap.message.LdapResult snickersResult )
     {
         snickersResult.setErrorMessage( twixResult.getErrorMessage() );
@@ -279,7 +253,7 @@
         }
         catch ( InvalidNameException e )
         {
-            log.error( "Could not parse matchedDN while transforming twix value to snickers: {}", 
+        	LOG.error( "Could not parse matchedDN while transforming twix value to snickers: {}", 
                 twixResult.getMatchedDN() );
             snickersResult.setMatchedDn( new LdapDN() );
         }
@@ -312,7 +286,7 @@
      * @param messageId The message Id
      * @return A Snickers CompareRequestImpl
      */
-    private Message transformCompareRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformCompareRequest( LdapMessage twixMessage, int messageId )
     {
         CompareRequestImpl snickersMessage = new CompareRequestImpl( messageId );
         CompareRequest compareRequest = twixMessage.getCompareRequest();
@@ -344,7 +318,7 @@
      * @param messageId The message Id
      * @return A Snickers DeleteRequestImpl
      */
-    private Message transformDelRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformDelRequest( LdapMessage twixMessage, int messageId )
     {
         DeleteRequestImpl snickersMessage = new DeleteRequestImpl( messageId );
         DelRequest delRequest = twixMessage.getDelRequest();
@@ -364,7 +338,7 @@
      * @param messageId The message Id
      * @return A Snickers ExtendedRequestImpl
      */
-    private Message transformExtendedRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformExtendedRequest( LdapMessage twixMessage, int messageId )
     {
         ExtendedRequest extendedRequest = twixMessage.getExtendedRequest();
         ExtendedRequestImpl snickersMessage;
@@ -396,7 +370,7 @@
      * @param messageId The message Id
      * @return A Snickers ModifyDNRequestImpl
      */
-    private Message transformModifyDNRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformModifyDNRequest( LdapMessage twixMessage, int messageId )
     {
         ModifyDnRequestImpl snickersMessage = new ModifyDnRequestImpl( messageId );
         ModifyDNRequest modifyDNRequest = twixMessage.getModifyDNRequest();
@@ -424,7 +398,7 @@
      * @param messageId The message Id
      * @return A Snickers ModifyRequestImpl
      */
-    private Message transformModifyRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformModifyRequest( LdapMessage twixMessage, int messageId )
     {
         ModifyRequestImpl snickersMessage = new ModifyRequestImpl( messageId );
         ModifyRequest modifyRequest = twixMessage.getModifyRequest();
@@ -447,12 +421,12 @@
 
 
     /**
-     * Transform the Filter part of a SearchRequest to en ExprNode
+     * Transform the Filter part of a SearchRequest to an ExprNode
      * 
      * @param twixFilter The filter to be transformed
      * @return An ExprNode
      */
-    private ExprNode transformFilter( Filter twixFilter )
+    public static ExprNode transformFilter( Filter twixFilter )
     {
         if ( twixFilter != null )
         {
@@ -605,6 +579,157 @@
         }
     }
 
+    /**
+     * Transform an ExprNode filter to a TwixFilter
+     * 
+     * @param exprNode The filter to be transformed
+     * @return A Twix filter
+     */
+    public static Filter transformFilter( ExprNode exprNode )
+    {
+        if ( exprNode != null )
+        {
+            Filter filter  = null;
+
+            // Transform OR, AND or NOT leaves
+            if ( exprNode instanceof BranchNode )
+            {
+                if ( exprNode instanceof AndNode )
+                {
+                    filter = new AndFilter();
+                }
+                else if ( exprNode instanceof OrNode )
+                {
+                    filter = new OrFilter();
+                }
+                else if ( exprNode instanceof NotNode )
+                {
+                    filter = new NotFilter();
+                }
+
+                List<ExprNode> children = ((BranchNode)exprNode).getChildren();
+
+                // Loop on all AND/OR children
+                if ( children != null )
+                {
+                    for ( ExprNode child:children )
+                    {
+                        try
+                        {
+                            ((ConnectorFilter)filter).addFilter( transformFilter( child ) );
+                        }
+                        catch ( DecoderException de )
+                        {
+                            LOG.error( "Error while transforming a ExprNode : " + de.getMessage() );
+                            return null;
+                        }
+                    }
+                }
+            }
+            else
+            {
+                if ( exprNode instanceof PresenceNode )
+                {
+                    // Transform Presence Node
+                    filter = new PresentFilter();
+                    ((PresentFilter)filter).setAttributeDescription( ((PresenceNode)exprNode).getAttribute() );
+                }
+                else if ( exprNode instanceof SimpleNode<?> )
+                {
+                    if ( exprNode instanceof EqualityNode<?> )
+                    {
+                        filter = new AttributeValueAssertionFilter( LdapConstants.EQUALITY_MATCH_FILTER );
+                        AttributeValueAssertion assertion = new AttributeValueAssertion();
+                        assertion.setAttributeDesc( ((EqualityNode<?>)exprNode).getAssertionType().name() );
+                        assertion.setAssertionValue( ((EqualityNode<?>)exprNode).getValue() );
+                        ((AttributeValueAssertionFilter)filter).setAssertion( assertion );
+                    }
+                    else if ( exprNode instanceof GreaterEqNode<?> ) 
+                    {
+                        filter = new AttributeValueAssertionFilter( LdapConstants.GREATER_OR_EQUAL_FILTER );
+                        AttributeValueAssertion assertion = new AttributeValueAssertion();
+                        assertion.setAttributeDesc( ((EqualityNode<?>)exprNode).getAssertionType().name() );
+                        assertion.setAssertionValue( ((EqualityNode<?>)exprNode).getValue() );
+                        ((AttributeValueAssertionFilter)filter).setAssertion( assertion );
+                    }
+                    else if ( exprNode instanceof LessEqNode<?> ) 
+                    {
+                        filter = new AttributeValueAssertionFilter( LdapConstants.LESS_OR_EQUAL_FILTER );
+                        AttributeValueAssertion assertion = new AttributeValueAssertion();
+                        assertion.setAttributeDesc( ((EqualityNode<?>)exprNode).getAssertionType().name() );
+                        assertion.setAssertionValue( ((EqualityNode<?>)exprNode).getValue() );
+                        ((AttributeValueAssertionFilter)filter).setAssertion( assertion );
+                    }
+                    else if ( exprNode instanceof ApproximateNode<?> )
+                    {
+                        filter = new AttributeValueAssertionFilter( LdapConstants.APPROX_MATCH_FILTER );
+                        AttributeValueAssertion assertion = new AttributeValueAssertion();
+                        assertion.setAttributeDesc( ((EqualityNode<?>)exprNode).getAssertionType().name() );
+                        assertion.setAssertionValue( ((EqualityNode<?>)exprNode).getValue() );
+                        ((AttributeValueAssertionFilter)filter).setAssertion( assertion );
+                    }
+                }
+                else if ( exprNode instanceof SubstringNode )
+                {
+                    // Transform Substring Nodes
+                    filter = new SubstringFilter();
+
+                    String initialString = ((SubstringNode)exprNode).getInitial();
+                    String finalString = ((SubstringNode)exprNode).getFinal();
+                    List<String> anyStrings = ((SubstringNode)exprNode).getAny();
+
+                    if ( initialString != null )
+                    {
+                        ((SubstringFilter)filter).setInitialSubstrings( initialString );
+                    }
+
+                    if ( finalString != null )
+                    {
+                        ((SubstringFilter)filter).setFinalSubstrings( finalString );
+                    }
+
+                    if ( anyStrings != null )
+                    {
+                        for ( String any:anyStrings )
+                        {
+                            ((SubstringFilter)filter).addAnySubstrings( any );
+                        }
+                    }
+                }
+                else if ( exprNode instanceof ExtensibleNode )
+                {
+                    // Transform Extensible Node
+                    filter = new ExtensibleMatchFilter();
+                    
+                    String attribute = ((ExtensibleNode)exprNode).getAttribute();
+                    String matchingRule = ((ExtensibleNode)exprNode).getMatchingRuleId();
+                    boolean dnAttributes = ((ExtensibleNode)exprNode).hasDnAttributes();
+                    Object value = ((ExtensibleNode)exprNode).getValue();
+
+                    if ( attribute != null )
+                    {
+                        ((ExtensibleMatchFilter)filter).setType( attribute );
+                    }
+
+                    if ( matchingRule != null )
+                    {
+                        ((ExtensibleMatchFilter)filter).setMatchingRule( matchingRule );
+                    }
+
+                    ((ExtensibleMatchFilter)filter).setMatchValue( value );
+                    ((ExtensibleMatchFilter)filter).setDnAttributes( dnAttributes );
+                }
+            }
+
+            return filter;
+        }
+        else
+        {
+            // We have found nothing to transform. Return null then.
+            return null;
+        }
+    }
+
 
     /**
      * Transform a SearchRequest message from a TwixMessage to a SnickersMessage
@@ -613,7 +738,7 @@
      * @param messageId The message Id
      * @return A Snickers SearchRequestImpl
      */
-    private Message transformSearchRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformSearchRequest( LdapMessage twixMessage, int messageId )
     {
         SearchRequestImpl snickersMessage = new SearchRequestImpl( messageId );
         SearchRequest searchRequest = twixMessage.getSearchRequest();
@@ -687,7 +812,7 @@
      * @param messageId The message Id
      * @return A Snickers UnBindRequestImpl
      */
-    private Message transformUnBindRequest( LdapMessage twixMessage, int messageId )
+    public static Message transformUnBindRequest( LdapMessage twixMessage, int messageId )
     {
         return new UnbindRequestImpl( messageId );
     }
@@ -699,14 +824,14 @@
      * @param obj the object to transform
      * @return the object transformed
      */
-    public Message transform( Object obj )
+    public static Message transform( Object obj )
     {
         LdapMessage twixMessage = ( LdapMessage ) obj;
         int messageId = twixMessage.getMessageId();
 
         if ( IS_DEBUG )
         {
-            log.debug( "Transforming LdapMessage <" + messageId + ", " + twixMessage.getMessageTypeName()
+        	LOG.debug( "Transforming LdapMessage <" + messageId + ", " + twixMessage.getMessageTypeName()
                 + "> from Twix to Snickers." );
         }
 
@@ -859,7 +984,7 @@
      * @param snickersLdapResult the Snickers LdapResult to transform
      * @return A Twix LdapResult
      */
-    private LdapResult transformLdapResult( LdapResultImpl snickersLdapResult )
+    public static LdapResult transformLdapResult( LdapResultImpl snickersLdapResult )
     {
         LdapResult twixLdapResult = new LdapResult();
 
@@ -890,7 +1015,7 @@
                 }
                 catch ( LdapURLEncodingException lude )
                 {
-                    log.warn( "The referral " + referral + " is invalid : " + lude.getMessage() );
+                	LOG.warn( "The referral " + referral + " is invalid : " + lude.getMessage() );
                     twixLdapResult.addReferral( LdapURL.EMPTY_URL );
                 }
             }
@@ -906,7 +1031,7 @@
      * @param twixMessage The Twix AddResponse to produce
      * @param snickersMessage The incoming Snickers AddResponse
      */
-    private void transformAddResponse( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformAddResponse( LdapMessage twixMessage, Message snickersMessage )
     {
         AddResponseImpl snickersAddResponse = ( AddResponseImpl ) snickersMessage;
 
@@ -926,7 +1051,7 @@
      * @param twixMessage The Twix BindResponse to produce
      * @param snickersMessage The incoming Snickers BindResponse
      */
-    private void transformBindResponse( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformBindResponse( LdapMessage twixMessage, Message snickersMessage )
     {
         BindResponseImpl snickersBindResponse = ( BindResponseImpl ) snickersMessage;
 
@@ -955,7 +1080,7 @@
      * @param twixMessage The Twix BindRequest to produce
      * @param snickersMessage The incoming Snickers BindRequest
      */
-    private void transformBindRequest( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformBindRequest( LdapMessage twixMessage, Message snickersMessage )
     {
         BindRequestImpl snickersBindRequest = ( BindRequestImpl ) snickersMessage;
 
@@ -990,7 +1115,7 @@
      * @param twixMessage The Twix CompareResponse to produce
      * @param snickersMessage The incoming Snickers CompareResponse
      */
-    private void transformCompareResponse( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformCompareResponse( LdapMessage twixMessage, Message snickersMessage )
     {
         CompareResponseImpl snickersCompareResponse = ( CompareResponseImpl ) snickersMessage;
 
@@ -1011,7 +1136,7 @@
      * @param twixMessage The Twix DelResponse to produce
      * @param snickersMessage The incoming Snickers DelResponse
      */
-    private void transformDelResponse( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformDelResponse( LdapMessage twixMessage, Message snickersMessage )
     {
         DeleteResponseImpl snickersDelResponse = ( DeleteResponseImpl ) snickersMessage;
 
@@ -1031,7 +1156,7 @@
      * @param twixMessage The Twix ExtendedResponse to produce
      * @param snickersMessage The incoming Snickers ExtendedResponse
      */
-    private void transformExtendedResponse( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformExtendedResponse( LdapMessage twixMessage, Message snickersMessage )
     {
         ExtendedResponseImpl snickersExtendedResponse = ( ExtendedResponseImpl ) snickersMessage;
         ExtendedResponse extendedResponse = new ExtendedResponse();
@@ -1043,7 +1168,7 @@
         }
         catch ( DecoderException de )
         {
-            log.warn( "The OID " + snickersExtendedResponse.getResponseName() + " is invalid : " + de.getMessage() );
+        	LOG.warn( "The OID " + snickersExtendedResponse.getResponseName() + " is invalid : " + de.getMessage() );
             extendedResponse.setResponseName( null );
         }
 
@@ -1065,7 +1190,7 @@
      * @param twixMessage The Twix ModifyResponse to produce
      * @param snickersMessage The incoming Snickers ModifyResponse
      */
-    private void transformModifyResponse( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformModifyResponse( LdapMessage twixMessage, Message snickersMessage )
     {
         ModifyResponseImpl snickersModifyResponse = ( ModifyResponseImpl ) snickersMessage;
 
@@ -1085,7 +1210,7 @@
      * @param twixMessage The Twix ModifyDNResponse to produce
      * @param snickersMessage The incoming Snickers ModifyDNResponse
      */
-    private void transformModifyDNResponse( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformModifyDNResponse( LdapMessage twixMessage, Message snickersMessage )
     {
         ModifyDnResponseImpl snickersModifyDNResponse = ( ModifyDnResponseImpl ) snickersMessage;
 
@@ -1106,7 +1231,7 @@
      * @param twixMessage The Twix SearchResultDone to produce
      * @param snickersMessage The incoming Snickers SearchResponseDone
      */
-    private void transformSearchResultDone( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformSearchResultDone( LdapMessage twixMessage, Message snickersMessage )
     {
         SearchResponseDoneImpl snickersSearchResponseDone = ( SearchResponseDoneImpl ) snickersMessage;
         SearchResultDone searchResultDone = new SearchResultDone();
@@ -1126,7 +1251,7 @@
      * @param twixMessage The Twix SearchResultEntry to produce
      * @param snickersMessage The incoming Snickers SearchResponseEntry
      */
-    private void transformSearchResultEntry( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformSearchResultEntry( LdapMessage twixMessage, Message snickersMessage )
     {
         SearchResponseEntryImpl snickersSearchResultResponse = ( SearchResponseEntryImpl ) snickersMessage;
         SearchResultEntry searchResultEntry = new SearchResultEntry();
@@ -1150,7 +1275,7 @@
      * @param twixMessage The Twix SearchResultReference to produce
      * @param snickersMessage The incoming Snickers SearchResponseReference
      */
-    private void transformSearchResultReference( LdapMessage twixMessage, Message snickersMessage )
+    public static void transformSearchResultReference( LdapMessage twixMessage, Message snickersMessage )
     {
         SearchResponseReferenceImpl snickersSearchResponseReference = ( SearchResponseReferenceImpl ) snickersMessage;
         SearchResultReference searchResultReference = new SearchResultReference();
@@ -1174,7 +1299,7 @@
                     }
                     catch ( LdapURLEncodingException luee )
                     {
-                        log.warn( "The LdapURL " + url + " is incorrect : " + luee.getMessage() );
+                    	LOG.warn( "The LdapURL " + url + " is incorrect : " + luee.getMessage() );
                     }
                 }
             }
@@ -1191,11 +1316,11 @@
      * @param msg the message to transform
      * @return the msg transformed
      */
-    public Object transform( Message msg )
+    public static Object transform( Message msg )
     {
         if ( IS_DEBUG )
         {
-            log.debug( "Transforming message type " + msg.getType() );
+        	LOG.debug( "Transforming message type " + msg.getType() );
         }
 
         LdapMessage twixMessage = new LdapMessage();
@@ -1258,7 +1383,7 @@
 
         if ( IS_DEBUG )
         {
-            log.debug( "Transformed message : " + twixMessage );
+        	LOG.debug( "Transformed message : " + twixMessage );
         }
 
         return twixMessage;
@@ -1272,7 +1397,7 @@
      * @param twixMessage the Twix message
      * @param msg the Snickers message
      */
-    private void transformControlsTwixToSnickers( LdapMessage twixMessage, Message msg )
+    public static void transformControlsTwixToSnickers( LdapMessage twixMessage, Message msg )
     {
         if ( twixMessage.getControls() == null )
         {
@@ -1281,7 +1406,7 @@
         
         for ( Control control:twixMessage.getControls() )
         {
-            log.debug( "Not decoding response control: {}", control );
+        	LOG.debug( "Not decoding response control: {}", control );
         }
     }
     
@@ -1291,7 +1416,7 @@
      * @param twixMessage The Twix SearchResultReference to produce
      * @param msg The incoming Snickers SearchResponseReference
      */
-    private void transformControls( LdapMessage twixMessage, Message msg )
+    public static void transformControls( LdapMessage twixMessage, Message msg )
     {
         for ( javax.naming.ldap.Control control:msg.getControls().values() )
         {

Modified: directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/filter/NotNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/filter/NotNode.java?rev=718293&r1=718292&r2=718293&view=diff
==============================================================================
--- directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/filter/NotNode.java (original)
+++ directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/filter/NotNode.java Mon Nov 17 09:47:29 2008
@@ -32,9 +32,9 @@
 public class NotNode extends BranchNode
 {
     /**
-     * Creates a NotNode using a logical operator and a list of children.
+     * Creates a NotNode using a logical NOT operator and a list of children.
      * 
-     * A Not node should contain only one child
+     * A Not node could contain only one child
      * 
      * @param childList the child nodes under this branch node.
      */
@@ -50,11 +50,27 @@
 
 
     /**
+     * Creates a NotNode using a logical NOT operator and the given child.
+     * 
+     * @param child the child node under this branch node.
+     */
+    public NotNode( ExprNode child )
+    {
+        super( AssertionType.NOT );
+
+        if ( child != null )
+        {
+            addNode( child );
+        }
+    }
+
+
+    /**
      * Creates an empty NotNode
      */
     public NotNode()
     {
-        this( null );
+        this( (ExprNode)null );
     }
 
     /**

Modified: directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java?rev=718293&r1=718292&r2=718293&view=diff
==============================================================================
--- directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java (original)
+++ directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java Mon Nov 17 09:47:29 2008
@@ -117,7 +117,7 @@
      */
     public static boolean isLDIFSafe( String str )
     {
-        if ( str == null )
+    	if ( StringTools.isEmpty( str ) )
         {
             // A null string is LDIF safe
             return true;

Modified: directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java?rev=718293&r1=718292&r2=718293&view=diff
==============================================================================
--- directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java (original)
+++ directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java Mon Nov 17 09:47:29 2008
@@ -26,10 +26,10 @@
 import org.apache.directory.shared.asn1.codec.stateful.DecoderMonitor;
 import org.apache.directory.shared.asn1.codec.stateful.StatefulDecoder;
 import org.apache.directory.shared.ldap.codec.ResponseCarryingException;
+import org.apache.directory.shared.ldap.codec.TwixTransformer;
 import org.apache.directory.shared.ldap.message.spi.BinaryAttributeDetector;
 import org.apache.directory.shared.ldap.message.spi.Provider;
 import org.apache.directory.shared.ldap.message.spi.ProviderDecoder;
-import org.apache.directory.shared.ldap.message.spi.TransformerSpi;
 
 import java.io.InputStream;
 import java.util.Hashtable;
@@ -50,9 +50,6 @@
     /** the ASN.1 provider's decoder */
     private final ProviderDecoder decoder;
 
-    /** the ASN.1 provider's transformer */
-    private final TransformerSpi transformer;
-
     /** the Message decode operation callback */
     private DecoderCallback cb;
 
@@ -71,14 +68,13 @@
         
         this.provider = Provider.getProvider( providerEnv );
         this.decoder = this.provider.getDecoder( binaryAttributeDetector );
-        this.transformer = this.provider.getTransformer();
         this.decoder.setCallback( new DecoderCallback()
         {
             public void decodeOccurred( StatefulDecoder decoder, Object decoded )
             {
                 if ( decoded instanceof Asn1Object )
                 {
-                    cb.decodeOccurred( decoder, transformer.transform( decoded ) );
+                    cb.decodeOccurred( decoder, TwixTransformer.transform( decoded ) );
                 }
                 else
                 {
@@ -130,7 +126,7 @@
         }
 
         // Call on transformer to convert stub based PDU into Message based PDU
-        return transformer.transform( providerEnvelope );
+        return TwixTransformer.transform( providerEnvelope );
     }
 
 

Modified: directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageEncoder.java?rev=718293&r1=718292&r2=718293&view=diff
==============================================================================
--- directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageEncoder.java (original)
+++ directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageEncoder.java Mon Nov 17 09:47:29 2008
@@ -26,10 +26,10 @@
 import org.apache.directory.shared.asn1.codec.EncoderException;
 import org.apache.directory.shared.asn1.codec.stateful.EncoderCallback;
 import org.apache.directory.shared.asn1.codec.stateful.EncoderMonitor;
+import org.apache.directory.shared.ldap.codec.TwixTransformer;
 import org.apache.directory.shared.ldap.message.spi.Provider;
 import org.apache.directory.shared.ldap.message.spi.ProviderEncoder;
 import org.apache.directory.shared.ldap.message.spi.ProviderException;
-import org.apache.directory.shared.ldap.message.spi.TransformerSpi;
 
 
 /**
@@ -47,9 +47,6 @@
     /** the provider's encoder */
     private final ProviderEncoder encoder;
 
-    /** the provider's transformer */
-    private final TransformerSpi transformer;
-
 
     /**
      * Creates a MessageEncoder using default properties for enabling a BER
@@ -61,7 +58,6 @@
     {
         this.provider = Provider.getProvider( Provider.getEnvironment() );
         this.encoder = provider.getEncoder();
-        this.transformer = provider.getTransformer();
     }
 
 
@@ -75,7 +71,7 @@
     public void encodeBlocking( Object lock, OutputStream out, Object obj ) throws ProviderException
     {
         // transform to build provider specific intermediate envelope
-        Object providerEnvelope = transformer.transform( ( Message ) obj );
+        Object providerEnvelope = TwixTransformer.transform( ( Message ) obj );
 
         // now encode provider's intermediate stub into a PDU onto stream
         this.encoder.encodeBlocking( lock, out, providerEnvelope );
@@ -88,7 +84,7 @@
     public ByteBuffer encodeBlocking( Object obj ) throws ProviderException
     {
         // transform to build provider specific intermediate envelope
-        Object providerEnvelope = transformer.transform( ( Message ) obj );
+        Object providerEnvelope = TwixTransformer.transform( ( Message ) obj );
 
         // now encode provider's intermediate stub into PDU in a byte buffer
         return this.encoder.encodeBlocking( providerEnvelope );
@@ -122,7 +118,7 @@
     public void encode( Object obj ) throws EncoderException
     {
         // transform to build provider specific intermediate envelope
-        Object providerEnvelope = transformer.transform( ( Message ) obj );
+        Object providerEnvelope = TwixTransformer.transform( ( Message ) obj );
 
         // now give intermediate envelope to provider's encoder
         this.encoder.encode( providerEnvelope );

Modified: directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/message/spi/Provider.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/message/spi/Provider.java?rev=718293&r1=718292&r2=718293&view=diff
==============================================================================
--- directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/message/spi/Provider.java (original)
+++ directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/message/spi/Provider.java Mon Nov 17 09:47:29 2008
@@ -181,16 +181,6 @@
             throws ProviderException;
 
 
-    /**
-     * Gets the transformer associated with this provider.
-     * 
-     * @return the provider's transformer.
-     * @throws ProviderException
-     *             if the provider or its transformer cannot be found
-     */
-    public abstract TransformerSpi getTransformer() throws ProviderException;
-
-
     // ------------------------------------------------------------------------
     // Factory/Environment Methods
     // ------------------------------------------------------------------------

Added: directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/schema/BooleanNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/schema/BooleanNormalizer.java?rev=718293&view=auto
==============================================================================
--- directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/schema/BooleanNormalizer.java (added)
+++ directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/schema/BooleanNormalizer.java Mon Nov 17 09:47:29 2008
@@ -0,0 +1,61 @@
+/*
+ *  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.schema;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.util.StringTools;
+
+
+/**
+ * 
+ * Normalizer for boolean values.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BooleanNormalizer implements Normalizer
+{
+    private static final long serialVersionUID = 1L;
+
+
+    public Object normalize( Object value ) throws NamingException
+    {
+        if ( value == null )
+        {
+            return null;
+        }
+
+        String strValue;
+
+        if ( value instanceof byte[] )
+        {
+            strValue = StringTools.utf8ToString( ( byte[] ) value );
+        }
+        else
+        {
+            strValue = ( String ) value;
+        }
+
+        return strValue.trim().toUpperCase();
+    }
+
+}

Modified: directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BooleanSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BooleanSyntaxChecker.java?rev=718293&r1=718292&r2=718293&view=diff
==============================================================================
--- directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BooleanSyntaxChecker.java (original)
+++ directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BooleanSyntaxChecker.java Mon Nov 17 09:47:29 2008
@@ -90,6 +90,6 @@
             return false;
         }
         
-        return ( ( "TRUE".equals( strValue ) ) || ( "FALSE".equals( strValue ) ) );
+        return ( ( "TRUE".equalsIgnoreCase( strValue ) ) || ( "FALSE".equalsIgnoreCase( strValue ) ) );
     }
 }

Modified: directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/util/DateUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/util/DateUtils.java?rev=718293&r1=718292&r2=718293&view=diff
==============================================================================
--- directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/util/DateUtils.java (original)
+++ directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/util/DateUtils.java Mon Nov 17 09:47:29 2008
@@ -169,4 +169,33 @@
             return dateFormat.format( date );
         }
     }
+
+
+    /**
+     * 
+     * @see #getGeneralizedTime()
+     *
+     * @param date the date to be converted to generalized time string
+     * @return given date in the generalized time string format
+     */
+    public static String getGeneralizedTime( Date date )
+    {
+        synchronized ( dateFormat )
+        {
+            return dateFormat.format( date );
+        }
+    }
+
+
+    /**
+     * 
+     * @see #getGeneralizedTime()
+     *
+     * @param time the time value to be converted to generalized time string
+     * @return given time in generalized time string format
+     */
+    public static String getGeneralizedTime( long time )
+    {
+        return getGeneralizedTime( new Date( time ) );
+    }
 }

Modified: directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java?rev=718293&r1=718292&r2=718293&view=diff
==============================================================================
--- directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java (original)
+++ directory/shared/branches/shared-mina2/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java Mon Nov 17 09:47:29 2008
@@ -803,20 +803,20 @@
 
         if ( initialPattern != null )
         {
-            buf.append( '^' ).append( initialPattern );
+        	buf.append( '^' ).append( Pattern.quote( initialPattern ) );
         }
 
         if ( anyPattern != null )
         {
             for ( int i = 0; i < anyPattern.length; i++ )
             {
-                buf.append( ".*" ).append( anyPattern[i] );
+            	buf.append( ".*" ).append( Pattern.quote( anyPattern[i] ) );
             }
         }
 
         if ( finalPattern != null )
         {
-            buf.append( ".*" ).append( finalPattern );
+        	buf.append( ".*" ).append( Pattern.quote( finalPattern ) );
         }
         else
         {

Modified: directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java?rev=718293&r1=718292&r2=718293&view=diff
==============================================================================
--- directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java (original)
+++ directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java Mon Nov 17 09:47:29 2008
@@ -72,6 +72,25 @@
         return entry;
     }
 
+    /**
+     * Tests the method IsLdifSafe with a null String
+     */
+    @Test
+    public void testIsLdifNullString()
+    {
+        assertTrue( LdifUtils.isLDIFSafe( null ) );
+    }
+    
+
+    /**
+     * Tests the method IsLdifSafe with an empty String
+     */
+    @Test
+    public void testIsLdifEmptyString()
+    {
+        assertTrue( LdifUtils.isLDIFSafe( "" ) );
+    }
+
     
     /**
      * Tests the method IsLdifSafe with a String starting with the
@@ -85,6 +104,7 @@
         assertFalse( LdifUtils.isLDIFSafe( c + testString ) );
     }
     
+    
     /**
      * Tests the method IsLdifSafe with a String starting with the
      * char LF (ASCII code 10)

Added: directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/schema/BooleanNormalizerTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/schema/BooleanNormalizerTest.java?rev=718293&view=auto
==============================================================================
--- directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/schema/BooleanNormalizerTest.java (added)
+++ directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/schema/BooleanNormalizerTest.java Mon Nov 17 09:47:29 2008
@@ -0,0 +1,69 @@
+/*
+ *  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.schema;
+
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+
+/**
+ * 
+ * BooleanNormalizerTest.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BooleanNormalizerTest
+{
+    BooleanNormalizer normalizer = new BooleanNormalizer();
+
+
+    @Test
+    public void testNormalizeNullValue() throws Exception
+    {
+        assertNull( normalizer.normalize( null ) );
+    }
+
+
+    @Test
+    public void testNormalizeNonNullValue() throws Exception
+    {
+        assertEquals( "TRUE", normalizer.normalize( "true" ) );
+        assertEquals( "ABC", normalizer.normalize( "aBc" ) );
+        assertEquals( "FALSE", normalizer.normalize( "falsE" ) );
+    }
+
+
+    @Test
+    public void testNormalizeValueWithSpaces() throws Exception
+    {
+        assertEquals( "TRUE", normalizer.normalize( " tRuE " ) );
+    }
+
+
+    @Test
+    public void testNormalizeByteValue() throws Exception
+    {
+        assertEquals( "TRUE", normalizer.normalize( "tRuE".getBytes() ) );
+        assertEquals( "TRUE", normalizer.normalize( "true".getBytes() ) );
+    }
+
+}

Modified: directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/BooleanSyntaxCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/BooleanSyntaxCheckerTest.java?rev=718293&r1=718292&r2=718293&view=diff
==============================================================================
--- directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/BooleanSyntaxCheckerTest.java (original)
+++ directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/BooleanSyntaxCheckerTest.java Mon Nov 17 09:47:29 2008
@@ -55,16 +55,23 @@
     }
     
     
-    public void testWrongCase()
+    public void testWrongValue()
     {
-        assertFalse( checker.isValidSyntax( "fAlSe" ) );
-        assertFalse( checker.isValidSyntax( "tRue" ) );
-        assertFalse( checker.isValidSyntax( "false" ) );
         assertFalse( checker.isValidSyntax( "abc" ) );
+        assertFalse( checker.isValidSyntax( "123" ) );
     }
     
     
-    public void testCorrectCase()
+    public void testMixedCase()
+    {
+        assertTrue( checker.isValidSyntax( "fAlSe" ) );
+        assertTrue( checker.isValidSyntax( "tRue" ) );
+        assertTrue( checker.isValidSyntax( "false" ) );
+        assertTrue( checker.isValidSyntax( "true" ) );
+    }
+        
+        
+    public void testUpperCase()
     {
         assertTrue( checker.isValidSyntax( "FALSE" ) );
         assertTrue( checker.isValidSyntax( "TRUE" ) );

Modified: directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java?rev=718293&r1=718292&r2=718293&view=diff
==============================================================================
--- directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java (original)
+++ directory/shared/branches/shared-mina2/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java Mon Nov 17 09:47:29 2008
@@ -289,6 +289,29 @@
     }
 
 
+    /**
+     * Tests StringTools.getRegex() with some LDAP filter special characters.
+     */
+    public void testGetRegexpWithLdapFilterSpecialChars() throws Exception
+    {
+        Pattern[] patterns = new Pattern[]
+            { StringTools.getRegex( null, new String[]
+                { "(" }, null ), StringTools.getRegex( null, new String[]
+                { ")" }, null ), StringTools.getRegex( null, new String[]
+                { "*" }, null ), StringTools.getRegex( null, new String[]
+                { "\\" }, null ), };
+
+        for ( Pattern pattern : patterns )
+        {
+            boolean b1 = pattern.matcher( "a(b*c\\d)e" ).matches();
+            assertTrue( b1 );
+
+            boolean b3 = pattern.matcher( "Test test" ).matches();
+            assertFalse( b3 );
+        }
+    }
+
+
     public void testDeepTrim()
     {
         assertEquals( "", StringTools.deepTrim( " ", false ) );



Mime
View raw message