You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2022/03/29 21:44:38 UTC
[sling-org-apache-sling-jcr-resource] branch SLING-11229 updated: SLING-11229 adding shared test classes
This is an automated email from the ASF dual-hosted git repository.
dklco pushed a commit to branch SLING-11229
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-resource.git
The following commit(s) were added to refs/heads/SLING-11229 by this push:
new af5294a SLING-11229 adding shared test classes
af5294a is described below
commit af5294a83af80c169f64d7a12f0b83929fa78729
Author: Dan Klco <kl...@adobe.com>
AuthorDate: Tue Mar 29 17:44:31 2022 -0400
SLING-11229 adding shared test classes
---
.../{ => internal}/SimpleProviderContext.java | 0
.../helper/jcr/JcrResourceProviderQueryTest.java | 29 +------------
.../JcrResourceProviderSessionHandlingTest.java | 15 +------
.../helper/jcr/JcrResourceProviderTest.java | 17 +-------
.../resource/internal/helper/jcr/SimpleConfig.java | 47 ++++++++++++++++++++++
5 files changed, 51 insertions(+), 57 deletions(-)
diff --git a/src/test/java/org/apache/sling/jcr/resource/SimpleProviderContext.java b/src/test/java/org/apache/sling/jcr/resource/internal/SimpleProviderContext.java
similarity index 100%
rename from src/test/java/org/apache/sling/jcr/resource/SimpleProviderContext.java
rename to src/test/java/org/apache/sling/jcr/resource/internal/SimpleProviderContext.java
diff --git a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderQueryTest.java b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderQueryTest.java
index e1db1f7..804a044 100644
--- a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderQueryTest.java
+++ b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderQueryTest.java
@@ -18,7 +18,6 @@
*/
package org.apache.sling.jcr.resource.internal.helper.jcr;
-import java.lang.annotation.Annotation;
import java.util.Iterator;
import javax.jcr.Node;
@@ -29,7 +28,7 @@ import javax.jcr.nodetype.NodeType;
import javax.jcr.query.Query;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.jcr.resource.SimpleProviderContext;
+import org.apache.sling.jcr.resource.internal.SimpleProviderContext;
import org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.Config;
import org.apache.sling.spi.resource.provider.ProviderContext;
import org.apache.sling.spi.resource.provider.ResolveContext;
@@ -111,30 +110,6 @@ public class JcrResourceProviderQueryTest extends SlingRepositoryTestBase {
}
}
- private static class SimpleConfig implements JcrResourceProvider.Config {
- private final boolean enabled;
- private final long limit;
-
- public SimpleConfig(boolean enabled, long limit) {
- this.enabled = enabled;
- this.limit = limit;
- }
-
- @Override
- public Class<? extends Annotation> annotationType() {
- return null;
- }
-
- @Override
- public boolean enable_query_limit() {
- return enabled;
- }
-
- @Override
- public long query_limit() {
- return this.limit;
- }
-
- }
+
}
diff --git a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderSessionHandlingTest.java b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderSessionHandlingTest.java
index 2e2d4bb..59e9311 100644
--- a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderSessionHandlingTest.java
+++ b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderSessionHandlingTest.java
@@ -237,20 +237,7 @@ public class JcrResourceProviderSessionHandlingTest {
when(ctx.locateService(anyString(), Mockito.<ServiceReference<Object>>any())).thenReturn(repo);
jcrResourceProvider = new JcrResourceProvider();
- jcrResourceProvider.activate(ctx, new Config() {
- @Override
- public Class<? extends Annotation> annotationType() {
- return null;
- }
- @Override
- public boolean enable_query_limit() {
- return false;
- }
- @Override
- public long query_limit() {
- return 0;
- }
- });
+ jcrResourceProvider.activate(ctx, new SimpleConfig(false, -1));
jcrProviderState = jcrResourceProvider.authenticate(authInfo);
}
diff --git a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderTest.java b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderTest.java
index 2fb00db..9deb85a 100644
--- a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderTest.java
+++ b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderTest.java
@@ -18,7 +18,6 @@
*/
package org.apache.sling.jcr.resource.internal.helper.jcr;
-import java.lang.annotation.Annotation;
import java.security.Principal;
import javax.jcr.Node;
@@ -29,7 +28,6 @@ import javax.jcr.nodetype.NodeType;
import org.apache.sling.api.resource.PersistenceException;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.Config;
import org.apache.sling.spi.resource.provider.ResolveContext;
import org.apache.sling.spi.resource.provider.ResourceContext;
import org.junit.Assert;
@@ -51,20 +49,7 @@ public class JcrResourceProviderTest extends SlingRepositoryTestBase {
ComponentContext ctx = Mockito.mock(ComponentContext.class);
Mockito.when(ctx.locateService(Mockito.anyString(), Mockito.any(ServiceReference.class))).thenReturn(repo);
jcrResourceProvider = new JcrResourceProvider();
- jcrResourceProvider.activate(ctx, new Config() {
- @Override
- public Class<? extends Annotation> annotationType() {
- return null;
- }
- @Override
- public boolean enable_query_limit() {
- return false;
- }
- @Override
- public long query_limit() {
- return 0;
- }
- });
+ jcrResourceProvider.activate(ctx, new SimpleConfig(false, -1));
}
@Override
diff --git a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/SimpleConfig.java b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/SimpleConfig.java
new file mode 100644
index 0000000..a4e7f12
--- /dev/null
+++ b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/SimpleConfig.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.resource.internal.helper.jcr;
+
+import java.lang.annotation.Annotation;
+
+public class SimpleConfig implements JcrResourceProvider.Config {
+ private final boolean enabled;
+ private final long limit;
+
+ public SimpleConfig(boolean enabled, long limit) {
+ this.enabled = enabled;
+ this.limit = limit;
+ }
+
+ @Override
+ public Class<? extends Annotation> annotationType() {
+ return null;
+ }
+
+ @Override
+ public boolean enable_query_limit() {
+ return enabled;
+ }
+
+ @Override
+ public long query_limit() {
+ return this.limit;
+ }
+
+}
\ No newline at end of file