directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject [directory-server] branch master updated: Formatting
Date Sat, 25 Jul 2020 15:13:22 GMT
This is an automated email from the ASF dual-hosted git repository.

seelmann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git


The following commit(s) were added to refs/heads/master by this push:
     new 857b4ae  Formatting
857b4ae is described below

commit 857b4ae23e1d381b4db3377782a5757552334710
Author: Stefan Seelmann <mail@stefan-seelmann.de>
AuthorDate: Sat Jul 25 17:12:45 2020 +0200

    Formatting
---
 .../server/core/operations/move/MoveIT.java        |  30 ++--
 .../operations/moveAndRename/MoveAndRenameIT.java  |  57 ++++---
 .../server/core/operations/rename/RenameIT.java    | 106 ++++++------
 .../server/core/DefaultDirectoryServiceTest.java   |   2 +-
 .../apache/directory/server/UberJarMainTest.java   | 180 ++++++++++-----------
 5 files changed, 180 insertions(+), 195 deletions(-)

diff --git a/core-integ/src/test/java/org/apache/directory/server/core/operations/move/MoveIT.java
b/core-integ/src/test/java/org/apache/directory/server/core/operations/move/MoveIT.java
index 13f75d4..93a72e2 100644
--- a/core-integ/src/test/java/org/apache/directory/server/core/operations/move/MoveIT.java
+++ b/core-integ/src/test/java/org/apache/directory/server/core/operations/move/MoveIT.java
@@ -86,7 +86,7 @@ public class MoveIT extends AbstractLdapTestUnit
 
         Dn dn = new Dn( oldDn );
         Entry entry = new DefaultEntry( getService().getSchemaManager(), dn,
-            "ObjectClass: top", 
+            "ObjectClass: top",
             "ObjectClass: person",
             "sn: TEST",
             "cn: test" );
@@ -100,7 +100,7 @@ public class MoveIT extends AbstractLdapTestUnit
 
         assertNotNull( connection.lookup( newDn ) );
         assertNull( connection.lookup( oldDn ) );
-        
+
         connection.close();
     }
 
@@ -115,29 +115,29 @@ public class MoveIT extends AbstractLdapTestUnit
         LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
 
         Entry test1 = new DefaultEntry( getService().getSchemaManager(), "cn=test1,ou=system",
-            "ObjectClass: top", 
+            "ObjectClass: top",
             "ObjectClass: person",
             "sn: Test1",
             "cn: tes1t" );
 
         Entry childTest1 = new DefaultEntry( getService().getSchemaManager(), "cn=childTest1,cn=test1,ou=system",
-            "ObjectClass: top", 
+            "ObjectClass: top",
             "ObjectClass: person",
             "sn: child test1",
             "cn: childTest1" );
 
         Entry test2 = new DefaultEntry( getService().getSchemaManager(), "cn=test2,ou=system",
-            "ObjectClass: top", 
+            "ObjectClass: top",
             "ObjectClass: person",
             "sn: Test2",
             "cn: test2" );
 
         Entry childTest2 = new DefaultEntry( getService().getSchemaManager(), "cn=childTest2,cn=test2,ou=system",
-            "ObjectClass: top", 
+            "ObjectClass: top",
             "ObjectClass: person",
             "sn: child test2",
             "cn: childTest2" );
-        
+
         connection.add( test1 );
         connection.add( test2 );
         connection.add( childTest1 );
@@ -156,11 +156,11 @@ public class MoveIT extends AbstractLdapTestUnit
         assertNotNull( connection.lookup( "cn=childTest2,cn=test2,ou=system" ) );
         assertNotNull( connection.lookup( "cn=test1,cn=test2,ou=system" ) );
         assertNotNull( connection.lookup( "cn=childTest1,cn=test1,cn=test2,ou=system" ) );
-        
+
         connection.close();
     }
