henrykuijpers commented on a change in pull request #46:
URL:
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/46#discussion_r649823690
##########
File path:
src/test/java/org/apache/sling/resourceresolver/impl/mapping/MapEntriesTest.java
##########
@@ -370,26 +381,31 @@ public void test_vanity_path_updates() throws Exception {
@Test
public void test_vanity_path_registration_include_exclude() throws
IOException {
final String[] validPaths = {"/libs/somewhere", "/libs/a/b", "/foo/a",
"/baa/a"};
- final String[] invalidPaths = {"/libs/denied/a", "/libs/denied/b/c",
"/nowhere"};
final List<Resource> resources = new ArrayList<>();
for(final String val : validPaths) {
resources.add(getVanityPathResource(val));
}
- for(final String val : invalidPaths) {
- resources.add(getVanityPathResource(val));
- }
-
-
- when(resourceResolver.findResources(anyString(),
eq("sql"))).thenAnswer(new Answer<Iterator<Resource>>() {
-
- @Override
- public Iterator<Resource> answer(InvocationOnMock invocation)
throws Throwable {
- if
(invocation.getArguments()[0].toString().contains("sling:vanityPath")) {
- return resources.iterator();
- } else {
- return Collections.<Resource> emptySet().iterator();
- }
+ when(resourceResolver.findResources(anyString(),
eq("sql"))).thenAnswer((Answer<Iterator<Resource>>) invocation -> {
Review comment:
As far as I know, the execution of querys isn't implemented anywhere in
the testing code that we have a available. IIUC, we need an actual instance to
be able to execute querys and thus validating the query syntax and also the
proper execution of the query.
What I've done is indeed making sure that the expected query is being
executed.
I think factoring out query code etc etc might be one mile too far for what
we're trying to achieve in this ticket? For us, given our big version storage,
it's quite important that those paths will not be considered anymore.
##########
File path:
src/test/java/org/apache/sling/resourceresolver/impl/mapping/MapEntriesTest.java
##########
@@ -370,26 +381,31 @@ public void test_vanity_path_updates() throws Exception {
@Test
public void test_vanity_path_registration_include_exclude() throws
IOException {
final String[] validPaths = {"/libs/somewhere", "/libs/a/b", "/foo/a",
"/baa/a"};
- final String[] invalidPaths = {"/libs/denied/a", "/libs/denied/b/c",
"/nowhere"};
final List<Resource> resources = new ArrayList<>();
for(final String val : validPaths) {
resources.add(getVanityPathResource(val));
}
- for(final String val : invalidPaths) {
- resources.add(getVanityPathResource(val));
- }
-
-
- when(resourceResolver.findResources(anyString(),
eq("sql"))).thenAnswer(new Answer<Iterator<Resource>>() {
-
- @Override
- public Iterator<Resource> answer(InvocationOnMock invocation)
throws Throwable {
- if
(invocation.getArguments()[0].toString().contains("sling:vanityPath")) {
- return resources.iterator();
- } else {
- return Collections.<Resource> emptySet().iterator();
- }
+ when(resourceResolver.findResources(anyString(),
eq("sql"))).thenAnswer((Answer<Iterator<Resource>>) invocation -> {
Review comment:
Just added that comment anyway. :)
@bdelacretaz Do you know of a way to test querys with a real query engine,
without booting a Sling instance?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]