SLING-8621 - TestUtil.cleanup causes in WARNing due to SlingContext Rule
Outright remove TestUtil.cleanup since it only operates on sessions managed by the SlingContext.
diff --git a/src/test/java/org/apache/sling/jcr/repoinit/ExecutionOrderTest.java b/src/test/java/org/apache/sling/jcr/repoinit/ExecutionOrderTest.java
index 0369d88..92fa512 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/ExecutionOrderTest.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/ExecutionOrderTest.java
@@ -27,7 +27,6 @@
import org.apache.sling.repoinit.parser.RepoInitParsingException;
import org.apache.sling.testing.mock.sling.ResourceResolverType;
import org.apache.sling.testing.mock.sling.junit.SlingContext;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -58,14 +57,9 @@
U.parseAndExecute(stmt);
}
- @After
- public void cleanup() throws RepositoryException, RepoInitParsingException {
- U.cleanup();
- }
-
@Test
public void pathCreated() throws PathNotFoundException, RepositoryException {
final Node n = U.getAdminSession().getNode("/" + REL_PATH);
assertEquals(NS_PREFIX + ":foo", n.getProperty("jcr:primaryType").getString());
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/apache/sling/jcr/repoinit/RegisterNamespacesTest.java b/src/test/java/org/apache/sling/jcr/repoinit/RegisterNamespacesTest.java
index 03d1df9..004af9b 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/RegisterNamespacesTest.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/RegisterNamespacesTest.java
@@ -27,7 +27,6 @@
import org.apache.sling.repoinit.parser.RepoInitParsingException;
import org.apache.sling.testing.mock.sling.ResourceResolverType;
import org.apache.sling.testing.mock.sling.junit.SlingContext;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -53,11 +52,6 @@
ns = U.getAdminSession().getWorkspace().getNamespaceRegistry();
}
- @After
- public void cleanup() throws RepositoryException, RepoInitParsingException {
- U.cleanup();
- }
-
@Test
public void NS1registered() throws Exception {
assertEquals(NS1, ns.getURI("one"));
diff --git a/src/test/java/org/apache/sling/jcr/repoinit/RegisterNodetypesTest.java b/src/test/java/org/apache/sling/jcr/repoinit/RegisterNodetypesTest.java
index 8b652d1..efaed73 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/RegisterNodetypesTest.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/RegisterNodetypesTest.java
@@ -27,7 +27,6 @@
import org.apache.sling.repoinit.parser.RepoInitParsingException;
import org.apache.sling.testing.mock.sling.ResourceResolverType;
import org.apache.sling.testing.mock.sling.junit.SlingContext;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -51,11 +50,6 @@
U.parseAndExecute(U.getTestCndStatement(NS_PREFIX, NS_URI));
}
- @After
- public void cleanup() throws RepositoryException, RepoInitParsingException {
- U.cleanup();
- }
-
@Test
public void NSregistered() throws Exception {
final NamespaceRegistry ns = U.getAdminSession().getWorkspace().getNamespaceRegistry();
@@ -66,4 +60,4 @@
public void fooNodetypeRegistered() throws Exception {
U.getAdminSession().getRootNode().addNode("test_" + TEST_ID, NS_PREFIX + ":foo");
}
- }
\ No newline at end of file
+ }
diff --git a/src/test/java/org/apache/sling/jcr/repoinit/RegisterPrivilegeTest.java b/src/test/java/org/apache/sling/jcr/repoinit/RegisterPrivilegeTest.java
index 6311167..c2ffe2f 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/RegisterPrivilegeTest.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/RegisterPrivilegeTest.java
@@ -21,7 +21,6 @@
import org.apache.sling.repoinit.parser.RepoInitParsingException;
import org.apache.sling.testing.mock.sling.ResourceResolverType;
import org.apache.sling.testing.mock.sling.junit.SlingContext;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -53,11 +52,6 @@
U.parseAndExecute("register abstract privilege withabstract_withaggregates with withoutabstract_withoutaggregates1,withoutabstract_withoutaggregates3");
}
- @After
- public void cleanup() throws RepositoryException, RepoInitParsingException {
- U.cleanup();
- }
-
@Test
public void testRegisterPrivilegeWithoutAbstractWithoutAggregates() throws Exception {
Privilege privilege = ((JackrabbitWorkspace) U.getAdminSession().getWorkspace()).getPrivilegeManager().getPrivilege("withoutabstract_withoutaggregates1");
diff --git a/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java b/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java
index aabbe4b..f3a1d99 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java
@@ -25,7 +25,6 @@
import org.apache.sling.repoinit.parser.RepoInitParsingException;
import org.apache.sling.testing.mock.sling.ResourceResolverType;
import org.apache.sling.testing.mock.sling.junit.SlingContext;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -55,11 +54,6 @@
uniqueId = UUID.randomUUID().toString();
}
- @After
- public void cleanup() {
- U.cleanup();
- }
-
@Test
public void testSyncServiceUserCreation() throws Exception {
@@ -96,4 +90,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/apache/sling/jcr/repoinit/impl/TestUtil.java b/src/test/java/org/apache/sling/jcr/repoinit/impl/TestUtil.java
index f57fee9..b1b86e9 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/impl/TestUtil.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/impl/TestUtil.java
@@ -198,10 +198,6 @@
return adminSession;
}
- public void cleanup() {
- adminSession.logout();
- }
-
public String getTestCndStatement(String nsPrefix, String nsURI) throws RepositoryException, RepoInitParsingException {
return "register nodetypes\n"
+ "<<===\n"