-    
-    
+
+
     /**
      * Test a move operation to a non existing parent:
      * cn=test,ou=system will be moved to cn=test,ou=users,ou=system
@@ -176,7 +176,7 @@ public class MoveIT extends AbstractLdapTestUnit
 
         Dn dn = new Dn( oldDn );
         Entry entry = new DefaultEntry( getService().getSchemaManager(), dn,
-            "ObjectClass: top", 
+            "ObjectClass: top",
             "ObjectClass: person",
             "sn: TEST",
             "cn: test" );
@@ -198,7 +198,7 @@ public class MoveIT extends AbstractLdapTestUnit
 
         assertNull( connection.lookup( newDn ) );
         assertNotNull( connection.lookup( oldDn ) );
-        
+
         connection.close();
     }
 
@@ -219,7 +219,7 @@ public class MoveIT extends AbstractLdapTestUnit
 
         Dn dn = new Dn( oldDn );
         Entry entry = new DefaultEntry( getService().getSchemaManager(), dn,
-            "ObjectClass: top", 
+            "ObjectClass: top",
             "ObjectClass: person",
             "sn: TEST",
             "cn: test" );
@@ -228,7 +228,7 @@ public class MoveIT extends AbstractLdapTestUnit
 
         Dn targetDn = new Dn( targetDnStr );
         Entry target = new DefaultEntry( getService().getSchemaManager(), targetDn,
-            "ObjectClass: top", 
+            "ObjectClass: top",
             "ObjectClass: person",
             "sn: TEST",
             "cn: test" );
@@ -247,7 +247,7 @@ public class MoveIT extends AbstractLdapTestUnit
             assertNotNull( connection.lookup( newDn ) );
             assertNotNull( connection.lookup( oldDn ) );
         }
-        
+
         connection.close();
     }
 }
diff --git a/core-integ/src/test/java/org/apache/directory/server/core/operations/moveAndRename/MoveAndRenameIT.java
b/core-integ/src/test/java/org/apache/directory/server/core/operations/moveAndRename/MoveAndRenameIT.java
index 2af0261..0900b7e 100644
--- a/core-integ/src/test/java/org/apache/directory/server/core/operations/moveAndRename/MoveAndRenameIT.java
+++ b/core-integ/src/test/java/org/apache/directory/server/core/operations/moveAndRename/MoveAndRenameIT.java
@@ -134,25 +134,25 @@ public class MoveAndRenameIT extends AbstractLdapTestUnit
         Entry oldCommon = connection.lookup( "ou=people,ou=system", "*", "+" );
         Entry oldSuperior = connection.lookup( "ou=committers,ou=Apache,ou=people,ou=system",
"*", "+" );
         Entry newSuperior = connection.lookup( "dc=domain,ou=system", "*", "+" );
-        
+
         // Check the old common
         Attribute nbSubordinate = oldCommon.get( "nbSubordinates" );
         Attribute nbChildren = oldCommon.get( "nbChildren" );
-        
+
         assertEquals( "5", nbSubordinate.getString() );
         assertEquals( "1", nbChildren.getString() );
 
         // The old superior
         nbSubordinate = oldSuperior.get( "nbSubordinates" );
         nbChildren = oldSuperior.get( "nbChildren" );
-        
+
         assertEquals( "2", nbSubordinate.getString() );
         assertEquals( "2", nbChildren.getString() );
 
         // The new superior
         nbSubordinate = newSuperior.get( "nbSubordinates" );
         nbChildren = newSuperior.get( "nbChildren" );
-        
+
         assertEquals( "0", nbSubordinate.getString() );
         assertEquals( "0", nbChildren.getString() );
 
@@ -166,41 +166,41 @@ public class MoveAndRenameIT extends AbstractLdapTestUnit
         connection.moveAndRename( oldDn, newDn, true );
 
         assertNull( connection.lookup( oldDn ) );
-        
+
         Entry movedEntry = connection.lookup( newDn, "*", "+" );
         assertNotNull( movedEntry );
         assertTrue( movedEntry.contains( "cn", "emmanuel" ) );
         assertFalse( movedEntry.contains( "cn", "elecharny" ) );
-        
+
         // Get the nbSubordinates before the move
         oldCommon = connection.lookup( "ou=people,ou=system", "*", "+" );
         oldSuperior = connection.lookup( "ou=committers,ou=Apache,ou=people,ou=system", "*",
"+" );
         newSuperior = connection.lookup( "dc=domain,ou=system", "*", "+" );
-        
+
         // Check the old common
         nbSubordinate = oldCommon.get( "nbSubordinates" );
         nbChildren = oldCommon.get( "nbChildren" );
-        
+
         assertEquals( "4", nbSubordinate.getString() );
         assertEquals( "1", nbChildren.getString() );
 
         // The old superior
         nbSubordinate = oldSuperior.get( "nbSubordinates" );
         nbChildren = oldSuperior.get( "nbChildren" );
-        
+
         assertEquals( "1", nbSubordinate.getString() );
         assertEquals( "1", nbChildren.getString() );
 
         // The new superior
         nbSubordinate = newSuperior.get( "nbSubordinates" );
         nbChildren = newSuperior.get( "nbChildren" );
-        
+
         assertEquals( "1", nbSubordinate.getString() );
         assertEquals( "1", nbChildren.getString() );
         connection.close();
     }
 
-    
+
     /**
      * Test a simple MoveAndRename move operation
      * cn=elecharny,ou=committers,ou=Apache,ou=people,ou=system will be moved to 
@@ -220,25 +220,25 @@ public class MoveAndRenameIT extends AbstractLdapTestUnit
         Entry oldCommon = connection.lookup( "ou=people,ou=system", "*", "+" );
         Entry oldSuperior = connection.lookup( "ou=committers,ou=Apache,ou=people,ou=system",
"*", "+" );
         Entry newSuperior = connection.lookup( "dc=domain,ou=system", "*", "+" );
-        
+
         // Check the old common
         Attribute nbSubordinate = oldCommon.get( "nbSubordinates" );
         Attribute nbChildren = oldCommon.get( "nbChildren" );
-        
+
         assertEquals( "5", nbSubordinate.getString() );
         assertEquals( "1", nbChildren.getString() );
 
         // The old superior
         nbSubordinate = oldSuperior.get( "nbSubordinates" );
         nbChildren = oldSuperior.get( "nbChildren" );
-        
+
         assertEquals( "2", nbSubordinate.getString() );
         assertEquals( "2", nbChildren.getString() );
 
         // The new superior
         nbSubordinate = newSuperior.get( "nbSubordinates" );
         nbChildren = newSuperior.get( "nbChildren" );
-        
+
         assertEquals( "0", nbSubordinate.getString() );
         assertEquals( "0", nbChildren.getString() );
 
@@ -252,42 +252,42 @@ public class MoveAndRenameIT extends AbstractLdapTestUnit
         connection.moveAndRename( oldDn, newDn, false );
 
         assertNull( connection.lookup( oldDn ) );
-        
+
         Entry movedEntry = connection.lookup( newDn, "*", "+" );
         assertNotNull( movedEntry );
         assertTrue( movedEntry.contains( "cn", "emmanuel" ) );
         assertTrue( movedEntry.contains( "cn", "elecharny" ) );
-        
+
         // Get the nbSubordinates before the move
         oldCommon = connection.lookup( "ou=people,ou=system", "*", "+" );
         oldSuperior = connection.lookup( "ou=committers,ou=Apache,ou=people,ou=system", "*",
"+" );
         newSuperior = connection.lookup( "dc=domain,ou=system", "*", "+" );
-        
+
         // Check the old common
         nbSubordinate = oldCommon.get( "nbSubordinates" );
         nbChildren = oldCommon.get( "nbChildren" );
-        
+
         assertEquals( "4", nbSubordinate.getString() );
         assertEquals( "1", nbChildren.getString() );
 
         // The old superior
         nbSubordinate = oldSuperior.get( "nbSubordinates" );
         nbChildren = oldSuperior.get( "nbChildren" );
-        
+
         assertEquals( "1", nbSubordinate.getString() );
         assertEquals( "1", nbChildren.getString() );
 
         // The new superior
         nbSubordinate = newSuperior.get( "nbSubordinates" );
         nbChildren = newSuperior.get( "nbChildren" );
-        
+
         assertEquals( "1", nbSubordinate.getString() );
         assertEquals( "1", nbChildren.getString() );
 
         connection.close();
     }
 
-    
+
     /**
      * Test a simple MoveAndRename move operation
      * ou=Apache,ou=system will be moved to cn=test,ou=users,ou=system
@@ -300,7 +300,6 @@ public class MoveAndRenameIT extends AbstractLdapTestUnit
     public void testMoveAndRenameRdnNotInObjectClass() throws Exception
     {
         LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
-        
 
         String oldDn = "ou=Apache,ou=system";
         String newDn = "uid=test,ou=people,ou=system";
@@ -311,17 +310,17 @@ public class MoveAndRenameIT extends AbstractLdapTestUnit
         connection.moveAndRename( oldDn, newDn );
 
         assertNull( connection.lookup( oldDn ) );
-        
+
         Entry movedEntry = connection.lookup( newDn );
         assertNotNull( movedEntry );
         assertTrue( movedEntry.contains( "cn", "test" ) );
         assertTrue( movedEntry.contains( "cn", "jDoe" ) );
         assertTrue( movedEntry.contains( "ou", "Apache" ) );
-        
+
         connection.close();
     }
-    
-    
+
+
     /**
      * Check that when doing a rename, with a SV RDN, we don't have the previous RDN in the
entry,
      * if the deleteOldrdn flag is set to true
@@ -353,9 +352,9 @@ public class MoveAndRenameIT extends AbstractLdapTestUnit
             "c: FR" );
 
         connection.add( frEntry );
-        
+
         Entry original = connection.lookup( frDn );
-        
+
         assertNotNull( original );
 
         // rename the FR entry to DE entry : should fail as DE entry already exists
diff --git a/core-integ/src/test/java/org/apache/directory/server/core/operations/rename/RenameIT.java
b/core-integ/src/test/java/org/apache/directory/server/core/operations/rename/RenameIT.java
index a93d904..a2c3f88 100644
--- a/core-integ/src/test/java/org/apache/directory/server/core/operations/rename/RenameIT.java
+++ b/core-integ/src/test/java/org/apache/directory/server/core/operations/rename/RenameIT.java
@@ -88,24 +88,24 @@ public class RenameIT extends AbstractLdapTestUnit
             "cn: test1" );
 
         connection.add( entry );
-        
+
         Entry original = connection.lookup( oldDn );
-        
+
         assertNotNull( original );
 
         connection.rename( oldDn, "cn=TEST2" );
-        
+
         Entry renamed = connection.lookup( newDn );
-        
+
         assertNotNull( renamed );
         assertEquals( newDn, renamed.getDn().toString() );
         Attribute attribute = renamed.get( "cn" );
-        
-        assertTrue( attribute.contains(  "test1" ) );
-        assertTrue( attribute.contains(  "test2" ) );
+
+        assertTrue( attribute.contains( "test1" ) );
+        assertTrue( attribute.contains( "test2" ) );
     }
-    
-    
+
+
     /**
      * Check that when doing a rename, with a MV RDN, and teh deleteOldRdn flag set to true,
      * we don't have the previous RDN in the entry.
@@ -128,25 +128,25 @@ public class RenameIT extends AbstractLdapTestUnit
             "cn: test1" );
 
         connection.add( entry );
-        
+
         Entry original = connection.lookup( oldDn );
-        
+
         assertNotNull( original );
 
         connection.rename( oldDn, "cn=test2", true );
-        
+
         assertNull( connection.lookup( oldDn ) );
         Entry renamed = connection.lookup( newDn );
-        
+
         assertNotNull( renamed );
         assertEquals( newDn, renamed.getDn().toString() );
         Attribute attribute = renamed.get( "cn" );
-        
+
         assertFalse( attribute.contains( "test1" ) );
         assertTrue( attribute.contains( "test2" ) );
     }
-    
-    
+
+
     /**
      * Check that when doing a rename, with a MV RDN, and the deleteOldRdn flag set to false,
      * we have the previous RDN in the entry.
@@ -169,25 +169,25 @@ public class RenameIT extends AbstractLdapTestUnit
             "cn: test1" );
 
         connection.add( entry );
-        
+
         Entry original = connection.lookup( oldDn );
-        
+
         assertNotNull( original );
 
         connection.rename( oldDn, "cn=test2", false );
-        
+
         assertNull( connection.lookup( oldDn ) );
         Entry renamed = connection.lookup( newDn );
-        
+
         assertNotNull( renamed );
         assertEquals( newDn, renamed.getDn().toString() );
         Attribute attribute = renamed.get( "cn" );
-        
+
         assertTrue( attribute.contains( "test1" ) );
         assertTrue( attribute.contains( "test2" ) );
     }
-    
-    
+
+
     /**
      * Check that when doing a rename, with a SV RDN, we get an error if the deleteOldRdn
flag is
      * set to false
@@ -209,9 +209,9 @@ public class RenameIT extends AbstractLdapTestUnit
             "c: FR" );
 
         connection.add( entry );
-        
+
         Entry original = connection.lookup( oldDn );
-        
+
         assertNotNull( original );
 
         try
@@ -222,12 +222,12 @@ public class RenameIT extends AbstractLdapTestUnit
         {
             System.out.println( e.getMessage() );
         }
-        
+
         assertNotNull( connection.lookup( oldDn ) );
         assertNull( connection.lookup( newDn ) );
     }
-    
-    
+
+
     /**
      * Check that when doing a rename, with a SV RDN, we don't have the previous RDN in the
entry,
      * if the deleteOldrdn flgg is set to true
@@ -249,25 +249,25 @@ public class RenameIT extends AbstractLdapTestUnit
             "c: FR" );
 
         connection.add( entry );
-        
+
         Entry original = connection.lookup( oldDn );
-        
+
         assertNotNull( original );
 
         connection.rename( oldDn, "c=DE", true );
-        
+
         assertNull( connection.lookup( oldDn ) );
         Entry renamed = connection.lookup( newDn );
-        
+
         assertNotNull( renamed );
         assertEquals( newDn, renamed.getDn().toString() );
         Attribute countryName = renamed.get( "c" );
-        
+
         assertTrue( countryName.contains( "DE" ) );
         assertFalse( countryName.contains( "FR" ) );
     }
-    
-    
+
+
     /**
      * Check that when doing a rename, with a SV RDN, we don't have the previous RDN in the
entry,
      * if the deleteOldrdn flag is set to true
@@ -299,9 +299,9 @@ public class RenameIT extends AbstractLdapTestUnit
             "c: FR" );
 
         connection.add( frEntry );
-        
+
         Entry original = connection.lookup( frDn );
-        
+
         assertNotNull( original );
 
         // rename the FR entry to DE entry : should fail as DE entry already exists
@@ -325,15 +325,15 @@ public class RenameIT extends AbstractLdapTestUnit
             assertFalse( originalDe.get( "c" ).contains( "FR" ) );
         }
     }
-    
-    
+
+
     /**
      * Check that when doing a rename, with a SV RDN, we get an error if the deleteOldRdn
flag is
      * set to false
      * 
      * @throws Exception
      */
