bhabegger commented on code in PR #2961:
URL: https://github.com/apache/jackrabbit-oak/pull/2961#discussion_r3442861607
##########
oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/diff/DiffIndexTest.java:
##########
@@ -259,6 +260,112 @@ public void testDiffIndexUpdate() throws Exception {
assertSameJson("{}", repositoryDefinitions.toString());
}
+ @Test
+ public void testDiffIndexUpdateUnversionedOotbExplicit() throws Exception {
+ NodeStore store = new MemoryNodeStore(INITIAL_CONTENT);
+
+ List<IndexEditorProvider> indexEditors = List.of(
+ new ReferenceEditorProvider(), new
PropertyIndexEditorProvider(), new NodeCounterEditorProvider());
+ IndexEditorProvider provider =
CompositeIndexEditorProvider.compose(indexEditors);
+ EditorHook hook = new EditorHook(new IndexUpdateProvider(provider));
+
+ // seed the store with an unversioned OOTB index /oak:index/test (type
lucene)
+ NodeBuilder builder = store.getRoot().builder();
+ builder.child(INDEX_DEFINITIONS_NAME).child("test")
+ .setProperty("jcr:primaryType",
IndexConstants.INDEX_DEFINITIONS_NODE_TYPE, Type.NAME)
+ .setProperty(TYPE_PROPERTY_NAME, "lucene");
+ store.merge(builder, hook, CommitInfo.EMPTY);
+
+ // diff adds indexRules to the product index
+ storeDiff(store, "2026-01-01T00:00:00.000Z",
+ "{ \"test\": {"
+ + " \"indexRules\": {"
+ + " \"nt:base\": {"
+ + " \"properties\": {"
+ + " \"prop1\": { \"name\": \"prop1\",
\"propertyIndex\": true }"
+ + " }"
+ + " }"
+ + " }"
+ + "} }");
+
+ // expect test-custom-1 with:
+ // - type "lucene" from the product index
+ // - indexRules/nt:base/properties/prop1 from the diff
+ assertSameJson("{\n"
Review Comment:
As `test-custom-1` is what we are testing maybe we can content ourselves of
asserting that ?
Couldn't we have an existence test by checking a path from
`RootIndexesListService.getRootIndexDefinitions(store, "lucene")` ?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]