You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sirona.apache.org by ol...@apache.org on 2014/03/04 03:47:04 UTC

svn commit: r1573844 - in /incubator/sirona/trunk: core/src/main/java/org/apache/sirona/store/tracking/ core/src/test/java/org/apache/sirona/store/tracking/ server/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/pathtracking/ server/repo...

Author: olamy
Date: Tue Mar  4 02:47:03 2014
New Revision: 1573844

URL: http://svn.apache.org/r1573844
Log:
fix reporting unit test issues with adding an easy to setup DefaultPathTrackingDataStore

Added:
    incubator/sirona/trunk/core/src/main/java/org/apache/sirona/store/tracking/DefaultPathTrackingDataStore.java   (with props)
Modified:
    incubator/sirona/trunk/core/src/main/java/org/apache/sirona/store/tracking/InMemoryPathTrackingDataStore.java
    incubator/sirona/trunk/core/src/test/java/org/apache/sirona/store/tracking/InMemoryPathTrackingTest.java
    incubator/sirona/trunk/server/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/pathtracking/PathTrackingEndpoints.java
    incubator/sirona/trunk/server/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/pathtracking/PathTrackingPlugin.java
    incubator/sirona/trunk/server/reporting/src/test/java/org/apache/sirona/reporting/template/SironaReportingTestBase.java
    incubator/sirona/trunk/server/reporting/src/test/resources/sirona.properties
    incubator/sirona/trunk/server/store/cassandra/src/main/java/org/apache/sirona/cassandra/pathtracking/CassandraPathTrackingDataStore.java

Added: incubator/sirona/trunk/core/src/main/java/org/apache/sirona/store/tracking/DefaultPathTrackingDataStore.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/core/src/main/java/org/apache/sirona/store/tracking/DefaultPathTrackingDataStore.java?rev=1573844&view=auto
==============================================================================
--- incubator/sirona/trunk/core/src/main/java/org/apache/sirona/store/tracking/DefaultPathTrackingDataStore.java (added)
+++ incubator/sirona/trunk/core/src/main/java/org/apache/sirona/store/tracking/DefaultPathTrackingDataStore.java Tue Mar  4 02:47:03 2014
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sirona.store.tracking;
+
+/**
+ *
+ */
+public class DefaultPathTrackingDataStore
+    extends InMemoryPathTrackingDataStore
+{
+    // no op just to ease users life
+}

Propchange: incubator/sirona/trunk/core/src/main/java/org/apache/sirona/store/tracking/DefaultPathTrackingDataStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sirona/trunk/core/src/main/java/org/apache/sirona/store/tracking/DefaultPathTrackingDataStore.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: incubator/sirona/trunk/core/src/main/java/org/apache/sirona/store/tracking/InMemoryPathTrackingDataStore.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/core/src/main/java/org/apache/sirona/store/tracking/InMemoryPathTrackingDataStore.java?rev=1573844&r1=1573843&r2=1573844&view=diff
==============================================================================
--- incubator/sirona/trunk/core/src/main/java/org/apache/sirona/store/tracking/InMemoryPathTrackingDataStore.java (original)
+++ incubator/sirona/trunk/core/src/main/java/org/apache/sirona/store/tracking/InMemoryPathTrackingDataStore.java Tue Mar  4 02:47:03 2014
@@ -168,6 +168,14 @@ public class InMemoryPathTrackingDataSto
     @Override
     public void clearEntries()
     {
+        for ( Map.Entry<String, List<ByteBuffer>> entry : pathTrackingEntries.entrySet() )
+        {
+            // clear entries to not wait gc
+            for ( ByteBuffer byteBuffer : entry.getValue() )
+            {
+                byteBuffer.clear();
+            }
+        }
         pathTrackingEntries = new ConcurrentHashMap<String, List<ByteBuffer>>( 50 );
     }
 

Modified: incubator/sirona/trunk/core/src/test/java/org/apache/sirona/store/tracking/InMemoryPathTrackingTest.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/core/src/test/java/org/apache/sirona/store/tracking/InMemoryPathTrackingTest.java?rev=1573844&r1=1573843&r2=1573844&view=diff
==============================================================================
--- incubator/sirona/trunk/core/src/test/java/org/apache/sirona/store/tracking/InMemoryPathTrackingTest.java (original)
+++ incubator/sirona/trunk/core/src/test/java/org/apache/sirona/store/tracking/InMemoryPathTrackingTest.java Tue Mar  4 02:47:03 2014
@@ -52,5 +52,12 @@ public class InMemoryPathTrackingTest
 
         Assert.assertEquals( "nodeId", entry.getNodeId() );
 
