You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2024/12/19 13:53:08 UTC

(sling-org-apache-sling-superimposing) branch feature/SLING-12588-parent-62 created (now 19978b5)

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

sseifert pushed a change to branch feature/SLING-12588-parent-62
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-superimposing.git


      at 19978b5  SLING-12588 apply spotless formatting

This branch includes the following new commits:

     new 913cee4  SLING-12588 Update to Parent 62
     new 19978b5  SLING-12588 apply spotless formatting

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(sling-org-apache-sling-superimposing) 02/02: SLING-12588 apply spotless formatting

Posted by ss...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sseifert pushed a commit to branch feature/SLING-12588-parent-62
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-superimposing.git

commit 19978b5499c98c27d19a1d61fa6c94ab8133b79a
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Thu Dec 19 14:53:00 2024 +0100

    SLING-12588 apply spotless formatting
---
 pom.xml                                            |  32 ++--
 .../sling/superimposing/SuperimposingManager.java  |   1 -
 .../SuperimposingResourceProvider.java             |  27 ++--
 .../impl/SuperimposingManagerImpl.java             | 162 ++++++++++++---------
 .../superimposing/impl/SuperimposingResource.java  |  43 +++---
 .../impl/SuperimposingResourceIterator.java        |  37 ++---
 .../impl/SuperimposingResourceProviderImpl.java    |  65 +++++----
 .../apache/sling/superimposing/package-info.java   |   1 -
 .../impl/SuperimposingManagerImplTest.java         | 159 +++++++++++---------
 .../impl/SuperimposingResourceIteratorTest.java    |  32 ++--
 .../SuperimposingResourceProviderImplTest.java     |  43 +++---
 .../impl/SuperimposingResourceTest.java            |  21 +--
 12 files changed, 348 insertions(+), 275 deletions(-)

diff --git a/pom.xml b/pom.xml
index 6266cf0..b0cf3d6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,11 +28,9 @@
     <version>0.2.1-SNAPSHOT</version>
 
     <name>Apache Sling Superimposing Resource Provider</name>
-    <description>
-        Allows to mirror resource trees and superimposing resources.
+    <description>Allows to mirror resource trees and superimposing resources.
         All changes from the master tree are reflected to the mirrored tree.
-        It is possible to add or overlay resources in the mirrored tree.
-    </description>
+        It is possible to add or overlay resources in the mirrored tree.</description>
 
     <scm>
         <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-superimposing.git</connection>
@@ -41,20 +39,10 @@
     </scm>
 
     <properties>
-         <sling.java.version>8</sling.java.version>
-         <project.build.outputTimestamp>2020-01-22T15:10:38Z</project.build.outputTimestamp>
+        <sling.java.version>8</sling.java.version>
+        <project.build.outputTimestamp>2020-01-22T15:10:38Z</project.build.outputTimestamp>
     </properties>
 
-    <build>
-        <plugins>
-            <!-- Maven Sling Plugin -->
-            <plugin>
-                <groupId>org.apache.sling</groupId>
-                <artifactId>sling-maven-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
-
     <dependencies>
         <dependency>
             <groupId>org.apache.sling</groupId>
@@ -109,7 +97,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-                <artifactId>org.osgi.service.component</artifactId>
+            <artifactId>org.osgi.service.component</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -140,4 +128,14 @@
         </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <!-- Maven Sling Plugin -->
+            <plugin>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>sling-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>
diff --git a/src/main/java/org/apache/sling/superimposing/SuperimposingManager.java b/src/main/java/org/apache/sling/superimposing/SuperimposingManager.java
index bc380b5..fada162 100644
--- a/src/main/java/org/apache/sling/superimposing/SuperimposingManager.java
+++ b/src/main/java/org/apache/sling/superimposing/SuperimposingManager.java
@@ -36,5 +36,4 @@ public interface SuperimposingManager {
      *   even if superimposing resource providers are registered or unregistered at the same time.
      */
     Iterator<SuperimposingResourceProvider> getRegisteredProviders();
-
 }
diff --git a/src/main/java/org/apache/sling/superimposing/SuperimposingResourceProvider.java b/src/main/java/org/apache/sling/superimposing/SuperimposingResourceProvider.java
index e7243e0..2a19d0b 100644
--- a/src/main/java/org/apache/sling/superimposing/SuperimposingResourceProvider.java
+++ b/src/main/java/org/apache/sling/superimposing/SuperimposingResourceProvider.java
@@ -1,18 +1,20 @@
 /*
- * 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
+ * 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
+ *   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.
+ * 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.sling.superimposing;
 
@@ -62,5 +64,4 @@ public interface SuperimposingResourceProvider extends ResourceProvider {
      * @return Overlayable yes/no
      */
     boolean isOverlayable();
-
 }