-    @Test 
+    @Test
     public void testRenameMvAttributeSVAttributeKeepOldRdn() throws Exception
     {
         LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
@@ -351,26 +351,26 @@ public class RenameIT extends AbstractLdapTestUnit
             "cn: test" );
 
         connection.add( entry );
-        
+
         Entry original = connection.lookup( oldDn );
-        
+
         assertNotNull( original );
 
         connection.rename( oldDn, "displayName=myTest", false );
-        
+
         assertNull( connection.lookup( oldDn ) );
         Entry renamed = connection.lookup( newDn );
-        
+
         assertNotNull( renamed );
         assertEquals( newDn, renamed.getDn().toString() );
         Attribute displayName = renamed.get( "displayName" );
         Attribute cn = renamed.get( "cn" );
-        
+
         assertTrue( displayName.contains( "mytest" ) );
         assertTrue( cn.contains( "test" ) );
     }
-    
-    
+
+
     /**
      * Check that when doing a rename, from a MV attribute to a SV attribute, we don't have

      * the previous RDN in the entry, if the deleteOldrdn flgg is set to true
@@ -393,24 +393,24 @@ public class RenameIT extends AbstractLdapTestUnit
             "ObjectClass: inetOrgPerson",
             "sn: TEST",
             "cn: test",
-            "gn: test");
+            "gn: test" );
 
         connection.add( entry );
-        
+
         Entry original = connection.lookup( oldDn );
-        
+
         assertNotNull( original );
 
         connection.rename( oldDn, "displayName=MyTest", true );
-        
+
         assertNull( connection.lookup( oldDn ) );
         Entry renamed = connection.lookup( newDn );
-        
+
         assertNotNull( renamed );
         assertEquals( newDn, renamed.getDn().toString() );
         Attribute displayName = renamed.get( "displayName" );
         Attribute cn = renamed.get( "gn" );
-        
+
         assertTrue( displayName.contains( "mytest" ) );
         assertNull( cn );
     }
diff --git a/core/src/test/java/org/apache/directory/server/core/DefaultDirectoryServiceTest.java
b/core/src/test/java/org/apache/directory/server/core/DefaultDirectoryServiceTest.java
index df0df02..90c2731 100644
--- a/core/src/test/java/org/apache/directory/server/core/DefaultDirectoryServiceTest.java
+++ b/core/src/test/java/org/apache/directory/server/core/DefaultDirectoryServiceTest.java
@@ -46,7 +46,7 @@ public class DefaultDirectoryServiceTest
         for ( int i = 0; i < service.getInterceptors().size(); i++ )
         {
             Interceptor interceptor = service.getInterceptors().get( i );
-            
+
             if ( existingInterceptorName.equals( interceptor.getName() ) )
             {
                 final Interceptor nextInterceptor = service.getInterceptors().get( i + 1
);
diff --git a/service/src/test/java/org/apache/directory/server/UberJarMainTest.java b/service/src/test/java/org/apache/directory/server/UberJarMainTest.java
index 5d9943c..6de01a5 100644
--- a/service/src/test/java/org/apache/directory/server/UberJarMainTest.java
+++ b/service/src/test/java/org/apache/directory/server/UberJarMainTest.java
@@ -44,8 +44,6 @@ import org.apache.directory.api.ldap.model.entry.ModificationOperation;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.message.SearchScope;
 import org.apache.directory.api.ldap.model.name.Dn;
-import org.apache.directory.api.ldap.model.schema.ObjectClass;
-import org.apache.directory.api.ldap.model.schema.registries.Schema;
 import org.apache.directory.api.util.Network;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.ldap.client.api.LdapConnectionConfig;
@@ -60,7 +58,6 @@ import org.junit.Test;
 import sun.security.x509.X500Name;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
 
 
 /**
@@ -75,10 +72,10 @@ public class UberJarMainTest
 
     /** The instance directory */
     private File instanceDirectory;
