You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2015/07/03 15:45:59 UTC

svn commit: r1689012 - /sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/RegisteredResourceComparatorTest.java

Author: bdelacretaz
Date: Fri Jul  3 13:45:59 2015
New Revision: 1689012

URL: http://svn.apache.org/r1689012
Log:
SLING-4854 - add ignored test that demonstrates the issue

Modified:
    sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/RegisteredResourceComparatorTest.java

Modified: sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/RegisteredResourceComparatorTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/RegisteredResourceComparatorTest.java?rev=1689012&r1=1689011&r2=1689012&view=diff
==============================================================================
--- sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/RegisteredResourceComparatorTest.java (original)
+++ sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/RegisteredResourceComparatorTest.java Fri Jul  3 13:45:59 2015
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.util.Dictionary;
 import java.util.Hashtable;
@@ -33,6 +34,7 @@ import org.apache.sling.installer.api.In
 import org.apache.sling.installer.api.tasks.RegisteredResource;
 import org.apache.sling.installer.api.tasks.ResourceState;
 import org.apache.sling.installer.api.tasks.TransformationResult;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class RegisteredResourceComparatorTest {
@@ -79,6 +81,13 @@ public class RegisteredResourceComparato
         }
         return result;
     }
+    
+    private RegisteredResource untransformedResource(String id, int prio) throws IOException {
+        final ByteArrayInputStream is = new ByteArrayInputStream(id.getBytes("UTF-8")); 
+        final InstallableResource r = new InstallableResource(id, is, null, id, id, prio);
+        final InternalResource internal = InternalResource.create("test", r);
+        return RegisteredResourceImpl.create(internal);
+    }
 
     private void assertOrder(RegisteredResource[] inOrder) {
         final SortedSet<RegisteredResource> toTest = new TreeSet<RegisteredResource>();
@@ -209,4 +218,15 @@ public class RegisteredResourceComparato
         inOrder[1] = getConfig("pidA", null, 100, "b", ResourceState.INSTALL);
         assertOrder(inOrder);
     }
+    
+    @Test
+    @Ignore("SLING-4854")
+    public void testNullEntityId() throws IOException {
+        final SortedSet<RegisteredResource> set = new TreeSet<RegisteredResource>();
+        final RegisteredResource a = untransformedResource("a", 1);
+        final RegisteredResource b = untransformedResource("b", 2);
+        set.add(a);
+        set.add(b);
+        assertEquals("Expecting a to be first", set.first(), a);
+    }
 }
\ No newline at end of file