directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1068439 - in /directory/shared/branches/m1: dsml-parser/ integ/ integ/src/test/java/org/apache/directory/shared/ldap/codec/api/ ldap-codec/ ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/ ldap-codec/src/main/java/org/apach...
Date Tue, 08 Feb 2011 15:19:10 GMT
Author: akarasulu
Date: Tue Feb  8 15:19:09 2011
New Revision: 1068439

URL: http://svn.apache.org/viewvc?rev=1068439&view=rev
Log:
ironing out some of the wrinkles in integration tests

Modified:
    directory/shared/branches/m1/dsml-parser/pom.xml
    directory/shared/branches/m1/integ/pom.xml
    directory/shared/branches/m1/integ/src/test/java/org/apache/directory/shared/ldap/codec/api/DefaultLdapCodecServiceTest.java
    directory/shared/branches/m1/ldap-codec/pom.xml
    directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
    directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/DefaultLdapCodecService.java
    directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/LdapCodecService.java
    directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/osgi/CodecHostActivator.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapResultTest.java
    directory/shared/branches/m1/ldap-extras/codec/pom.xml
    directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/PasswordPolicyDecorator.java

Modified: directory/shared/branches/m1/dsml-parser/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/pom.xml?rev=1068439&r1=1068438&r2=1068439&view=diff
==============================================================================
--- directory/shared/branches/m1/dsml-parser/pom.xml (original)
+++ directory/shared/branches/m1/dsml-parser/pom.xml Tue Feb  8 15:19:09 2011
@@ -71,6 +71,24 @@
   <build>
     <plugins>
       <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <groupId>org.apache.maven.plugins</groupId>
+        <configuration>
+          <systemPropertyVariables>
+            <workingDirectory>${basedir}/target</workingDirectory>
+            <felix.cache.rootdir>
+              ${project.build.directory}
+            </felix.cache.rootdir>
+            <felix.cache.locking>
+              false
+            </felix.cache.locking>
+            <org.osgi.framework.storage>
+              ${project.build.directory}/osgi-cache
+            </org.osgi.framework.storage>
+          </systemPropertyVariables>
+        </configuration>
+      </plugin>
+      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
         <configuration>

Modified: directory/shared/branches/m1/integ/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/integ/pom.xml?rev=1068439&r1=1068438&r2=1068439&view=diff
==============================================================================
--- directory/shared/branches/m1/integ/pom.xml (original)
+++ directory/shared/branches/m1/integ/pom.xml Tue Feb  8 15:19:09 2011
@@ -92,11 +92,21 @@
         <configuration>
           <systemPropertyVariables>
             <workingDirectory>${basedir}/target</workingDirectory>
-            <property>
-               <!-- org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService.pluginDirectory
-->
-              <name>org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService.pluginDirectory</name>
-              <value>${pluginDirectory}/foo</value>
-            </property> 
+            <felix.cache.rootdir>
+              ${project.build.directory}
+            </felix.cache.rootdir>
+            <felix.cache.locking>
+              true
+            </felix.cache.locking>
+            <org.osgi.framework.storage.clean>
+              onFirstInit
+            </org.osgi.framework.storage.clean>
+            <org.osgi.framework.storage>
+              ${project.build.directory}/osgi-cache
+            </org.osgi.framework.storage>
+            <org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService.pluginDirectory>
+              ${pluginDirectory}
+            </org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService.pluginDirectory>
           </systemPropertyVariables>
         </configuration>
       </plugin>
@@ -107,7 +117,7 @@
         <executions>
           <execution>
             <id>copy</id>
-            <phase>package</phase>
+            <phase>compile</phase>
             <goals>
               <goal>copy</goal>
             </goals>

Modified: directory/shared/branches/m1/integ/src/test/java/org/apache/directory/shared/ldap/codec/api/DefaultLdapCodecServiceTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/integ/src/test/java/org/apache/directory/shared/ldap/codec/api/DefaultLdapCodecServiceTest.java?rev=1068439&r1=1068438&r2=1068439&view=diff
==============================================================================
--- directory/shared/branches/m1/integ/src/test/java/org/apache/directory/shared/ldap/codec/api/DefaultLdapCodecServiceTest.java
(original)
+++ directory/shared/branches/m1/integ/src/test/java/org/apache/directory/shared/ldap/codec/api/DefaultLdapCodecServiceTest.java
Tue Feb  8 15:19:09 2011
@@ -21,8 +21,10 @@ package org.apache.directory.shared.ldap
 
 
 import static org.junit.Assert.*; 
