incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1538569 - /sling/trunk/bundles/jcr/it-jackrabbit-oak/src/test/java/org/apache/sling/jcr/repository/it/CommonTests.java
Date Mon, 04 Nov 2013 11:58:27 GMT
Author: bdelacretaz
Date: Mon Nov  4 11:58:26 2013
New Revision: 1538569

URL: http://svn.apache.org/r1538569
Log:
add uniqueName utility

Modified:
    sling/trunk/bundles/jcr/it-jackrabbit-oak/src/test/java/org/apache/sling/jcr/repository/it/CommonTests.java

Modified: sling/trunk/bundles/jcr/it-jackrabbit-oak/src/test/java/org/apache/sling/jcr/repository/it/CommonTests.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/it-jackrabbit-oak/src/test/java/org/apache/sling/jcr/repository/it/CommonTests.java?rev=1538569&r1=1538568&r2=1538569&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/it-jackrabbit-oak/src/test/java/org/apache/sling/jcr/repository/it/CommonTests.java
(original)
+++ sling/trunk/bundles/jcr/it-jackrabbit-oak/src/test/java/org/apache/sling/jcr/repository/it/CommonTests.java
Mon Nov  4 11:58:26 2013
@@ -57,7 +57,6 @@ import org.slf4j.LoggerFactory;
 public abstract class CommonTests {
 
     private final Logger log = LoggerFactory.getLogger(getClass());
-    private final AtomicInteger counter = new AtomicInteger();
     
     @Inject
     protected SlingRepository repository;
@@ -70,6 +69,7 @@ public abstract class CommonTests {
     protected abstract void doCheckRepositoryDescriptors();
     
     private final List<String> toDelete = new LinkedList<String>();
+    private final AtomicInteger uniqueNameCounter = new AtomicInteger();
     
     private <ItemType extends Item> ItemType deleteAfterTests(ItemType it) throws RepositoryException
{
         toDelete.add(it.getPath());
@@ -83,7 +83,7 @@ public abstract class CommonTests {
         Session s = repository.loginAdministrative(null);
         try {
             final Node root = s.getRootNode();
-            final String name = "TEST_" + counter.incrementAndGet() + "_" + System.currentTimeMillis();
+            final String name = uniqueName("assertCreateRetrieveNode");
             final String propName = "PN_" + name;
             final String propValue = "PV_" + name;
             final Node child = nodeType == null ? root.addNode(name) : root.addNode(name,
nodeType);
@@ -100,6 +100,10 @@ public abstract class CommonTests {
             s.logout();
         }
     }
+    
+    protected String uniqueName(String hint) {
+        return hint + "_" + uniqueNameCounter.incrementAndGet() + "_" + System.currentTimeMillis();
+    }
 
     @After
     public void deleteTestItems() throws RepositoryException {
@@ -287,7 +291,7 @@ public abstract class CommonTests {
         final Session s = repository.loginAdministrative(null);
         final int nPaths = 500;
         final int timeoutMsec = 5000;
-        final String prefix = "testOsgiResourceEvents_" + counter.incrementAndGet() + "_"
+ System.currentTimeMillis();
+        final String prefix = uniqueName("testOsgiResourceEvents");
         
         try {
             for(int i=0; i  < nPaths; i++) {



Mime
View raw message