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 2015/05/15 10:55:42 UTC
svn commit: r1679514 [1/2] - in /incubator/sirona/trunk:
plugins/hazelcast/gui/ server/ server/reporting/
server/reporting/reporting-api/
server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/configuration/
server/reporting/repor...
Author: rmannibucau
Date: Fri May 15 08:55:40 2015
New Revision: 1679514
URL: http://svn.apache.org/r1679514
Log:
splitting EE and Servlet reporting webapp
Added:
incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/configuration/
incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/configuration/SironaApplication.java
incubator/sirona/trunk/server/reporting/reporting-ui/src/main/web/
incubator/sirona/trunk/server/reporting/reporting-ui/src/main/web/web.xml
incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/WEB-INF/
incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/WEB-INF/web.xml
incubator/sirona/trunk/server/reporting/reporting-ui/src/test/
incubator/sirona/trunk/server/reporting/reporting-ui/src/test/resources/
incubator/sirona/trunk/server/reporting/reporting-ui/src/test/resources/META-INF/
incubator/sirona/trunk/server/reporting/reporting-ui/src/test/resources/META-INF/spring-context.xml
incubator/sirona/trunk/server/reporting/reporting-ui/src/test/resources/log4j2-test.xml
incubator/sirona/trunk/server/reporting/reporting-webapp-full/
incubator/sirona/trunk/server/reporting/reporting-webapp-full/pom.xml
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/main/
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/main/resources/
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/main/resources/applicationContext.xml
- copied, changed from r1679504, incubator/sirona/trunk/server/reporting/reporting-webapp/src/main/webapp/WEB-INF/applicationContext.xml
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/main/webapp/
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/main/webapp/WEB-INF/
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/main/webapp/WEB-INF/web.xml
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/FormatsTest.java
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/GaugesTest.java
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/HomeTest.java
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/JMXTest.java
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/JTATest.java
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/JVMTest.java
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/ReportTest.java
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/SironaReportingTestBase.java
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/StatusTest.java
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/ThreadsTest.java
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/WebTest.java
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/resources/
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/resources/arquillian.xml
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/resources/log4j2-test.xml
incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/resources/sirona.properties
incubator/sirona/trunk/server/reporting/reporting-webapp/src/main/webapp/WEB-INF/openejb-jar.xml
Removed:
incubator/sirona/trunk/server/reporting/reporting-api/src/main/resources/WEB-INF/
incubator/sirona/trunk/server/reporting/reporting-webapp/src/main/webapp/WEB-INF/applicationContext.xml
incubator/sirona/trunk/server/reporting/reporting-webapp/src/test/
incubator/sirona/trunk/server/reporting/src/
Modified:
incubator/sirona/trunk/plugins/hazelcast/gui/pom.xml
incubator/sirona/trunk/server/pom.xml
incubator/sirona/trunk/server/reporting/pom.xml
incubator/sirona/trunk/server/reporting/reporting-api/pom.xml
incubator/sirona/trunk/server/reporting/reporting-api/src/main/resources/META-INF/web-fragment.xml
incubator/sirona/trunk/server/reporting/reporting-webapp/pom.xml
incubator/sirona/trunk/server/reporting/reporting-webapp/src/main/java/org/apache/sirona/reporting/web/SironaController.java
incubator/sirona/trunk/server/reporting/reporting-webapp/src/main/webapp/WEB-INF/web.xml
Modified: incubator/sirona/trunk/plugins/hazelcast/gui/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/plugins/hazelcast/gui/pom.xml?rev=1679514&r1=1679513&r2=1679514&view=diff
==============================================================================
--- incubator/sirona/trunk/plugins/hazelcast/gui/pom.xml (original)
+++ incubator/sirona/trunk/plugins/hazelcast/gui/pom.xml Fri May 15 08:55:40 2015
@@ -92,7 +92,7 @@
</dependency>
<dependency>
<groupId>org.apache.sirona</groupId>
- <artifactId>sirona-reporting-webapp</artifactId>
+ <artifactId>sirona-reporting-webapp-full</artifactId>
<version>${project.version}</version>
<classifier>classes</classifier>
<scope>test</scope>
Modified: incubator/sirona/trunk/server/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/pom.xml?rev=1679514&r1=1679513&r2=1679514&view=diff
==============================================================================
--- incubator/sirona/trunk/server/pom.xml (original)
+++ incubator/sirona/trunk/server/pom.xml Fri May 15 08:55:40 2015
@@ -28,6 +28,10 @@
<name>Apache Sirona Incubator :: Server</name>
<packaging>pom</packaging>
+ <properties>
+ <tomee.version>1.7.1</tomee.version>
+ </properties>
+
<modules>
<module>collector</module>
<module>reporting</module>
Modified: incubator/sirona/trunk/server/reporting/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/pom.xml?rev=1679514&r1=1679513&r2=1679514&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/pom.xml (original)
+++ incubator/sirona/trunk/server/reporting/pom.xml Fri May 15 08:55:40 2015
@@ -25,7 +25,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>sirona-reporting</artifactId>
- <name>Apache Sirona Incubator :: Reporting</name>
+ <name>Apache Sirona Incubator :: Server :: Reporting</name>
<packaging>pom</packaging>
<properties>
@@ -41,6 +41,7 @@
<module>reporting-api</module>
<module>reporting-ui</module>
<module>reporting-webapp</module>
+ <module>reporting-webapp-full</module>
</modules>
<dependencyManagement>
@@ -51,16 +52,72 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>2.0</version>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jaxrs_1.1_spec</artifactId> <!-- compatible with EE 6 servers -->
+ <version>1.0</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
+ <scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tomcat.maven</groupId>
+ <artifactId>tomcat7-maven-plugin</artifactId>
+ <configuration>
+ <port>${tomcatRunPort}</port>
+ <path>${tomcatRunPath}</path>
+ <skip>${sirona.reporting.tomcat.skip}</skip>
+ <systemProperties>
+ <org.apache.sirona.configuration.sirona.properties>${sirona.properties.path}</org.apache.sirona.configuration.sirona.properties>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>reserve-http-port</id>
+ <phase>generate-test-resources</phase>
+ <goals>
+ <goal>reserve-network-port</goal>
+ </goals>
+ <configuration>
+ <portNames>
+ <portName>tomcat.http</portName>
+ </portNames>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <arquillian.launch>tomcat7</arquillian.launch>
+ <tomcat.http>${tomcat.http}</tomcat.http>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project>
Modified: incubator/sirona/trunk/server/reporting/reporting-api/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-api/pom.xml?rev=1679514&r1=1679513&r2=1679514&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-api/pom.xml (original)
+++ incubator/sirona/trunk/server/reporting/reporting-api/pom.xml Fri May 15 08:55:40 2015
@@ -32,10 +32,16 @@
<dependency>
<groupId>org.apache.sirona</groupId>
<artifactId>sirona-core</artifactId>
+ <scope>provided</scope> <!-- using to put it in the container to get JDBC monitoring and deploy the webapp -->
</dependency>
<dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
+ <groupId>org.apache.sirona</groupId>
+ <artifactId>sirona-aop</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jaxrs_1.1_spec</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sirona</groupId>
@@ -51,4 +57,24 @@
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.openejb.maven</groupId>
+ <artifactId>tomee-maven-plugin</artifactId>
+ <version>${tomee.version}</version>
+ <configuration>
+ <tomeeClassifier>jaxrs</tomeeClassifier>
+ <simpleLog>true</simpleLog>
+ <libs>
+ <lib>${project.groupId}:sirona-api:${project.version}</lib>
+ <lib>${project.groupId}:sirona-core:${project.version}</lib>
+ <lib>${project.groupId}:sirona-aop:${project.version}</lib>
+ <lib>${project.groupId}:sirona-store-memory:${project.version}</lib>
+ <lib>org.apache.commons:commons-proxy:1.0</lib>
+ </libs>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
Added: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/configuration/SironaApplication.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/configuration/SironaApplication.java?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/configuration/SironaApplication.java (added)
+++ incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/configuration/SironaApplication.java Fri May 15 08:55:40 2015
@@ -0,0 +1,24 @@
+/*
+ * 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.configuration;
+
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Application;
+
+@ApplicationPath("restServices")
+public class SironaApplication extends Application {
+}
Modified: incubator/sirona/trunk/server/reporting/reporting-api/src/main/resources/META-INF/web-fragment.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-api/src/main/resources/META-INF/web-fragment.xml?rev=1679514&r1=1679513&r2=1679514&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-api/src/main/resources/META-INF/web-fragment.xml (original)
+++ incubator/sirona/trunk/server/reporting/reporting-api/src/main/resources/META-INF/web-fragment.xml Fri May 15 08:55:40 2015
@@ -15,14 +15,13 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+<web-fragment xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"
version="3.0">
-
<listener>
<listener-class>org.apache.sirona.web.discovery.GaugeDiscoveryListener</listener-class>
</listener>
-
-
-</web-app>
+</web-fragment>
Added: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/web/web.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/web/web.xml?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/web/web.xml (added)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/web/web.xml Fri May 15 08:55:40 2015
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+ version="3.0">
+
+</web-app>
Added: incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/WEB-INF/web.xml?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/WEB-INF/web.xml (added)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/main/webapp/WEB-INF/web.xml Fri May 15 08:55:40 2015
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+ version="3.0">
+
+ <context-param> <!-- only register this webapp gauges -->
+ <param-name>monitoring.discovery.packages</param-name>
+ <param-value>org.apache.sirona.reporting.web.plugin</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>
+ classpath*:META-INF/spring-context.xml
+ </param-value>
+ </context-param>
+
+
+ <listener>
+ <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>CXFServlet</servlet-name>
+ <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>CXFServlet</servlet-name>
+ <url-pattern>/restServices/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
Added: incubator/sirona/trunk/server/reporting/reporting-ui/src/test/resources/META-INF/spring-context.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/test/resources/META-INF/spring-context.xml?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/test/resources/META-INF/spring-context.xml (added)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/test/resources/META-INF/spring-context.xml Fri May 15 08:55:40 2015
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
+
+ <!--
+ <import resource="classpath:META-INF/cxf/cxf.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
+ -->
+
+ <bean id="cxf" class="org.apache.cxf.bus.spring.SpringBus" destroy-method="shutdown"/>
+ <bean id="org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor" class="org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor"/>
+ <bean id="org.apache.cxf.bus.spring.Jsr250BeanPostProcessor" class="org.apache.cxf.bus.spring.Jsr250BeanPostProcessor"/>
+ <bean id="org.apache.cxf.bus.spring.BusExtensionPostProcessor" class="org.apache.cxf.bus.spring.BusExtensionPostProcessor"/>
+
+ <bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider">
+ <property name="mapper">
+ <bean class="com.fasterxml.jackson.databind.ObjectMapper"/>
+ </property>
+ </bean>
+
+ <jaxrs:server id="sironaServices" address="/sironaServices" basePackages="org.apache.sirona.reporting.web.**,org.apache.sirona.reporting.web**">
+ <jaxrs:providers>
+ <ref bean="jsonProvider"/>
+ </jaxrs:providers>
+ </jaxrs:server>
+
+</beans>
Added: incubator/sirona/trunk/server/reporting/reporting-ui/src/test/resources/log4j2-test.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/src/test/resources/log4j2-test.xml?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/src/test/resources/log4j2-test.xml (added)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/src/test/resources/log4j2-test.xml Fri May 15 08:55:40 2015
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ ~ 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.
+ -->
+
+
+<configuration status="debug">
+
+
+ <appenders>
+ <Console name="console" target="SYSTEM_OUT">
+ <!--PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/-->
+ <PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n}" />
+ </Console>
+ </appenders>
+ <loggers>
+
+ <logger name="org.springframework" level="info"/>
+
+ <logger name="org.apache.cxf" level="info"/>
+
+ <root level="info" includeLocation="true">
+ <appender-ref ref="console"/>
+ </root>
+ </loggers>
+</configuration>
+
+
Added: incubator/sirona/trunk/server/reporting/reporting-webapp-full/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp-full/pom.xml?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp-full/pom.xml (added)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp-full/pom.xml Fri May 15 08:55:40 2015
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.sirona</groupId>
+ <artifactId>sirona-reporting</artifactId>
+ <version>0.3-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>sirona-reporting-webapp-full</artifactId>
+ <name>Apache Sirona Incubator :: Server :: Reporting :: Webapp Full</name>
+ <packaging>war</packaging>
+ <description>Intended for Servlet only containers</description>
+
+ <properties>
+ <sirona.reporting.ui.tomcat.skip>false</sirona.reporting.ui.tomcat.skip>
+ <log4j2.version>2.0</log4j2.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_3.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jaxrs_2.0_spec</artifactId>
+ <version>1.0-alpha-1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.sirona</groupId>
+ <artifactId>sirona-core</artifactId>
+ <scope>provided</scope> <!-- using to put it in the container to get JDBC monitoring and deploy the webapp -->
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sirona</groupId>
+ <artifactId>sirona-aop</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sirona</groupId>
+ <artifactId>sirona-reporting-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>${cxf.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency> <!-- if someday webapp (ee artifact) moves to johnzon ensures to align it here as well -->
+ <groupId>com.fasterxml.jackson.jaxrs</groupId>
+ <artifactId>jackson-jaxrs-json-provider</artifactId>
+ <version>${jacksonVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sirona</groupId>
+ <artifactId>sirona-reporting-webapp</artifactId>
+ <version>${project.version}</version>
+ <classifier>classes</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jul-to-slf4j</artifactId>
+ <version>1.7.7</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.descriptors</groupId>
+ <artifactId>shrinkwrap-descriptors-impl-javaee</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-tomcat-embedded-7</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-jasper</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-logging-juli</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jdt.core.compiler</groupId>
+ <artifactId>ecj</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.htmlunit</groupId>
+ <artifactId>htmlunit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tomcat.maven</groupId>
+ <artifactId>tomcat7-maven-plugin</artifactId>
+ <configuration>
+ <port>${tomcatRunPort}</port>
+ <path>${tomcatRunPath}</path>
+ <skip>${sirona.reporting.ui.tomcat.skip}</skip>
+ <systemProperties>
+ <org.apache.sirona.configuration.sirona.properties>${sirona.properties.path}</org.apache.sirona.configuration.sirona.properties>
+ </systemProperties>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.sirona</groupId>
+ <artifactId>sirona-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sirona</groupId>
+ <artifactId>sirona-aop</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-1.2-api</artifactId>
+ <version>${log4j2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <version>${log4j2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-jcl</artifactId>
+ <version>${log4j2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jul-to-slf4j</artifactId>
+ <version>1.7.7</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>cassandra</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tomcat.maven</groupId>
+ <artifactId>tomcat7-maven-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.sirona</groupId>
+ <artifactId>sirona-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sirona</groupId>
+ <artifactId>sirona-cassandra</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
\ No newline at end of file
Copied: incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/main/resources/applicationContext.xml (from r1679504, incubator/sirona/trunk/server/reporting/reporting-webapp/src/main/webapp/WEB-INF/applicationContext.xml)
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/main/resources/applicationContext.xml?p2=incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/main/resources/applicationContext.xml&p1=incubator/sirona/trunk/server/reporting/reporting-webapp/src/main/webapp/WEB-INF/applicationContext.xml&r1=1679504&r2=1679514&rev=1679514&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp/src/main/webapp/WEB-INF/applicationContext.xml (original)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/main/resources/applicationContext.xml Fri May 15 08:55:40 2015
@@ -20,26 +20,20 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
+ http://cxf.apache.org/jaxrs
+ http://cxf.apache.org/schemas/jaxrs.xsd">
+ <bean id="cxf" class="org.apache.cxf.bus.spring.SpringBus" destroy-method="shutdown"/>
+ <bean id="org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor" class="org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor"/>
+ <bean id="org.apache.cxf.bus.spring.Jsr250BeanPostProcessor" class="org.apache.cxf.bus.spring.Jsr250BeanPostProcessor"/>
+ <bean id="org.apache.cxf.bus.spring.BusExtensionPostProcessor" class="org.apache.cxf.bus.spring.BusExtensionPostProcessor"/>
- <import resource="classpath:META-INF/cxf/cxf.xml"/>
- <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
-
- <bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider">
- <property name="mapper">
- <bean class="com.fasterxml.jackson.databind.ObjectMapper"/>
- </property>
- </bean>
-
- <jaxrs:server id="sironaServices" address="/sironaServices" basePackages="org.apache.sirona.reporting.web.**">
+ <jaxrs:server id="sironaServices" basePackages="org.apache.sirona.reporting.web.**" serviceClass="org.apache.sirona.reporting.web.Environment">
<jaxrs:providers>
- <ref bean="jsonProvider"/>
+ <bean class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider" />
</jaxrs:providers>
</jaxrs:server>
-
</beans>
Added: incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/main/webapp/WEB-INF/web.xml?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/main/webapp/WEB-INF/web.xml (added)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/main/webapp/WEB-INF/web.xml Fri May 15 08:55:40 2015
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+ version="3.0">
+ <context-param> <!-- only register this webapp gauges -->
+ <param-name>monitoring.discovery.packages</param-name>
+ <param-value>org.apache.sirona.reporting.web.plugin</param-value>
+ </context-param>
+
+ <filter>
+ <filter-name>Monitoring</filter-name>
+ <filter-class>org.apache.sirona.reporting.web.SironaController</filter-class>
+ </filter>
+
+ <servlet>
+ <servlet-name>CXFServlet</servlet-name>
+ <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
+ <init-param>
+ <param-name>config-location</param-name>
+ <param-value>classpath:applicationContext.xml</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <filter-mapping>
+ <filter-name>Monitoring</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <servlet-mapping>
+ <servlet-name>CXFServlet</servlet-name>
+ <url-pattern>/restServices/*</url-pattern>
+ </servlet-mapping>
+</web-app>
Added: incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/FormatsTest.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/FormatsTest.java?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/FormatsTest.java (added)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/FormatsTest.java Fri May 15 08:55:40 2015
@@ -0,0 +1,95 @@
+/*
+ * 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;
+
+import org.apache.commons.lang3.SystemUtils;
+import org.apache.sirona.Role;
+import org.apache.sirona.counters.Counter;
+import org.apache.sirona.reporting.web.handler.TemplateHelper;
+import org.apache.sirona.reporting.web.plugin.api.Template;
+import org.apache.sirona.reporting.web.plugin.report.format.CSVFormat;
+import org.apache.sirona.reporting.web.plugin.report.format.Format;
+import org.apache.sirona.reporting.web.template.Templates;
+import org.apache.sirona.repositories.Repository;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Collections;
+
+import static org.junit.Assert.assertEquals;
+
+public class FormatsTest {
+ @BeforeClass
+ public static void setup() {
+ Repository.INSTANCE.clearCounters();
+ Templates.init("", "");
+
+ final Counter counter = Repository.INSTANCE.getCounter(new Counter.Key(Role.FAILURES, "RendererTest"));
+ counter.updateConcurrency(1);
+ counter.add(1.);
+ }
+
+ @AfterClass
+ public static void clear() {
+ Repository.INSTANCE.clearCounters();
+ }
+
+ @Test
+ public void renderToXML() throws Exception {
+ final StringWriter out = new StringWriter();
+ final TemplateHelper helper = new TemplateHelper(new PrintWriter(out), Collections.<String, Object>emptyMap());
+ final Template template = Format.Defaults.XML.render(Collections.<String, Object>emptyMap());
+ helper.renderPlain(template.getTemplate(), template.getUserParams());
+
+ assertEquals("<?xml version=\"1.0\"?> <repository> " +
+ "<counter name=\"RendererTest\" role=\"failures\" unit=\"u\" Hits=\"1.0\" Max=\"1.0\" Mean=\"1.0\" Min=\"1.0\" " +
+ "StandardDeviation=\"0.0\" Sum=\"1.0\" Variance=\"0.0\" Value=\"1.0\" Concurrency=\"0.0\" MaxConcurrency=\"1.0\" />" +
+ " </repository>", inline(out));
+ }
+
+ @Test
+ public void renderToJSON() throws Exception {
+ final StringWriter out = new StringWriter();
+ final TemplateHelper helper = new TemplateHelper(new PrintWriter(out), Collections.<String, Object>emptyMap());
+ final Template template = Format.Defaults.JSON.render(Collections.<String, Object>emptyMap());
+ helper.renderPlain(template.getTemplate(), template.getUserParams());
+
+ assertEquals("{\"counters\":[" +
+ " {\"name\":\"RendererTest\", \"role\":\"failures\",\"unit\":\"u\",\"Hits\":\"1.0\",\"Max\":\"1.0\",\"Mean\":\"1.0\",\"Min\":\"1.0\"," +
+ "\"StandardDeviation\":\"0.0\",\"Sum\":\"1.0\",\"Variance\":\"0.0\"," +
+ "\"Value\":\"1.0\",\"Concurrency\":\"0.0\",\"MaxConcurrency\":\"1.0\"} ]}", inline(out));
+ }
+
+ @Test
+ public void renderToCSV() throws Exception {
+ final StringWriter out = new StringWriter();
+ final TemplateHelper helper = new TemplateHelper(new PrintWriter(out), Collections.<String, Object>emptyMap());
+ final Template template = Format.Defaults.CSV.render(Collections.<String, Object>emptyMap());
+ helper.renderPlain(template.getTemplate(), template.getUserParams());
+
+ assertEquals(CSVFormat.HEADER +
+ "RendererTest;failures (u);1.0;1.0;1.0;1.0;0.0;1.0;0.0;1.0;0.0;1.0" + SystemUtils.LINE_SEPARATOR,
+ out.toString());
+ }
+
+ private static String inline(StringWriter out) {
+ return out.toString().replace("\r\n", " ").replace("\n", " ").replaceAll(" +", " ").replace("\t", "").trim();
+ }
+}
Added: incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/GaugesTest.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/GaugesTest.java?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/GaugesTest.java (added)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/GaugesTest.java Fri May 15 08:55:40 2015
@@ -0,0 +1,52 @@
+/*
+ * 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.template;
+
+import com.gargoylesoftware.htmlunit.TextPage;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+public class GaugesTest extends SironaReportingTestBase {
+ private static final String CPU_GAUGE_ENCODED = "Q1BV";
+
+ @Test
+ public void checkGaugesAreListed() throws IOException {
+ final HtmlPage page = page("gauges");
+ final String content = page.getWebResponse().getContentAsString();
+ assertThat(content, containsString("<a href=\"/sirona-test/sirona/gauges/" + CPU_GAUGE_ENCODED + "\">"));
+ assertThat(content, containsString("CPU"));
+ }
+
+ @Test
+ public void checkDetail() throws IOException {
+ final HtmlPage page = page("gauges/" + CPU_GAUGE_ENCODED);
+ assertThat(page.getWebResponse().getContentAsString(), containsString("id=\"" + CPU_GAUGE_ENCODED + "-graph\""));
+ }
+
+ @Test
+ public void checkJsonDetail() throws IOException {
+ final TextPage page = page("gauges/" + CPU_GAUGE_ENCODED + "/0/" + (System.currentTimeMillis() + 1000));
+ final String json = page.getWebResponse().getContentAsString();
+ assertThat(json, containsString("[{\"label\":\"CPU\",\"color\":"));
+ assertThat(json, containsString("\"data\":"));
+ }
+}
Added: incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/HomeTest.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/HomeTest.java?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/HomeTest.java (added)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/HomeTest.java Fri May 15 08:55:40 2015
@@ -0,0 +1,40 @@
+/*
+ * 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.template;
+
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+import org.junit.Test;
+
+import java.io.IOException;
+
+public class HomeTest extends SironaReportingTestBase {
+ @Test
+ public void checkHomeShowsPlugins() throws IOException {
+ final HtmlPage page = page("");
+ final String plugins = page.getElementById("plugins").asText();
+ assertThat(plugins, containsString("Home"));
+ assertThat(plugins, containsString("Report"));
+ assertThat(plugins, containsString("JMX"));
+ assertThat(plugins, containsString("JVM"));
+ assertThat(plugins, containsString("JTA"));
+ assertThat(plugins, containsString("Threads"));
+ assertThat(plugins, containsString("Web"));
+ }
+}
Added: incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/JMXTest.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/JMXTest.java?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/JMXTest.java (added)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/JMXTest.java Fri May 15 08:55:40 2015
@@ -0,0 +1,44 @@
+/*
+ * 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.template;
+
+import com.gargoylesoftware.htmlunit.TextPage;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static com.gargoylesoftware.htmlunit.WebAssert.assertElementPresent;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+public class JMXTest extends SironaReportingTestBase {
+ @Test
+ public void checkSomeMBeanIsAvailable() throws IOException {
+ final String classLoadingMBeanId = "amF2YS5sYW5nOnR5cGU9Q2xhc3NMb2FkaW5n"; // java.lang:ClassLoading
+
+ final HtmlPage page = page("jmx");
+ assertElementPresent(page, classLoadingMBeanId);
+
+ // we could click on the link but it would mandates to activate js in the WebClient (see parent)
+ // this is not as easy as setting the boolean because of dev environment (proxy, etc...)
+ final TextPage detail = page("jmx/" + classLoadingMBeanId);
+ final String detailAsStr = detail.getWebResponse().getContentAsString();
+ assertThat(detailAsStr, containsString("LoadedClassCount"));
+ assertThat(detailAsStr, containsString("sun.management.ClassLoadingImpl"));
+ }
+}
Added: incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/JTATest.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/JTATest.java?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/JTATest.java (added)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/JTATest.java Fri May 15 08:55:40 2015
@@ -0,0 +1,42 @@
+/*
+ * 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.template;
+
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static com.gargoylesoftware.htmlunit.WebAssert.assertElementPresent;
+import static org.junit.Assert.assertTrue;
+
+public class JTATest extends SironaReportingTestBase {
+ @Test
+ public void checkGraphArePresent() throws IOException {
+ final HtmlPage page = page("jta");
+ assertElementPresent(page, "Commits-graph");
+ assertElementPresent(page, "Rollbacks-graph");
+ assertElementPresent(page, "Actives-graph");
+ }
+
+ @Test
+ public void checkJsonEndpoint() throws IOException {
+ final String page = page("jta/Actives/0/" + System.currentTimeMillis()).getWebResponse().getContentAsString().replace(" ", "");
+ assertTrue(page.contains("\"data\":["));
+ assertTrue(page.startsWith("[{\"label\":\"Actives\",\"color\":\"#"));
+ }
+}
Added: incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/JVMTest.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/JVMTest.java?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/JVMTest.java (added)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/JVMTest.java Fri May 15 08:55:40 2015
@@ -0,0 +1,41 @@
+/*
+ * 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.template;
+
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static com.gargoylesoftware.htmlunit.WebAssert.assertElementPresent;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+public class JVMTest extends SironaReportingTestBase {
+ @Test
+ public void checkGraphArePresent() throws IOException {
+ final HtmlPage page = page("jvm");
+ assertElementPresent(page, "cpu-graph");
+ assertElementPresent(page, "memory-graph");
+
+ final String detailAsStr = page.getWebResponse().getContentAsString();
+ assertThat(detailAsStr, containsString("CPU"));
+ assertThat(detailAsStr, containsString("Memory"));
+ assertThat(detailAsStr, containsString("OS Name"));
+ assertThat(detailAsStr, containsString(System.getProperty("os.name")));
+ }
+}
Added: incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/ReportTest.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/ReportTest.java?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/ReportTest.java (added)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/ReportTest.java Fri May 15 08:55:40 2015
@@ -0,0 +1,88 @@
+/*
+ * 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.template;
+
+import com.gargoylesoftware.htmlunit.WebAssert;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import org.apache.sirona.Role;
+import org.apache.sirona.counters.Counter;
+import org.apache.sirona.counters.Unit;
+import org.apache.sirona.reporting.web.plugin.report.format.MapFormat;
+import org.apache.sirona.repositories.Repository;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.Locale;
+
+import static org.junit.Assert.assertEquals;
+
+public class ReportTest extends SironaReportingTestBase {
+ private Counter.Key key;
+
+ private static Locale oldLocale;
+ private static final String lineSeparator = System.getProperty("line.separator");
+
+ @Before
+ public void init() {
+ Repository.INSTANCE.clearCounters();
+ key = new Counter.Key(new Role("role", Unit.UNARY), "counter");
+ Repository.INSTANCE.getCounter(key).add(55);
+ }
+
+ @After
+ public void reset() {
+ Repository.INSTANCE.clearCounters();
+ }
+
+ @BeforeClass
+ public static void setDefaultLocale() {
+ oldLocale = Locale.getDefault();
+ Locale.setDefault(Locale.ENGLISH);
+ }
+
+ @AfterClass
+ public static void restoreLocale() {
+ Locale.setDefault(oldLocale);
+ }
+
+ @Test
+ public void generalList() throws IOException {
+ final WebClient client = newClient();
+ final HtmlPage page = client.getPage(base.toExternalForm() + "sirona/report");
+ WebAssert.assertElementPresent(page, "report-table");
+
+ final String text = page.getElementById("report-table").asText();
+ assertEquals("Counter\tRole\tHits\tMax\tMean\tMin\tStandardDeviation\tSum\tVariance\tValue\tConcurrency\tMaxConcurrency" + lineSeparator +
+ "counter\trole(u)\t1.00\t55.00\t55.00\t55.00\t0.00\t55.00\t0.00\t55.00\t0.00\t0.00", text.replace(" ", ""));
+ }
+
+ @Test
+ public void detail() throws IOException {
+ final WebClient client = newClient();
+ final HtmlPage page = client.getPage(base.toExternalForm() + "sirona/report/counter/" + MapFormat.generateCounterKeyString(key));
+ WebAssert.assertElementPresent(page, "counter");
+
+ final String text = page.getElementById("counter").asText();
+ assertEquals("Counter\tRole\tHits\tMax\tMean\tMin\tStandardDeviation\tSum\tVariance\tValue\tConcurrency\tMaxConcurrency" + lineSeparator +
+ "counter\trole (u)\t1.00\t55.00\t55.00\t55.00\t0.00\t55.00\t0.00\t55.00\t0.00\t0.00", text);
+ }
+}
Added: incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/SironaReportingTestBase.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/SironaReportingTestBase.java?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/SironaReportingTestBase.java (added)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/SironaReportingTestBase.java Fri May 15 08:55:40 2015
@@ -0,0 +1,75 @@
+/*
+ * 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.template;
+
+import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController;
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.WebClient;
+import org.apache.catalina.startup.Constants;
+import org.apache.sirona.reporting.web.registration.SironaReportingInitializer;
+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;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.runner.RunWith;
+
+import javax.servlet.ServletContainerInitializer;
+import java.io.IOException;
+import java.net.URL;
+
+// NOTE: we depend implicitely on tomcat embedded adapter since
+// 1) we don't add dependencies
+// 2) we use the fact Repository.INSTANCE is in the same JVM
+@RunWith(Arquillian.class)
+public abstract class SironaReportingTestBase {
+ static {
+ // we use this hack to init jars to skip since this method is triggered before any deployment
+ // so ContextConfig is not yet loaded
+ System.setProperty(Constants.DEFAULT_JARS_TO_SKIP, "a*,c*,d*,e*,g*,h*,i*,j*,l*,m*,n*,p*,r*,sa*,se*,sh*,su*,t*,v*,w*,x*,z*");
+ }
+
+ @Deployment(testable = false)
+ public static Archive<?> war() {
+ // bug hack: we don't create an Archive<?> representing our webapp since all will be at classpath
+ // this makes test faster and easier to maintain (if we add stuff) but dependent on our current tomcat embedded adapter
+ return ShrinkWrap.create(WebArchive.class, "sirona-test.war")
+ .addAsLibraries(
+ ShrinkWrap.create(JavaArchive.class, "sci.jar") // bug in tomcat?
+ .addAsServiceProvider(ServletContainerInitializer.class, SironaReportingInitializer.class)
+ .addClass(SironaLifecycle.class));
+ }
+
+ @ArquillianResource
+ protected URL base;
+
+ protected <P extends Page> P page(final String path) throws IOException {
+ return newClient().getPage(base.toExternalForm() + "/sirona/" + path);
+ }
+
+ protected static WebClient newClient() {
+ final WebClient webClient = new WebClient();
+ webClient.getOptions().setJavaScriptEnabled(false);
+ webClient.getOptions().setCssEnabled(false);
+ webClient.getOptions().setAppletEnabled(false);
+ webClient.setAjaxController(new NicelyResynchronizingAjaxController());
+ return webClient;
+ }
+}
Added: incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/StatusTest.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/StatusTest.java?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/StatusTest.java (added)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/StatusTest.java Fri May 15 08:55:40 2015
@@ -0,0 +1,60 @@
+/*
+ * 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.template;
+
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import org.apache.sirona.configuration.ioc.IoCs;
+import org.apache.sirona.repositories.Repository;
+import org.apache.sirona.status.NodeStatus;
+import org.apache.sirona.status.Status;
+import org.apache.sirona.status.ValidationResult;
+import org.apache.sirona.store.status.NodeStatusDataStore;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.Date;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+public class StatusTest extends SironaReportingTestBase {
+ @BeforeClass
+ public static void addStatus() {
+ IoCs.findOrCreateInstance(Repository.class);
+ IoCs.getInstance(NodeStatusDataStore.class).statuses()
+ .put("node1",
+ new NodeStatus(
+ new ValidationResult[] { new ValidationResult("validation #1", Status.OK, "all is fine") },
+ new Date()));
+ }
+
+ @Test
+ public void checkNodesAreListed() throws IOException {
+ final HtmlPage page = page("status");
+ assertThat(page.getWebResponse().getContentAsString(), containsString("/status/node1"));
+ }
+
+ @Test
+ public void checkDetail() throws IOException {
+ final HtmlPage page = page("status/node1");
+ assertThat(page.getWebResponse().getContentAsString(), containsString("Global status"));
+ assertThat(page.getWebResponse().getContentAsString(), containsString(": OK"));
+ assertThat(page.getWebResponse().getContentAsString(), containsString("validation #1"));
+ assertThat(page.getWebResponse().getContentAsString(), containsString("all is fine"));
+ }
+}
Added: incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/ThreadsTest.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/ThreadsTest.java?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/ThreadsTest.java (added)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/ThreadsTest.java Fri May 15 08:55:40 2015
@@ -0,0 +1,44 @@
+/*
+ * 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.template;
+
+import com.gargoylesoftware.htmlunit.TextPage;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static com.gargoylesoftware.htmlunit.WebAssert.assertElementPresent;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public class ThreadsTest extends SironaReportingTestBase {
+ private static final String CONTAINER_BACKGROUND_THREAD = "Q29udGFpbmVyQmFja2dyb3VuZFByb2Nlc3NvcltTdGFuZGFyZEVuZ2luZVthcnF1aWxsaWFuLXRvbWNhdC1lbWJlZGRlZC03XV0"; // always exists
+
+ @Test
+ public void checkThreadsAreListed() throws IOException {
+ final HtmlPage page = page("threads");
+ assertElementPresent(page, CONTAINER_BACKGROUND_THREAD);
+ }
+
+ @Test
+ public void checkDetail() throws IOException {
+ final TextPage page = page("threads/" + CONTAINER_BACKGROUND_THREAD);
+ assertThat(page.getWebResponse().getContentAsString(), containsString("org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run"));
+ }
+}
Added: incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/WebTest.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/WebTest.java?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/WebTest.java (added)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/java/org/apache/sirona/reporting/template/WebTest.java Fri May 15 08:55:40 2015
@@ -0,0 +1,45 @@
+/*
+ * 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.template;
+
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static com.gargoylesoftware.htmlunit.WebAssert.assertElementPresent;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public class WebTest extends SironaReportingTestBase {
+ @Test
+ public void checkSessionsGraphIsPresent() throws IOException {
+ final HtmlPage page = page("web");
+ assertElementPresent(page, "sessions-graph");
+
+ final String detailAsStr = page.getWebResponse().getContentAsString();
+ assertThat(detailAsStr, containsString("Sessions"));
+ }
+
+ @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
+ }
+}
Added: incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/resources/arquillian.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/resources/arquillian.xml?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/resources/arquillian.xml (added)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/resources/arquillian.xml Fri May 15 08:55:40 2015
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+ 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.
+-->
+<arquillian xmlns="http://jboss.org/schema/arquillian"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.org/schema/arquillian
+ http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+ <container qualifier="tomcat7">
+ <configuration>
+ <property name="tomcatHome">target/tomcat7</property>
+ <property name="workDir">target/arquillian-work</property>
+ <property name="unpackArchive">true</property>
+ <property name="bindHttpPort">${tomcat.http:9090}</property>
+ </configuration>
+ </container>
+</arquillian>
Added: incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/resources/log4j2-test.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/resources/log4j2-test.xml?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/resources/log4j2-test.xml (added)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/resources/log4j2-test.xml Fri May 15 08:55:40 2015
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ ~ 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.
+ -->
+
+
+<configuration status="debug">
+
+
+ <appenders>
+ <Console name="console" target="SYSTEM_OUT">
+ <!--PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/-->
+ <PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n}" />
+ </Console>
+ </appenders>
+ <loggers>
+
+ <logger name="org.springframework" level="info"/>
+
+ <logger name="org.apache.cxf" level="info"/>
+
+ <root level="info" includeLocation="true">
+ <appender-ref ref="console"/>
+ </root>
+ </loggers>
+</configuration>
+
+
Added: incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/resources/sirona.properties
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/resources/sirona.properties?rev=1679514&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/resources/sirona.properties (added)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp-full/src/test/resources/sirona.properties Fri May 15 08:55:40 2015
@@ -0,0 +1,18 @@
+# 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.
+org.apache.sirona.store.status.NodeStatusDataStore = org.apache.sirona.store.status.EmptyStatuses
+org.apache.sirona.store.tracking.PathTrackingDataStore = org.apache.sirona.store.memory.tracking.InMemoryPathTrackingDataStore
Modified: incubator/sirona/trunk/server/reporting/reporting-webapp/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-webapp/pom.xml?rev=1679514&r1=1679513&r2=1679514&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-webapp/pom.xml (original)
+++ incubator/sirona/trunk/server/reporting/reporting-webapp/pom.xml Fri May 15 08:55:40 2015
@@ -43,6 +43,16 @@
</dependency>
<dependency>
<groupId>org.apache.sirona</groupId>
+ <artifactId>sirona-core</artifactId>
+ <scope>provided</scope> <!-- using to put it in the container to get JDBC monitoring and deploy the webapp -->
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sirona</groupId>
+ <artifactId>sirona-aop</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sirona</groupId>
<artifactId>sirona-plugins-api</artifactId>
<version>${project.version}</version>
</dependency>
@@ -63,150 +73,31 @@
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-frontend-jaxrs</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
+ <dependency> <!-- I'd love to use johnzon but would make hard the support of TomEE 1 and 7 -->
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>${jacksonVersion}</version>
</dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.jaxrs</groupId>
- <artifactId>jackson-jaxrs-xml-provider</artifactId>
- <version>${jacksonVersion}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.shrinkwrap.descriptors</groupId>
- <artifactId>shrinkwrap-descriptors-impl-javaee</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.shrinkwrap.resolver</groupId>
- <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.junit</groupId>
- <artifactId>arquillian-junit-container</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.protocol</groupId>
- <artifactId>arquillian-protocol-servlet</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.container</groupId>
- <artifactId>arquillian-tomcat-embedded-7</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-jasper</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.htmlunit</groupId>
- <artifactId>htmlunit</artifactId>
- </dependency>
</dependencies>
<build>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- <filtering>true</filtering>
- </testResource>
- </testResources>
<plugins>
<plugin>
- <groupId>org.apache.tomcat.maven</groupId>
- <artifactId>tomcat7-maven-plugin</artifactId>
+ <groupId>org.apache.openejb.maven</groupId>
+ <artifactId>tomee-maven-plugin</artifactId>
+ <version>${tomee.version}</version>
<configuration>
- <port>${tomcatRunPort}</port>
- <path>${tomcatRunPath}</path>
- <skip>${sirona.reporting.tomcat.skip}</skip>
- <systemProperties>
- <org.apache.sirona.configuration.sirona.properties>${sirona.properties.path}</org.apache.sirona.configuration.sirona.properties>
- </systemProperties>
+ <tomeeClassifier>jaxrs</tomeeClassifier>
+ <simpleLog>true</simpleLog>
+ <libs>
+ <lib>${project.groupId}:sirona-api:${project.version}</lib>
+ <lib>${project.groupId}:sirona-core:${project.version}</lib>
+ <lib>${project.groupId}:sirona-aop:${project.version}</lib>
+ <lib>${project.groupId}:sirona-store-memory:${project.version}</lib>
+ <lib>org.apache.commons:commons-proxy:1.0</lib>
+ </libs>
</configuration>
</plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>reserve-http-port</id>
- <phase>generate-test-resources</phase>
- <goals>
- <goal>reserve-network-port</goal>
- </goals>
- <configuration>
- <portNames>
- <portName>tomcat.http</portName>
- </portNames>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemPropertyVariables>
- <arquillian.launch>tomcat7</arquillian.launch>
- <tomcat.http>${tomcat.http}</tomcat.http>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
</build>
-
- <profiles>
- <profile>
- <id>cassandra</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.tomcat.maven</groupId>
- <artifactId>tomcat7-maven-plugin</artifactId>
- <dependencies>
- <dependency>
- <groupId>org.apache.sirona</groupId>
- <artifactId>sirona-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.sirona</groupId>
- <artifactId>sirona-cassandra</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
</project>