jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1351356 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/stats/QueryStatCoreTest.java
Date Mon, 18 Jun 2012 14:16:39 GMT
Author: alexparvulescu
Date: Mon Jun 18 14:16:38 2012
New Revision: 1351356

URL: http://svn.apache.org/viewvc?rev=1351356&view=rev
Log:
JCR-3346 JMX Popular Queries size issue

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/stats/QueryStatCoreTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/stats/QueryStatCoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/stats/QueryStatCoreTest.java?rev=1351356&r1=1351355&r2=1351356&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/stats/QueryStatCoreTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/stats/QueryStatCoreTest.java
Mon Jun 18 14:16:38 2012
@@ -18,10 +18,8 @@ package org.apache.jackrabbit.core.stats
 
 import static javax.jcr.query.Query.JCR_SQL2;
 
-import javax.jcr.query.QueryManager;
+import java.util.concurrent.atomic.AtomicLong;
 
-import org.apache.jackrabbit.core.JackrabbitRepositoryStub;
-import org.apache.jackrabbit.core.RepositoryContext;
 import org.apache.jackrabbit.test.AbstractJCRTest;
 
 /**
@@ -30,27 +28,23 @@ import org.apache.jackrabbit.test.Abstra
 public class QueryStatCoreTest extends AbstractJCRTest {
 
     private QueryStatCore queryStat;
-    private QueryManager qm;
+
+    private AtomicLong token = new AtomicLong(System.currentTimeMillis());
 
     protected void setUp() throws Exception {
         super.setUp();
-        RepositoryContext context = JackrabbitRepositoryStub
-                .getRepositoryContext(superuser.getRepository());
-        queryStat = context.getStatManager().getQueryStat();
+        queryStat = new QueryStatImpl();
         queryStat.setEnabled(true);
-
-        qm = superuser.getWorkspace().getQueryManager();
     }
 
     protected void tearDown() throws Exception {
-        qm = null;
         super.tearDown();
     }
 
     private void runRandomQuery() throws Exception {
         String sql = "SELECT * FROM [nt:unstructured] as t where CONTAINS(t, '"
-                + System.currentTimeMillis() + "') ";
-        qm.createQuery(sql, JCR_SQL2).execute();
+                + token.getAndIncrement() + "') ";
+        queryStat.logQuery(JCR_SQL2, sql, 5);
     }
 
     public void testPopularQuery() throws Exception {



Mime
View raw message