jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1503614 - in /jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark: AbstractTest.java FlatTreeWithAceForSamePrincipalTest.java
Date Tue, 16 Jul 2013 08:39:00 GMT
Author: angela
Date: Tue Jul 16 08:39:00 2013
New Revision: 1503614

URL: http://svn.apache.org/r1503614
Log:
OAK-887 : test was missing cleanup after test completion

Modified:
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/FlatTreeWithAceForSamePrincipalTest.java

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java?rev=1503614&r1=1503613&r2=1503614&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java
Tue Jul 16 08:39:00 2013
@@ -34,10 +34,11 @@ import org.apache.jackrabbit.oak.fixture
  */
 abstract class AbstractTest extends Benchmark {
 
+    private static final Credentials CREDENTIALS = new SimpleCredentials("admin", "admin".toCharArray());
+
     private static final int WARMUP = Integer.getInteger("warmup", 5);
 
-    private static final long RUNTIME =
-            TimeUnit.SECONDS.toMillis(Long.getLong("runtime", 60));
+    private static final long RUNTIME = TimeUnit.SECONDS.toMillis(Long.getLong("runtime",
60));
 
     private Repository repository;
 
@@ -107,9 +108,6 @@ abstract class AbstractTest extends Benc
         }
     }
 
-    private static final Credentials CREDENTIALS =
-            new SimpleCredentials("admin", "admin".toCharArray());
-
     private DescriptiveStatistics runTest(Repository repository) throws Exception {
         DescriptiveStatistics statistics = new DescriptiveStatistics();
 

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/FlatTreeWithAceForSamePrincipalTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/FlatTreeWithAceForSamePrincipalTest.java?rev=1503614&r1=1503613&r2=1503614&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/FlatTreeWithAceForSamePrincipalTest.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/FlatTreeWithAceForSamePrincipalTest.java
Tue Jul 16 08:39:00 2013
@@ -30,24 +30,28 @@ import org.apache.jackrabbit.oak.spi.sec
 
 public class FlatTreeWithAceForSamePrincipalTest extends AbstractTest {
 
+    private static final String TEST_USER_ID = "test";
+
+    private UserManager userManager;
+
+    private Session admin;
 	private Session reader;
 
 	@Override
 	protected void beforeSuite() throws Exception {
 
 		long start = System.currentTimeMillis();
-		Session writer = loginWriter();
 
-		UserManager userManager = ((JackrabbitSession) writer).getUserManager();
-        String userId = "test";
-		Principal userPrincipal = userManager.createUser(userId, userId).getPrincipal();
+		admin = loginWriter();
+		userManager = ((JackrabbitSession) admin).getUserManager();
+		Principal userPrincipal = userManager.createUser(TEST_USER_ID, TEST_USER_ID).getPrincipal();
 
-		AccessControlManager acm = writer.getAccessControlManager();
+		AccessControlManager acm = admin.getAccessControlManager();
 		JackrabbitAccessControlList acl = AccessControlUtils.getAccessControlList(acm, "/");
 		acl.addEntry(userPrincipal, AccessControlUtils.privilegesFromNames(acm, PrivilegeConstants.JCR_READ),
true);
 		acm.setPolicy("/", acl);
 
-		Node a = writer.getRootNode().addNode("a");
+		Node a = admin.getRootNode().addNode("a");
 		for (int i = 1; i < 10000; i++) {
 			a.addNode("node" + i);
 			acl = AccessControlUtils.getAccessControlList(acm, "/a/node"+i);
@@ -55,8 +59,8 @@ public class FlatTreeWithAceForSamePrinc
 			acm.setPolicy("/a/node"+i, acl);
 		}
 
-		writer.save();
-		reader = login(new SimpleCredentials(userId, userId.toCharArray()));
+		admin.save();
+		reader = login(new SimpleCredentials(TEST_USER_ID, TEST_USER_ID.toCharArray()));
 
 		long end = System.currentTimeMillis();
 		System.out.println("time "+(end - start));
@@ -75,7 +79,13 @@ public class FlatTreeWithAceForSamePrinc
 	}
 
 	protected void afterSuite() throws Exception {
-		 
+        Node root = admin.getRootNode();
+        if (root.hasNode("a")) {
+            root.getNode("a").remove();
+        }
+		if (userManager != null) {
+            userManager.getAuthorizable(TEST_USER_ID).remove();
+        }
+        admin.save();
 	}
-
 }



Mime
View raw message