-
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
3 changed files
with
122 additions
and
10 deletions.
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
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
50 changes: 50 additions & 0 deletions
50
...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,50 @@ | ||
/* | ||
* (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.PropertyType; | ||
import javax.jcr.RepositoryException; | ||
import javax.jcr.Session; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import biz.netcentric.cq.tools.actool.extensions.OakRepository; | ||
|
||
class QueryHelperIT { | ||
|
||
@RegisterExtension | ||
static final OakRepository repository = new OakRepository(false); | ||
|
||
@Test | ||
void testHasQueryIndexForACLsWithoutIndex(Session session) throws RepositoryException, IOException { | ||
// adjust nodetype index definition (at /oak:index/nodetype) to reflect what is configured in AEM | ||
Node ntIndexDefNode = session.getNode("/oak:index/nodetype"); | ||
ntIndexDefNode.setProperty("declaringNodeTypes", new String[] { "oak:QueryIndexDefinition", "rep:User", "rep:Authorizable" }, PropertyType.NAME); | ||
session.save(); | ||
assertFalse(QueryHelper.hasQueryIndexForACLs(session)); | ||
} | ||
|
||
@Test | ||
void testHasQueryIndexForACLsWithIndex(Session session) throws RepositoryException, IOException { | ||
// adjust nodetype index definition (at /oak:index/nodetype) to include rep:ACL | ||
// this is a different type than shipped with ACTool (Lucene), but lucene based index providers are hard to set up in an IT | ||
Node ntIndexDefNode = session.getNode("/oak:index/nodetype"); | ||
ntIndexDefNode.setProperty("declaringNodeTypes", new String[] { "oak:QueryIndexDefinition", "rep:User", "rep:Authorizable", "rep:ACL" }, PropertyType.NAME); | ||
session.save(); | ||
assertTrue(QueryHelper.hasQueryIndexForACLs(session)); | ||
} | ||
|
||
} |