sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] cziegeler closed pull request #1: SLING-7366 OrderBefore property not being honored during resource mer?
Date Thu, 01 Jan 1970 00:00:00 GMT
cziegeler closed pull request #1: SLING-7366 OrderBefore property not being honored during
resource mer?
URL: https://github.com/apache/sling-org-apache-sling-resourcemerger/pull/1
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java
b/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java
index 8cf6d2b..3ba9c9e 100644
--- a/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java
+++ b/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java
@@ -378,7 +378,6 @@ public Resource getResource(final ResolveContext<Void> ctx, final
String path, f
                     if (orderBeforeIndex > -1) {
                         candidates.add(orderBeforeIndex, holder);
                         candidates.remove(candidates.size() - 1);
-                        previousChildPositionInCandidateList = orderBeforeIndex;
                     } else {
                         // or reorder because overlaid resource has a different order
                         if (childPositionInCandidateList != -1 && previousChildPositionInCandidateList
!= -1) {
diff --git a/src/test/java/org/apache/sling/resourcemerger/impl/CommonMergedResourceProviderTest.java
b/src/test/java/org/apache/sling/resourcemerger/impl/CommonMergedResourceProviderTest.java
index c213d99..07c1904 100644
--- a/src/test/java/org/apache/sling/resourcemerger/impl/CommonMergedResourceProviderTest.java
+++ b/src/test/java/org/apache/sling/resourcemerger/impl/CommonMergedResourceProviderTest.java
@@ -402,12 +402,20 @@ public void testOrderBeingModifiedThroughOrderBefore() throws PersistenceExcepti
         MockHelper.create(this.resolver)
             .resource("/apps/base/child1")
             .resource("/apps/base/child2")
-            .resource("/apps/overlay/child3").p(MergedResourceConstants.PN_ORDER_BEFORE,
"child2")
+            .resource("/apps/base/child3")
+            .resource("/apps/base/child4")
+            .resource("/apps/overlay/child5").p(MergedResourceConstants.PN_ORDER_BEFORE,
"child2")
+            .resource("/apps/overlay/child6").p(MergedResourceConstants.PN_ORDER_BEFORE,
"child2")
+            .resource("/apps/overlay/child7").p(MergedResourceConstants.PN_ORDER_BEFORE,
"child4")
+            .resource("/apps/overlay/child8").p(MergedResourceConstants.PN_ORDER_BEFORE,
"child3")
+            .resource("/apps/overlay/child9").p(MergedResourceConstants.PN_ORDER_BEFORE,
"child3")
+            .resource("/apps/overlay/child10")
+            .resource("/apps/overlay/child3")
             .commit();
         Resource mergedResource = this.provider.getResource(ctx, "/merged", ResourceContext.EMPTY_CONTEXT,
null);
         // convert the iterator returned by list children into an iterable (to be able to
perform some tests)
         IteratorIterable<Resource> iterable = new IteratorIterable<Resource>(provider.listChildren(ctx,
mergedResource), true);
         
-        Assert.assertThat(iterable, Matchers.contains(ResourceMatchers.name("child1"),ResourceMatchers.name("child3"),
ResourceMatchers.name("child2")));
+        Assert.assertThat(iterable, Matchers.contains(ResourceMatchers.name("child1"),ResourceMatchers.name("child5"),
ResourceMatchers.name("child6"), ResourceMatchers.name("child2"), ResourceMatchers.name("child8"),ResourceMatchers.name("child9"),
ResourceMatchers.name("child7"),ResourceMatchers.name("child4"),ResourceMatchers.name("child10"),ResourceMatchers.name("child3")));
     }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message