diff --git a/src/main/java/org/apache/sling/superimposing/impl/SuperimposingManagerImpl.java b/src/main/java/org/apache/sling/superimposing/impl/SuperimposingManagerImpl.java
index 4d13346..977b2f2 100644
--- a/src/main/java/org/apache/sling/superimposing/impl/SuperimposingManagerImpl.java
+++ b/src/main/java/org/apache/sling/superimposing/impl/SuperimposingManagerImpl.java
@@ -1,25 +1,28 @@
 /*
- * 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
+ * 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
+ *   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.
+ * 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.sling.superimposing.impl;
 
-import static org.apache.sling.superimposing.SuperimposingResourceProvider.MIXIN_SUPERIMPOSE;
-import static org.apache.sling.superimposing.SuperimposingResourceProvider.PROP_SUPERIMPOSE_OVERLAYABLE;
-import static org.apache.sling.superimposing.SuperimposingResourceProvider.PROP_SUPERIMPOSE_REGISTER_PARENT;
-import static org.apache.sling.superimposing.SuperimposingResourceProvider.PROP_SUPERIMPOSE_SOURCE_PATH;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.observation.Event;
+import javax.jcr.observation.EventIterator;
+import javax.jcr.observation.EventListener;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -34,12 +37,6 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.stream.Collectors;
 
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.observation.Event;
-import javax.jcr.observation.EventIterator;
-import javax.jcr.observation.EventListener;
-
 import org.apache.commons.collections4.IteratorUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.sling.api.resource.LoginException;
@@ -63,6 +60,11 @@ import org.osgi.service.metatype.annotations.ObjectClassDefinition;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.sling.superimposing.SuperimposingResourceProvider.MIXIN_SUPERIMPOSE;
+import static org.apache.sling.superimposing.SuperimposingResourceProvider.PROP_SUPERIMPOSE_OVERLAYABLE;
+import static org.apache.sling.superimposing.SuperimposingResourceProvider.PROP_SUPERIMPOSE_REGISTER_PARENT;
+import static org.apache.sling.superimposing.SuperimposingResourceProvider.PROP_SUPERIMPOSE_SOURCE_PATH;
+
 /**
  * Manages the resource registrations for the {@link SuperimposingResourceProviderImpl}.
  * Provides read-only access to all registered providers.
@@ -71,27 +73,38 @@ import org.slf4j.LoggerFactory;
 @Designate(ocd = SuperimposingManagerImpl.Config.class)
 public class SuperimposingManagerImpl implements SuperimposingManager, EventListener {
 
-    
-    @ObjectClassDefinition(name = "Apache Sling Superimposing Resource Manager", description = "Manages the resource registrations for the Superimposing Resource Provider.", id = "org.apache.sling.superimposing.impl.SuperimposingManagerImpl")
+    @ObjectClassDefinition(
+            name = "Apache Sling Superimposing Resource Manager",
+            description = "Manages the resource registrations for the Superimposing Resource Provider.",
+            id = "org.apache.sling.superimposing.impl.SuperimposingManagerImpl")
     @interface Config {
-        
-        @AttributeDefinition(name = "Enable superimposition", description = "Enable/Disable the superimposing functionality")
+
+        @AttributeDefinition(
+                name = "Enable superimposition",
+                description = "Enable/Disable the superimposing functionality")
         boolean enabled() default false;
-        
-        @AttributeDefinition(name = "Observation paths", description = "List of paths that should be monitored for resource events to detect superimposing content nodes.")
-        String [] observationPaths() default "/content";
 
-        @AttributeDefinition(name = "Find all Queries", description = "List of query expressions to find all existing superimposing registrations on service startup. Query syntax is depending on underlying resource provdider implementation. Prepend the query with query syntax name separated by \"|\".")
-        String [] findAllQueries() default "JCR-SQL2|SELECT * FROM [" + MIXIN_SUPERIMPOSE + "] WHERE ISDESCENDANTNODE('/content')";
+        @AttributeDefinition(
+                name = "Observation paths",
+                description =
+                        "List of paths that should be monitored for resource events to detect superimposing content nodes.")
+        String[] observationPaths() default "/content";
+
+        @AttributeDefinition(
+                name = "Find all Queries",
+                description =
+                        "List of query expressions to find all existing superimposing registrations on service startup. Query syntax is depending on underlying resource provdider implementation. Prepend the query with query syntax name separated by \"|\".")
+        String[] findAllQueries() default
+                "JCR-SQL2|SELECT * FROM [" + MIXIN_SUPERIMPOSE + "] WHERE ISDESCENDANTNODE('/content')";
     }
 
     public static final String PATH_SEPARATOR = "/";
-    
+
     private boolean enabled;
 
     private String[] findAllQueries;
     private EventListener[] observationEventListeners;
-    
+
     /**
      * Map for holding the superimposing mappings, with the superimpose path as key and the providers as values
      */
@@ -102,7 +115,7 @@ public class SuperimposingManagerImpl implements SuperimposingManager, EventList
 
     @Activate
     private Config config;
-    
+
     /**
      * Administrative resource resolver (read only usage)
      */
@@ -123,9 +136,10 @@ public class SuperimposingManagerImpl implements SuperimposingManager, EventList
      * The default logger
      */
     private static final Logger log = LoggerFactory.getLogger(SuperimposingManagerImpl.class);
+
     static final String PROPERTY_KEY_OLD_OBSERVATION_PATHS = "obervationPaths";
     private static final String PROPERTY_KEY_OBSERVATION_PATHS = "observationPaths";