+        store.clearEntries();
+
+        all = store.getPathTrackingEntries();
+
+        Assert.assertNotNull( all );
+        Assert.assertEquals( 0, all.size() );
+
     }
 }

Modified: incubator/sirona/trunk/server/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/pathtracking/PathTrackingEndpoints.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/pathtracking/PathTrackingEndpoints.java?rev=1573844&r1=1573843&r2=1573844&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/pathtracking/PathTrackingEndpoints.java (original)
+++ incubator/sirona/trunk/server/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/pathtracking/PathTrackingEndpoints.java Tue Mar  4 02:47:03 2014
@@ -1,3 +1,19 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
 package org.apache.sirona.reporting.web.plugin.pathtracking;
 
 import org.apache.sirona.configuration.ioc.IoCs;

Modified: incubator/sirona/trunk/server/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/pathtracking/PathTrackingPlugin.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/pathtracking/PathTrackingPlugin.java?rev=1573844&r1=1573843&r2=1573844&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/pathtracking/PathTrackingPlugin.java (original)
+++ incubator/sirona/trunk/server/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/pathtracking/PathTrackingPlugin.java Tue Mar  4 02:47:03 2014
@@ -1,3 +1,19 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
 package org.apache.sirona.reporting.web.plugin.pathtracking;
 
 import org.apache.sirona.reporting.web.plugin.api.Plugin;

Modified: incubator/sirona/trunk/server/reporting/src/test/java/org/apache/sirona/reporting/template/SironaReportingTestBase.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/src/test/java/org/apache/sirona/reporting/template/SironaReportingTestBase.java?rev=1573844&r1=1573843&r2=1573844&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/src/test/java/org/apache/sirona/reporting/template/SironaReportingTestBase.java (original)
+++ incubator/sirona/trunk/server/reporting/src/test/java/org/apache/sirona/reporting/template/SironaReportingTestBase.java Tue Mar  4 02:47:03 2014
@@ -61,7 +61,7 @@ public abstract class SironaReportingTes
     protected URL base;
 
     protected <P extends Page> P page(final String path) throws IOException {
-        return newClient().getPage(base.toExternalForm() + "sirona/" + path);
+        return newClient().getPage(base.toExternalForm() + "/sirona/" + path);
     }
 
     protected static WebClient newClient() {

Modified: incubator/sirona/trunk/server/reporting/src/test/resources/sirona.properties
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/src/test/resources/sirona.properties?rev=1573844&r1=1573843&r2=1573844&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/src/test/resources/sirona.properties (original)
+++ incubator/sirona/trunk/server/reporting/src/test/resources/sirona.properties Tue Mar  4 02:47:03 2014
@@ -15,3 +15,4 @@
 # specific language governing permissions and limitations
 # under the License.
 org.apache.sirona.store.status.NodeStatusDataStore = org.apache.sirona.store.status.EmptyStatuses
+org.apache.sirona.store.tracking.PathTrackingDataStore = org.apache.sirona.store.tracking.InMemoryPathTrackingDataStore

Modified: incubator/sirona/trunk/server/store/cassandra/src/main/java/org/apache/sirona/cassandra/pathtracking/CassandraPathTrackingDataStore.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/store/cassandra/src/main/java/org/apache/sirona/cassandra/pathtracking/CassandraPathTrackingDataStore.java?rev=1573844&r1=1573843&r2=1573844&view=diff
==============================================================================
--- incubator/sirona/trunk/server/store/cassandra/src/main/java/org/apache/sirona/cassandra/pathtracking/CassandraPathTrackingDataStore.java (original)
+++ incubator/sirona/trunk/server/store/cassandra/src/main/java/org/apache/sirona/cassandra/pathtracking/CassandraPathTrackingDataStore.java Tue Mar  4 02:47:03 2014
@@ -203,7 +203,7 @@ public class CassandraPathTrackingDataSt
     }
 
     @Override
-    protected void pushEntriesByBatch( ConcurrentMap<String, Set<PathTrackingEntry>> pathTrackingEntries )
+    protected void pushEntriesByBatch( Map<String, Set<PathTrackingEntry>> pathTrackingEntries )
     {
         List<PathTrackingEntry> entries = new ArrayList<PathTrackingEntry>(  );