sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SLING-7366) Sling Resource Merger: Order Before Property not being honored during resource merging
Date Wed, 10 Jan 2018 09:51:01 GMT

    [ https://issues.apache.org/jira/browse/SLING-7366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16319980#comment-16319980
] 

ASF GitHub Bot commented on SLING-7366:
---------------------------------------

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


> Sling Resource Merger: Order Before Property not being honored during resource merging
> --------------------------------------------------------------------------------------
>
>                 Key: SLING-7366
>                 URL: https://issues.apache.org/jira/browse/SLING-7366
>             Project: Sling
>          Issue Type: Bug
>    Affects Versions: Resource Merger 1.3.4
>            Reporter: Rishi Mehta
>            Priority: Critical
>
> Due to the changes in https://issues.apache.org/jira/browse/SLING-6956, the *orderBefore*
property in resource is not honored correctly during resource merging.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message