-    
+
     /**
      * Find all existing superimposing registrations using all query defined in service configuration.
      * @param resolver Resource resolver
@@ -135,8 +149,9 @@ public class SuperimposingManagerImpl implements SuperimposingManager, EventList
         List<Resource> allResources = new ArrayList<>();
         for (String queryString : this.findAllQueries) {
             if (!StringUtils.contains(queryString, "|")) {
-                throw new IllegalArgumentException("Query string does not contain query syntax seperated by '|': " + queryString);
-          }
+                throw new IllegalArgumentException(
+                        "Query string does not contain query syntax seperated by '|': " + queryString);
+            }
             String queryLanguage = StringUtils.substringBefore(queryString, "|");
             String query = StringUtils.substringAfter(queryString, "|");
             allResources.addAll(IteratorUtils.toList(resolver.findResources(query, queryLanguage)));
@@ -161,7 +176,11 @@ public class SuperimposingManagerImpl implements SuperimposingManager, EventList
         }
 
         final long time = System.currentTimeMillis() - start;
-        log.info("Registered {} SuperimposingResourceProvider(s) in {} ms, skipping {} invalid one(s).", countSuccess, time, countFailed);
+        log.info(
+                "Registered {} SuperimposingResourceProvider(s) in {} ms, skipping {} invalid one(s).",
+                countSuccess,
+                time,
+                countFailed);
     }
 
     /**
@@ -172,7 +191,8 @@ public class SuperimposingManagerImpl implements SuperimposingManager, EventList
     private boolean registerProvider(Resource superimposingResource) {
         String superimposePath = superimposingResource.getPath();
 
-        // use JCR API to get properties from superimposing resource to make sure superimposing does not delivery values from source node
+        // use JCR API to get properties from superimposing resource to make sure superimposing does not delivery values
+        // from source node
         final String sourcePath = getJcrStringProperty(superimposePath, PROP_SUPERIMPOSE_SOURCE_PATH);
         final boolean registerParent = getJcrBooleanProperty(superimposePath, PROP_SUPERIMPOSE_REGISTER_PARENT);
         final boolean overlayable = getJcrBooleanProperty(superimposePath, PROP_SUPERIMPOSE_OVERLAYABLE);
@@ -181,13 +201,13 @@ public class SuperimposingManagerImpl implements SuperimposingManager, EventList
         boolean valid = true;
         if (StringUtils.isBlank(sourcePath)) {
             valid = false;
-        }
-        else {
+        } else {
             // check whether the parent of the node should be registered as superimposing provider
             if (registerParent) {
                 superimposePath = ResourceUtil.getParent(superimposePath);
             }
-            // target path is not valid if it equals to a parent or child of the superimposing path, or to the superimposing path itself
+            // target path is not valid if it equals to a parent or child of the superimposing path, or to the
+            // superimposing path itself
             if (StringUtils.equals(sourcePath, superimposePath)
                     || StringUtils.startsWith(sourcePath, superimposePath + PATH_SEPARATOR)
                     || StringUtils.startsWith(superimposePath, sourcePath + PATH_SEPARATOR)) {
@@ -197,7 +217,8 @@ public class SuperimposingManagerImpl implements SuperimposingManager, EventList
 
         // register valid superimposing
         if (valid) {
-            final SuperimposingResourceProviderImpl srp = new SuperimposingResourceProviderImpl(superimposePath, sourcePath, overlayable);
+            final SuperimposingResourceProviderImpl srp =
+                    new SuperimposingResourceProviderImpl(superimposePath, sourcePath, overlayable);
             final SuperimposingResourceProviderImpl oldSrp = superimposingProviders.put(superimposePath, srp);
 
             // unregister in case there was a provider registered before
@@ -209,7 +230,9 @@ public class SuperimposingManagerImpl implements SuperimposingManager, EventList
                 srp.registerService(bundleContext);
                 return true;
             } else {
-                log.debug("Skipped re-registering resource provider {} because there were no relevant changes.", superimposePath);
+                log.debug(
+                        "Skipped re-registering resource provider {} because there were no relevant changes.",
+                        superimposePath);
             }
         }
 
@@ -234,8 +257,7 @@ public class SuperimposingManagerImpl implements SuperimposingManager, EventList
                 return null;
             }
             return session.getProperty(absolutePropertyPath).getString();
-        }
-        catch (RepositoryException ex) {
+        } catch (RepositoryException ex) {
             return null;
         }
     }
@@ -248,8 +270,7 @@ public class SuperimposingManagerImpl implements SuperimposingManager, EventList
                 return false;
             }
             return session.getProperty(absolutePropertyPath).getBoolean();
-        }
-        catch (RepositoryException ex) {
+        } catch (RepositoryException ex) {
             return false;
         }
     }
@@ -282,8 +303,12 @@ public class SuperimposingManagerImpl implements SuperimposingManager, EventList
         Collection<String> observationPaths = new ArrayList<>(Arrays.asList(config.observationPaths()));
         // merge with old configuration property key (with typo)
         if (properties.containsKey(PROPERTY_KEY_OLD_OBSERVATION_PATHS)) {
-            log.warn("Using deprecated configuration property {}, please switch to the new key {}", PROPERTY_KEY_OLD_OBSERVATION_PATHS, PROPERTY_KEY_OBSERVATION_PATHS);
-            observationPaths.addAll(Arrays.asList(PropertiesUtil.toStringArray(properties.get(PROPERTY_KEY_OLD_OBSERVATION_PATHS))));
+            log.warn(
+                    "Using deprecated configuration property {}, please switch to the new key {}",
+                    PROPERTY_KEY_OLD_OBSERVATION_PATHS,
+                    PROPERTY_KEY_OBSERVATION_PATHS);
+            observationPaths.addAll(
+                    Arrays.asList(PropertiesUtil.toStringArray(properties.get(PROPERTY_KEY_OLD_OBSERVATION_PATHS))));
         }
         // get "find all" queries
         this.findAllQueries = config.findAllQueries();
@@ -295,19 +320,25 @@ public class SuperimposingManagerImpl implements SuperimposingManager, EventList
         // Watch for events on the root to register/deregister superimposings at runtime
         // For each observed path create an event listener object which redirects the event to the main class
         final Session session = resolver.adaptTo(Session.class);
-        if (session!=null) {
+        if (session != null) {
             this.observationEventListeners = new EventListener[observationPaths.size()];
-            int i=0;
+            int i = 0;
             for (String observationPath : observationPaths) {
                 this.observationEventListeners[i] = this;
-                session.getWorkspace().getObservationManager().addEventListener(
-                        this.observationEventListeners[i++],
-                        Event.NODE_ADDED | Event.NODE_REMOVED | Event.PROPERTY_ADDED | Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED,
-                        observationPath, // absolute path
-                        true, // isDeep
-                        null, // uuids
-                        null, // node types
-                        true); // noLocal
+                session.getWorkspace()
+                        .getObservationManager()
+                        .addEventListener(
+                                this.observationEventListeners[i++],
+                                Event.NODE_ADDED
+                                        | Event.NODE_REMOVED
+                                        | Event.PROPERTY_ADDED
+                                        | Event.PROPERTY_CHANGED
+                                        | Event.PROPERTY_REMOVED,
+                                observationPath, // absolute path
+                                true, // isDeep
+                                null, // uuids
+                                null, // node types
+                                true); // noLocal
             }
         }
 
@@ -315,8 +346,7 @@ public class SuperimposingManagerImpl implements SuperimposingManager, EventList
         initialization = Executors.newSingleThreadExecutor().submit(() -> {
             try {
                 registerAllSuperimposings();
-            }
-            catch (Exception ex) {
+            } catch (Exception ex) {
                 log.warn("Error registering existing superimposing resources on service startup.", ex);
             }
         });
@@ -331,9 +361,9 @@ public class SuperimposingManagerImpl implements SuperimposingManager, EventList
             }
 
             // de-register JCR observation
-            if (resolver!=null) {
+            if (resolver != null) {
                 final Session session = resolver.adaptTo(Session.class);
-                if (session!=null && this.observationEventListeners!=null) {
+                if (session != null && this.observationEventListeners != null) {
                     for (EventListener eventListener : this.observationEventListeners) {
                         session.getWorkspace().getObservationManager().removeEventListener(eventListener);
                     }
@@ -420,8 +450,8 @@ public class SuperimposingManagerImpl implements SuperimposingManager, EventList
      */
     public Iterator<SuperimposingResourceProvider> getRegisteredProviders() {
         List<SuperimposingResourceProvider> resourceProviders = superimposingProviders.values().stream()
-                .map(srp -> (SuperimposingResourceProvider) srp).collect(Collectors.toList());
+                .map(srp -> (SuperimposingResourceProvider) srp)
+                .collect(Collectors.toList());
         return IteratorUtils.unmodifiableIterator(resourceProviders.iterator());
     }
-
 }
