You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2020/05/22 04:45:53 UTC

[directory-server] branch master updated: o Added the required license o Reformatted the code

This is an automated email from the ASF dual-hosted git repository.

elecharny 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 57948f0  o Added the required license o Reformatted the code
57948f0 is described below

commit 57948f0339425342dd9ef71b36392c87c14e2ed9
Author: emmanuel lecharny <em...@busit.com>
AuthorDate: Fri May 22 06:45:39 2020 +0200

    o Added the required license
    o Reformatted the code
---
 .../server/core/DefaultDirectoryServiceTest.java   | 94 ++++++++++++++--------
 1 file changed, 62 insertions(+), 32 deletions(-)

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 34f9a78..df0df02 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
@@ -1,5 +1,25 @@
+/*
+ *   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.server.core;
 
+
 import static org.junit.Assert.assertEquals;
 
 import org.apache.directory.api.ldap.model.exception.LdapException;
@@ -8,46 +28,56 @@ import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.api.interceptor.Interceptor;
 import org.junit.Test;
 
-public class DefaultDirectoryServiceTest {
 
-  @Test
-  public void testAddAfterExistingInterceptor() throws LdapException {
-    // given
-    final String existingInterceptorName = InterceptorEnum.AUTHENTICATION_INTERCEPTOR.getName();
-    DefaultDirectoryService service = new DefaultDirectoryService();
+public class DefaultDirectoryServiceTest
+{
+
+    @Test
+    public void testAddAfterExistingInterceptor() throws LdapException
+    {
+        // given
+        final String existingInterceptorName = InterceptorEnum.AUTHENTICATION_INTERCEPTOR.getName();
+        DefaultDirectoryService service = new DefaultDirectoryService();
 
-    // when
-    service.addAfter(existingInterceptorName, new FooInterceptor());
+        // when
+        service.addAfter( existingInterceptorName, new FooInterceptor() );
 
-    // then
-    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);
-        assertEquals("foo", nextInterceptor.getName());
-      }
+        // then
+        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 );
+                assertEquals( "foo", nextInterceptor.getName() );
+            }
+        }
     }
-  }
 
-  @Test
-  public void testAddAfterForUnknownPredecessor() throws LdapException {
-    // given
-    DefaultDirectoryService service = new DefaultDirectoryService();
 
-    // when
-    service.addAfter("-unknown-", new FooInterceptor());
+    @Test
+    public void testAddAfterForUnknownPredecessor() throws LdapException
+    {
+        // given
+        DefaultDirectoryService service = new DefaultDirectoryService();
 
-    // then
-    final Interceptor lastInterceptor = service.getInterceptors()
-        .get(service.getInterceptors().size() - 1);
-    assertEquals("foo", lastInterceptor.getName());
-  }
+        // when
+        service.addAfter( "-unknown-", new FooInterceptor() );
+
+        // then
+        final Interceptor lastInterceptor = service.getInterceptors()
+            .get( service.getInterceptors().size() - 1 );
+        assertEquals( "foo", lastInterceptor.getName() );
+    }
 
-  static class FooInterceptor extends BaseInterceptor {
+    static class FooInterceptor extends BaseInterceptor
+    {
 
-    @Override
-    public String getName() {
-      return "foo";
+        @Override
+        public String getName()
+        {
+            return "foo";
+        }
     }
-  }
 }
\ No newline at end of file