-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve detection of index for "rep:ACL" nodes
Rely on EXPLAIN MEASURE and evaluate the estimated cost. This closes #714
- Loading branch information
Showing
2 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...controltool-bundle/src/test/java/biz/netcentric/cq/tools/actool/helper/QueryHelperIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* (C) Copyright 2023 Cognizant Netcentric. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package biz.netcentric.cq.tools.actool.helper; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.io.IOException; | ||
|
||
import javax.jcr.Node; | ||
import javax.jcr.RepositoryException; | ||
import javax.jcr.Session; | ||
|
||
import org.apache.jackrabbit.commons.JcrUtils; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
|
||
import biz.netcentric.cq.tools.actool.extensions.OakRepository; | ||
|
||
@ExtendWith(OakRepository.class) | ||
class QueryHelperIT { | ||
|
||
@Test | ||
void testHasQueryIndexForACLs(Session session) throws RepositoryException, JsonProcessingException, IOException { | ||
// create more nodes than the threshold to have a realistic cost for traversal | ||
createNodes(JcrUtils.getOrAddNode(session.getRootNode(), "tmp"), 256); | ||
session.save(); | ||
// FIXME: the default oak repo does always have a node type index provider (NodeTypeIndexProvider) and an according index definition at "/oak:index/nodetype" | ||
assertTrue(QueryHelper.hasQueryIndexForACLs(session)); | ||
} | ||
|
||
private static void createNodes(Node rootNode, int numNodes) throws RepositoryException { | ||
for (int n=0; n<numNodes; n++) { | ||
JcrUtils.getOrAddNode(rootNode, "Node"+n); | ||
} | ||
} | ||
} |