You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sirona.apache.org by rm...@apache.org on 2013/11/03 21:39:31 UTC
svn commit: r1538442 - in /incubator/sirona/trunk: collector/
collector/src/main/java/org/apache/sirona/collector/server/
collector/src/main/webapp/WEB-INF/
core/src/main/java/org/apache/sirona/repositories/
core/src/main/java/org/apache/sirona/util/ r...
Author: rmannibucau
Date: Sun Nov 3 20:39:30 2013
New Revision: 1538442
URL: http://svn.apache.org/r1538442
Log:
printing data by node for gauges by default in reporting view if in collector mode
Added:
incubator/sirona/trunk/core/src/main/java/org/apache/sirona/util/Environment.java
incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/graph/
incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/graph/Line.java
Modified:
incubator/sirona/trunk/collector/pom.xml
incubator/sirona/trunk/collector/src/main/java/org/apache/sirona/collector/server/Collector.java
incubator/sirona/trunk/collector/src/main/webapp/WEB-INF/web.xml
incubator/sirona/trunk/core/src/main/java/org/apache/sirona/repositories/DefaultRepository.java
incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/MonitoringController.java
incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/jta/JTAEndpoints.java
incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/jvm/JVMEndpoints.java
incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/web/WebEndpoints.java
incubator/sirona/trunk/reporting/src/main/resources/resources/js/sirona.js
incubator/sirona/trunk/reporting/src/main/resources/templates/jvm/jvm.vm
incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/JTATest.java
incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/SironaReportingTestBase.java
incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/WebTest.java
Modified: incubator/sirona/trunk/collector/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/collector/pom.xml?rev=1538442&r1=1538441&r2=1538442&view=diff
==============================================================================
--- incubator/sirona/trunk/collector/pom.xml (original)
+++ incubator/sirona/trunk/collector/pom.xml Sun Nov 3 20:39:30 2013
@@ -43,6 +43,9 @@
<dependency>
<groupId>org.apache.sirona</groupId>
<artifactId>sirona-reporting</artifactId>
+ <version>${project.version}</version>
+ <classifier>classes</classifier>
+ <scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
Modified: incubator/sirona/trunk/collector/src/main/java/org/apache/sirona/collector/server/Collector.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/collector/src/main/java/org/apache/sirona/collector/server/Collector.java?rev=1538442&r1=1538441&r2=1538442&view=diff
==============================================================================
--- incubator/sirona/trunk/collector/src/main/java/org/apache/sirona/collector/server/Collector.java (original)
+++ incubator/sirona/trunk/collector/src/main/java/org/apache/sirona/collector/server/Collector.java Sun Nov 3 20:39:30 2013
@@ -20,12 +20,12 @@ import com.fasterxml.jackson.core.JsonPa
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.sirona.Role;
-import org.apache.sirona.gauges.CollectorGaugeDataStore;
-import org.apache.sirona.math.M2AwareStatisticalSummary;
-import org.apache.sirona.counters.CollectorCounterStore;
import org.apache.sirona.configuration.Configuration;
+import org.apache.sirona.counters.CollectorCounterStore;
import org.apache.sirona.counters.Counter;
import org.apache.sirona.counters.Unit;
+import org.apache.sirona.gauges.CollectorGaugeDataStore;
+import org.apache.sirona.math.M2AwareStatisticalSummary;
import org.apache.sirona.repositories.Repository;
import org.apache.sirona.store.CounterDataStore;
import org.apache.sirona.store.GaugeDataStore;
@@ -57,7 +57,8 @@ public class Collector extends HttpServl
@Override
public void init() {
- Repository.INSTANCE.iterator(); // for init for next finds
+ // force init to ensure we have stores
+ Configuration.findOrCreateInstance(Repository.class);
final GaugeDataStore gds = Configuration.findOrCreateInstance(GaugeDataStore.class);
if (!CollectorGaugeDataStore.class.isInstance(gds)) {
Modified: incubator/sirona/trunk/collector/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/collector/src/main/webapp/WEB-INF/web.xml?rev=1538442&r1=1538441&r2=1538442&view=diff
==============================================================================
--- incubator/sirona/trunk/collector/src/main/webapp/WEB-INF/web.xml (original)
+++ incubator/sirona/trunk/collector/src/main/webapp/WEB-INF/web.xml Sun Nov 3 20:39:30 2013
@@ -22,6 +22,7 @@
<servlet>
<servlet-name>collector</servlet-name>
<servlet-class>org.apache.sirona.collector.server.Collector</servlet-class>
+ <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>collector</servlet-name>
Modified: incubator/sirona/trunk/core/src/main/java/org/apache/sirona/repositories/DefaultRepository.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/core/src/main/java/org/apache/sirona/repositories/DefaultRepository.java?rev=1538442&r1=1538441&r2=1538442&view=diff
==============================================================================
--- incubator/sirona/trunk/core/src/main/java/org/apache/sirona/repositories/DefaultRepository.java (original)
+++ incubator/sirona/trunk/core/src/main/java/org/apache/sirona/repositories/DefaultRepository.java Sun Nov 3 20:39:30 2013
@@ -19,7 +19,9 @@ package org.apache.sirona.repositories;
import org.apache.sirona.MonitoringException;
import org.apache.sirona.Role;
import org.apache.sirona.configuration.Configuration;
+import org.apache.sirona.counters.CollectorCounterStore;
import org.apache.sirona.counters.Counter;
+import org.apache.sirona.gauges.CollectorGaugeDataStore;
import org.apache.sirona.gauges.DefaultGaugeManager;
import org.apache.sirona.gauges.Gauge;
import org.apache.sirona.stopwatches.CounterStopWatch;
@@ -55,11 +57,17 @@ public class DefaultRepository implement
if (counter == null) {
counter = Configuration.findOrCreateInstance(DataStoreFactory.class).getCounterDataStore();
Configuration.setSingletonInstance(CounterDataStore.class, counter);
+ if (CollectorCounterStore.class.isInstance(counter)) {
+ Configuration.setSingletonInstance(CollectorCounterStore.class, counter);
+ }
}
if (gauge == null) {
gauge = Configuration.findOrCreateInstance(DataStoreFactory.class).getGaugeDataStore();
Configuration.setSingletonInstance(GaugeDataStore.class, gauge);
+ if (CollectorGaugeDataStore.class.isInstance(gauge)) {
+ Configuration.setSingletonInstance(CollectorGaugeDataStore.class, gauge);
+ }
}
this.counterDataStore = counter;
this.gaugeDataStore = gauge;
Added: incubator/sirona/trunk/core/src/main/java/org/apache/sirona/util/Environment.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/core/src/main/java/org/apache/sirona/util/Environment.java?rev=1538442&view=auto
==============================================================================
--- incubator/sirona/trunk/core/src/main/java/org/apache/sirona/util/Environment.java (added)
+++ incubator/sirona/trunk/core/src/main/java/org/apache/sirona/util/Environment.java Sun Nov 3 20:39:30 2013
@@ -0,0 +1,33 @@
+/*
+ * 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.util;
+
+import org.apache.sirona.configuration.Configuration;
+import org.apache.sirona.counters.CollectorCounterStore;
+import org.apache.sirona.repositories.Repository;
+import org.apache.sirona.store.CounterDataStore;
+
+public final class Environment {
+ private Environment() {
+ // no-op
+ }
+
+ public static boolean isCollector() {
+ Configuration.findOrCreateInstance(Repository.class); // ensure we have stores which init next class by default
+ return CollectorCounterStore.class.isInstance(Configuration.findOrCreateInstance(CounterDataStore.class));
+ }
+}
Modified: incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/MonitoringController.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/MonitoringController.java?rev=1538442&r1=1538441&r2=1538442&view=diff
==============================================================================
--- incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/MonitoringController.java (original)
+++ incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/MonitoringController.java Sun Nov 3 20:39:30 2013
@@ -16,6 +16,7 @@
*/
package org.apache.sirona.reporting.web;
+import org.apache.sirona.configuration.Configuration;
import org.apache.sirona.reporting.web.handler.FilteringEndpoints;
import org.apache.sirona.reporting.web.handler.HomeEndpoint;
import org.apache.sirona.reporting.web.handler.internal.EndpointInfo;
@@ -23,6 +24,7 @@ import org.apache.sirona.reporting.web.h
import org.apache.sirona.reporting.web.plugin.PluginRepository;
import org.apache.sirona.reporting.web.template.MapBuilder;
import org.apache.sirona.reporting.web.template.Templates;
+import org.apache.sirona.repositories.Repository;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
@@ -55,19 +57,15 @@ public class MonitoringController implem
private String mapping = null;
private ClassLoader classloader;
private Invoker defaultInvoker;
- private String ignoreInternal = "true";
@Override
public void init(final FilterConfig config) throws ServletException {
+ Configuration.findOrCreateInstance(Repository.class); // ensure datastore are loaded
+
classloader = Thread.currentThread().getContextClassLoader();
initMapping(config.getInitParameter("monitoring-mapping"));
Templates.init(config.getServletContext().getContextPath(), mapping);
initHandlers();
-
- final String ignoreStr = config.getInitParameter("ignore-internal-urls");
- if (ignoreStr != null) {
- ignoreInternal = ignoreStr;
- }
}
private void initHandlers() {
Added: incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/graph/Line.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/graph/Line.java?rev=1538442&view=auto
==============================================================================
--- incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/graph/Line.java (added)
+++ incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/graph/Line.java Sun Nov 3 20:39:30 2013
@@ -0,0 +1,100 @@
+/*
+ * 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.graph;
+
+import org.apache.sirona.Role;
+import org.apache.sirona.configuration.Configuration;
+import org.apache.sirona.gauges.CollectorGaugeDataStore;
+import org.apache.sirona.reporting.web.plugin.json.Jsons;
+import org.apache.sirona.repositories.Repository;
+import org.apache.sirona.store.GaugeValuesRequest;
+import org.apache.sirona.util.Environment;
+
+import java.awt.Color;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+public class Line {
+ public static final String DEFAULT_COLOR = "#317eac";
+
+ private static final Random RANDOM = new Random(System.currentTimeMillis());
+ private static final int MAX_COLOR = 256;
+
+ // default 5 colors, will grow automatically if more is needed. We need to keep same color between 2 refreshing
+ private static final Collection<String> COLORS = new CopyOnWriteArrayList<String>(new String[] {
+ generateColor(), generateColor(), generateColor(), generateColor(), generateColor()
+ });
+
+ public static String toJson(final String label, final String color, final Map<Long, Double> data) {
+ return "{\"label\":\"" + label + "\",\"color\":\"" + color + "\",\"data\": " + Jsons.toJson(data) + "}";
+ }
+
+ private static String generateColor() {
+ int red, green, blue;
+ synchronized (RANDOM) {
+ red = RANDOM.nextInt(MAX_COLOR);
+ green = RANDOM.nextInt(MAX_COLOR);
+ blue = RANDOM.nextInt(MAX_COLOR);
+ }
+
+ final Color color = new Color(red, green, blue);
+ final String hexString = Integer.toHexString(color.getRGB());
+ return "#" + hexString.substring(2, hexString.length());
+ }
+
+ public static String generateReport(final String label, final Role role, final long start, final long end) {
+ if (!Environment.isCollector()) {
+ return "[" + Line.toJson(label, Line.DEFAULT_COLOR, Repository.INSTANCE.getGaugeValues(start, end, role)) + "]";
+ }
+
+ Configuration.findOrCreateInstance(Repository.class); // ensure CollectorGaugeDataStore exists
+
+ final CollectorGaugeDataStore gaugeStore = Configuration.findOrCreateInstance(CollectorGaugeDataStore.class);
+ final Iterator<String> markers = gaugeStore.markers().iterator();
+ final StringBuilder builder = new StringBuilder("[");
+ final Iterator<String> colors = COLORS.iterator();
+ while (markers.hasNext()) {
+ final String marker = markers.next();
+ final String color;
+ if (colors.hasNext()) {
+ color = colors.next();
+ } else {
+ color = generateColor();
+ COLORS.add(color);
+ }
+
+ builder.append(
+ toJson(
+ label + " (" + marker + ")",
+ color,
+ gaugeStore.getGaugeValues(new GaugeValuesRequest(start, end, role), marker)
+ )
+ );
+ if (markers.hasNext()) {
+ builder.append(",");
+ }
+ }
+ return builder.append("]").toString();
+ }
+
+ private Line() {
+ // no-op
+ }
+}
Modified: incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/jta/JTAEndpoints.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/jta/JTAEndpoints.java?rev=1538442&r1=1538441&r2=1538442&view=diff
==============================================================================
--- incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/jta/JTAEndpoints.java (original)
+++ incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/jta/JTAEndpoints.java Sun Nov 3 20:39:30 2013
@@ -20,8 +20,8 @@ import org.apache.sirona.Role;
import org.apache.sirona.counters.Unit;
import org.apache.sirona.reporting.web.handler.api.Regex;
import org.apache.sirona.reporting.web.handler.api.Template;
-import org.apache.sirona.reporting.web.plugin.json.Jsons;
-import org.apache.sirona.repositories.Repository;
+
+import static org.apache.sirona.reporting.web.graph.Line.generateReport;
public class JTAEndpoints {
// copied to avoid classloading issue depending on the deployment, see org.apache.sirona.jta.JTAGauges
@@ -36,16 +36,16 @@ public class JTAEndpoints {
@Regex("/Commits/([0-9]*)/([0-9]*)")
public String commit(final long start, final long end) {
- return "{ \"data\": " + Jsons.toJson(Repository.INSTANCE.getGaugeValues(start, end, COMMITED)) + ", \"label\": \"Commits\", \"color\": \"#317eac\" }";
+ return generateReport("Commits", COMMITED, start, end);
}
@Regex("/Rollbacks/([0-9]*)/([0-9]*)")
public String rollback(final long start, final long end) {
- return "{ \"data\": " + Jsons.toJson(Repository.INSTANCE.getGaugeValues(start, end, ROLLBACKED)) + ", \"label\": \"Rollback\", \"color\": \"#317eac\" }";
+ return generateReport("Rollbacks", ROLLBACKED, start, end);
}
@Regex("/Actives/([0-9]*)/([0-9]*)")
public String active(final long start, final long end) {
- return "{ \"data\": " + Jsons.toJson(Repository.INSTANCE.getGaugeValues(start, end, ACTIVE)) + ", \"label\": \"Active\", \"color\": \"#317eac\" }";
+ return generateReport("Actives", ACTIVE, start, end);
}
}
Modified: incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/jvm/JVMEndpoints.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/jvm/JVMEndpoints.java?rev=1538442&r1=1538441&r2=1538442&view=diff
==============================================================================
--- incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/jvm/JVMEndpoints.java (original)
+++ incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/jvm/JVMEndpoints.java Sun Nov 3 20:39:30 2013
@@ -16,17 +16,19 @@
*/
package org.apache.sirona.reporting.web.plugin.jvm;
-import org.apache.sirona.reporting.web.handler.api.Regex;
-import org.apache.sirona.reporting.web.handler.api.Template;
-import org.apache.sirona.reporting.web.plugin.json.Jsons;
import org.apache.sirona.gauges.jvm.CPUGauge;
import org.apache.sirona.gauges.jvm.UsedMemoryGauge;
-import org.apache.sirona.reporting.web.template.MapBuilder;
-import org.apache.sirona.repositories.Repository;
+import org.apache.sirona.reporting.web.handler.api.Regex;
+import org.apache.sirona.reporting.web.handler.api.Template;
+import org.apache.sirona.util.Environment;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.lang.management.OperatingSystemMXBean;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.apache.sirona.reporting.web.graph.Line.generateReport;
public class JVMEndpoints {
@Regex
@@ -34,23 +36,25 @@ public class JVMEndpoints {
final OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean();
final MemoryMXBean memory = ManagementFactory.getMemoryMXBean();
- return new Template("jvm/jvm.vm", new MapBuilder<String, Object>()
- .set("architecture", os.getArch())
- .set("name", os.getName())
- .set("version", os.getVersion())
- .set("numberProcessor", os.getAvailableProcessors())
- .set("maxMemory", memory.getHeapMemoryUsage().getMax())
- .set("initMemory", memory.getHeapMemoryUsage().getInit())
- .build());
+ final Map<String,Object> params = new HashMap<String, Object>();
+ if (!Environment.isCollector()) {
+ params.put("architecture", os.getArch());
+ params.put("name", os.getName());
+ params.put("version", os.getVersion());
+ params.put("numberProcessor", os.getAvailableProcessors());
+ params.put("maxMemory", memory.getHeapMemoryUsage().getMax());
+ params.put("initMemory", memory.getHeapMemoryUsage().getInit());
+ }
+ return new Template("jvm/jvm.vm", params);
}
@Regex("/cpu/([0-9]*)/([0-9]*)")
public String cpu(final long start, final long end) {
- return "{ \"data\": " + Jsons.toJson(Repository.INSTANCE.getGaugeValues(start, end, CPUGauge.CPU)) + ", \"label\": \"CPU Usage\", \"color\": \"#317eac\" }";
+ return generateReport("CPU Usage", CPUGauge.CPU, start, end);
}
@Regex("/memory/([0-9]*)/([0-9]*)")
public String memory(final long start, final long end) {
- return "{ \"data\": " + Jsons.toJson(Repository.INSTANCE.getGaugeValues(start, end, UsedMemoryGauge.USED_MEMORY)) + ", \"label\": \"Used Memory\", \"color\": \"#317eac\" }";
+ return generateReport("Used Memory", UsedMemoryGauge.USED_MEMORY, start, end);
}
}
Modified: incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/web/WebEndpoints.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/web/WebEndpoints.java?rev=1538442&r1=1538441&r2=1538442&view=diff
==============================================================================
--- incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/web/WebEndpoints.java (original)
+++ incubator/sirona/trunk/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/web/WebEndpoints.java Sun Nov 3 20:39:30 2013
@@ -31,7 +31,7 @@ public class WebEndpoints {
@Regex("/sessions/([0-9]*)/([0-9]*)")
public String sessions(final long start, final long end) {
- final StringBuilder builder = new StringBuilder();
+ final StringBuilder builder = new StringBuilder("[");
for (final Role gauge : SessionGauge.gauges().keySet()) {
builder.append("{ \"data\": ")
.append(Jsons.toJson(Repository.INSTANCE.getGaugeValues(start, end, gauge)))
@@ -40,9 +40,9 @@ public class WebEndpoints {
}
final int length = builder.length();
- if (length > 0) {
- return builder.toString().substring(0, length - 1);
+ if (length > 1) {
+ return builder.toString().substring(0, length - 1) + "]";
}
- return builder.toString();
+ return builder.append("]").toString();
}
}
Modified: incubator/sirona/trunk/reporting/src/main/resources/resources/js/sirona.js
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/main/resources/resources/js/sirona.js?rev=1538442&r1=1538441&r2=1538442&view=diff
==============================================================================
--- incubator/sirona/trunk/reporting/src/main/resources/resources/js/sirona.js (original)
+++ incubator/sirona/trunk/reporting/src/main/resources/resources/js/sirona.js Sun Nov 3 20:39:30 2013
@@ -27,9 +27,9 @@
type: "GET",
dataType: "json",
success: function (data) {
- $.plot("#" + graph + "-graph", [ data ], options);
+ $.plot("#" + graph + "-graph", data, options);
},
- complete: complete,
+ //complete: complete, // TODO: find a better way to refresh the plot
timeout: timeout
});
};
Modified: incubator/sirona/trunk/reporting/src/main/resources/templates/jvm/jvm.vm
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/main/resources/templates/jvm/jvm.vm?rev=1538442&r1=1538441&r2=1538442&view=diff
==============================================================================
--- incubator/sirona/trunk/reporting/src/main/resources/templates/jvm/jvm.vm (original)
+++ incubator/sirona/trunk/reporting/src/main/resources/templates/jvm/jvm.vm Sun Nov 3 20:39:30 2013
@@ -25,6 +25,7 @@
<i class="icon-table"></i>Computer Info
</h3>
</div>
+ #if ($name)
<div class="panel-body">
<table id="cpu-table" class="table table-bordered table-striped table-hover">
<tbody>
@@ -35,6 +36,7 @@
</tbody>
</table>
</div>
+ #end
</div>
</div>
<div class="col-lg-6">
@@ -46,6 +48,7 @@
<i class="icon-table"></i>Memory Status
</h3>
</div>
+ #if ($initMemory)
<div class="panel-body">
<table id="memory-table" class="table table-bordered table-striped table-hover">
<tbody>
@@ -54,6 +57,7 @@
</tbody>
</table>
</div>
+ #end
</div>
</div>
</div>
Modified: incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/JTATest.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/JTATest.java?rev=1538442&r1=1538441&r2=1538442&view=diff
==============================================================================
--- incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/JTATest.java (original)
+++ incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/JTATest.java Sun Nov 3 20:39:30 2013
@@ -36,7 +36,7 @@ public class JTATest extends SironaRepor
@Test
public void checkJsonEndpoint() throws IOException {
final String page = page("jta/Actives/0/" + System.currentTimeMillis()).getWebResponse().getContentAsString().replace(" ", "");
- assertTrue(page.startsWith("{\"data\":["));
- assertTrue(page.endsWith(",\"label\":\"Active\",\"color\":\"#317eac\"}"));
+ assertTrue(page.contains("\"data\":["));
+ assertTrue(page.startsWith("[{\"label\":\"Actives\",\"color\":\"#"));
}
}
Modified: incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/SironaReportingTestBase.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/SironaReportingTestBase.java?rev=1538442&r1=1538441&r2=1538442&view=diff
==============================================================================
--- incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/SironaReportingTestBase.java (original)
+++ incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/SironaReportingTestBase.java Sun Nov 3 20:39:30 2013
@@ -21,6 +21,7 @@ import com.gargoylesoftware.htmlunit.Pag
import com.gargoylesoftware.htmlunit.WebClient;
import org.apache.catalina.startup.Constants;
import org.apache.sirona.reporting.web.registration.MonitoringReportingInitializer;
+import org.apache.sirona.web.lifecycle.SironaLifecycle;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
@@ -52,7 +53,8 @@ public abstract class SironaReportingTes
return ShrinkWrap.create(WebArchive.class, "sirona-test.war")
.addAsLibraries(
ShrinkWrap.create(JavaArchive.class, "sci.jar") // bug in tomcat?
- .addAsServiceProvider(ServletContainerInitializer.class, MonitoringReportingInitializer.class));
+ .addAsServiceProvider(ServletContainerInitializer.class, MonitoringReportingInitializer.class)
+ .addClass(SironaLifecycle.class));
}
@ArquillianResource
Modified: incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/WebTest.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/WebTest.java?rev=1538442&r1=1538441&r2=1538442&view=diff
==============================================================================
--- incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/WebTest.java (original)
+++ incubator/sirona/trunk/reporting/src/test/java/org/apache/sirona/reporting/template/WebTest.java Sun Nov 3 20:39:30 2013
@@ -40,6 +40,6 @@ public class WebTest extends SironaRepor
@Test
public void checkJsonEndpoint() throws IOException {
final String page = page("web/sessions/0/" + System.currentTimeMillis()).getWebResponse().getContentAsString().replace(" ", "");
- assertEquals("", page); // we don't deploy in this tests sessions gauges so we have nothing
+ assertEquals("[]", page); // we don't deploy in this tests sessions gauges so we have nothing
}
}