+
 import java.util.Iterator;
 
+import org.apache.directory.shared.ldap.extras.controls.PasswordPolicy;
 import org.apache.directory.shared.ldap.model.message.Control;
 import org.junit.Test;
 
@@ -33,7 +35,7 @@ import org.junit.Test;
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class DefaultLdapCodecServiceTest
-{
+{   
     /**
      * Test method for {@link DefaultLdapCodecService#DefaultLdapCodecService()}.
      */
@@ -42,14 +44,17 @@ public class DefaultLdapCodecServiceTest
     {
         System.out.println( "Property name = " + DefaultLdapCodecService.PLUGIN_DIRECTORY_PROPERTY
);
         System.out.println( "Property value = " + System.getProperty( DefaultLdapCodecService.PLUGIN_DIRECTORY_PROPERTY
) );
+        
         DefaultLdapCodecService codec = new DefaultLdapCodecService();
         Iterator<String> oids = codec.registeredControls();
         while ( oids.hasNext() )
         {
             System.out.println( "Registered OID = " + oids.next() );
         }
+        
+        assertTrue( codec.isControlRegistered( PasswordPolicy.OID ) );
 
-        CodecControl<? extends Control> control = codec.newControl( "2.16.840.1.113730.3.4.3"
);
+        CodecControl<? extends Control> control = codec.newControl( PasswordPolicy.OID
);
         assertNotNull( control );
         System.out.println( control );
         assertNotNull( codec );

Modified: directory/shared/branches/m1/ldap-codec/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/pom.xml?rev=1068439&r1=1068438&r2=1068439&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/pom.xml (original)
+++ directory/shared/branches/m1/ldap-codec/pom.xml Tue Feb  8 15:19:09 2011
@@ -92,40 +92,21 @@
   <build>
     <plugins>
       <plugin>
-        <artifactId>maven-antrun-plugin</artifactId>
-        <executions>
-          <execution>
-            <phase>generate-sources</phase>
-            <configuration />
-            <goals>
-              <goal>run</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>antlr-maven-plugin</artifactId>
-        <configuration>
-          <grammars>*.g</grammars>
-        </configuration>
-        <executions>
-           <execution>
-              <goals>
-                 <goal>generate</goal>
-              </goals>
-           </execution>
-        </executions>
-      </plugin>
-
-      <plugin>
         <artifactId>maven-surefire-plugin</artifactId>
+        <groupId>org.apache.maven.plugins</groupId>
         <configuration>
-          <excludes>
-            <exclude>**/Abstract*</exclude>
-            <exclude>**/*RegressionTest*</exclude>
-          </excludes>
+          <systemPropertyVariables>
+            <workingDirectory>${basedir}/target</workingDirectory>
+            <felix.cache.rootdir>
+              ${project.build.directory}
+            </felix.cache.rootdir>
+            <felix.cache.locking>
+              false
+            </felix.cache.locking>
+            <org.osgi.framework.storage>
+              ${project.build.directory}/osgi-cache
+            </org.osgi.framework.storage>
+          </systemPropertyVariables>
         </configuration>
       </plugin>
 

Modified: directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java?rev=1068439&r1=1068438&r2=1068439&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
(original)
+++ directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
Tue Feb  8 15:19:09 2011
@@ -158,11 +158,13 @@ public final class LdapMessageGrammar<E>
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. LdapMessageGrammar is a singleton */
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     private static Grammar<LdapMessageContainer<MessageDecorator<? extends Message>>>
instance = new LdapMessageGrammar();
 
     /**
      * Creates a new LdapMessageGrammar object.
      */
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     private LdapMessageGrammar()
     {
 
@@ -6372,13 +6374,14 @@ public final class LdapMessageGrammar<E>
      *
      * @return An instance on the LdapMessage Grammar
      */
+    @SuppressWarnings("rawtypes")
     public static Grammar getInstance()
     {
         return instance;
     }
 
     /**
-     * Build an AttributeType froma byte array. An AttributeType contains
+     * Build an AttributeType from a byte array. An AttributeType contains
      * only chars within [0-9][a-z][A-Z][-.].
      *
      * @param bytes The bytes containing the AttributeType

Modified: directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/DefaultLdapCodecService.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/DefaultLdapCodecService.java?rev=1068439&r1=1068438&r2=1068439&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/DefaultLdapCodecService.java
(original)
+++ directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/DefaultLdapCodecService.java
Tue Feb  8 15:19:09 2011
@@ -28,6 +28,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 
 import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.EncoderException;
@@ -73,6 +74,26 @@ public class DefaultLdapCodecService imp
      */
     private static final String[] SYSTEM_PACKAGES =
     {
+        "org.slf4j; version=1.6.0",
+        "org.apache.directory.shared.i18n; version=1.0.0",
+        "org.apache.directory.shared.util; version=1.0.0",
+        "org.apache.directory.shared.util.exception; version=1.0.0",
+        "org.apache.directory.shared.asn1; version=1.0.0",
+        "org.apache.directory.shared.asn1.util; version=1.0.0",
+        "org.apache.directory.shared.asn1.ber; version=1.0.0",
+        "org.apache.directory.shared.asn1.ber.tlv; version=1.0.0",
+        "org.apache.directory.shared.asn1.ber.grammar; version=1.0.0",
+        "org.apache.directory.shared.asn1.actions; version=1.0.0",
+        "org.apache.directory.shared.ldap.asn1.ber; version=1.0.0",
+        "org.apache.directory.shared.ldap.model; version=1.0.0",
+        "org.apache.directory.shared.ldap.model.exception; version=1.0.0",
+        "org.apache.directory.shared.ldap.model.filter; version=1.0.0",
+        "org.apache.directory.shared.ldap.model.name; version=1.0.0",
+        "org.apache.directory.shared.ldap.model.entry; version=1.0.0",
+        "org.apache.directory.shared.ldap.model.schema; version=1.0.0",
+        "org.apache.directory.shared.ldap.model.message; version=1.0.0",
+        "org.apache.directory.shared.ldap.model.message.controls; version=1.0.0",
+        "org.apache.directory.shared.ldap.codec.controls; version=1.0.0",
         "org.apache.directory.shared.ldap.codec.api; version=1.0.0"
     };
  
@@ -165,7 +186,7 @@ public class DefaultLdapCodecService imp
         do
         {
             // add comma if we're not at start and have more left
-            if ( ii > 0 && ii < SYSTEM_PACKAGES.length - 1 )
+            if ( ii > 0 && ii < SYSTEM_PACKAGES.length )
             {
                 sb.append( ',' );
             }
@@ -194,10 +215,26 @@ public class DefaultLdapCodecService imp
         config.put( FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, activators );
         config.put( FelixConstants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, getSystemPackages() );
         
-        // @TODO - this must be overridden by tests to be false in surefire configs
-        // @TODO - remove this and make it a property on this class which is true 
-        //         by default unless overridden by surefire's configuration.
-        config.put( "felix.cache.locking", false );
+        Properties props = System.getProperties();
+        if ( props.getProperty( FelixConstants.FRAMEWORK_STORAGE ) != null )
+        {
+            config.put( FelixConstants.FRAMEWORK_STORAGE, props.getProperty( FelixConstants.FRAMEWORK_STORAGE
) );
+        }
+
+        if ( props.getProperty( FelixConstants.FRAMEWORK_STORAGE_CLEAN ) != null )
+        {
+            config.put( FelixConstants.FRAMEWORK_STORAGE_CLEAN, props.getProperty( FelixConstants.FRAMEWORK_STORAGE_CLEAN
) );
+        }
+
+        if ( props.getProperty( "felix.cache.rootdir" ) != null )
+        {
+            config.put( "felix.cache.rootdir", props.getProperty( "felix.cache.rootdir" )
);
+        }
+
+        if ( props.getProperty( "felix.cache.locking" ) != null )
+        {
+            config.put( "felix.cache.locking", props.getProperty( "felix.cache.locking" )
);
+        }
         
         // instantiate and start up felix
         felix = new Felix( config );
@@ -290,6 +327,15 @@ public class DefaultLdapCodecService imp
         return Collections.unmodifiableSet( controlFactories.keySet() ).iterator();
     }
     
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isControlRegistered( String oid )
+    {
+        return controlFactories.containsKey( oid );
+    }
+    
 
     /**
      * {@inheritDoc}

Modified: directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/LdapCodecService.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/LdapCodecService.java?rev=1068439&r1=1068438&r2=1068439&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/LdapCodecService.java
(original)
+++ directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/LdapCodecService.java
Tue Feb  8 15:19:09 2011
@@ -46,6 +46,14 @@ public interface LdapCodecService
     
     
     /**
+     * Checks if a control has been registered.
+     * 
+     * @return The OID of the control to check for registration
+     */
+    boolean isControlRegistered( String oid );
+    
+    
+    /**
      * Returns an Iterator over the OID Strings of registered extended 
      * requests.
      *

Modified: directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/osgi/CodecHostActivator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/osgi/CodecHostActivator.java?rev=1068439&r1=1068438&r2=1068439&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/osgi/CodecHostActivator.java
(original)
+++ directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/osgi/CodecHostActivator.java
Tue Feb  8 15:19:09 2011
@@ -75,7 +75,8 @@ public class CodecHostActivator implemen
             
             for ( File file : files )
             {
-                bundleContext.installBundle( file.toURI().toURL().toExternalForm() );
+                Bundle bundle = bundleContext.installBundle( file.toURI().toURL().toExternalForm()
);
+                bundle.start();
             }
         }
     }

Modified: directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapResultTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapResultTest.java?rev=1068439&r1=1068438&r2=1068439&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapResultTest.java
(original)
+++ directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapResultTest.java
Tue Feb  8 15:19:09 2011
@@ -30,12 +30,12 @@ import java.util.Collection;
 
 import com.mycila.junit.concurrent.Concurrency;
 import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.EncoderException;
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService;
-import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.codec.decorators.AddResponseDecorator;
 import org.apache.directory.shared.ldap.codec.decorators.MessageDecorator;
 import org.apache.directory.shared.ldap.model.message.AddResponse;
@@ -43,6 +43,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.Referral;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.util.Strings;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -58,10 +60,25 @@ import org.junit.runner.RunWith;
 public class LdapResultTest
 {
     /** The encoder instance */
-    LdapEncoder encoder = new LdapEncoder();
+    private static LdapEncoder encoder = new LdapEncoder();
+    
+    private static DefaultLdapCodecService codec = new DefaultLdapCodecService();
+    
+    
+    @BeforeClass
+    public static void setupLdapCodecService()
+    {
+        codec = new DefaultLdapCodecService();
+    }
+    
+    
+    @AfterClass
+    public static void tearDownLdapCodecService()
+    {
+        codec.shutdown();
+        codec = null;
+    }
     
-    LdapCodecService codec = new DefaultLdapCodecService();
-
 
     // ~ Methods
     // ------------------------------------------------------------------------------------

Modified: directory/shared/branches/m1/ldap-extras/codec/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-extras/codec/pom.xml?rev=1068439&r1=1068438&r2=1068439&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-extras/codec/pom.xml (original)
+++ directory/shared/branches/m1/ldap-extras/codec/pom.xml Tue Feb  8 15:19:09 2011
@@ -74,6 +74,25 @@
       </plugin>
 
       <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <groupId>org.apache.maven.plugins</groupId>
+        <configuration>
+          <systemPropertyVariables>
+            <workingDirectory>${basedir}/target</workingDirectory>
+            <felix.cache.rootdir>
+              ${project.build.directory}
+            </felix.cache.rootdir>
+            <felix.cache.locking>
+              false
+            </felix.cache.locking>
+            <org.osgi.framework.storage>
+              ${project.build.directory}/osgi-cache
+            </org.osgi.framework.storage>
+          </systemPropertyVariables>
+        </configuration>
+      </plugin>
+
+      <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
         <inherited>true</inherited>

Modified: directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/PasswordPolicyDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/PasswordPolicyDecorator.java?rev=1068439&r1=1068438&r2=1068439&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/PasswordPolicyDecorator.java
(original)
+++ directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/PasswordPolicyDecorator.java
Tue Feb  8 15:19:09 2011
@@ -195,16 +195,16 @@ public class PasswordPolicyDecorator ext
         sb.append( "  PasswordPolicyResponse control :\n" );
         sb.append( "   oid          : '" ).append( getOid() ).append( '\n' );
         
-        if ( getResponse().getTimeBeforeExpiration() >= 0 )
+        if ( hasResponse() && getResponse().getTimeBeforeExpiration() >= 0 )
         {
             sb.append( "   timeBeforeExpiration          : '" ).append( getResponse().getTimeBeforeExpiration()
).append( '\n' );
         }
-        else if ( getResponse().getGraceAuthNsRemaining() >= 0 )
+        else if ( hasResponse() && getResponse().getGraceAuthNsRemaining() >=
0 )
         {
             sb.append( "   graceAuthNsRemaining          : '" ).append( getResponse().getGraceAuthNsRemaining()
).append( '\n' );
         }
 
-        if ( getResponse().getPasswordPolicyError() != null )
+        if ( hasResponse() && getResponse().getPasswordPolicyError() != null )
         {
             sb.append( "   ppolicyError          : '" ).append( getResponse().getPasswordPolicyError().toString()
).append( '\n' );
         }



Mime
View raw message