You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:23:04 UTC

[sling-org-apache-sling-commons-metrics] annotated tag org.apache.sling.commons.metrics-1.2.2 created (now 728a10b)

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a change to annotated tag org.apache.sling.commons.metrics-1.2.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-metrics.git.


      at 728a10b  (tag)
 tagging 1691178064df948a7e139ad73314c2b3bef8f8f2 (commit)
      by Karl Pauls
      on Fri Jun 2 20:57:17 2017 +0000

- Log -----------------------------------------------------------------
org.apache.sling.commons.metrics-1.2.2
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new a22642b  SLING-4080 - API to capture/measure application-level metrics
     new 80a2f48  SLING-4080 - API to capture/measure application-level metrics
     new 2f36180  SLING-4080 - API to capture/measure application-level metrics
     new 66282a3  SLING-4080 - API to capture/measure application-level metrics
     new 51f39e4  SLING-4080 - API to capture/measure application-level metrics
     new a41c22d  SLING-4080 - API to capture/measure application-level metrics
     new 1cb754c  SLING-4080 - API to capture/measure application-level metrics
     new 6168de6  SLING-4080 - API to capture/measure application-level metrics
     new e2c7c10  SLING-4080 - API to capture/measure application-level metrics
     new 6bd68f8  SLING-4080 - API to capture/measure application-level metrics Moving to trunk from sandbox
     new b67d410  SLING-4080 - API to capture/measure application-level metrics
     new 79e3480  SLING-4080 - API to capture/measure application-level metrics
     new bbd4906  SLING-4080 - API to capture/measure application-level metrics
     new eb6c21b  SLING-4080 - API to capture/measure application-level metrics
     new 2c1237f  SLING-4080 - API to capture/measure application-level metrics
     new f332c2e  SLING-4080 - API to capture/measure application-level metrics
     new a523422  SLING-4080 - API to capture/measure application-level metrics
     new f6846d7  SLING-4080 - API to capture/measure application-level metrics
     new 8b19b8e  SLING-4080 - API to capture/measure application-level metrics
     new e75be94  SLING-4080 - API to capture/measure application-level metrics
     new 97878b9  SLING-4080 - API to capture/measure application-level metrics
     new f54222d  [maven-release-plugin] prepare release org.apache.sling.commons.metrics-0.0.2
     new 5e06af8  [maven-release-plugin] prepare for next development iteration
     new 15ce3aa  SLING-4080 - API to capture/measure application-level metrics
     new 1889f9b  svn:ignore
     new 71d7fff  [maven-release-plugin] prepare release org.apache.sling.commons.metrics-1.0.0
     new e5d38fb  [maven-release-plugin] prepare for next development iteration
     new 8ca6065  SLING-5424 - MBeanServer reference in MetricServiceImpl should be made optional
     new 2871fc7  SLING-5693 - Add support for exporting MetricRegistry data as JSON
     new 91f51c8  SLING-5899 - "Guages" Typo in Sling metrics console
     new 8d6a1a2  Update to parent pom 29
     new 3ca6f09  SLING-5443 - Review the naming conventions used by JMXReporter to register the Metric MBeans
     new f9f9947  SLING-5443 - Review the naming conventions used by JMXReporter to register the Metric MBeans
     new 8c9ec74  SLING-5443 - Review the naming conventions used by JMXReporter to register the Metric MBeans
     new 090aa7b  SLING-5443 - Review the naming conventions used by JMXReporter to register the Metric MBeans
     new fa6a655  SLING-5966 - Add Gauge support to metrics
     new 709afe3  SLING-6297 - Switch to standard OSGi annotation in Metrics
     new c504247  [maven-release-plugin] prepare release org.apache.sling.commons.metrics-1.2.0
     new 622eedf  [maven-release-plugin] prepare for next development iteration
     new 8be75c6  SLING-6527 : Remove usage of org.json from metrics module
     new 24a65d6  SLING-6596 - typo: guage -> gauge
     new 7d97faa  SLING-6596 - fix typo introduced by the typo fixing
     new a21c601  use Sling Parent 30
     new fd39242  SLING-6702 - rename the existing MetricsServiceFactory
     new d47d7fd  SLING-6702 - rename the existing MetricsServiceFactory
     new c06acb3  SLING-6702 - MetricsServiceFactory + tests. Test are a bit slow for now, starting a full Sling Launchpad should not be needed
     new f45f5f5  [maven-release-plugin] prepare release org.apache.sling.commons.metrics-1.2.2
     new 1691178  [maven-release-plugin] copy for tag org.apache.sling.commons.metrics-1.2.2

The 48 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].

[sling-org-apache-sling-commons-metrics] 10/10: [maven-release-plugin] copy for tag org.apache.sling.commons.metrics-1.2.2

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.metrics-1.2.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-metrics.git

commit 1691178064df948a7e139ad73314c2b3bef8f8f2
Author: Karl Pauls <pa...@apache.org>
AuthorDate: Fri Jun 2 20:57:17 2017 +0000

    [maven-release-plugin] copy for tag org.apache.sling.commons.metrics-1.2.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.commons.metrics-1.2.2@1797444 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-metrics] 05/10: use Sling Parent 30

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.metrics-1.2.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-metrics.git

