You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2023/08/07 16:49:32 UTC

[camel] 02/02: (chores) camel-jcr: avoid recreating the repository for every single test (#11011)

This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 1e9d2fc833f4c26ef468dc02e46fb36edb39676a
Author: Otavio Rodolfo Piske <or...@users.noreply.github.com>
AuthorDate: Sun Aug 6 10:04:00 2023 +0200

    (chores) camel-jcr: avoid recreating the repository for every single test (#11011)
    
    Signed-off-by: Otavio R. Piske <an...@gmail.com>
---
 .../src/test/java/org/apache/camel/component/jcr/JcrAuthTestBase.java | 4 +---
 .../test/java/org/apache/camel/component/jcr/JcrRouteTestSupport.java | 3 +--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrAuthTestBase.java b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrAuthTestBase.java
index 0c92e37aade..dd65fe36398 100644
--- a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrAuthTestBase.java
+++ b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrAuthTestBase.java
@@ -44,7 +44,7 @@ public abstract class JcrAuthTestBase extends CamelTestSupport {
 
     protected static final String REPO_PATH = "target/repository";
 
-    private Repository repository;
+    private static Repository repository = new TransientRepository(new File(REPO_PATH));
 
     @Override
     @BeforeEach
@@ -55,8 +55,6 @@ public abstract class JcrAuthTestBase extends CamelTestSupport {
 
     @Override
     protected void bindToRegistry(Registry registry) throws Exception {
-        repository = new TransientRepository(new File(REPO_PATH));
-
         // set up a user to authenticate
         SessionImpl session = (SessionImpl) repository
                 .login(new SimpleCredentials("admin", "admin".toCharArray()));
diff --git a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteTestSupport.java b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteTestSupport.java
index b116f002de5..75f4775fd4a 100644
--- a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteTestSupport.java
+++ b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteTestSupport.java
@@ -40,7 +40,7 @@ public abstract class JcrRouteTestSupport extends CamelTestSupport {
 
     protected static final String REPO_PATH = "target/repository-simple-security";
 
-    private Repository repository;
+    private static final Repository repository = new TransientRepository(CONFIG_FILE, REPO_PATH);
 
     @Override
     @BeforeEach
@@ -64,7 +64,6 @@ public abstract class JcrRouteTestSupport extends CamelTestSupport {
             throw new FileNotFoundException("Missing config file: " + config.getPath());
         }
 
-        repository = new TransientRepository(CONFIG_FILE, REPO_PATH);
         registry.bind("repository", repository);
     }
 }