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

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


The following commit(s) were added to refs/heads/main by this push:
     new e2a67a898b9 (chores) camel-jcr: avoid recreating the repository for 
every single test (#11011)
e2a67a898b9 is described below

commit e2a67a898b94749a6b00b2f43c397f60e3b1c771
Author: Otavio Rodolfo Piske <[email protected]>
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 <[email protected]>
---
 .../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);
     }
 }

Reply via email to