-    
+
     /** The UberjarMain */
     private UberjarMain uberjarMain;
-    
+
     private KeyStore keyStore;
 
     @Before
@@ -97,17 +94,16 @@ public class UberJarMainTest
 
         // Creating the UberjarMain
         uberjarMain = new UberjarMain();
-        
+
         try
         {
             // Create a temporary keystore, be sure to remove it when exiting the test
             File keyStoreFile = File.createTempFile( "testStore", "ks" );
             keyStoreFile.deleteOnExit();
 
-            
             keyStore = KeyStore.getInstance( KeyStore.getDefaultType() );
             char[] keyStorePassword = "secret".toCharArray();
-            
+
             try ( InputStream keyStoreData = new FileInputStream( keyStoreFile ) )
             {
                 keyStore.load( null, keyStorePassword );
@@ -116,16 +112,18 @@ public class UberJarMainTest
             // Generate the asymmetric keys, using EC algorithm
             KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance( "EC" );
             KeyPair keyPair = keyPairGenerator.generateKeyPair();
-            
+
             // Generate the subject's name
             @SuppressWarnings("restriction")
             X500Name owner = new X500Name( "apacheds", "directory", "apache", "US" );
 
             // Create the self-signed certificate
-            X509Certificate certificate = CertificateUtil.generateSelfSignedCertificate(
owner, keyPair, 365, "SHA256WithECDSA" );
-            
-            keyStore.setKeyEntry( "apachedsKey", keyPair.getPrivate(), keyStorePassword,
new X509Certificate[] { certificate } );
-            
+            X509Certificate certificate = CertificateUtil.generateSelfSignedCertificate(
owner, keyPair, 365,
+                "SHA256WithECDSA" );
+
+            keyStore.setKeyEntry( "apachedsKey", keyPair.getPrivate(), keyStorePassword,
new X509Certificate[]
+                { certificate } );
+
             try ( FileOutputStream out = new FileOutputStream( keyStoreFile ) )
             {
                 keyStore.store( out, keyStorePassword );
@@ -133,12 +131,12 @@ public class UberJarMainTest
         }
         catch ( Exception e )
         {
-            
+
         }
 
     }
 
-    
+
     @After
     public void delete() throws Exception
     {
@@ -147,8 +145,8 @@ public class UberJarMainTest
             uberjarMain.stop();
         }
     }