diff --git a/src/main/java/org/apache/sling/superimposing/impl/SuperimposingResource.java b/src/main/java/org/apache/sling/superimposing/impl/SuperimposingResource.java
index 9f1fd7a..ba13ed3 100644
--- a/src/main/java/org/apache/sling/superimposing/impl/SuperimposingResource.java
+++ b/src/main/java/org/apache/sling/superimposing/impl/SuperimposingResource.java
@@ -1,18 +1,20 @@
 /*
- * 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
+ * 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
+ *   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.
+ * 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.sling.superimposing.impl;
 
@@ -40,7 +42,7 @@ public class SuperimposingResource extends AbstractResource implements Resource
 
         // make a copy of resource metadata object
         this.resourceMetadata = new ResourceMetadata();
-        if (mappedResource.getResourceMetadata()!=null) {
+        if (mappedResource.getResourceMetadata() != null) {
             this.resourceMetadata.putAll(mappedResource.getResourceMetadata());
         }
 
@@ -71,7 +73,8 @@ public class SuperimposingResource extends AbstractResource implements Resource
     public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
         AdapterType adapted = super.adaptTo(type);
         if (null == adapted) {
-            // fallback to adapt from mapped resource (although this may lead sometimes to unexpected results e.g. original JCR node)
+            // fallback to adapt from mapped resource (although this may lead sometimes to unexpected results e.g.
+            // original JCR node)
             adapted = resource.adaptTo(type);
         }
         return adapted;
@@ -84,9 +87,13 @@ public class SuperimposingResource extends AbstractResource implements Resource
     @Override
     public String toString() {
         return new StringBuilder(getClass().getSimpleName())
-                .append("[type=").append(getResourceType())
-                .append(", path=").append(getPath())
-                .append(", resource=[").append(getResource()).append("]]").toString();
+                .append("[type=")
+                .append(getResourceType())
+                .append(", path=")
+                .append(getPath())
+                .append(", resource=[")
+                .append(getResource())
+                .append("]]")
+                .toString();
     }
-
 }
diff --git a/src/main/java/org/apache/sling/superimposing/impl/SuperimposingResourceIterator.java b/src/main/java/org/apache/sling/superimposing/impl/SuperimposingResourceIterator.java
index 1077b9b..ade42bd 100644
--- a/src/main/java/org/apache/sling/superimposing/impl/SuperimposingResourceIterator.java
+++ b/src/main/java/org/apache/sling/superimposing/impl/SuperimposingResourceIterator.java
@@ -1,26 +1,28 @@
 /*
- * 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
+ * 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
+ *   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.
+ * 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.sling.superimposing.impl;
 
-import org.apache.sling.api.resource.Resource;
-
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 
+import org.apache.sling.api.resource.Resource;
+
 /**
  * Iterates over children of a {@link SuperimposingResource} by iterating over the children of the source resource
  * and remapping and wrapping all children in SuperimposingResource instances.
@@ -32,7 +34,8 @@ public class SuperimposingResourceIterator implements Iterator<Resource> {
 
     private Resource next;
 
-    SuperimposingResourceIterator(SuperimposingResourceProviderImpl superimposingProvider, Iterator<Resource> decoratee) {
+    SuperimposingResourceIterator(
+            SuperimposingResourceProviderImpl superimposingProvider, Iterator<Resource> decoratee) {
         this.superimposingProvider = superimposingProvider;
         this.decoratee = decoratee;
         seek();
@@ -42,7 +45,8 @@ public class SuperimposingResourceIterator implements Iterator<Resource> {
         next = null;
         while (next == null && decoratee.hasNext()) {
             final Resource resource = decoratee.next();
-            final String superimposingPath = SuperimposingResourceProviderImpl.reverseMapPath(superimposingProvider, resource.getPath());
+            final String superimposingPath =
+                    SuperimposingResourceProviderImpl.reverseMapPath(superimposingProvider, resource.getPath());
             if (null != superimposingPath) {
                 next = new SuperimposingResource(resource, superimposingPath);
             }
@@ -65,5 +69,4 @@ public class SuperimposingResourceIterator implements Iterator<Resource> {
     public void remove() {
         throw new UnsupportedOperationException();
     }
-
 }
diff --git a/src/main/java/org/apache/sling/superimposing/impl/SuperimposingResourceProviderImpl.java b/src/main/java/org/apache/sling/superimposing/impl/SuperimposingResourceProviderImpl.java
index a929b08..80dd2ce 100644
--- a/src/main/java/org/apache/sling/superimposing/impl/SuperimposingResourceProviderImpl.java
+++ b/src/main/java/org/apache/sling/superimposing/impl/SuperimposingResourceProviderImpl.java
@@ -1,29 +1,31 @@
 /*
- * 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
+ * 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
+ *   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.
+ * 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.sling.superimposing.impl;
 
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.Iterator;
-
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.servlet.http.HttpServletRequest;
 
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Iterator;
+
 import org.apache.commons.lang3.StringUtils;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
@@ -94,9 +96,8 @@ public class SuperimposingResourceProviderImpl implements SuperimposingResourceP
         // unwrap resource if it is a wrapped resource
         final Resource currentResource;
         if (resource instanceof ResourceWrapper) {
-            currentResource = ((ResourceWrapper)resource).getResource();
-        }
-        else {
+            currentResource = ((ResourceWrapper) resource).getResource();
+        } else {
             currentResource = resource;
         }
 
@@ -120,8 +121,7 @@ public class SuperimposingResourceProviderImpl implements SuperimposingResourceP
     static String mapPath(SuperimposingResourceProviderImpl provider, ResourceResolver resolver, String path) {
         if (provider.overlayable) {
             return mapPathWithOverlay(provider, resolver, path);
-        }
-        else {
+        } else {
             return mapPathWithoutOverlay(provider, resolver, path);
         }
     }
@@ -133,17 +133,16 @@ public class SuperimposingResourceProviderImpl implements SuperimposingResourceP
      * @param path Path to map
      * @return Mapped path or null if no mapping available
      */