commit a21c6013e737e2eddfbf2d241a283004176169b2
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Mar 6 10:22:30 2017 +0000

    use Sling Parent 30
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics@1785621 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 7937633..2035102 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>29</version>
+        <version>30</version>
     </parent>
 
     <artifactId>org.apache.sling.commons.metrics</artifactId>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-metrics] 03/10: SLING-6596 - typo: guage -> gauge

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.metrics-1.2.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-metrics.git

commit 24a65d6db31d7242a99b354085f53435d72b5871
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Mar 3 08:45:17 2017 +0000

    SLING-6596 - typo: guage -> gauge
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics@1785238 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/commons/metrics/internal/JSONReporter.java   | 4 ++--
 .../sling/commons/metrics/internal/MetricWebConsolePlugin.java    | 4 ++--
 .../apache/sling/commons/metrics/internal/JSONReporterTest.java   | 8 ++++----
 .../commons/metrics/internal/MetricWebConsolePluginTest.java      | 4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/sling/commons/metrics/internal/JSONReporter.java b/src/main/java/org/apache/sling/commons/metrics/internal/JSONReporter.java
index 8e630d0..c7a439f 100644
--- a/src/main/java/org/apache/sling/commons/metrics/internal/JSONReporter.java
+++ b/src/main/java/org/apache/sling/commons/metrics/internal/JSONReporter.java
@@ -13,7 +13,7 @@
  * 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
+ * specific langauge governing permissions and limitations
  * under the License.
  */
 