-    
-    
+
+
     private LdapConnection createConnection() throws LdapException, UnknownHostException
     {
         LdapConnectionConfig configuration = new LdapConnectionConfig();
@@ -163,11 +161,11 @@ public class UberJarMainTest
 
         // Binding on the connection
         connection.bind();
-        
+
         return connection;
     }
-    
-    
+
+
     private Thread createServer()
     {
         // First start the server to initialize the example partition 
@@ -179,7 +177,7 @@ public class UberJarMainTest
             public void run()
             {
                 LdapConnection connection = null;
-                
+
                 try
                 {
                     // Creating a connection on the created server
@@ -187,7 +185,7 @@ public class UberJarMainTest
 
                     // Looking for the Root DSE entry
                     Entry rootDseEntry = connection.lookup( Dn.ROOT_DSE );
-                    
+
                     if ( rootDseEntry == null )
                     {
                         // This isn't good
@@ -225,36 +223,36 @@ public class UberJarMainTest
      */
     @Test
     public void nisTest() throws Exception
-    {   
+    {
         // First start the server to initialize the example partition 
         uberjarMain.start( instanceDirectory.toString() );
-        
+
         // Creating a separate thread for the connection verification
         Thread connectionVerificationThread = new Thread()
         {
             public void run()
             {
                 LdapConnection connection = null;
-                
+
                 try
                 {
                     // Creating a connection on the created server
                     connection = createConnection();
-                    
-                    connection.modify( "cn=nis,ou=schema", 
-                        new DefaultModification( 
+
+                    connection.modify( "cn=nis,ou=schema",
+                        new DefaultModification(
                             ModificationOperation.REPLACE_ATTRIBUTE, "m-disabled", "FALSE"
) );
-                    
+
                     // Reload the schema in order to be able to deal with NIS elements
                     connection.loadSchema();
-                    
+
                     // Ok, now try to fetch the NIS schema elements
                     Entry nisSchema = connection.lookup( "cn=nis,ou=schema" );
-                    
+
                     assertEquals( "FALSE", nisSchema.get( "m-disabled" ).getString() );
-                    
+
                     Entry posixAccount = connection.lookup( "m-oid=1.3.6.1.1.1.2.0,ou=objectClasses,cn=nis,ou=schema"
);
-                    
+
                     if ( posixAccount == null )
                     {
                         // This isn't good
@@ -298,9 +296,9 @@ public class UberJarMainTest
      */
     @Test
     public void serviceInstanceTest() throws Exception
-    {   
+    {
         Thread connectionVerificationThread = createServer();
-        
+
         // Starting the connection verification thread
         // and waiting for the termination of it
         connectionVerificationThread.start();
@@ -311,15 +309,15 @@ public class UberJarMainTest
         {
             fail();
         }
-        
+
         // Stop the server
         uberjarMain.stop();
 
         // Restart the server
         uberjarMain.start( instanceDirectory.toString() );
-        
+
         LdapConnection connection = null;
-        
+
         try
         {
             // Creating a connection on the created server
@@ -327,18 +325,18 @@ public class UberJarMainTest
 
             // Looking for the Root DSE entry
             Entry rootDseEntry = connection.lookup( Dn.ROOT_DSE );
-            
+
             Entry nisSchema = connection.lookup( "cn=nis,ou=schema" );
-            
+
             System.out.println( "Before nis anabling" );
             System.out.println( nisSchema );
 
             Entry nisObjectClass = connection.lookup( "ou=objectClasses,cn=nis,ou=schema"
);
 
             System.out.println( nisObjectClass );
-            
+
             Entry posixAccount = connection.lookup( "m-oid=1.3.6.1.1.1.2.0,ou=objectClasses,cn=nis,ou=schema"
);
-            
+
             System.out.println( "posixAccount : " + posixAccount );
 
             if ( rootDseEntry == null )
@@ -374,10 +372,10 @@ public class UberJarMainTest
      */
     @Test
     public void repairTest() throws Exception
-    {   
+    {
         // First start the server to initialize the example partition 
         Thread connectionVerificationThread = createServer();
-        
+
         // Starting the connection verification thread
         // and waiting for the termination of it
         connectionVerificationThread.start();
@@ -388,7 +386,7 @@ public class UberJarMainTest
         {
             fail();
         }
-        
+
         // Add a few entries to create a more complex hierarchy
         // We will have :
         // dc=example,dc=com
@@ -405,137 +403,125 @@ public class UberJarMainTest
         //   ou=groups
         //     cn=users
         LdapConnection connection = createConnection();
-        
+
         // First level
-        Entry people = new DefaultEntry( 
+        Entry people = new DefaultEntry(
             "ou=People,dc=example,dc=com",
             "objectClass: organizationalUnit",
             "objectClass: top",
-            "ou: People"
-            );
-        
+            "ou: People" );
+
         connection.add( people );
-        
-        Entry groups = new DefaultEntry( 
+
+        Entry groups = new DefaultEntry(
             "ou=Groups,dc=example,dc=com",
             "objectClass: organizationalUnit",
             "objectClass: top",
-            "ou: Groups"
-            );
-        
+            "ou: Groups" );
+
         connection.add( groups );
-        
+
         // Second level
-        Entry committers  = new DefaultEntry( 
+        Entry committers = new DefaultEntry(
             "ou=Committers,ou=people,dc=example,dc=com",
             "objectClass: organizationalUnit",
             "objectClass: top",
-            "ou: Committers"
-            );
+            "ou: Committers" );
 
         connection.add( committers );
 
-        Entry pmcs  = new DefaultEntry( 
+        Entry pmcs = new DefaultEntry(
             "ou=Pmcs,ou=people,dc=example,dc=com",
             "objectClass: organizationalUnit",
             "objectClass: top",
-            "ou: Pmcs"
-            );
+            "ou: Pmcs" );
 
         connection.add( pmcs );
 
-        Entry users  = new DefaultEntry( 
+        Entry users = new DefaultEntry(
             "ou=Users,ou=people,dc=example,dc=com",
             "objectClass: organizationalUnit",
             "objectClass: top",
-            "ou: Users"
-            );
+            "ou: Users" );
 
         connection.add( users );
 
         // Third level, committers
-        Entry emmanuelCommitter  = new DefaultEntry( 
+        Entry emmanuelCommitter = new DefaultEntry(
             "cn=emmanuel,ou=Committers,ou=people,dc=example,dc=com",
             "objectClass: person",
             "objectClass: top",
             "cn: emmanuel",
-            "sn: Emmanuel Lecharny"
-            );
+            "sn: Emmanuel Lecharny" );
 
         connection.add( emmanuelCommitter );
 
-        Entry kiranCommitter  = new DefaultEntry( 
+        Entry kiranCommitter = new DefaultEntry(
             "cn=kiran,ou=Committers,ou=people,dc=example,dc=com",
             "objectClass: person",
             "objectClass: top",
             "cn: kiran",
-            "sn: Kiran Ayyagari"
-            );
+            "sn: Kiran Ayyagari" );
 
         connection.add( kiranCommitter );
 
-        Entry stefanCommitter  = new DefaultEntry( 
+        Entry stefanCommitter = new DefaultEntry(
             "cn=stefan,ou=Committers,ou=people,dc=example,dc=com",
             "objectClass: person",
             "objectClass: top",
             "cn: stefan",
-            "sn: Stefan Seelmann"
-            );
+            "sn: Stefan Seelmann" );
 
         connection.add( stefanCommitter );
-        
-        Entry radovanCommitter  = new DefaultEntry( 
+
+        Entry radovanCommitter = new DefaultEntry(
             "cn=radovan,ou=Committers,ou=people,dc=example,dc=com",
             "objectClass: person",
             "objectClass: top",
             "cn: radovan",
-            "sn: Radovan Semancik"
-            );
+            "sn: Radovan Semancik" );
 
         connection.add( radovanCommitter );
 
         // Third level, PMCs
-        Entry emmanuelPmc = new DefaultEntry( 
+        Entry emmanuelPmc = new DefaultEntry(
             "cn=emmanuel,ou=Pmcs,ou=people,dc=example,dc=com",
             "objectClass: person",
             "objectClass: top",
             "cn: emmanuel",
-            "sn: Emmanuel Lecharny"
-            );
+            "sn: Emmanuel Lecharny" );
 
         connection.add( emmanuelPmc );
 
-        Entry kiranPmc = new DefaultEntry( 
+        Entry kiranPmc = new DefaultEntry(
             "cn=kiran,ou=Pmcs,ou=people,dc=example,dc=com",
             "objectClass: person",
             "objectClass: top",
             "cn: kiran",
-            "sn: Kiran Ayyagari"
-            );
+            "sn: Kiran Ayyagari" );
 
         connection.add( kiranPmc );
 
-        Entry stefanPmc = new DefaultEntry( 
+        Entry stefanPmc = new DefaultEntry(
             "cn=stefan,ou=Pmcs,ou=people,dc=example,dc=com",
             "objectClass: person",
             "objectClass: top",
             "cn: stefan",
-            "sn: Stefan Seelmann"
-            );
+            "sn: Stefan Seelmann" );
 
         connection.add( stefanPmc );
-        
+
         // Now, check that we have 13 entries
         int entryCount = 0;
-        
-        EntryCursor cursor = connection.search( "dc=example, dc=com","(ObjectClass=*)", SearchScope.SUBTREE,
"*" );
-        
+
+        EntryCursor cursor = connection.search( "dc=example, dc=com", "(ObjectClass=*)",
SearchScope.SUBTREE, "*" );
+
         while ( cursor.next() )
         {
             cursor.get();
             entryCount++;
         }
-        
+
         assertEquals( 13, entryCount );
 
         // Stop the server
@@ -546,7 +532,7 @@ public class UberJarMainTest
 
         // And restart it
         connectionVerificationThread = createServer();
-        
+
         // Starting the connection verification thread
         // and waiting for the termination of it
         connectionVerificationThread.start();
@@ -562,15 +548,15 @@ public class UberJarMainTest
         connection = createConnection();
 
         entryCount = 0;
-        
-        cursor = connection.search( "dc=example, dc=com","(ObjectClass=*)", SearchScope.SUBTREE,
"*" );
-        
+
+        cursor = connection.search( "dc=example, dc=com", "(ObjectClass=*)", SearchScope.SUBTREE,
"*" );
+
         while ( cursor.next() )
         {
             cursor.get();
             entryCount++;
         }
-        
+
         assertEquals( 13, entryCount );
     }
 }


Mime
View raw message