You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by GitBox <gi...@apache.org> on 2022/04/25 13:08:24 UTC

[GitHub] [jackrabbit-oak] mreutegg commented on a diff in pull request #550: OAK-9751 : handled cases where path changes in lucene exceeds max bui…

mreutegg commented on code in PR #550:
URL: https://github.com/apache/jackrabbit-oak/pull/550#discussion_r857606356


##########
oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/LuceneJournalPropertyBuilderTest.java:
##########
@@ -53,7 +53,25 @@ public void nullOrEmptyJson() throws Exception{
 
         assertTrue(Iterables.isEmpty(((IndexedPaths)builder2.build())));
     }
+    @Test
+    public void addJsonLessThanMaxBuilderSize() throws Exception {
+        String a = null;
+        for (int i = 0; i < 499; i++) {
+            a = "{\"/var/eventing/jobs/foo/2022/4/19/14/27/af96fcfa9e32_8589" + i + "\" :[\"/oak:index/foo\",\"/oak:index/bar\"]}";
+            builder.addSerializedProperty(a);
+        }
+        assertEquals(createdIndexPathMap((IndexedPaths)builder.build()).size(), 998);

Review Comment:
   Please swap the two arguments for assertEquals(). The first argument is the expected value, which is 998 in this test.



##########
oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/LuceneJournalPropertyBuilderTest.java:
##########
@@ -53,7 +53,25 @@ public void nullOrEmptyJson() throws Exception{
 
         assertTrue(Iterables.isEmpty(((IndexedPaths)builder2.build())));
     }
+    @Test
+    public void addJsonLessThanMaxBuilderSize() throws Exception {
+        String a = null;
+        for (int i = 0; i < 499; i++) {
+            a = "{\"/var/eventing/jobs/foo/2022/4/19/14/27/af96fcfa9e32_8589" + i + "\" :[\"/oak:index/foo\",\"/oak:index/bar\"]}";
+            builder.addSerializedProperty(a);
+        }
+        assertEquals(createdIndexPathMap((IndexedPaths)builder.build()).size(), 998);
+    }
 
+    @Test
+    public void addJsonBiggerThanMaxBuilderSize() throws Exception {
+        String a = null;
+        for (int i = 0; i < 502; i++) {
+            a = "{\"/var/eventing/jobs/foo/2022/4/19/14/27/af96fcfa9e32_8589" + i + "\" :[\"/oak:index/foo\",\"/oak:index/bar\"]}";
+            builder.addSerializedProperty(a);
+        }
+        assertEquals(createdIndexPathMap((IndexedPaths)builder.build()).size(), 1000);

Review Comment:
   Same as above. Please swap the two arguments to assertEquals().



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org