-    static String mapPathWithOverlay(SuperimposingResourceProviderImpl provider, ResourceResolver resolver, String path) {
+    static String mapPathWithOverlay(
+            SuperimposingResourceProviderImpl provider, ResourceResolver resolver, String path) {
         if (StringUtils.equals(path, provider.rootPath)) {
             // Superimposing root path cannot be overlayed
             return mapPathWithoutOverlay(provider, resolver, path);
-        }
-        else if (StringUtils.startsWith(path, provider.rootPrefix)) {
+        } else if (StringUtils.startsWith(path, provider.rootPrefix)) {
             if (hasOverlayResource(resolver, path)) {
                 // overlay item exists, allow underlying resource provider to step in
                 return null;
-            }
-            else {
+            } else {
                 // overlay item does not exist, overlay cannot be applied, fallback to mapped path without overlay
                 return mapPathWithoutOverlay(provider, resolver, path);
             }
@@ -169,7 +168,8 @@ public class SuperimposingResourceProviderImpl implements SuperimposingResourceP
      * @param path Path to map
      * @return Mapped path or null if no mapping available
      */
-    static String mapPathWithoutOverlay(SuperimposingResourceProviderImpl provider, ResourceResolver resolver, String path) {
+    static String mapPathWithoutOverlay(
+            SuperimposingResourceProviderImpl provider, ResourceResolver resolver, String path) {
         final String mappedPath;
         if (StringUtils.equals(path, provider.rootPath)) {
             mappedPath = provider.sourcePath;
@@ -200,13 +200,13 @@ public class SuperimposingResourceProviderImpl implements SuperimposingResourceP
         return mappedPath;
     }
 
-    //---------- Service Registration
+    // ---------- Service Registration
 
     void registerService(BundleContext context) {
         final Dictionary<String, Object> props = new Hashtable<String, Object>();
         props.put(Constants.SERVICE_DESCRIPTION, "Provider of superimposed resources");
         props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
-        props.put(ROOTS, new String[]{rootPath});
+        props.put(ROOTS, new String[] {rootPath});
 
         registration = context.registerService(SERVICE_NAME, this, props);
 
@@ -245,9 +245,10 @@ public class SuperimposingResourceProviderImpl implements SuperimposingResourceP
     @Override
     public boolean equals(Object o) {
         if (o instanceof SuperimposingResourceProviderImpl) {
-            final SuperimposingResourceProviderImpl srp = (SuperimposingResourceProviderImpl)o;
-            return this.rootPath.equals(srp.rootPath) && this.sourcePath.equals(srp.sourcePath) && this.overlayable == srp.overlayable;
-
+            final SuperimposingResourceProviderImpl srp = (SuperimposingResourceProviderImpl) o;
+            return this.rootPath.equals(srp.rootPath)
+                    && this.sourcePath.equals(srp.sourcePath)
+                    && this.overlayable == srp.overlayable;
         }
         return false;
     }
diff --git a/src/main/java/org/apache/sling/superimposing/package-info.java b/src/main/java/org/apache/sling/superimposing/package-info.java
index 94be471..1a910f6 100644
--- a/src/main/java/org/apache/sling/superimposing/package-info.java
+++ b/src/main/java/org/apache/sling/superimposing/package-info.java
@@ -21,4 +21,3 @@
 package org.apache.sling.superimposing;
 
 import org.osgi.annotation.versioning.Version;
-
diff --git a/src/test/java/org/apache/sling/superimposing/impl/SuperimposingManagerImplTest.java b/src/test/java/org/apache/sling/superimposing/impl/SuperimposingManagerImplTest.java
index bc777ff..4029363 100644
--- a/src/test/java/org/apache/sling/superimposing/impl/SuperimposingManagerImplTest.java
+++ b/src/test/java/org/apache/sling/superimposing/impl/SuperimposingManagerImplTest.java
@@ -18,24 +18,13 @@
  */
 package org.apache.sling.superimposing.impl;
 
-import static org.apache.sling.superimposing.SuperimposingResourceProvider.PROP_SUPERIMPOSE_OVERLAYABLE;
-import static org.apache.sling.superimposing.SuperimposingResourceProvider.PROP_SUPERIMPOSE_REGISTER_PARENT;
-import static org.apache.sling.superimposing.SuperimposingResourceProvider.PROP_SUPERIMPOSE_SOURCE_PATH;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyBoolean;
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.ArgumentMatchers.same;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.lenient;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoInteractions;
-import static org.mockito.Mockito.when;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.Property;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.observation.Event;
+import javax.jcr.observation.EventIterator;
+import javax.jcr.observation.EventListener;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -45,14 +34,6 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-import javax.jcr.PathNotFoundException;
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.observation.Event;
-import javax.jcr.observation.EventIterator;
-import javax.jcr.observation.EventListener;
-
 import org.apache.commons.collections4.IteratorUtils;
 import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.Resource;
@@ -76,23 +57,49 @@ import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.component.ComponentContext;
 
+import static org.apache.sling.superimposing.SuperimposingResourceProvider.PROP_SUPERIMPOSE_OVERLAYABLE;
+import static org.apache.sling.superimposing.SuperimposingResourceProvider.PROP_SUPERIMPOSE_REGISTER_PARENT;
+import static org.apache.sling.superimposing.SuperimposingResourceProvider.PROP_SUPERIMPOSE_SOURCE_PATH;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.same;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.lenient;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoInteractions;
+import static org.mockito.Mockito.when;
+
 @RunWith(MockitoJUnitRunner.class)
 public class SuperimposingManagerImplTest {
 
     @Mock
     private Dictionary<String, Object> componentContextProperties;
+
     @Mock
     private ComponentContext componentContext;
+
     @Mock
     private BundleContext bundleContext;
+
     @Mock
     private ResourceResolverFactory resourceResolverFactory;
+
     @Mock
     private SuperimposingManagerImpl.Config config;
+
     @Mock
     private ResourceResolver resourceResolver;
-    @Mock(answer=Answers.RETURNS_DEEP_STUBS)
+
+    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
     private Session session;
+
     private List<ServiceRegistration> serviceRegistrations = new ArrayList<ServiceRegistration>();
 
     @InjectMocks
@@ -107,74 +114,77 @@ public class SuperimposingManagerImplTest {
     public void setUp() throws LoginException {
         lenient().when(componentContext.getBundleContext()).thenReturn(bundleContext);
         lenient().when(componentContext.getProperties()).thenReturn(componentContextProperties);
-        lenient().when(componentContextProperties.get(SuperimposingManagerImpl.PROPERTY_KEY_OLD_OBSERVATION_PATHS)).thenReturn(new String[] { OBSERVATION_PATH });
-        lenient().when(resourceResolverFactory.getAdministrativeResourceResolver(any(Map.class))).thenReturn(resourceResolver);
+        lenient()
+                .when(componentContextProperties.get(SuperimposingManagerImpl.PROPERTY_KEY_OLD_OBSERVATION_PATHS))
+                .thenReturn(new String[] {OBSERVATION_PATH});
+        lenient()
+                .when(resourceResolverFactory.getAdministrativeResourceResolver(any(Map.class)))
+                .thenReturn(resourceResolver);
         when(resourceResolver.adaptTo(Session.class)).thenReturn(session);
 
         when(config.enabled()).thenReturn(true);
-        when(config.findAllQueries()).thenReturn(new String[]{"syntax|query"});
-        when(config.observationPaths()).thenReturn(new String[]{OBSERVATION_PATH});
+        when(config.findAllQueries()).thenReturn(new String[] {"syntax|query"});
+        when(config.observationPaths()).thenReturn(new String[] {OBSERVATION_PATH});
 
         // collect a list of all service registrations to validate that they are all unregistered on shutdown
-        when(bundleContext.registerService(anyString(), any(), any(Dictionary.class))).thenAnswer(new Answer<ServiceRegistration>() {
-            public ServiceRegistration answer(InvocationOnMock invocation) {
-                final ServiceRegistration mockRegistration = mock(ServiceRegistration.class);
-                serviceRegistrations.add(mockRegistration);
-                doAnswer(new Answer() {
-                    public Object answer(InvocationOnMock invocation) {
-                        return serviceRegistrations.remove(mockRegistration);
+        when(bundleContext.registerService(anyString(), any(), any(Dictionary.class)))
+                .thenAnswer(new Answer<ServiceRegistration>() {
+                    public ServiceRegistration answer(InvocationOnMock invocation) {
+                        final ServiceRegistration mockRegistration = mock(ServiceRegistration.class);
+                        serviceRegistrations.add(mockRegistration);
+                        doAnswer(new Answer() {
+                                    public Object answer(InvocationOnMock invocation) {
+                                        return serviceRegistrations.remove(mockRegistration);
+                                    }
+                                })
+                                .when(mockRegistration)
+                                .unregister();
+                        return mockRegistration;
                     }
-                }).when(mockRegistration).unregister();
-                return mockRegistration;
-            }
-        });
+                });
 
         // simulate absolute path access to properties via session object
         try {
             when(session.itemExists(anyString())).thenAnswer(new Answer<Boolean>() {
                 public Boolean answer(InvocationOnMock invocation) throws Throwable {
-                    final String absolutePath = (String)invocation.getArguments()[0];
+                    final String absolutePath = (String) invocation.getArguments()[0];
                     final String nodePath = ResourceUtil.getParent(absolutePath);
                     final String propertyName = ResourceUtil.getName(absolutePath);
                     Resource resource = resourceResolver.getResource(nodePath);
-                    if (resource!=null) {
+                    if (resource != null) {
                         ValueMap props = resource.adaptTo(ValueMap.class);
                         return props.containsKey(propertyName);
-                    }
-                    else {
+                    } else {
                         return false;
                     }
                 }
             });
             when(session.getProperty(anyString())).thenAnswer(new Answer<Property>() {
                 public Property answer(InvocationOnMock invocation) throws Throwable {
-                    final String absolutePath = (String)invocation.getArguments()[0];
+                    final String absolutePath = (String) invocation.getArguments()[0];
                     final String nodePath = ResourceUtil.getParent(absolutePath);
                     final String propertyName = ResourceUtil.getName(absolutePath);
                     Resource resource = resourceResolver.getResource(nodePath);
-                    if (resource!=null) {
+                    if (resource != null) {
                         ValueMap props = resource.adaptTo(ValueMap.class);
                         Object value = props.get(propertyName);
-                        if (value==null) {
+                        if (value == null) {
                             throw new PathNotFoundException();
                         }
                         Property prop = mock(Property.class);
                         lenient().when(prop.getName()).thenReturn(propertyName);
                         if (value instanceof String) {
-                            when(prop.getString()).thenReturn((String)value);
-                        }
-                        else if (value instanceof Boolean) {
-                            when(prop.getBoolean()).thenReturn((Boolean)value);
+                            when(prop.getString()).thenReturn((String) value);
+                        } else if (value instanceof Boolean) {
+                            when(prop.getBoolean()).thenReturn((Boolean) value);
                         }
                         return prop;
-                    }
-                    else {
+                    } else {
                         throw new PathNotFoundException();
                     }
                 }
             });
-        }
-        catch (RepositoryException ex) {
+        } catch (RepositoryException ex) {
             throw new RuntimeException(ex);
         }
     }
@@ -184,7 +194,15 @@ public class SuperimposingManagerImplTest {
 
         if (underTest.isEnabled()) {
             // verify observation registration
-            verify(session.getWorkspace().getObservationManager()).addEventListener(any(EventListener.class), anyInt(), eq(OBSERVATION_PATH), anyBoolean(), any(), any(), anyBoolean());
+            verify(session.getWorkspace().getObservationManager())
+                    .addEventListener(
+                            any(EventListener.class),
+                            anyInt(),
+                            eq(OBSERVATION_PATH),
+                            anyBoolean(),
+                            any(),
+                            any(),
+                            anyBoolean());
             // wait until separate initialization thread has finished
             while (!underTest.initialization.isDone()) {
                 Thread.sleep(10);
@@ -208,7 +226,8 @@ public class SuperimposingManagerImplTest {
         }
     }
 
-    private Resource prepareSuperimposingResource(String superimposedPath, String sourcePath, boolean registerParent, boolean overlayable) {
+    private Resource prepareSuperimposingResource(
+            String superimposedPath, String sourcePath, boolean registerParent, boolean overlayable) {
         Resource resource = mock(Resource.class);
         when(resource.getPath()).thenReturn(superimposedPath);
         ValueMap props = new ValueMapDecorator(new HashMap<String, Object>());
@@ -243,8 +262,9 @@ public class SuperimposingManagerImplTest {
         when(resourceResolver.findResources("query", "syntax")).then(new Answer<Iterator<Resource>>() {
             public Iterator<Resource> answer(InvocationOnMock invocation) {
                 return Arrays.asList(new Resource[] {
-                        prepareSuperimposingResource(SUPERIMPOSED_PATH, ORIGINAL_PATH, false, false)
-                }).iterator();
+                            prepareSuperimposingResource(SUPERIMPOSED_PATH, ORIGINAL_PATH, false, false)
+                        })
+                        .iterator();
             }
         });
         initialize(true);
@@ -268,7 +288,8 @@ public class SuperimposingManagerImplTest {
 
         Event propertyEvent = mock(Event.class);
         when(propertyEvent.getType()).thenReturn(Event.PROPERTY_ADDED);
-        when(propertyEvent.getPath()).thenReturn(resourcePath + "/" + SuperimposingResourceProvider.PROP_SUPERIMPOSE_SOURCE_PATH);
+        when(propertyEvent.getPath())
+                .thenReturn(resourcePath + "/" + SuperimposingResourceProvider.PROP_SUPERIMPOSE_SOURCE_PATH);
 
         EventIterator eventIterator = mock(EventIterator.class);
         when(eventIterator.hasNext()).thenReturn(true, true, false);
@@ -281,7 +302,8 @@ public class SuperimposingManagerImplTest {
 
         Event propertyEvent = mock(Event.class);
         when(propertyEvent.getType()).thenReturn(Event.PROPERTY_CHANGED);
-        when(propertyEvent.getPath()).thenReturn(resourcePath + "/" + SuperimposingResourceProvider.PROP_SUPERIMPOSE_SOURCE_PATH);
+        when(propertyEvent.getPath())
+                .thenReturn(resourcePath + "/" + SuperimposingResourceProvider.PROP_SUPERIMPOSE_SOURCE_PATH);
 
         EventIterator eventIterator = mock(EventIterator.class);
         when(eventIterator.hasNext()).thenReturn(true, false);
@@ -321,7 +343,8 @@ public class SuperimposingManagerImplTest {
 
     @SuppressWarnings("unchecked")
     @Test
-    public void testSuperimposedResourceCreateUpdateRemove() throws InterruptedException, LoginException, RepositoryException {
+    public void testSuperimposedResourceCreateUpdateRemove()
+            throws InterruptedException, LoginException, RepositoryException {
         initialize(true);
 
         // simulate node create event
@@ -364,7 +387,8 @@ public class SuperimposingManagerImplTest {
         initialize(true);
 
         // simulate node create event
-        final Resource superimposedResource = prepareSuperimposingResource(SUPERIMPOSED_PATH, ORIGINAL_PATH, false, false);
+        final Resource superimposedResource =
+                prepareSuperimposingResource(SUPERIMPOSED_PATH, ORIGINAL_PATH, false, false);
         underTest.onEvent(prepareNodeCreateEvent(superimposedResource));
 
         // simulate a node move event
@@ -374,9 +398,7 @@ public class SuperimposingManagerImplTest {
         // prepare a query that returns the moved superimposed resource
         when(resourceResolver.findResources("query", "syntax")).then(new Answer<Iterator<Resource>>() {
             public Iterator<Resource> answer(InvocationOnMock invocation) {
-                return Arrays.asList(new Resource[] {
-                        superimposedResource
-                }).iterator();
+                return Arrays.asList(new Resource[] {superimposedResource}).iterator();
             }
         });
 
@@ -391,5 +413,4 @@ public class SuperimposingManagerImplTest {
         assertFalse(provider.isOverlayable());
         verify(bundleContext).registerService(anyString(), same(provider), any(Dictionary.class));
     }
-
 }
diff --git a/src/test/java/org/apache/sling/superimposing/impl/SuperimposingResourceIteratorTest.java b/src/test/java/org/apache/sling/superimposing/impl/SuperimposingResourceIteratorTest.java
index 5b781e6..8c0d520 100644
--- a/src/test/java/org/apache/sling/superimposing/impl/SuperimposingResourceIteratorTest.java
+++ b/src/test/java/org/apache/sling/superimposing/impl/SuperimposingResourceIteratorTest.java
@@ -18,11 +18,6 @@
  */
 package org.apache.sling.superimposing.impl;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
-
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 
@@ -33,13 +28,20 @@ import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+
 @RunWith(MockitoJUnitRunner.class)
 public class SuperimposingResourceIteratorTest {
 
     @Mock
     private Iterator<Resource> originalResourceIterator;
+
     @Mock
     private Resource originalResource1;
+
     @Mock
     private Resource originalResource2;
 
@@ -50,7 +52,8 @@ public class SuperimposingResourceIteratorTest {
 
     @Before
     public void setUp() {
-        this.superimposingResourceProvider = new SuperimposingResourceProviderImpl(SUPERIMPOSED_PATH, ORIGINAL_PATH, false);
+        this.superimposingResourceProvider =
+                new SuperimposingResourceProviderImpl(SUPERIMPOSED_PATH, ORIGINAL_PATH, false);
         when(this.originalResource1.getPath()).thenReturn(ORIGINAL_PATH + "/node1");
         when(this.originalResource2.getPath()).thenReturn(ORIGINAL_PATH + "/node2");
     }
@@ -58,20 +61,23 @@ public class SuperimposingResourceIteratorTest {
     @Test
     public void testEmpty() {
         when(this.originalResourceIterator.hasNext()).thenReturn(false);
-        Iterator<Resource> underTest = new SuperimposingResourceIterator(this.superimposingResourceProvider, this.originalResourceIterator);
+        Iterator<Resource> underTest =
+                new SuperimposingResourceIterator(this.superimposingResourceProvider, this.originalResourceIterator);
         assertFalse(underTest.hasNext());
     }
 
-    @Test(expected=NoSuchElementException.class)
+    @Test(expected = NoSuchElementException.class)
     public void testEmptyGetNext() {
         when(this.originalResourceIterator.hasNext()).thenReturn(false);
-        Iterator<Resource> underTest = new SuperimposingResourceIterator(this.superimposingResourceProvider, this.originalResourceIterator);
+        Iterator<Resource> underTest =
+                new SuperimposingResourceIterator(this.superimposingResourceProvider, this.originalResourceIterator);
         underTest.next();
     }
 
-    @Test(expected=UnsupportedOperationException.class)
+    @Test(expected = UnsupportedOperationException.class)
     public void testRemove() {
-        Iterator<Resource> underTest = new SuperimposingResourceIterator(this.superimposingResourceProvider, this.originalResourceIterator);
+        Iterator<Resource> underTest =
+                new SuperimposingResourceIterator(this.superimposingResourceProvider, this.originalResourceIterator);
         underTest.remove();
     }
 
@@ -79,7 +85,8 @@ public class SuperimposingResourceIteratorTest {
     public void testWith2Elements() {
         when(this.originalResourceIterator.hasNext()).thenReturn(true, true, false);
         when(this.originalResourceIterator.next()).thenReturn(this.originalResource1, this.originalResource2, null);
-        Iterator<Resource> underTest = new SuperimposingResourceIterator(this.superimposingResourceProvider, this.originalResourceIterator);
+        Iterator<Resource> underTest =
+                new SuperimposingResourceIterator(this.superimposingResourceProvider, this.originalResourceIterator);
 
         assertTrue(underTest.hasNext());
         assertEquals(SUPERIMPOSED_PATH + "/node1", underTest.next().getPath());
@@ -89,5 +96,4 @@ public class SuperimposingResourceIteratorTest {
 
         assertFalse(underTest.hasNext());
     }
-
 }
diff --git a/src/test/java/org/apache/sling/superimposing/impl/SuperimposingResourceProviderImplTest.java b/src/test/java/org/apache/sling/superimposing/impl/SuperimposingResourceProviderImplTest.java
index e44bf54..efd0b91 100644
--- a/src/test/java/org/apache/sling/superimposing/impl/SuperimposingResourceProviderImplTest.java
+++ b/src/test/java/org/apache/sling/superimposing/impl/SuperimposingResourceProviderImplTest.java
@@ -18,25 +18,13 @@
  */
 package org.apache.sling.superimposing.impl;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.lenient;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
 
 import java.util.Arrays;
 import java.util.Dictionary;
 import java.util.Iterator;
 
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceMetadata;
 import org.apache.sling.api.resource.ResourceResolver;
@@ -52,6 +40,18 @@ import org.mockito.stubbing.Answer;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.lenient;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
 @RunWith(MockitoJUnitRunner.class)
 public class SuperimposingResourceProviderImplTest {
 
@@ -60,16 +60,22 @@ public class SuperimposingResourceProviderImplTest {
 
     @Mock
     private BundleContext bundleContext;
+
     @Mock
     private ServiceRegistration serviceRegistration;
+
     @Mock
     private ServiceRegistration serviceRegistrationOverlay;
+
     @Mock
     private ResourceResolver resourceResolver;
+
     @Mock
     private Session session;
+
     @Mock
     private Resource originalRootResource;
+
     @Mock
     private Resource originalSubResource;
 
@@ -81,12 +87,14 @@ public class SuperimposingResourceProviderImplTest {
     public void setUp() {
         // setup a superimposing resource provider without overlay
         underTest = new SuperimposingResourceProviderImpl(SUPERIMPOSED_PATH, ORIGINAL_PATH, false);
-        when(bundleContext.registerService(anyString(), eq(underTest), any(Dictionary.class))).thenReturn(serviceRegistration);
+        when(bundleContext.registerService(anyString(), eq(underTest), any(Dictionary.class)))
+                .thenReturn(serviceRegistration);
         underTest.registerService(bundleContext);
 
         // and one with overlay
         underTestOverlay = new SuperimposingResourceProviderImpl(SUPERIMPOSED_PATH, ORIGINAL_PATH, true);
-        when(bundleContext.registerService(anyString(), eq(underTestOverlay), any(Dictionary.class))).thenReturn(serviceRegistrationOverlay);
+        when(bundleContext.registerService(anyString(), eq(underTestOverlay), any(Dictionary.class)))
+                .thenReturn(serviceRegistrationOverlay);
         underTestOverlay.registerService(bundleContext);
 
         // prepare test resources
@@ -94,7 +102,7 @@ public class SuperimposingResourceProviderImplTest {
         prepareOriginalResource(originalSubResource, ORIGINAL_PATH + "/sub1");
         when(resourceResolver.listChildren(originalRootResource)).thenAnswer(new Answer<Iterator<Resource>>() {
             public Iterator<Resource> answer(InvocationOnMock invocation) {
-                return Arrays.asList(new Resource[] { originalSubResource }).iterator();
+                return Arrays.asList(new Resource[] {originalSubResource}).iterator();
             }
         });
     }
@@ -246,5 +254,4 @@ public class SuperimposingResourceProviderImplTest {
         Iterator<Resource> iterator = underTest.listChildren(mock(Resource.class));
         assertNull(iterator);
     }
-
 }
diff --git a/src/test/java/org/apache/sling/superimposing/impl/SuperimposingResourceTest.java b/src/test/java/org/apache/sling/superimposing/impl/SuperimposingResourceTest.java
index 96757cf..d975d3c 100644
--- a/src/test/java/org/apache/sling/superimposing/impl/SuperimposingResourceTest.java
+++ b/src/test/java/org/apache/sling/superimposing/impl/SuperimposingResourceTest.java
@@ -18,12 +18,6 @@
  */
 package org.apache.sling.superimposing.impl;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.mockito.Mockito.lenient;
-import static org.mockito.Mockito.when;
-
 import org.apache.sling.api.adapter.AdapterManager;
 import org.apache.sling.api.adapter.SlingAdaptable;
 import org.apache.sling.api.resource.Resource;
@@ -35,6 +29,12 @@ import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.mockito.Mockito.lenient;
+import static org.mockito.Mockito.when;
+
 @RunWith(MockitoJUnitRunner.class)
 public class SuperimposingResourceTest {
 
@@ -42,8 +42,10 @@ public class SuperimposingResourceTest {
 
     @Mock
     private Resource originalResource;
+
     @Mock
     private ResourceResolver resourceResolver;
+
     private ResourceMetadata resourceMetadata = new ResourceMetadata();
 
     private static final String ORIGINAL_PATH = "/root/path1";
@@ -78,8 +80,8 @@ public class SuperimposingResourceTest {
         SlingAdaptable.setAdapterManager(new AdapterManager() {
             @SuppressWarnings("unchecked")
             public <AdapterType> AdapterType getAdapter(Object adaptable, Class<AdapterType> type) {
-                if (adaptable instanceof SuperimposingResource && type==String.class) {
-                    return (AdapterType)"mystring";
+                if (adaptable instanceof SuperimposingResource && type == String.class) {
+                    return (AdapterType) "mystring";
                 }
                 return null;
             }
@@ -88,8 +90,7 @@ public class SuperimposingResourceTest {
         when(this.originalResource.adaptTo(Integer.class)).thenReturn(12345);
 
         assertEquals("mystring", underTest.adaptTo(String.class));
-        assertEquals((Integer)12345, underTest.adaptTo(Integer.class));
+        assertEquals((Integer) 12345, underTest.adaptTo(Integer.class));
         assertNull(underTest.adaptTo(Boolean.class));
     }
-
 }


(sling-org-apache-sling-superimposing) 01/02: SLING-12588 Update to Parent 62

Posted by ss...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sseifert pushed a commit to branch feature/SLING-12588-parent-62
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-superimposing.git

commit 913cee4d2c9a10fb1dc747d1f19fbaf78a30b31c
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Thu Dec 19 14:52:22 2024 +0100

    SLING-12588 Update to Parent 62
---
 .sling-module.json | 5 +++++
 pom.xml            | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/.sling-module.json b/.sling-module.json
new file mode 100644
index 0000000..cfad4d2
--- /dev/null
+++ b/.sling-module.json
@@ -0,0 +1,5 @@
+{
+  "jenkins": {
+    "jdks": [17, 21]
+  }
+}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 9b50f0d..6266cf0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling-bundle-parent</artifactId>
-        <version>46</version>
+        <version>62</version>
         <relativePath />
     </parent>