@@ -163,7 +163,7 @@ class JSONReporter implements Reporter, Closeable {
                         SortedMap<String, Timer> timers) throws IOException {
         json.object();
         if (!gauges.isEmpty()) {
-            json.key("guages").object();
+            json.key("gauges").object();
             for (Map.Entry<String, Gauge> entry : gauges.entrySet()) {
                 printGauge(entry);
             }
diff --git a/src/main/java/org/apache/sling/commons/metrics/internal/MetricWebConsolePlugin.java b/src/main/java/org/apache/sling/commons/metrics/internal/MetricWebConsolePlugin.java
index 0ebc173..70a7581 100644
--- a/src/main/java/org/apache/sling/commons/metrics/internal/MetricWebConsolePlugin.java
+++ b/src/main/java/org/apache/sling/commons/metrics/internal/MetricWebConsolePlugin.java
@@ -13,7 +13,7 @@
  * 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
+ * specific langauge governing permissions and limitations
  * under the License.
  */
 
@@ -397,7 +397,7 @@ public class MetricWebConsolePlugin extends HttpServlet implements
         pw.println("<br>");
         pw.println("<div class='table'>");
         pw.println("<div class='ui-widget-header ui-corner-top buttonGroup'>Gauges</div>");
-        pw.println("<table class='nicetable' id='data-guages'>");
+        pw.println("<table class='nicetable' id='data-gauges'>");
         pw.println("<thead>");
         pw.println("<tr>");
         pw.println("<th class='header'>Name</th>");
diff --git a/src/test/java/org/apache/sling/commons/metrics/internal/JSONReporterTest.java b/src/test/java/org/apache/sling/commons/metrics/internal/JSONReporterTest.java
index 49a6b46..d05c175 100644
--- a/src/test/java/org/apache/sling/commons/metrics/internal/JSONReporterTest.java
+++ b/src/test/java/org/apache/sling/commons/metrics/internal/JSONReporterTest.java
@@ -13,7 +13,7 @@
  * 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
+ * specific langauge governing permissions and limitations
  * under the License.
  */
 
@@ -49,7 +49,7 @@ public class JSONReporterTest {
         Map<String, Object> json = getJSON(registry);
 
         assertTrue(json.containsKey("meters"));
-        assertTrue(json.containsKey("guages"));
+        assertTrue(json.containsKey("gauges"));
         assertTrue(json.containsKey("timers"));
         assertTrue(json.containsKey("counters"));
         assertTrue(json.containsKey("histograms"));
@@ -75,7 +75,7 @@ public class JSONReporterTest {
 
 
         Map<String, Object> json = getJSON(registry);
-        assertTrue(((Map<String, Object>)json.get("guages")).containsKey("test"));
+        assertTrue(((Map<String, Object>)json.get("gauges")).containsKey("test"));
     }
 
     private static Map<String, Object> getJSON(MetricRegistry registry) throws IOException {
@@ -88,4 +88,4 @@ public class JSONReporterTest {
         return new JSONParser(sw.toString()).getParsed();
     }
 
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/apache/sling/commons/metrics/internal/MetricWebConsolePluginTest.java b/src/test/java/org/apache/sling/commons/metrics/internal/MetricWebConsolePluginTest.java
index 296c9e6..56e44bc 100644
--- a/src/test/java/org/apache/sling/commons/metrics/internal/MetricWebConsolePluginTest.java
+++ b/src/test/java/org/apache/sling/commons/metrics/internal/MetricWebConsolePluginTest.java
@@ -13,7 +13,7 @@
  * 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
+ * specific langauge governing permissions and limitations
  * under the License.
  */
 
@@ -145,7 +145,7 @@ public class MetricWebConsolePluginTest {
         assertTable("data-counters", page);
         assertTable("data-timers", page);
         assertTable("data-histograms", page);
-        assertTable("data-guages", page);
+        assertTable("data-gauges", page);
     }
 
     private void assertTable(String name, HtmlPage page) {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-metrics] 02/10: SLING-6527 : Remove usage of org.json from metrics module

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.metrics-1.2.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-metrics.git

commit 8be75c69e515c2e877671aa047f49d48b1daedfb
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Feb 20 08:24:46 2017 +0000

    SLING-6527 : Remove usage of org.json from metrics module
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics@1783721 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 271 ++++++++++-----------
 .../commons/metrics/internal/JSONReporter.java     |  19 +-
 .../commons/metrics/internal/JSONReporterTest.java |  46 ++--
 3 files changed, 170 insertions(+), 166 deletions(-)

diff --git a/pom.xml b/pom.xml
index d395d4c..7937633 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,148 +18,147 @@
   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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
 
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>29</version>
+    </parent>
 
-  <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.apache.sling.commons.metrics</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.2.1-SNAPSHOT</version>
 
-  <parent>
-    <groupId>org.apache.sling</groupId>
-    <artifactId>sling</artifactId>
-    <version>29</version>
-  </parent>
+    <name>Apache Sling Metrics</name>
+    <description>
+        Integrates Metric library with Sling. Refer to
+        https://sling.apache.org/documentation/bundles/metrics.html
+        for details
+    </description>
 
-  <artifactId>org.apache.sling.commons.metrics</artifactId>
-  <packaging>bundle</packaging>
-  <version>1.2.1-SNAPSHOT</version>
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/commons/metrics</url>
+    </scm>
 
-  <name>Apache Sling Metrics</name>
-  <description>
-    Integrates Metric library with Sling. Refer to
-    https://sling.apache.org/documentation/bundles/metrics.html
-    for details
-  </description>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-DocURL>
+                            https://sling.apache.org/documentation/bundles/metrics.html
+                        </Bundle-DocURL>
+                        <DynamicImport-Package>
+                            javax.servlet,
+                            javax.servlet.http;version="[2.3,3)",
+                            org.apache.commons.io.output;version="[2.4.0,3)",
+                            org.apache.felix.inventory;version="[1.0.0,2)"
+                        </DynamicImport-Package>
+                        <Embed-Dependency>
+                             org.apache.felix.utils;inline=org/apache/felix/utils/json/JSONWriter**
+                        </Embed-Dependency>
+                    </instructions>
+                    <!-- Export SCR metadata to classpath to have them available in unit tests -->
+                    <exportScr>true</exportScr>
+                </configuration>
+                <executions>
+                    <!-- Configure extra execution of 'manifest' in process-classes phase to make sure SCR metadata is generated before unit test runs -->
+                    <execution>
+                        <id>scr-metadata</id>
+                        <goals>
+                            <goal>manifest</goal>
+                        </goals>
+                        <configuration>
+                            <supportIncrementalBuild>true</supportIncrementalBuild>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
 
-  <scm>
-    <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics</developerConnection>
-    <url>http://svn.apache.org/viewvc/sling/trunk/bundles/commons/metrics</url>
-  </scm>
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.dropwizard.metrics</groupId>
+            <artifactId>metrics-core</artifactId>
+            <version>3.1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi.cmpn</artifactId>
+        </dependency>
 
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.inventory</artifactId>
+            <version>1.0.2</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.2</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.utils</artifactId>
+            <version>1.9.0</version>
+            <optional>true</optional>
+        </dependency>
 
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Bundle-DocURL>
-              https://sling.apache.org/documentation/bundles/metrics.html
-            </Bundle-DocURL>
-            <DynamicImport-Package>
-              javax.servlet,
-              javax.servlet.http;version="[2.3,3)",
-              org.apache.commons.io.output;version="[2.4.0,3)",
-              org.apache.felix.inventory;version="[1.0.0,2)"
-            </DynamicImport-Package>
-          </instructions>
-          <!-- Export SCR metadata to classpath to have them available in unit tests -->
-          <exportScr>true</exportScr>
-        </configuration>
-        <executions>
-          <!-- Configure extra execution of 'manifest' in process-classes phase to make sure SCR metadata is generated before unit test runs -->
-          <execution>
-            <id>scr-metadata</id>
-            <goals>
-              <goal>manifest</goal>
-            </goals>
-            <configuration>
-              <supportIncrementalBuild>true</supportIncrementalBuild>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>io.dropwizard.metrics</groupId>
-      <artifactId>metrics-core</artifactId>
-      <version>3.1.0</version>
-    </dependency>
-    <dependency>
-      <groupId>javax.servlet</groupId>
-      <artifactId>javax.servlet-api</artifactId>
-      <optional>true</optional>
-    </dependency>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>osgi.core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>osgi.cmpn</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.apache.felix.inventory</artifactId>
-      <version>1.0.2</version>
-      <optional>true</optional>
-    </dependency>
-    <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-      <version>2.2</version>
-      <optional>true</optional>
-    </dependency>
-    <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
-      <version>20090211</version>
-      <optional>true</optional>
-    </dependency>
-
-    <dependency>
-      <groupId>org.hamcrest</groupId>
-      <artifactId>hamcrest-all</artifactId>
-      <version>1.3</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.sling</groupId>
-      <artifactId>org.apache.sling.testing.osgi-mock</artifactId>
-      <version>2.1.0</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-core</artifactId>
-      <version>1.10.19</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-simple</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>net.sourceforge.htmlunit</groupId>
-      <artifactId>htmlunit</artifactId>
-      <version>2.12</version>
-      <scope>test</scope>
-    </dependency>
-
-  </dependencies>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest-all</artifactId>
+            <version>1.3</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.testing.osgi-mock</artifactId>
+            <version>2.1.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <version>1.10.19</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>net.sourceforge.htmlunit</groupId>
+            <artifactId>htmlunit</artifactId>
+            <version>2.12</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
 </project>
diff --git a/src/main/java/org/apache/sling/commons/metrics/internal/JSONReporter.java b/src/main/java/org/apache/sling/commons/metrics/internal/JSONReporter.java
index 9c631f7..8e630d0 100644
--- a/src/main/java/org/apache/sling/commons/metrics/internal/JSONReporter.java
+++ b/src/main/java/org/apache/sling/commons/metrics/internal/JSONReporter.java
@@ -20,6 +20,7 @@
 package org.apache.sling.commons.metrics.internal;
 
 import java.io.Closeable;
+import java.io.IOException;
 import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.util.Locale;
@@ -27,6 +28,8 @@ import java.util.Map;
 import java.util.SortedMap;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.felix.utils.json.JSONWriter;
+
 import com.codahale.metrics.ConsoleReporter;
 import com.codahale.metrics.Counter;
 import com.codahale.metrics.Gauge;
@@ -37,8 +40,6 @@ import com.codahale.metrics.MetricRegistry;
 import com.codahale.metrics.Reporter;
 import com.codahale.metrics.Snapshot;
 import com.codahale.metrics.Timer;
-import org.json.JSONException;
-import org.json.JSONWriter;
 
 class JSONReporter implements Reporter, Closeable {
 
@@ -147,7 +148,7 @@ class JSONReporter implements Reporter, Closeable {
                     registry.getHistograms(filter),
                     registry.getMeters(filter),
                     registry.getTimers(filter));
-        } catch (JSONException e) {
+        } catch (IOException e) {
             throw new RuntimeException(e);
         }
     }
@@ -159,7 +160,7 @@ class JSONReporter implements Reporter, Closeable {
 
     private void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters,
                         SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters,
-                        SortedMap<String, Timer> timers) throws JSONException {
+                        SortedMap<String, Timer> timers) throws IOException {
         json.object();
         if (!gauges.isEmpty()) {
             json.key("guages").object();
@@ -205,7 +206,7 @@ class JSONReporter implements Reporter, Closeable {
 
     }
 
-    private void printTimer(Map.Entry<String, Timer> e) throws JSONException {
+    private void printTimer(Map.Entry<String, Timer> e) throws IOException {
         json.key(e.getKey()).object();
         Timer timer = e.getValue();
         Snapshot snapshot = timer.getSnapshot();
@@ -233,7 +234,7 @@ class JSONReporter implements Reporter, Closeable {
         json.endObject();
     }
 
-    private void printMeter(Map.Entry<String, Meter> e) throws JSONException {
+    private void printMeter(Map.Entry<String, Meter> e) throws IOException {
         json.key(e.getKey()).object();
         Meter meter = e.getValue();
         json.key("count").value(e.getValue().getCount());
@@ -245,7 +246,7 @@ class JSONReporter implements Reporter, Closeable {
         json.endObject();
     }
 
-    private void printHistogram(Map.Entry<String, Histogram> e) throws JSONException {
+    private void printHistogram(Map.Entry<String, Histogram> e) throws IOException {
         json.key(e.getKey()).object();
         json.key("count").value(e.getValue().getCount());
 
@@ -264,13 +265,13 @@ class JSONReporter implements Reporter, Closeable {
         json.endObject();
     }
 
-    private void printCounter(Map.Entry<String, Counter> e) throws JSONException {
+    private void printCounter(Map.Entry<String, Counter> e) throws IOException {
         json.key(e.getKey()).object();
         json.key("count").value(e.getValue().getCount());
         json.endObject();
     }
 
-    private void printGauge(Map.Entry<String, Gauge> e) throws JSONException {
+    private void printGauge(Map.Entry<String, Gauge> e) throws IOException {
         json.key(e.getKey()).object();
         Object v = e.getValue().getValue();
         json.key("value").value(jsonSafeValue(v));
diff --git a/src/test/java/org/apache/sling/commons/metrics/internal/JSONReporterTest.java b/src/test/java/org/apache/sling/commons/metrics/internal/JSONReporterTest.java
index 1f13872..49a6b46 100644
--- a/src/test/java/org/apache/sling/commons/metrics/internal/JSONReporterTest.java
+++ b/src/test/java/org/apache/sling/commons/metrics/internal/JSONReporterTest.java
@@ -19,21 +19,24 @@
 
 package org.apache.sling.commons.metrics.internal;
 
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
 import java.io.PrintStream;
 import java.io.StringWriter;
+import java.util.Map;
 
-import com.codahale.metrics.Gauge;
-import com.codahale.metrics.JvmAttributeGaugeSet;
-import com.codahale.metrics.MetricRegistry;
 import org.apache.commons.io.output.WriterOutputStream;
-import org.json.JSONException;
-import org.json.JSONObject;
+import org.apache.felix.utils.json.JSONParser;
 import org.junit.Test;
 
-import static org.junit.Assert.assertTrue;
+import com.codahale.metrics.Gauge;
+import com.codahale.metrics.JvmAttributeGaugeSet;
+import com.codahale.metrics.MetricRegistry;
 
 public class JSONReporterTest {
 
+    @SuppressWarnings("unchecked")
     @Test
     public void jsonOutput() throws Exception {
         MetricRegistry registry = new MetricRegistry();
@@ -43,21 +46,22 @@ public class JSONReporterTest {
         registry.counter("test4").inc(9);
         registry.registerAll(new JvmAttributeGaugeSet());
 
-        JSONObject json = getJSON(registry);
+        Map<String, Object> json = getJSON(registry);
 
-        assertTrue(json.has("meters"));
-        assertTrue(json.has("guages"));
-        assertTrue(json.has("timers"));
-        assertTrue(json.has("counters"));
-        assertTrue(json.has("histograms"));
-        assertTrue(json.has("meters"));
+        assertTrue(json.containsKey("meters"));
+        assertTrue(json.containsKey("guages"));
+        assertTrue(json.containsKey("timers"));
+        assertTrue(json.containsKey("counters"));
+        assertTrue(json.containsKey("histograms"));
+        assertTrue(json.containsKey("meters"));
 
-        assertTrue(json.getJSONObject("meters").has("test1"));
-        assertTrue(json.getJSONObject("timers").has("test2"));
-        assertTrue(json.getJSONObject("counters").has("test4"));
-        assertTrue(json.getJSONObject("histograms").has("test3"));
+        assertTrue(((Map<String, Object>)json.get("meters")).containsKey("test1"));
+        assertTrue(((Map<String, Object>)json.get("timers")).containsKey("test2"));
+        assertTrue(((Map<String, Object>)json.get("counters")).containsKey("test4"));
+        assertTrue(((Map<String, Object>)json.get("histograms")).containsKey("test3"));
     }
 
+    @SuppressWarnings("unchecked")
     @Test
     public void nan_value() throws Exception{
         MetricRegistry registry = new MetricRegistry();
@@ -70,18 +74,18 @@ public class JSONReporterTest {
         });
 
 
-        JSONObject json = getJSON(registry);
-        assertTrue(json.getJSONObject("guages").has("test"));
+        Map<String, Object> json = getJSON(registry);
+        assertTrue(((Map<String, Object>)json.get("guages")).containsKey("test"));
     }
 
-    private static JSONObject getJSON(MetricRegistry registry) throws JSONException {
+    private static Map<String, Object> getJSON(MetricRegistry registry) throws IOException {
         StringWriter sw = new StringWriter();
         JSONReporter reporter = JSONReporter.forRegistry(registry)
                 .outputTo(new PrintStream(new WriterOutputStream(sw)))
                 .build();
         reporter.report();
         reporter.close();
-        return new JSONObject(sw.toString());
+        return new JSONParser(sw.toString()).getParsed();
     }
 
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-metrics] 07/10: SLING-6702 - rename the existing MetricsServiceFactory

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.metrics-1.2.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-metrics.git

commit d47d7fd057f42425b270385c915d1162cacd93ef
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Mar 23 14:14:49 2017 +0000

    SLING-6702 - rename the existing MetricsServiceFactory
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics@1788252 13f79535-47bb-0310-9956-ffa450edef68
---
 ...ryTest.java => InternalMetricsServiceFactoryTest.java} | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/src/test/java/org/apache/sling/commons/metrics/internal/MetricsServiceFactoryTest.java b/src/test/java/org/apache/sling/commons/metrics/internal/InternalMetricsServiceFactoryTest.java
similarity index 95%
rename from src/test/java/org/apache/sling/commons/metrics/internal/MetricsServiceFactoryTest.java
rename to src/test/java/org/apache/sling/commons/metrics/internal/InternalMetricsServiceFactoryTest.java
index f6d635b..2d3ee4e 100644
--- a/src/test/java/org/apache/sling/commons/metrics/internal/MetricsServiceFactoryTest.java
+++ b/src/test/java/org/apache/sling/commons/metrics/internal/InternalMetricsServiceFactoryTest.java
@@ -19,26 +19,19 @@
 
 package org.apache.sling.commons.metrics.internal;
 
-import java.util.Collections;
-
-import javax.management.ObjectName;
-
 import com.codahale.metrics.MetricRegistry;
+import javax.management.ObjectName;
 import org.apache.sling.commons.metrics.MetricsService;
 import org.apache.sling.testing.mock.osgi.MockBundle;
-import org.apache.sling.testing.mock.osgi.MockOsgi;
 import org.apache.sling.testing.mock.osgi.junit.OsgiContext;
-import org.junit.After;
-import org.junit.Before;
+import static org.junit.Assert.*;
 import org.junit.Rule;
 import org.junit.Test;
+import static org.mockito.Mockito.mock;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.ServiceRegistration;
 
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.mock;
-
-public class MetricsServiceFactoryTest {
+public class InternalMetricsServiceFactoryTest {
     @Rule
     public final OsgiContext context = new OsgiContext();
     private MetricsServiceImpl serviceImpl = new MetricsServiceImpl();

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-metrics] 01/10: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.metrics-1.2.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-metrics.git

commit 622eedf0166761666e8ab44efbe412d2f10bc862
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Mon Nov 28 09:31:51 2016 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics@1771694 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 3275dd5..d395d4c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
 
   <artifactId>org.apache.sling.commons.metrics</artifactId>
   <packaging>bundle</packaging>
-  <version>1.2.0</version>
+  <version>1.2.1-SNAPSHOT</version>
 
   <name>Apache Sling Metrics</name>
   <description>
@@ -40,9 +40,9 @@
   </description>
 
   <scm>
-    <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.commons.metrics-1.2.0</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.commons.metrics-1.2.0</developerConnection>
-    <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.commons.metrics-1.2.0</url>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics</developerConnection>
+    <url>http://svn.apache.org/viewvc/sling/trunk/bundles/commons/metrics</url>
   </scm>
 
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-metrics] 04/10: SLING-6596 - fix typo introduced by the typo fixing

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.metrics-1.2.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-metrics.git

commit 7d97faa2a1a587214cc9b1e79dd9a8109558a00f
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Mar 3 14:12:32 2017 +0000

    SLING-6596 - fix typo introduced by the typo fixing
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics@1785309 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/sling/commons/metrics/internal/JSONReporter.java    | 2 +-
 .../apache/sling/commons/metrics/internal/MetricWebConsolePlugin.java   | 2 +-
 .../org/apache/sling/commons/metrics/internal/JSONReporterTest.java     | 2 +-
 .../sling/commons/metrics/internal/MetricWebConsolePluginTest.java      | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/sling/commons/metrics/internal/JSONReporter.java b/src/main/java/org/apache/sling/commons/metrics/internal/JSONReporter.java
index c7a439f..d501fb2 100644
--- a/src/main/java/org/apache/sling/commons/metrics/internal/JSONReporter.java
+++ b/src/main/java/org/apache/sling/commons/metrics/internal/JSONReporter.java
@@ -13,7 +13,7 @@
  * 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 langauge governing permissions and limitations
+ * specific language governing permissions and limitations
  * under the License.
  */
 
diff --git a/src/main/java/org/apache/sling/commons/metrics/internal/MetricWebConsolePlugin.java b/src/main/java/org/apache/sling/commons/metrics/internal/MetricWebConsolePlugin.java
index 70a7581..6b8e8c1 100644
--- a/src/main/java/org/apache/sling/commons/metrics/internal/MetricWebConsolePlugin.java
+++ b/src/main/java/org/apache/sling/commons/metrics/internal/MetricWebConsolePlugin.java
@@ -13,7 +13,7 @@
  * 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 langauge governing permissions and limitations
+ * specific language governing permissions and limitations
  * under the License.
  */
 
diff --git a/src/test/java/org/apache/sling/commons/metrics/internal/JSONReporterTest.java b/src/test/java/org/apache/sling/commons/metrics/internal/JSONReporterTest.java
index d05c175..4de6cc8 100644
--- a/src/test/java/org/apache/sling/commons/metrics/internal/JSONReporterTest.java
+++ b/src/test/java/org/apache/sling/commons/metrics/internal/JSONReporterTest.java
@@ -13,7 +13,7 @@
  * 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 langauge governing permissions and limitations
+ * specific language governing permissions and limitations
  * under the License.
  */
 
diff --git a/src/test/java/org/apache/sling/commons/metrics/internal/MetricWebConsolePluginTest.java b/src/test/java/org/apache/sling/commons/metrics/internal/MetricWebConsolePluginTest.java
index 56e44bc..6b73d91 100644
--- a/src/test/java/org/apache/sling/commons/metrics/internal/MetricWebConsolePluginTest.java
+++ b/src/test/java/org/apache/sling/commons/metrics/internal/MetricWebConsolePluginTest.java
@@ -13,7 +13,7 @@
  * 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 langauge governing permissions and limitations
+ * specific language governing permissions and limitations
  * under the License.
  */
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-metrics] 09/10: [maven-release-plugin] prepare release org.apache.sling.commons.metrics-1.2.2

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.metrics-1.2.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-metrics.git

commit f45f5f5f466b34ae6d7f61c4a3bf341acdd44ddf
Author: Karl Pauls <pa...@apache.org>
AuthorDate: Fri Jun 2 20:57:03 2017 +0000

    [maven-release-plugin] prepare release org.apache.sling.commons.metrics-1.2.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics@1797443 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index fe07ab1..4da9663 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.commons.metrics</artifactId>
     <packaging>bundle</packaging>
-    <version>1.2.1-SNAPSHOT</version>
+    <version>1.2.2</version>
 
     <name>Apache Sling Metrics</name>
     <description>
@@ -42,9 +42,9 @@
     </properties>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/commons/metrics</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.commons.metrics-1.2.2</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.commons.metrics-1.2.2</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.commons.metrics-1.2.2</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-metrics] 06/10: SLING-6702 - rename the existing MetricsServiceFactory

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.metrics-1.2.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-metrics.git

commit fd392422a947b4a28ef58f98870f540a049bc0e7
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Mar 23 14:01:20 2017 +0000

    SLING-6702 - rename the existing MetricsServiceFactory
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics@1788246 13f79535-47bb-0310-9956-ffa450edef68
---
 ...{MetricsServiceFactory.java => InternalMetricsServiceFactory.java} | 4 ++--
 .../org/apache/sling/commons/metrics/internal/MetricsServiceImpl.java | 2 +-
 .../sling/commons/metrics/internal/MetricsServiceFactoryTest.java     | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/sling/commons/metrics/internal/MetricsServiceFactory.java b/src/main/java/org/apache/sling/commons/metrics/internal/InternalMetricsServiceFactory.java
similarity index 94%
rename from src/main/java/org/apache/sling/commons/metrics/internal/MetricsServiceFactory.java
rename to src/main/java/org/apache/sling/commons/metrics/internal/InternalMetricsServiceFactory.java
index b9d8bb6..c3f7fff 100644
--- a/src/main/java/org/apache/sling/commons/metrics/internal/MetricsServiceFactory.java
+++ b/src/main/java/org/apache/sling/commons/metrics/internal/InternalMetricsServiceFactory.java
@@ -32,11 +32,11 @@ import org.osgi.framework.Bundle;
 import org.osgi.framework.ServiceFactory;
 import org.osgi.framework.ServiceRegistration;
 
-class MetricsServiceFactory implements ServiceFactory<MetricsService> {
+class InternalMetricsServiceFactory implements ServiceFactory<MetricsService> {
     private final MetricsService delegate;
     private final BundleMetricsMapper metricsMapper;
 
-    public MetricsServiceFactory(MetricsService delegate, BundleMetricsMapper metricsMapper) {
+    public InternalMetricsServiceFactory(MetricsService delegate, BundleMetricsMapper metricsMapper) {
         this.delegate = delegate;
         this.metricsMapper = metricsMapper;
     }
diff --git a/src/main/java/org/apache/sling/commons/metrics/internal/MetricsServiceImpl.java b/src/main/java/org/apache/sling/commons/metrics/internal/MetricsServiceImpl.java
index cec64bb..5d57ab9 100644
--- a/src/main/java/org/apache/sling/commons/metrics/internal/MetricsServiceImpl.java
+++ b/src/main/java/org/apache/sling/commons/metrics/internal/MetricsServiceImpl.java
@@ -71,7 +71,7 @@ public class MetricsServiceImpl implements MetricsService {
         svcProps.put(Constants.SERVICE_DESCRIPTION, "Apache Sling Metrics Service");
         svcProps.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
         regs.add(context.registerService(MetricsService.class.getName(),
-                new MetricsServiceFactory(this, metricsMapper), svcProps));
+                new InternalMetricsServiceFactory(this, metricsMapper), svcProps));
 
         final Dictionary<String, String> regProps = new Hashtable<>();
         regProps.put(Constants.SERVICE_DESCRIPTION, "Apache Sling Metrics Registry");
diff --git a/src/test/java/org/apache/sling/commons/metrics/internal/MetricsServiceFactoryTest.java b/src/test/java/org/apache/sling/commons/metrics/internal/MetricsServiceFactoryTest.java
index 71d7fe4..f6d635b 100644
--- a/src/test/java/org/apache/sling/commons/metrics/internal/MetricsServiceFactoryTest.java
+++ b/src/test/java/org/apache/sling/commons/metrics/internal/MetricsServiceFactoryTest.java
@@ -44,7 +44,7 @@ public class MetricsServiceFactoryTest {
     private MetricsServiceImpl serviceImpl = new MetricsServiceImpl();
     private MetricRegistry registry = serviceImpl.getRegistry();
     private BundleMetricsMapper mapper = new BundleMetricsMapper(registry);
-    private MetricsServiceFactory srvFactory = new MetricsServiceFactory(serviceImpl, mapper);
+    private InternalMetricsServiceFactory srvFactory = new InternalMetricsServiceFactory(serviceImpl, mapper);
     private ServiceRegistration<MetricsService> reg = mock(ServiceRegistration.class);
 
     @Test

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-metrics] 08/10: SLING-6702 - MetricsServiceFactory + tests. Test are a bit slow for now, starting a full Sling Launchpad should not be needed

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.metrics-1.2.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-metrics.git

commit c06acb322fd2d37c1c60fdff6e733bdcd53b09dc
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Mar 23 15:50:05 2017 +0000

    SLING-6702 - MetricsServiceFactory + tests. Test are a bit slow for now, starting a full Sling Launchpad should not be needed
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics@1788272 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 85 ++++++++++++++++++-
 .../commons/metrics/MetricsServiceFactory.java     | 62 ++++++++++++++
 .../apache/sling/commons/metrics/package-info.java |  2 +-
 .../metrics/test/MetricsServiceFactoryIT.java      | 96 ++++++++++++++++++++++
 4 files changed, 243 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 2035102..fe07ab1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,6 +36,10 @@
         https://sling.apache.org/documentation/bundles/metrics.html
         for details
     </description>
+    
+    <properties>
+        <org.ops4j.pax.exam.version>4.10.0</org.ops4j.pax.exam.version>
+    </properties>
 
     <scm>
         <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics</connection>
@@ -80,6 +84,38 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>integration-test</goal>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
+                    <systemProperties>
+                        <property>
+                            <name>bundle.filename</name>
+                            <value>${basedir}/target/${project.build.finalName}.jar</value>
+                        </property>
+                    </systemProperties>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.servicemix.tooling</groupId>
+                <artifactId>depends-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                          <goal>generate-depends-file</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 
@@ -160,5 +196,52 @@
             <version>2.12</version>
             <scope>test</scope>
         </dependency>
-    </dependencies>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam</artifactId>
+            <version>${org.ops4j.pax.exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-cm</artifactId>
+            <version>${org.ops4j.pax.exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-container-forked</artifactId>
+            <version>${org.ops4j.pax.exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-junit4</artifactId>
+            <version>${org.ops4j.pax.exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-link-mvn</artifactId>
+            <version>${org.ops4j.pax.exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.inject</groupId>
+            <artifactId>javax.inject</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.framework</artifactId>
+            <version>5.6.2</version>
+            <scope>test</scope>
+         </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.testing.paxexam</artifactId>
+            <version>0.0.4</version>
+            <scope>provided</scope>
+        </dependency>
+     </dependencies>
 </project>
diff --git a/src/main/java/org/apache/sling/commons/metrics/MetricsServiceFactory.java b/src/main/java/org/apache/sling/commons/metrics/MetricsServiceFactory.java
new file mode 100644
index 0000000..cd1c23f
--- /dev/null
+++ b/src/main/java/org/apache/sling/commons/metrics/MetricsServiceFactory.java
@@ -0,0 +1,62 @@
+/*
+ * 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.sling.commons.metrics;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+
+/** Utility that provides a MetricsService to any class that
+ *  has been loaded from an OSGi bundle.
+ *  This is meant to make it as easy to access the MetricsService
+ *  as it is to get a Logger, for example.
+ */
+public class MetricsServiceFactory {
+    
+    /** Provide a MetricsService mapped to the Bundle that loaded class c 
+     *  @param c a Class loaded by an OSGi bundle
+     *  @return a MetricsService
+     */
+    public static MetricsService getMetricsService(Class<?> c) {
+        if(c == null) {
+            throw new IllegalArgumentException("Class parameter is required");
+        }
+        
+        final Bundle b = FrameworkUtil.getBundle(c);
+        if(b == null) {
+            throw new IllegalArgumentException("No BundleContext, Class was not loaded from a Bundle?: " 
+                    + c.getClass().getName());
+        }
+        
+        final BundleContext ctx = b.getBundleContext();
+
+        // In theory we should unget this reference, but the OSGi framework
+        // ungets all references held by a bundle when it stops and we cannot
+        // do much better than that anyway.
+        final ServiceReference ref = ctx.getServiceReference(MetricsService.class.getName());
+        if(ref == null) {
+            throw new IllegalStateException("MetricsService not found for Bundle "
+                    + b.getSymbolicName());
+        }
+        
+        return (MetricsService)ctx.getService(ref);
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/commons/metrics/package-info.java b/src/main/java/org/apache/sling/commons/metrics/package-info.java
index 3d6a101..0fa4a33 100644
--- a/src/main/java/org/apache/sling/commons/metrics/package-info.java
+++ b/src/main/java/org/apache/sling/commons/metrics/package-info.java
@@ -22,7 +22,7 @@
  *
  * @version 1.0
  */
-@Version("1.1.0")
+@Version("1.2.0")
 package org.apache.sling.commons.metrics;
 
 
diff --git a/src/test/java/org/apache/sling/commons/metrics/test/MetricsServiceFactoryIT.java b/src/test/java/org/apache/sling/commons/metrics/test/MetricsServiceFactoryIT.java
new file mode 100644
index 0000000..1e7cd83
--- /dev/null
+++ b/src/test/java/org/apache/sling/commons/metrics/test/MetricsServiceFactoryIT.java
@@ -0,0 +1,96 @@
+/*
+ * 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.sling.commons.metrics.test;
+
+import javax.inject.Inject;
+import org.apache.sling.commons.metrics.MetricsService;
+import org.apache.sling.commons.metrics.MetricsServiceFactory;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingLaunchpadOakTar;
+import org.apache.sling.testing.paxexam.TestSupport;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.osgi.framework.BundleContext;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class MetricsServiceFactoryIT extends TestSupport {
+
+    @Inject
+    private BundleContext bundleContext;
+    
+    @Configuration
+    public Option[] configuration() {
+        return new Option[]{
+            baseConfiguration()
+        };
+    }
+
+    @Override
+    protected Option baseConfiguration() {
+        return composite(
+            super.baseConfiguration(),
+            launchpad(),
+            testBundle("bundle.filename"),
+            mavenBundle().groupId("io.dropwizard.metrics").artifactId("metrics-core").versionAsInProject(),
+            mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.testing.paxexam").versionAsInProject(),
+            mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.junit.core").version("1.0.23")
+        );
+    }
+    
+   protected Option launchpad() {
+        final int httpPort = findFreePort();
+        final String workingDirectory = workingDirectory();
+        return slingLaunchpadOakTar(workingDirectory, httpPort);
+    }
+   
+    @Test
+    public void nullClass() {
+        try {
+            MetricsServiceFactory.getMetricsService(null);
+            fail("Expecting an Exception");
+        } catch(IllegalArgumentException asExpected) {
+        }
+        
+    }
+    
+    @Test
+    public void classNotLoadedFromOsgiBundle() {
+        try {
+            MetricsServiceFactory.getMetricsService(String.class);
+            fail("Expecting an Exception");
+        } catch(IllegalArgumentException asExpected) {
+        }
+    }
+    
+    @Test
+    public void classFromBundle() {
+        final MetricsService m = MetricsServiceFactory.getMetricsService(getClass());
+        assertNotNull("Expecting a MetricsService", m);
+    }
+    
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.