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:39:47 UTC

[sling-org-apache-sling-hc-support] annotated tag org.apache.sling.hc.support-1.0.4 created (now 0d1ed7e)

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

rombert pushed a change to annotated tag org.apache.sling.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git.


      at 0d1ed7e  (tag)
 tagging 3dc00094c7a1e77564024e18a9cca242a9e58668 (commit)
      by Bertrand Delacretaz
      on Thu Sep 26 14:54:49 2013 +0000

- Log -----------------------------------------------------------------
org.apache.sling.hc.support-1.0.4
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new 7300945  SLING-2987 - split into several bundles
     new c6decff  SLING-2987 - split into several bundles
     new 7f238d5  SLING-2987 - CompositeHealthCheck - execute a set of other HealthChecks selected by tags
     new 4301c26  SLING-2987 - metatype and samples config tweaks
     new 82038d7  SLING-2987 - fix logging errors
     new 9b08382  SLING-2987 - add filter.tags to info
     new bcce508  SLING-3020 - Result is now immutable
     new baa4b25  SLING-3020 - error reporting tweaks
     new 3abcf33  SLING-3021 :  Use service properties for HC meta data and improve JMX registration
     new 1315652  SLING-3024 :  Move SimpleConstraintChecker to healthchecks bundle
     new aeee81c  Clean up maven pom - remove unused dependencies, wrong plugin instructions etc.
     new e3ba14d  A little code cleanup of annotations
     new d0e1473  Apply naming conventions
     new 08e38a5  SLING-3034 - explain what this is for
     new ed9b0ef  Correctly free service references
     new 155f3a4  SLING-3034 - move 'core' HealthCheck services to api bundle
     new bb224b1  SLING-3034 - rename modules: healthchecks to support
     new 5fd6a7b  SLING-3034 - rename modules: api to core and healthchecks to support
     new f445623  SLING-3034 - SlingRequestStatusHealthCheckTest added
     new 0cc7be7  add missing metatype to core module, and fix and check metatype in support module
     new b0bbcd2  SLING-3127 - prepare Health Check tools release
     new da8fb74  SLING-3127 - it's Apache Sling ;-)
     new fafd1c5  SLING-3127 - add scm info
     new a9c2614  SLING-3127 - use latest parent pom
     new ed95aef  [maven-release-plugin] prepare release org.apache.sling.hc.core-1.0.0
     new 3d57fbf  [maven-release-plugin] prepare for next development iteration
     new 83d1ba6  [maven-release-plugin] prepare release org.apache.sling.hc.core-1.0.2
     new 4c9cf8d  [maven-release-plugin] prepare for next development iteration
     new 9fa3bf9  SLING-3127 - prepare for release
     new 354b479  [maven-release-plugin] prepare release org.apache.sling.hc.support-1.0.4
     new 3dc0009  [maven-release-plugin]  copy for tag org.apache.sling.hc.support-1.0.4

The 31 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-hc-support] 03/31: SLING-2987 - CompositeHealthCheck - execute a set of other HealthChecks selected by tags

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit 7f238d522acfff04cd56a8a1b45eb2fcedd10645
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Aug 13 10:04:23 2013 +0000

    SLING-2987 - CompositeHealthCheck - execute a set of other HealthChecks selected by tags
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/healthchecks@1513416 13f79535-47bb-0310-9956-ffa450edef68
---
 .../hc/healthchecks/impl/CompositeHealthCheck.java | 113 +++++++++++++++++++++
 .../OSGI-INF/metatype/metatype.properties          |  78 ++++++++++++++
 2 files changed, 191 insertions(+)

diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
new file mode 100644
index 0000000..0b37da7
--- /dev/null
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
@@ -0,0 +1,113 @@
+/*
+ * 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 SF 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.hc.healthchecks.impl;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.ConfigurationPolicy;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.commons.osgi.PropertiesUtil;
+import org.apache.sling.hc.api.Constants;
+import org.apache.sling.hc.api.HealthCheck;
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.api.ResultLogEntry;
+import org.apache.sling.hc.util.HealthCheckFilter;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/** {@link HealthCheck} that executes a number of other HealthChecks,
+ *  selected by their tags, and merges their Results.
+ */
+@Component(
+        name="org.apache.sling.hc.CompositeHealthCheck",
+        configurationFactory=true, 
+        policy=ConfigurationPolicy.REQUIRE, 
+        metatype=true)
+@Service
+public class CompositeHealthCheck implements HealthCheck {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+    private Map<String, String> info;
+    private BundleContext bundleContext;
+    
+    @Property(cardinality=50)
+    public static final String PROP_TAGS = Constants.HC_TAGS;
+    
+    @Property(cardinality=50)
+    public static final String PROP_FILTER_TAGS = "filter.tags";
+    private String [] filterTags;
+    
+    
+    @Activate
+    public void activate(ComponentContext ctx) {
+        bundleContext = ctx.getBundleContext();
+        info = new HealthCheckInfo(ctx.getProperties());
+        filterTags = PropertiesUtil.toStringArray(ctx.getProperties().get(PROP_FILTER_TAGS), new String[] {});
+        log.info("Activated, will select HealthCheck having tags {}", Arrays.asList(filterTags));
+    }
+    
+    @Override
+    public Result execute() {
+        final Result result = new Result(log);
+        final List<HealthCheck> checks = new HealthCheckFilter(bundleContext).getTaggedHealthCheck(filterTags);
+        if(checks.size() == 0) {
+            result.log(ResultLogEntry.LT_WARN, "HealthCheckFilter returns no HealthCheck for tags " + Arrays.asList(filterTags));
+            return result;
+        }
+            
+        result.log(ResultLogEntry.LT_DEBUG, 
+                "Executing " + checks.size() 
+                + " HealthCheck selected by the " + Arrays.asList(filterTags) + " tags");
+        int failures = 0;
+        for(HealthCheck hc : checks) {
+            if(hc == this) {
+                result.log(ResultLogEntry.LT_WARN, 
+                        "Cowardly forfeiting execution of this HealthCheck in an infinite loop - do not include my tags in the filter tags!");
+                continue;
+            }
+            result.log(ResultLogEntry.LT_DEBUG, "Executing " + hc); 
+            final Result sub = hc.execute();
+            if(!sub.isOk()) {
+                failures++;
+            }
+            result.merge(sub);
+        }
+        
+        if(failures == 0) {
+            result.log(ResultLogEntry.LT_DEBUG, 
+                    checks.size() + " HealthCheck executed, all ok"); 
+        } else {
+            result.log(ResultLogEntry.LT_WARN, 
+                    checks.size() + " HealthCheck executed, " + failures + " failures"); 
+        }
+        
+        return result;
+    }
+
+    @Override
+    public Map<String, String> getInfo() {
+        return info;
+    }
+}
\ No newline at end of file
diff --git a/src/main/resources/OSGI-INF/metatype/metatype.properties b/src/main/resources/OSGI-INF/metatype/metatype.properties
new file mode 100644
index 0000000..2b2482c
--- /dev/null
+++ b/src/main/resources/OSGI-INF/metatype/metatype.properties
@@ -0,0 +1,78 @@
+#
+#  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.
+#
+
+#
+# This file contains localization strings for configuration labels and
+# descriptions as used in the metatype.xml descriptor generated by the
+# the Sling SCR plugin
+
+org.apache.sling.hc.JmxAttributeHealthCheck.name = JMX Attribute Health Check
+org.apache.sling.hc.JmxAttributeHealthCheck.description = Checks the value of a single JMX attribute.
+
+org.apache.sling.hc.ScriptableHealthCheck.name = Scriptable Health Check
+org.apache.sling.hc.ScriptableHealthCheck.description = Uses scripted expressions to verify multiple JMX \
+  attributes or other values.
+
+org.apache.sling.hc.DefaultLoginsHealthCheck.name = Default Logins Health Check 
+org.apache.sling.hc.DefaultLoginsHealthCheck.description = Expects default logins to fail, used to verify \
+    that they are disabled on production systems
+    
+org.apache.sling.hc.SlingRequestStatusHealthCheck.name = Sling Request Status Health Check
+org.apache.sling.hc.SlingRequestStatusHealthCheck.description = Checks the HTTP status of Sling requests.
+
+org.apache.sling.hc.CompositeHealthCheck.name = Composite Health Check 
+org.apache.sling.hc.CompositeHealthCheck.description = Executes a set of Health Checks, selected by tags. 
+
+filter.tags.name = Filter tags
+filter.tags.description = Tags used to select Health Checks.
+
+mbean.name.name = MBean name
+mbean.name.description = The name of the MBean to check.
+
+attribute.name.name = Attribute name
+attribute.name.description = The name of the MBean attribute to check.
+
+attribute.value.constraint.name = Attribute value constraint
+attribute.value.constraint.description = Constraint on the MBean attribute value.
+
+hc.mbean.name.name = MBean name
+hc.mbean.name.description = Name of the MBean to create for this Health Check.
+
+hc.tags.name = Health Check tags
+hc.tags.description = List of tags for this Health Check service, used to select \
+    subsets of Health Check services for execution.
+
+hc.name.name = Health Check Name
+hc.name.description = Name of this Health Check service, used for example to identify the \
+    corresponding JMX MBean.
+
+expression.name = Expression
+expression.description = The value of this expression must be "true" for the Health Check \
+    to be successful.
+
+language.extension.name = Language extension
+language.extension.description = File extension of the language to use to evaluate the \
+    expression, for example "ecma" or "groovy", asssuming the corresponding script engine \
+    is available.
+    
+username.name = Username
+username.description = The username to use to test logins.
+
+password.name = Password
+password.description = The password to use to test logins.        
\ 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-hc-support] 01/31: SLING-2987 - split into several bundles

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit 730094505f2d9e4791a9bf76fe2627a0155424fb
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Aug 12 16:01:50 2013 +0000

    SLING-2987 - split into several bundles
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/healthchecks@1513179 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 154 ++++++++++
 .../impl/DefaultLoginsHealthCheck.java             | 129 +++++++++
 .../hc/healthchecks/impl/HealthCheckInfo.java      |  42 +++
 .../hc/healthchecks/impl/InternalRequest.java      | 319 +++++++++++++++++++++
 .../hc/healthchecks/impl/InternalResponse.java     | 185 ++++++++++++
 .../healthchecks/impl/JmxAttributeHealthCheck.java | 115 ++++++++
 .../hc/healthchecks/impl/JmxScriptBinding.java     |  62 ++++
 .../hc/healthchecks/impl/OsgiScriptBinding.java    |  73 +++++
 .../healthchecks/impl/ScriptableHealthCheck.java   | 131 +++++++++
 .../impl/SlingRequestStatusHealthCheck.java        | 153 ++++++++++
 src/test/java/org/apache/sling/hc/healthcheck      |  44 +++
 .../healthchecks/DefaultLoginsHealthCheckTest.java |  77 +++++
 .../healthchecks/JmxAttributeHealthCheckTest.java  |  57 ++++
 .../hc/healthchecks/JmxScriptBindingTest.java      |  41 +++
 .../hc/healthchecks/OsgiScriptBindingTest.java     |  67 +++++
 .../hc/healthchecks/ScriptableHealthCheckTest.java |  94 ++++++
 16 files changed, 1743 insertions(+)

diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..b146639
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>16</version>
+        <relativePath>16</relativePath>
+    </parent>
+
+    <groupId>org.apache.sling</groupId>
+    <artifactId>org.apache.sling.hc.healthchecks</artifactId>
+    <packaging>bundle</packaging>
+    <version>0.0.2-SNAPSHOT</version>
+
+    <name>Sling Health Check Module - Health Check Services</name>
+    <inceptionYear>2013</inceptionYear>
+    
+    <description>
+        Default Sling Health Check Services
+    </description>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Private-Package>
+                            org.apache.sling.hc.healthchecks.*
+                        </Private-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+            </plugin>
+           <plugin>
+              <groupId>org.codehaus.mojo</groupId>
+              <artifactId>animal-sniffer-maven-plugin</artifactId>
+              <configuration>
+                <signature>
+                  <groupId>org.codehaus.mojo.signature</groupId>
+                  <artifactId>java16</artifactId>
+                  <version>1.0</version>
+                </signature>
+              </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.hc.api</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.osgi</artifactId>
+            <version>2.2.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.api</artifactId>
+            <version>2.1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.jcr.api</artifactId>
+            <version>2.0.4</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.engine</artifactId>
+            <version>2.2.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.6.2</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+       <dependency>
+            <groupId>javax.jcr</groupId>
+            <artifactId>jcr</artifactId>
+            <scope>provided</scope>
+        </dependency>
+         <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <version>1.6.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.11</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <version>1.9.5</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>rhino</groupId>
+            <artifactId>js</artifactId>
+            <version>1.6R6</version>
+            <scope>test</scope>
+        </dependency>
+     </dependencies>
+</project>
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java
new file mode 100644
index 0000000..357c5c1
--- /dev/null
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java
@@ -0,0 +1,129 @@
+/*
+ * 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 SF 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.hc.healthchecks.impl;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import javax.jcr.Credentials;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.ConfigurationPolicy;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.commons.osgi.PropertiesUtil;
+import org.apache.sling.hc.api.Constants;
+import org.apache.sling.hc.api.HealthCheck;
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.api.ResultLogEntry;
+import org.apache.sling.jcr.api.SlingRepository;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/** {@link HealthCheck} that checks that Sling default logins fail.
+ *  Used to verify that those logins are disabled on production systems */
+@Component(
+        name="org.apache.sling.hc.DefaultLoginsHealthCheck",
+        configurationFactory=true, 
+        policy=ConfigurationPolicy.REQUIRE, 
+        metatype=true)
+@Service
+public class DefaultLoginsHealthCheck implements HealthCheck {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+    private Map<String, String> info;
+    
+    @Property(cardinality=500)
+    public static final String PROP_LOGINS = "logins";
+    private List<String> logins;
+    
+    @Property(cardinality=50)
+    public static final String PROP_TAGS = Constants.HC_TAGS;
+    
+    @Property
+    public static final String PROP_NAME = Constants.HC_NAME;
+    
+    @Property
+    public static final String PROP_MBEAN_NAME = Constants.HC_MBEAN_NAME;
+    
+    @Reference
+    private SlingRepository repository;
+    
+    @Activate
+    public void activate(ComponentContext ctx) {
+        info = new HealthCheckInfo(ctx.getProperties());
+        logins = Arrays.asList(PropertiesUtil.toStringArray(ctx.getProperties().get(PROP_LOGINS), new String[] {}));
+        log.info("Activated, logins={}", logins);
+    }
+    
+    @Override
+    public Result execute() {
+        final Result result = new Result(log);
+        int checked=0;
+        int failures=0;
+        
+        for(String login : logins) {
+            final String [] parts = login.split(":");
+            if(parts.length != 2) {
+                result.log(ResultLogEntry.LT_WARN, "Expected login in the form username:password, got " + login);
+                continue;
+            }
+            checked++;
+            final String username = parts[0].trim();
+            final String password = parts[1].trim();
+            final Credentials creds = new SimpleCredentials(username, password.toCharArray());
+            Session s = null;
+            try {
+                s = repository.login(creds);
+                if(s != null) {
+                    failures++;
+                    result.log(ResultLogEntry.LT_WARN_SECURITY, "Login as [" + username + "] succeeded, was expecting it to fail");
+                } else {
+                    result.log(ResultLogEntry.LT_DEBUG, "Login as [" + username + "] didn't throw an Exception but returned null Session");
+                }
+            } catch(RepositoryException re) {
+                result.log(ResultLogEntry.LT_DEBUG, "Login as [" + username + "] failed, as expected");
+            } finally {
+                if(s != null) {
+                    s.logout();
+                }
+            }
+        }
+        
+        if(checked==0) {
+            result.log(ResultLogEntry.LT_WARN, "Did not check any logins, configured logins=" + logins);
+        } else if(failures != 0){
+            result.log(ResultLogEntry.LT_WARN_SECURITY, "Checked " + checked + " logins, " + failures + " tests failed");
+        } else {
+            result.log(ResultLogEntry.LT_DEBUG, "Checked " + checked + " logins, all tests successful");
+        }
+        return result;
+    }
+
+    @Override
+    public Map<String, String> getInfo() {
+        return info;
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/HealthCheckInfo.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/HealthCheckInfo.java
new file mode 100644
index 0000000..ac3dc61
--- /dev/null
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/HealthCheckInfo.java
@@ -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 SF 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.hc.healthchecks.impl;
+
+import java.util.Arrays;
+import java.util.Dictionary;
+import java.util.HashMap;
+
+import org.apache.sling.commons.osgi.PropertiesUtil;
+import org.apache.sling.hc.api.Constants;
+
+// TODO move to services bundle
+
+/** Utility that copies useful HealthCheck service
+ *  properties to a Map that can be used as the Result's
+ *  info(). Copies all service properties that have names
+ *  that start with the {#Constants.HC_PROP_PREFIX} */
+public class HealthCheckInfo extends HashMap<String, String> {
+    private static final long serialVersionUID = 8661195387931574705L;
+
+    public HealthCheckInfo(Dictionary<?, ?> serviceProperties) {
+        put(Constants.HC_NAME, PropertiesUtil.toString(serviceProperties.get(Constants.HC_NAME), ""));
+        put(Constants.HC_MBEAN_NAME, PropertiesUtil.toString(serviceProperties.get(Constants.HC_MBEAN_NAME), ""));
+        put(Constants.HC_TAGS, 
+                Arrays.asList(PropertiesUtil.toStringArray(serviceProperties.get(Constants.HC_TAGS), new String[] {})).toString());
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/InternalRequest.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/InternalRequest.java
new file mode 100644
index 0000000..570e57c
--- /dev/null
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/InternalRequest.java
@@ -0,0 +1,319 @@
+/*
+ * 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 SF 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.hc.healthchecks.impl;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+public class InternalRequest implements HttpServletRequest {
+
+    private final String path;
+    private final Map<String, Object> attributes = new HashMap<String, Object>();
+    
+    public InternalRequest(String path) {
+        this.path = path;
+    }
+    
+    @Override
+    public Object getAttribute(String key) {
+        return attributes.get(key);
+    }
+
+    @Override
+    public Enumeration<?> getAttributeNames() {
+        return new Vector<String>(attributes.keySet()).elements();
+    }
+
+    @Override
+    public String getCharacterEncoding() {
+        return "UTF-8";
+    }
+
+    @Override
+    public int getContentLength() {
+        return 0;
+    }
+
+    @Override
+    public String getContentType() {
+        return "text/plain";
+    }
+
+    @Override
+    public ServletInputStream getInputStream() throws IOException {
+        return new ServletInputStream() {
+            @Override
+            public int read() throws IOException {
+                return 0;
+            }
+        };
+    }
+
+    @Override
+    public String getLocalAddr() {
+        return "127.0.0.1";
+    }
+
+    @Override
+    public String getLocalName() {
+        return "localhost";
+    }
+
+    @Override
+    public int getLocalPort() {
+        return 0;
+    }
+
+    @Override
+    public Locale getLocale() {
+        return Locale.getDefault();
+    }
+
+    @Override
+    public Enumeration<?> getLocales() {
+        return new Vector<Locale>().elements();
+    }
+
+    @Override
+    public String getParameter(String arg0) {
+        return null;
+    }
+
+    @Override
+    public Map<?,?> getParameterMap() {
+        return new HashMap<String, Object>();
+    }
+
+    @Override
+    public Enumeration<?> getParameterNames() {
+        return new Vector<String>().elements();
+    }
+
+    @Override
+    public String[] getParameterValues(String arg0) {
+        return null;
+    }
+
+    @Override
+    public String getProtocol() {
+        return "http";
+    }
+
+    @Override
+    public BufferedReader getReader() throws IOException {
+        return new BufferedReader(new StringReader(""));
+    }
+
+    @Override
+    public String getRealPath(String arg0) {
+        return path;
+    }
+
+    @Override
+    public String getRemoteAddr() {
+        return "127.0.0.1";
+    }
+
+    @Override
+    public String getRemoteHost() {
+        return "localhost";
+    }
+
+    @Override
+    public int getRemotePort() {
+        return 1234;
+    }
+
+    @Override
+    public RequestDispatcher getRequestDispatcher(String arg0) {
+        return null;
+    }
+
+    @Override
+    public String getScheme() {
+        return "http";
+    }
+
+    @Override
+    public String getServerName() {
+        return "localhost";
+    }
+
+    @Override
+    public int getServerPort() {
+        return 80;
+    }
+
+    @Override
+    public boolean isSecure() {
+        return false;
+    }
+
+    @Override
+    public void removeAttribute(String arg0) {
+    }
+
+    @Override
+    public void setAttribute(String key, Object value) {
+        attributes.put(key, value);
+    }
+
+    @Override
+    public void setCharacterEncoding(String arg0)
+            throws UnsupportedEncodingException {
+    }
+
+    @Override
+    public String getAuthType() {
+        return null;
+    }
+
+    @Override
+    public String getContextPath() {
+        return "";
+    }
+
+    @Override
+    public Cookie[] getCookies() {
+        return null;
+    }
+
+    @Override
+    public long getDateHeader(String arg0) {
+        return 0;
+    }
+
+    @Override
+    public String getHeader(String arg0) {
+        return null;
+    }
+
+    @Override
+    public Enumeration<?> getHeaderNames() {
+        return new Vector<String>().elements();
+    }
+
+    @Override
+    public Enumeration<?> getHeaders(String arg0) {
+        return new Vector<String>().elements();
+    }
+
+    @Override
+    public int getIntHeader(String arg0) {
+        return 0;
+    }
+
+    @Override
+    public String getMethod() {
+        return "GET";
+    }
+
+    @Override
+    public String getPathInfo() {
+        return path;
+    }
+
+    @Override
+    public String getPathTranslated() {
+        return path;
+    }
+
+    @Override
+    public String getQueryString() {
+        return "";
+    }
+
+    @Override
+    public String getRemoteUser() {
+        return "remoteuser";
+    }
+
+    @Override
+    public String getRequestURI() {
+        return "http://localhost" + path;
+    }
+
+    @Override
+    public StringBuffer getRequestURL() {
+        return new StringBuffer(getRequestURI());
+    }
+
+    @Override
+    public String getRequestedSessionId() {
+        return "";
+    }
+
+    @Override
+    public String getServletPath() {
+        return "";
+    }
+
+    @Override
+    public HttpSession getSession() {
+        return null;
+    }
+
+    @Override
+    public HttpSession getSession(boolean arg0) {
+        return null;
+    }
+
+    @Override
+    public Principal getUserPrincipal() {
+        return null;
+    }
+
+    @Override
+    public boolean isRequestedSessionIdFromCookie() {
+        return false;
+    }
+
+    @Override
+    public boolean isRequestedSessionIdFromURL() {
+        return false;
+    }
+
+    @Override
+    public boolean isRequestedSessionIdFromUrl() {
+        return false;
+    }
+
+    @Override
+    public boolean isRequestedSessionIdValid() {
+        return false;
+    }
+
+    @Override
+    public boolean isUserInRole(String arg0) {
+        return false;
+    }
+}
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/InternalResponse.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/InternalResponse.java
new file mode 100644
index 0000000..ead7da5
--- /dev/null
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/InternalResponse.java
@@ -0,0 +1,185 @@
+/*
+ * 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 SF 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.hc.healthchecks.impl;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Locale;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+
+public class InternalResponse implements HttpServletResponse {
+
+    private int status = 200;
+    
+    private static class DevNullOutputStream extends ServletOutputStream {
+        @Override
+        public void write(int b) {
+        }
+    }
+    
+    @Override
+    public void flushBuffer() throws IOException {
+    }
+
+    @Override
+    public int getBufferSize() {
+        return 0;
+    }
+
+    @Override
+    public String getCharacterEncoding() {
+        return "UTF-8";
+    }
+
+    @Override
+    public String getContentType() {
+        return "text/plain";
+    }
+
+    @Override
+    public Locale getLocale() {
+        return Locale.getDefault();
+    }
+
+    @Override
+    public ServletOutputStream getOutputStream() throws IOException {
+        return new DevNullOutputStream();
+    }
+
+    @Override
+    public PrintWriter getWriter() throws IOException {
+        return new PrintWriter(new DevNullOutputStream());
+    }
+
+    @Override
+    public boolean isCommitted() {
+        return false;
+    }
+
+    @Override
+    public void reset() {
+    }
+
+    @Override
+    public void resetBuffer() {
+    }
+
+    @Override
+    public void setBufferSize(int arg0) {
+    }
+
+    @Override
+    public void setCharacterEncoding(String arg0) {
+    }
+
+    @Override
+    public void setContentLength(int arg0) {
+    }
+
+    @Override
+    public void setContentType(String arg0) {
+    }
+
+    @Override
+    public void setLocale(Locale arg0) {
+    }
+
+    @Override
+    public void addCookie(Cookie arg0) {
+    }
+
+    @Override
+    public void addDateHeader(String arg0, long arg1) {
+    }
+
+    @Override
+    public void addHeader(String arg0, String arg1) {
+    }
+
+    @Override
+    public void addIntHeader(String arg0, int arg1) {
+    }
+
+    @Override
+    public boolean containsHeader(String arg0) {
+        return false;
+    }
+
+    @Override
+    public String encodeRedirectURL(String url) {
+        return url;
+    }
+
+    @Override
+    public String encodeRedirectUrl(String url) {
+        return url;
+    }
+
+    @Override
+    public String encodeURL(String url) {
+        return url;
+    }
+
+    @Override
+    public String encodeUrl(String url) {
+        return url;
+    }
+
+    @Override
+    public void sendError(int s, String arg1) throws IOException {
+        status = s;
+    }
+
+    @Override
+    public void sendError(int s) throws IOException {
+        status = s;
+    }
+
+    @Override
+    public void sendRedirect(String arg0) throws IOException {
+    }
+
+    @Override
+    public void setDateHeader(String arg0, long arg1) {
+    }
+
+    @Override
+    public void setHeader(String arg0, String arg1) {
+    }
+
+    @Override
+    public void setIntHeader(String arg0, int arg1) {
+    }
+
+    @Override
+    public void setStatus(int s, String arg1) {
+        status = s;
+    }
+
+    @Override
+    public void setStatus(int s) {
+        status = s;
+    }
+    
+    public int getStatus() {
+        return status;
+    }
+}
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
new file mode 100644
index 0000000..a536fbd
--- /dev/null
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
@@ -0,0 +1,115 @@
+/*
+ * 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 SF 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.hc.healthchecks.impl;
+
+import java.lang.management.ManagementFactory;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.ConfigurationPolicy;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.commons.osgi.PropertiesUtil;
+import org.apache.sling.hc.api.Constants;
+import org.apache.sling.hc.api.HealthCheck;
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.api.ResultLogEntry;
+import org.apache.sling.hc.util.SimpleConstraintChecker;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.helpers.MessageFormatter;
+
+/** {@link HealthCheck} that checks a single JMX attribute */
+@Component(
+        name="org.apache.sling.hc.JmxAttributeHealthCheck",
+        configurationFactory=true, 
+        policy=ConfigurationPolicy.REQUIRE, 
+        metatype=true)
+@Service
+public class JmxAttributeHealthCheck implements HealthCheck {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+    private Map<String, String> info;
+    private String mbeanName;
+    private String attributeName;
+    private String constraint;
+
+    @Property
+    public static final String PROP_OBJECT_NAME = "mbean.name";
+    
+    @Property
+    public static final String PROP_ATTRIBUTE_NAME = "attribute.name";
+    
+    @Property
+    public static final String PROP_CONSTRAINT = "attribute.value.constraint";
+    
+    @Property(cardinality=50)
+    public static final String PROP_TAGS = Constants.HC_TAGS;
+    
+    @Property
+    public static final String PROP_NAME = Constants.HC_NAME;
+    
+    @Property
+    public static final String PROP_MBEAN_NAME = Constants.HC_MBEAN_NAME;
+    
+    @Activate
+    public void activate(ComponentContext ctx) {
+        info = new HealthCheckInfo(ctx.getProperties());
+        mbeanName = PropertiesUtil.toString(ctx.getProperties().get(PROP_OBJECT_NAME), "");
+        attributeName = PropertiesUtil.toString(ctx.getProperties().get(PROP_ATTRIBUTE_NAME), "");
+        constraint = PropertiesUtil.toString(ctx.getProperties().get(PROP_CONSTRAINT), "");
+        
+        info.put(PROP_OBJECT_NAME, mbeanName);
+        info.put(PROP_ATTRIBUTE_NAME, attributeName);
+        info.put(PROP_CONSTRAINT, constraint);
+        
+        log.info("Activated with HealthCheck name={}, objectName={}, attribute={}, constraint={}", 
+                new Object[] { info.get(Constants.HC_NAME), mbeanName, attributeName, constraint });
+    }
+    
+    @Override
+    public Result execute() {
+        final Result result = new Result(log);
+        result.log(ResultLogEntry.LT_DEBUG, 
+                MessageFormatter.format("Checking {} / {} with constraint {}", 
+                        new Object[] { mbeanName, attributeName, constraint }).getMessage());
+        try {
+            final MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer();
+            final ObjectName objectName = new ObjectName(mbeanName);
+            if(jmxServer.queryNames(objectName, null).size() == 0) {
+                log.error("MBean not found: {}", objectName);
+            }
+            final Object value = jmxServer.getAttribute(objectName, attributeName);
+            log.debug("{} {} returns {}", new Object[] { mbeanName, attributeName, value });
+            new SimpleConstraintChecker().check(value, constraint, result);
+        } catch(Exception e) {
+            log.warn(e.toString(), e);
+        }
+        return result;
+    }
+
+    @Override
+    public Map<String, String> getInfo() {
+        return info;
+    }
+}
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxScriptBinding.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxScriptBinding.java
new file mode 100644
index 0000000..bbfc95e
--- /dev/null
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxScriptBinding.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 SF 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.hc.healthchecks.impl;
+
+import java.lang.management.ManagementFactory;
+
+import javax.management.AttributeNotFoundException;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.api.ResultLogEntry;
+import org.slf4j.helpers.MessageFormatter;
+
+/** The JmxBinding is meant to be bound as "jmx" global variables
+ *  in scripted rules, to allow for writing scripted expressions
+ *  like jmx.attribute("java.lang:type=ClassLoading", "LoadedClassCount") > 100
+ */
+public class JmxScriptBinding {
+    private MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer();
+    private final Result result;
+    
+    public JmxScriptBinding(Result result) {
+        this.result = result;
+    }
+    
+    public Object attribute(String objectNameString, String attributeName) 
+            throws MalformedObjectNameException, AttributeNotFoundException, InstanceNotFoundException, MBeanException, ReflectionException {
+        final ObjectName name = new ObjectName(objectNameString);
+        if(jmxServer.queryNames(name, null).size() == 0) {
+            final String msg = "JMX object name not found: [" + objectNameString + "]";
+            result.log(ResultLogEntry.LT_WARN, msg);
+            throw new IllegalStateException(msg);
+        }
+        result.log(ResultLogEntry.LT_DEBUG, MessageFormatter.format("Got JMX Object [{}]", name).getMessage());
+        final Object value = jmxServer.getAttribute(name, attributeName);
+        result.log(ResultLogEntry.LT_DEBUG, 
+                MessageFormatter.format(
+                        "JMX Object [{}] Attribute [{}] = [{}]", 
+                        new Object[] { name, attributeName, value }).getMessage());
+        return value;
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/OsgiScriptBinding.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/OsgiScriptBinding.java
new file mode 100644
index 0000000..27e9f28
--- /dev/null
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/OsgiScriptBinding.java
@@ -0,0 +1,73 @@
+/*
+ * 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 SF 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.hc.healthchecks.impl;
+
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.api.ResultLogEntry;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.slf4j.helpers.MessageFormatter;
+
+/** The OsgiBinding is meant to be bound as an "osgi" global variable
+ *  in scripted rules, to allow for checking some OSGi states in
+ *  a simple way
+ */
+public class OsgiScriptBinding {
+    private final Result result;
+    private final BundleContext bundleContext;
+    
+    public OsgiScriptBinding(BundleContext ctx, Result result) {
+        this.result = result;
+        this.bundleContext = ctx;
+    }
+    
+    public int inactiveBundlesCount() {
+        int count = 0;
+        for(Bundle b : bundleContext.getBundles()) {
+            if(!isActive(b)) {
+                count++;
+            }
+        }
+        result.log(ResultLogEntry.LT_DEBUG, MessageFormatter.format("inactiveBundlesCount={}", count).getMessage());
+        return count;
+    }
+    
+    private boolean isActive(Bundle b) {
+        boolean active = true;
+        if(!isFragment(b) && Bundle.ACTIVE != b.getState()) {
+            active = false;
+            result.log(ResultLogEntry.LT_INFO, 
+                    MessageFormatter.format(
+                            "Bundle {} is not active, state={} ({})", 
+                            new Object[] { b.getSymbolicName(), b.getState(), b.getState()}).getMessage());
+        }
+        return active;
+    }
+    
+    private boolean isFragment(Bundle b) {
+        final String header = (String) b.getHeaders().get( Constants.FRAGMENT_HOST );
+        if(header!= null && header.trim().length() > 0) {
+            result.log(ResultLogEntry.LT_DEBUG, 
+                    MessageFormatter.format("{} is a fragment bundle, state won't be checked", b).getMessage());
+            return true;
+        } else {
+            return false;
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java
new file mode 100644
index 0000000..6e5d82f
--- /dev/null
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java
@@ -0,0 +1,131 @@
+/*
+ * 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 SF 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.hc.healthchecks.impl;
+import java.util.Map;
+
+import javax.script.Bindings;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.ConfigurationPolicy;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.commons.osgi.PropertiesUtil;
+import org.apache.sling.hc.api.Constants;
+import org.apache.sling.hc.api.HealthCheck;
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.api.ResultLogEntry;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.helpers.MessageFormatter;
+
+/** {@link HealthCheck} that checks a scriptable expression */
+@Component(
+        name="org.apache.sling.hc.ScriptableHealthCheck",
+        configurationFactory=true, 
+        policy=ConfigurationPolicy.REQUIRE, 
+        metatype=true)
+@Service
+public class ScriptableHealthCheck implements HealthCheck {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+    private Map<String, String> info;
+    private String expression;
+    private String languageExtension;
+    private BundleContext bundleContext;
+    
+    public static final String DEFAULT_LANGUAGE_EXTENSION = "ecma";
+
+    @Property
+    public static final String PROP_EXPRESSION = "expression";
+    
+    @Property
+    public static final String PROP_LANGUAGE_EXTENSION = "language.extension";
+    
+    @Property(cardinality=50)
+    public static final String PROP_TAGS = Constants.HC_TAGS;
+    
+    @Property
+    public static final String PROP_NAME = Constants.HC_NAME;
+    
+    @Property
+    public static final String PROP_MBEAN_NAME = Constants.HC_MBEAN_NAME;
+    
+    @Reference
+    private ScriptEngineManager scriptEngineManager;
+    
+    @Activate
+    public void activate(ComponentContext ctx) {
+        info = new HealthCheckInfo(ctx.getProperties());
+        bundleContext = ctx.getBundleContext();
+        expression = PropertiesUtil.toString(ctx.getProperties().get(PROP_EXPRESSION), "");
+        languageExtension = PropertiesUtil.toString(ctx.getProperties().get(PROP_LANGUAGE_EXTENSION), DEFAULT_LANGUAGE_EXTENSION);
+        
+        info.put(PROP_EXPRESSION, expression);
+        info.put(PROP_LANGUAGE_EXTENSION, languageExtension);
+        
+        log.info("Activated, name={}, languageExtension={}, expression={}", languageExtension, expression);
+    }
+    
+    @Override
+    public Result execute() {
+        final Result result = new Result(log);
+        result.log(ResultLogEntry.LT_DEBUG, 
+                MessageFormatter.format(
+                        "Checking expression [{}], language extension=[{}]", 
+                        expression, languageExtension).getMessage());
+        try {
+            final ScriptEngine engine = scriptEngineManager.getEngineByExtension(languageExtension);
+            if(engine == null) {
+                result.log(ResultLogEntry.LT_WARN, 
+                        MessageFormatter.format(
+                                "No ScriptEngine available for extension {}", 
+                                languageExtension).getMessage());
+            } else {
+                // TODO pluggable Bindings? Reuse the Sling bindings providers?
+                final Bindings b = engine.createBindings();
+                b.put("jmx", new JmxScriptBinding(result));
+                b.put("osgi", new OsgiScriptBinding(bundleContext, result));
+                final Object value = engine.eval(expression, b);
+                if(value!=null && "true".equals(value.toString())) {
+                    result.log(ResultLogEntry.LT_DEBUG, 
+                            MessageFormatter.format(
+                                    "Expression [{}] evaluates to true as expected", expression).getMessage());
+                } else {
+                    result.log(ResultLogEntry.LT_WARN, 
+                            MessageFormatter.format(
+                                    "Expression [{}] does not evaluate to true, value={}", 
+                                    expression, value).getMessage());
+                }
+            }
+        } catch(Exception e) {
+            result.log(ResultLogEntry.LT_WARN, e.toString()); 
+        }
+        return result;
+    }
+
+    @Override
+    public Map<String, String> getInfo() {
+        return info;
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
new file mode 100644
index 0000000..744561d
--- /dev/null
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
@@ -0,0 +1,153 @@
+/*
+ * 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 SF 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.hc.healthchecks.impl;
+
+import java.util.Arrays;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.ConfigurationPolicy;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceResolverFactory;
+import org.apache.sling.commons.osgi.PropertiesUtil;
+import org.apache.sling.engine.SlingRequestProcessor;
+import org.apache.sling.hc.api.Constants;
+import org.apache.sling.hc.api.HealthCheck;
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.api.ResultLogEntry;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.helpers.MessageFormatter;
+
+/** {@link HealthCheck} that checks the HTTP status of Sling requests */
+@Component(
+        name="org.apache.sling.hc.SlingRequestStatusHealthCheck",
+        configurationFactory=true, 
+        policy=ConfigurationPolicy.REQUIRE, 
+        metatype=true)
+@Service
+public class SlingRequestStatusHealthCheck implements HealthCheck {
+
+    private static final Logger log = LoggerFactory.getLogger(SlingRequestStatusHealthCheck.class);
+    private Map<String, String> info;
+    private String [] paths;
+    
+    static class PathSpec {
+        int status;
+        String path;
+        
+        PathSpec(String configuredPath) {
+            path = configuredPath;
+            status = 200;
+            
+            final String [] parts  = configuredPath.split(":");
+            if(parts.length == 2) {
+                try {
+                    status = Integer.valueOf(parts[1].trim());
+                    path = parts[0].trim();
+                } catch(NumberFormatException nfe) {
+                    log.warn("NumberFormatException while parsing [{}], invalid status value?", configuredPath);
+                }
+            } 
+        }
+    }
+    
+    @Property(cardinality=Integer.MAX_VALUE)
+    public static final String PROP_PATH = "path";
+    
+    @Property(cardinality=50)
+    public static final String PROP_TAGS = Constants.HC_TAGS;
+    
+    @Property
+    public static final String PROP_NAME = Constants.HC_NAME;
+    
+    @Property
+    public static final String PROP_MBEAN_NAME = Constants.HC_MBEAN_NAME;
+    
+    @Reference
+    private SlingRequestProcessor requestProcessor;
+    
+    @Reference
+    private ResourceResolverFactory resolverFactory;  
+    
+    @Activate
+    public void activate(ComponentContext ctx) {
+        info = new HealthCheckInfo(ctx.getProperties());
+        paths = PropertiesUtil.toStringArray(ctx.getProperties().get(PROP_PATH), new String [] {});
+        log.info("Activated, paths={}", Arrays.asList(paths));
+    }
+    
+    @Override
+    public Result execute() {
+        final Result result = new Result(log);
+        
+        ResourceResolver resolver = null;
+        int checked = 0;
+        int failed = 0;
+        
+        try {
+            resolver = resolverFactory.getAdministrativeResourceResolver(null);
+            for(String p : paths) {
+                final PathSpec ps = new PathSpec(p);
+                final HttpServletRequest request = new InternalRequest(ps.path);
+                final InternalResponse response = new InternalResponse();
+                requestProcessor.processRequest(request, response, resolver);
+                final int status = response.getStatus();
+                if(status != ps.status) {
+                    failed++;
+                    result.log(ResultLogEntry.LT_WARN,
+                            MessageFormatter.format(
+                            "[{}] returns status {}, expected {}", new Object[] { ps.path, status, ps.status }).getMessage());
+                } else {
+                    result.log(ResultLogEntry.LT_DEBUG,
+                            MessageFormatter.format(
+                            "[{}] returns status {} as expected", ps.path, status).getMessage());
+                }
+                checked++;
+            }
+        } catch(Exception e) {
+            result.log(ResultLogEntry.LT_WARN, "Exception while executing request: " + e.toString());
+        } finally {
+            if(resolver != null) {
+                resolver.close();
+            }
+        }
+        
+        if(checked == 0) {
+            result.log(ResultLogEntry.LT_WARN, "No paths checked, empty paths list?");
+        } else {
+            result.log(ResultLogEntry.LT_DEBUG, 
+                    MessageFormatter.format(
+                            "{} paths checked, {} failures", checked, failed).getMessage());
+        }
+        
+        return result;
+    }
+
+    @Override
+    public Map<String, String> getInfo() {
+        return info;
+    }
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/hc/healthcheck b/src/test/java/org/apache/sling/hc/healthcheck
new file mode 100644
index 0000000..954f535
--- /dev/null
+++ b/src/test/java/org/apache/sling/hc/healthcheck
@@ -0,0 +1,44 @@
+package org.apache.sling.hc.impl.healthchecks;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+@RunWith(Parameterized.class)
+public class PathSpecTest {
+    private final String pathSpec;
+    private final String expectedPath;
+    private final int expectedStatus;
+    
+    @Parameters(name="{1}")
+    public static List<Object[]> data() {
+        final List<Object[]> result = new ArrayList<Object[]>();
+
+        result.add(new Object[] { "/one.html", "/one.html", 200 } ); 
+        result.add(new Object[] { "/two.html:404", "/two.html", 404 } ); 
+        result.add(new Object[] { "three.html : 404 ", "three.html", 404 } ); 
+        result.add(new Object[] { "four.html:not an integer", "four.html:not an integer", 200 } ); 
+        result.add(new Object[] { "", "", 200 } ); 
+
+        return result;
+    }
+
+    public PathSpecTest(String pathSpec, String expectedPath, int expectedStatus) {
+        this.pathSpec = pathSpec;
+        this.expectedPath = expectedPath;
+        this.expectedStatus = expectedStatus;
+    }
+    
+    @Test
+    public void testParsing() {
+        final SlingRequestStatusHealthCheck.PathSpec ps = new SlingRequestStatusHealthCheck.PathSpec(pathSpec);
+        assertEquals(expectedPath, ps.path);
+        assertEquals(expectedStatus, ps.status);
+    }
+}
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/DefaultLoginsHealthCheckTest.java b/src/test/java/org/apache/sling/hc/healthchecks/DefaultLoginsHealthCheckTest.java
new file mode 100644
index 0000000..1c48f00
--- /dev/null
+++ b/src/test/java/org/apache/sling/hc/healthchecks/DefaultLoginsHealthCheckTest.java
@@ -0,0 +1,77 @@
+/*
+ * 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 SF 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.hc.healthchecks;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+
+import javax.jcr.Credentials;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.healthchecks.impl.DefaultLoginsHealthCheck;
+import org.apache.sling.jcr.api.SlingRepository;
+import org.junit.Test;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+public class DefaultLoginsHealthCheckTest {
+    
+    private Result getTestResult(String login) throws Exception {
+        final DefaultLoginsHealthCheck c = new DefaultLoginsHealthCheck();
+        setField(c, "logins", Arrays.asList(new String[] { login }));
+        
+        final SlingRepository repo = Mockito.mock(SlingRepository.class);
+        setField(c, "repository", repo);
+        final Session s = Mockito.mock(Session.class);
+        Mockito.when(repo.login(Matchers.any(Credentials.class))).thenAnswer(new Answer<Session>() {
+            @Override
+            public Session answer(InvocationOnMock invocation) {
+                final SimpleCredentials c = (SimpleCredentials)invocation.getArguments()[0];
+                if("admin".equals(c.getUserID())) {
+                    return s;
+                }
+                return null;
+            }
+        });
+        
+        return c.execute();
+    }
+    
+    private void setField(Object o, String name, Object value) throws Exception {
+        final Field f = o.getClass().getDeclaredField(name);
+        f.setAccessible(true);
+        f.set(o, value);
+    }
+    
+    @Test
+    public void testHealthCheckFails() throws Exception {
+        assertFalse("Expecting failed check", getTestResult("admin:admin").isOk());
+    }
+    
+    @Test
+    public void testHealthCheckSucceeds() throws Exception {
+        assertTrue("Expecting successful check", getTestResult("FOO:bar").isOk());
+    }
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/JmxAttributeHealthCheckTest.java b/src/test/java/org/apache/sling/hc/healthchecks/JmxAttributeHealthCheckTest.java
new file mode 100644
index 0000000..81f68fc
--- /dev/null
+++ b/src/test/java/org/apache/sling/hc/healthchecks/JmxAttributeHealthCheckTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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 SF 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.hc.healthchecks;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.healthchecks.impl.JmxAttributeHealthCheck;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.osgi.service.component.ComponentContext;
+
+public class JmxAttributeHealthCheckTest {
+    
+    static void assertJmxValue(String objectName, String attributeName, String constraint, boolean expected) {
+        final JmxAttributeHealthCheck hc = new JmxAttributeHealthCheck();
+        
+        final ComponentContext ctx = Mockito.mock(ComponentContext.class);
+        final Dictionary<String, String> props = new Hashtable<String, String>();
+        props.put(JmxAttributeHealthCheck.PROP_OBJECT_NAME, objectName);
+        props.put(JmxAttributeHealthCheck.PROP_ATTRIBUTE_NAME, attributeName);
+        props.put(JmxAttributeHealthCheck.PROP_CONSTRAINT, constraint);
+        Mockito.when(ctx.getProperties()).thenReturn(props);
+        hc.activate(ctx);
+        
+        final Result r = hc.execute();
+        assertEquals("Expected result " + expected, expected, r.isOk());
+    }
+    
+    @Test
+    public void testJmxAttributeMatch() {
+        assertJmxValue("java.lang:type=ClassLoading", "LoadedClassCount", "> 10", true);
+    }
+    
+    @Test
+    public void testJmxAttributeNoMatch() {
+        assertJmxValue("java.lang:type=ClassLoading", "LoadedClassCount", "< 10", false);
+    }
+}
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/JmxScriptBindingTest.java b/src/test/java/org/apache/sling/hc/healthchecks/JmxScriptBindingTest.java
new file mode 100644
index 0000000..7cad43b
--- /dev/null
+++ b/src/test/java/org/apache/sling/hc/healthchecks/JmxScriptBindingTest.java
@@ -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 SF 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.hc.healthchecks;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.healthchecks.impl.JmxScriptBinding;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class JmxScriptBindingTest {
+    
+    private final Logger logger = LoggerFactory.getLogger(getClass());
+    
+    @Test
+    public void testJmxAttribute() throws Exception {
+        final Result r = new Result(logger);
+        final JmxScriptBinding b = new JmxScriptBinding(r);
+        final Object value= b.attribute("java.lang:type=ClassLoading", "LoadedClassCount");
+        assertNotNull("Expecting non-null attribute value", value);
+        assertTrue("Expecting non-empty value", value.toString().length() > 0);
+    }
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/OsgiScriptBindingTest.java b/src/test/java/org/apache/sling/hc/healthchecks/OsgiScriptBindingTest.java
new file mode 100644
index 0000000..b9dcf83
--- /dev/null
+++ b/src/test/java/org/apache/sling/hc/healthchecks/OsgiScriptBindingTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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 SF 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.hc.healthchecks;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.healthchecks.impl.OsgiScriptBinding;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class OsgiScriptBindingTest {
+    
+    private final Logger logger = LoggerFactory.getLogger(getClass());
+    
+    private Bundle mockBundle(boolean isFragment, boolean isActive) {
+        final Bundle b = Mockito.mock(Bundle.class);
+        Mockito.when(b.getState()).thenReturn(isActive ? Bundle.ACTIVE : Bundle.RESOLVED);
+        
+        final Dictionary<String, String> headers = new Hashtable<String, String>();
+        if(isFragment) {
+            headers.put(Constants.FRAGMENT_HOST, "FOO");
+        }
+        Mockito.when(b.getHeaders()).thenReturn(headers);
+        
+        return b;
+    }
+    
+    @Test
+    public void testInactiveBundles() throws Exception {
+        final BundleContext ctx = Mockito.mock(BundleContext.class);
+        final Bundle [] bundles = { 
+                mockBundle(false, true), 
+                mockBundle(false, false), 
+                mockBundle(false, true),
+                mockBundle(true, false)
+        };
+        Mockito.when(ctx.getBundles()).thenReturn(bundles);
+        
+        final Result r = new Result(logger);
+        final OsgiScriptBinding b = new OsgiScriptBinding(ctx, r);
+        assertEquals(1, b.inactiveBundlesCount());
+    }
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/ScriptableHealthCheckTest.java b/src/test/java/org/apache/sling/hc/healthchecks/ScriptableHealthCheckTest.java
new file mode 100644
index 0000000..351b88f
--- /dev/null
+++ b/src/test/java/org/apache/sling/hc/healthchecks/ScriptableHealthCheckTest.java
@@ -0,0 +1,94 @@
+/*
+ * 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 SF 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.hc.healthchecks;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.lang.reflect.Field;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.healthchecks.impl.ScriptableHealthCheck;
+import org.junit.Test;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.osgi.service.component.ComponentContext;
+
+public class ScriptableHealthCheckTest {
+    
+    private ScriptableHealthCheck hc;
+    private Dictionary<String, String> props;
+    private ComponentContext ctx;
+
+    private void assertExpression(String expression, String languageExtension, boolean expected) throws Exception {
+        hc = new ScriptableHealthCheck();
+        ctx = Mockito.mock(ComponentContext.class);
+        props = new Hashtable<String, String>();
+        
+        final ScriptEngine rhino = new ScriptEngineManager().getEngineByExtension("js");
+        assertNotNull("With the rhino jar in our classpath, we should get a js script engine", rhino);
+        final ScriptEngineManager manager = Mockito.mock(ScriptEngineManager.class);
+        Mockito.when(manager.getEngineByExtension(Matchers.same("ecma"))).thenReturn(rhino);
+        final Field f = hc.getClass().getDeclaredField("scriptEngineManager");
+        f.setAccessible(true);
+        f.set(hc, manager);
+        
+        props.put(ScriptableHealthCheck.PROP_EXPRESSION, expression);
+        if(languageExtension != null) {
+            props.put(ScriptableHealthCheck.PROP_LANGUAGE_EXTENSION, languageExtension);
+        }
+        Mockito.when(ctx.getProperties()).thenReturn(props);
+        hc.activate(ctx);
+        final Result r = hc.execute();
+        assertEquals("Expecting result " + expected, expected, r.isOk());
+    }
+    
+    @Test
+    public void testSimpleExpression() throws Exception {
+        assertExpression("2 + 3 == 5", null, true);
+    }
+    
+    @Test
+    public void testJmxExpression() throws Exception {
+        assertExpression(
+                "jmx.attribute('java.lang:type=ClassLoading', 'LoadedClassCount') > 10"
+                + " && jmx.attribute('java.lang:type=Runtime', 'ManagementSpecVersion') > 1", 
+                "ecma", true);
+    }
+    
+    @Test
+    public void testFalseExpression() throws Exception {
+        assertExpression("2 + 3 == 15", null, false);
+    }
+    
+    @Test
+    public void testSyntaxError() throws Exception {
+        assertExpression("{not [valid ok?", null, false);
+    }
+    
+    @Test
+    public void testNoEngine() throws Exception {
+        assertExpression("2 + 3 == 5", null, true);
+        assertExpression("2 + 3 == 5", "groovy", false);
+    }
+}

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

[sling-org-apache-sling-hc-support] 31/31: [maven-release-plugin] copy for tag org.apache.sling.hc.support-1.0.4

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit 3dc00094c7a1e77564024e18a9cca242a9e58668
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Sep 26 14:54:49 2013 +0000

    [maven-release-plugin]  copy for tag org.apache.sling.hc.support-1.0.4
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.support-1.0.4@1526526 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-hc-support] 05/31: SLING-2987 - fix logging errors

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit 82038d7b5cd701ccf799dd86bb902d8d39e01ce8
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Aug 13 12:44:23 2013 +0000

    SLING-2987 - fix logging errors
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/healthchecks@1513462 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java | 7 +++++--
 .../org/apache/sling/hc/healthchecks/impl/JmxScriptBinding.java    | 2 +-
 .../org/apache/sling/hc/healthchecks/impl/OsgiScriptBinding.java   | 2 +-
 .../sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java  | 2 +-
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
index a536fbd..6e72e5d 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
@@ -91,7 +91,7 @@ public class JmxAttributeHealthCheck implements HealthCheck {
     public Result execute() {
         final Result result = new Result(log);
         result.log(ResultLogEntry.LT_DEBUG, 
-                MessageFormatter.format("Checking {} / {} with constraint {}", 
+                MessageFormatter.arrayFormat("Checking {} / {} with constraint {}", 
                         new Object[] { mbeanName, attributeName, constraint }).getMessage());
         try {
             final MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer();
@@ -100,7 +100,10 @@ public class JmxAttributeHealthCheck implements HealthCheck {
                 log.error("MBean not found: {}", objectName);
             }
             final Object value = jmxServer.getAttribute(objectName, attributeName);
-            log.debug("{} {} returns {}", new Object[] { mbeanName, attributeName, value });
+            result.log(ResultLogEntry.LT_DEBUG,
+                    MessageFormatter.arrayFormat( 
+                    "{} {} returns {}", 
+                    new Object[] { mbeanName, attributeName, value }).getMessage());
             new SimpleConstraintChecker().check(value, constraint, result);
         } catch(Exception e) {
             log.warn(e.toString(), e);
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxScriptBinding.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxScriptBinding.java
index bbfc95e..6773c56 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxScriptBinding.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxScriptBinding.java
@@ -54,7 +54,7 @@ public class JmxScriptBinding {
         result.log(ResultLogEntry.LT_DEBUG, MessageFormatter.format("Got JMX Object [{}]", name).getMessage());
         final Object value = jmxServer.getAttribute(name, attributeName);
         result.log(ResultLogEntry.LT_DEBUG, 
-                MessageFormatter.format(
+                MessageFormatter.arrayFormat(
                         "JMX Object [{}] Attribute [{}] = [{}]", 
                         new Object[] { name, attributeName, value }).getMessage());
         return value;
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/OsgiScriptBinding.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/OsgiScriptBinding.java
index 27e9f28..29f80db 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/OsgiScriptBinding.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/OsgiScriptBinding.java
@@ -53,7 +53,7 @@ public class OsgiScriptBinding {
         if(!isFragment(b) && Bundle.ACTIVE != b.getState()) {
             active = false;
             result.log(ResultLogEntry.LT_INFO, 
-                    MessageFormatter.format(
+                    MessageFormatter.arrayFormat(
                             "Bundle {} is not active, state={} ({})", 
                             new Object[] { b.getSymbolicName(), b.getState(), b.getState()}).getMessage());
         }
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
index 744561d..32fd6d4 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
@@ -118,7 +118,7 @@ public class SlingRequestStatusHealthCheck implements HealthCheck {
                 if(status != ps.status) {
                     failed++;
                     result.log(ResultLogEntry.LT_WARN,
-                            MessageFormatter.format(
+                            MessageFormatter.arrayFormat(
                             "[{}] returns status {}, expected {}", new Object[] { ps.path, status, ps.status }).getMessage());
                 } else {
                     result.log(ResultLogEntry.LT_DEBUG,

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

[sling-org-apache-sling-hc-support] 15/31: Correctly free service references

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit ed9b0ef04c9821fa21abdae4749056a45e779d70
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Sep 2 14:47:08 2013 +0000

    Correctly free service references
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/healthchecks@1519454 13f79535-47bb-0310-9956-ffa450edef68
---
 .../hc/healthchecks/impl/CompositeHealthCheck.java | 58 ++++++++++++----------
 1 file changed, 31 insertions(+), 27 deletions(-)

diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
index 57a4a63..4996e44 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
@@ -71,37 +71,41 @@ public class CompositeHealthCheck implements HealthCheck {
     @Override
     public Result execute() {
         final FormattingResultLog resultLog = new FormattingResultLog();
-        final List<HealthCheck> checks = new HealthCheckFilter(bundleContext).getTaggedHealthChecks(filterTags);
-        if(checks.size() == 0) {
-            resultLog.warn("HealthCheckFilter returns no HealthCheck for tags {}", Arrays.asList(filterTags));
-            return new Result(resultLog);
-        }
-
-        int executed = 0;
-        resultLog.debug("Executing {} HealthCheck selected by the {} tags", checks.size(), Arrays.asList(filterTags));
-        int failures = 0;
-        for(HealthCheck hc : checks) {
-            if(hc == this) {
-                resultLog.info("Cowardly forfeiting execution of this HealthCheck in an infinite loop, ignoring it");
-                continue;
+        final HealthCheckFilter filter = new HealthCheckFilter(bundleContext);
+        try {
+            final List<HealthCheck> checks = filter.getTaggedHealthChecks(filterTags);
+            if(checks.size() == 0) {
+                resultLog.warn("HealthCheckFilter returns no HealthCheck for tags {}", Arrays.asList(filterTags));
+                return new Result(resultLog);
             }
-            resultLog.debug("Executing {}", hc);
-            executed++;
-            final Result sub = hc.execute();
-            if(!sub.isOk()) {
-                failures++;
-            }
-            for(ResultLog.Entry e : sub) {
-                resultLog.add(e);
+
+            int executed = 0;
+            resultLog.debug("Executing {} HealthCheck selected by the {} tags", checks.size(), Arrays.asList(filterTags));
+            int failures = 0;
+            for(HealthCheck hc : checks) {
+                if(hc == this) {
+                    resultLog.info("Cowardly forfeiting execution of this HealthCheck in an infinite loop, ignoring it");
+                    continue;
+                }
+                resultLog.debug("Executing {}", hc);
+                executed++;
+                final Result sub = hc.execute();
+                if(!sub.isOk()) {
+                    failures++;
+                }
+                for(ResultLog.Entry e : sub) {
+                    resultLog.add(e);
+                }
             }
-        }
 
-        if(failures == 0) {
-            resultLog.debug("{} HealthCheck executed, all ok", executed);
-        } else {
-            resultLog.warn("{} HealthCheck executed, {} failures", executed, failures);
+            if(failures == 0) {
+                resultLog.debug("{} HealthCheck executed, all ok", executed);
+            } else {
+                resultLog.warn("{} HealthCheck executed, {} failures", executed, failures);
+            }
+        } finally {
+            filter.dispose();
         }
-
         return new Result(resultLog);
     }
 }
\ 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-hc-support] 13/31: Apply naming conventions

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit d0e1473b21cb58cb2ed56b01d3ad53494ca3c4fe
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Aug 30 09:43:09 2013 +0000

    Apply naming conventions
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/healthchecks@1518923 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/resources/OSGI-INF/metatype/metatype.properties | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/resources/OSGI-INF/metatype/metatype.properties b/src/main/resources/OSGI-INF/metatype/metatype.properties
index 088ac97..be5ecee 100644
--- a/src/main/resources/OSGI-INF/metatype/metatype.properties
+++ b/src/main/resources/OSGI-INF/metatype/metatype.properties
@@ -25,18 +25,18 @@
 org.apache.sling.hc.JmxAttributeHealthCheck.name = JMX Attribute Health Check
 org.apache.sling.hc.JmxAttributeHealthCheck.description = Checks the value of a single JMX attribute.
 
-org.apache.sling.hc.ScriptableHealthCheck.name = Scriptable Health Check
+org.apache.sling.hc.ScriptableHealthCheck.name = Apache Sling Scriptable Health Check
 org.apache.sling.hc.ScriptableHealthCheck.description = Uses scripted expressions to verify multiple JMX \
   attributes or other values.
 
-org.apache.sling.hc.DefaultLoginsHealthCheck.name = Default Logins Health Check 
+org.apache.sling.hc.DefaultLoginsHealthCheck.name = Apache Sling  Default Logins Health Check 
 org.apache.sling.hc.DefaultLoginsHealthCheck.description = Expects default logins to fail, used to verify \
     that they are disabled on production systems
     
-org.apache.sling.hc.SlingRequestStatusHealthCheck.name = Sling Request Status Health Check
+org.apache.sling.hc.SlingRequestStatusHealthCheck.name = Apache Sling  Sling Request Status Health Check
 org.apache.sling.hc.SlingRequestStatusHealthCheck.description = Checks the HTTP status of Sling requests.
 
-org.apache.sling.hc.CompositeHealthCheck.name = Composite Health Check 
+org.apache.sling.hc.CompositeHealthCheck.name = Apache Sling  Composite Health Check 
 org.apache.sling.hc.CompositeHealthCheck.description = Executes a set of Health Checks, selected by tags. 
 
 filter.tags.name = Filter tags

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

[sling-org-apache-sling-hc-support] 24/31: SLING-3127 - use latest parent pom

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit a9c261438ba2395d18924789ea2bcf40ad55e467
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Sep 26 13:34:43 2013 +0000

    SLING-3127 - use latest parent pom
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support@1526484 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 49b8230..c0b3e7c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,8 +9,8 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>17</version>
-        <relativePath/>
+        <version>18</version>
+        <relativePath>../../../../parent/pom.xml</relativePath>
     </parent>
 
     <groupId>org.apache.sling</groupId>

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

[sling-org-apache-sling-hc-support] 16/31: SLING-3034 - move 'core' HealthCheck services to api bundle

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit 155f3a4deb30bd8a23ac0cf989562bb0c02a4227
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Sep 3 12:25:48 2013 +0000

    SLING-3034 - move 'core' HealthCheck services to api bundle
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/healthchecks@1519663 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  16 +-
 .../hc/healthchecks/impl/CompositeHealthCheck.java | 111 --------------
 .../impl/DefaultLoginsHealthCheck.java             |   2 +-
 .../healthchecks/impl/JmxAttributeHealthCheck.java |  99 ------------
 .../hc/healthchecks/impl/JmxScriptBinding.java     |  57 -------
 .../hc/healthchecks/impl/OsgiScriptBinding.java    |  67 ---------
 .../healthchecks/impl/ScriptableHealthCheck.java   | 108 -------------
 .../impl/SlingRequestStatusHealthCheck.java        |   2 +-
 .../hc/healthchecks/util/FormattingResultLog.java  |  49 ------
 .../healthchecks/util/SimpleConstraintChecker.java |  80 ----------
 .../sling/hc/healthchecks/util/package-info.java   |  24 ---
 .../healthchecks/JmxAttributeHealthCheckTest.java  |  56 -------
 .../hc/healthchecks/JmxScriptBindingTest.java      |  37 -----
 .../hc/healthchecks/OsgiScriptBindingTest.java     |  63 --------
 .../hc/healthchecks/ScriptableHealthCheckTest.java |  94 ------------
 .../util/SimpleConstraintCheckerTest.java          | 167 ---------------------
 16 files changed, 8 insertions(+), 1024 deletions(-)

diff --git a/pom.xml b/pom.xml
index a3c65a3..4594916 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,11 +45,12 @@
     <dependencies>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
+            <artifactId>org.osgi.compendium</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
@@ -90,7 +91,7 @@
             <groupId>javax.servlet</groupId>
             <artifactId>servlet-api</artifactId>
         </dependency>
-       <dependency>
+        <dependency>
             <groupId>javax.jcr</groupId>
             <artifactId>jcr</artifactId>
         </dependency>
@@ -98,6 +99,7 @@
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-simple</artifactId>
             <version>1.6.2</version>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>junit</groupId>
@@ -109,11 +111,5 @@
             <version>1.9.5</version>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>rhino</groupId>
-            <artifactId>js</artifactId>
-            <version>1.6R6</version>
-            <scope>test</scope>
-        </dependency>
      </dependencies>
 </project>
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
deleted file mode 100644
index 4996e44..0000000
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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 SF 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.hc.healthchecks.impl;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.ConfigurationPolicy;
-import org.apache.felix.scr.annotations.Properties;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.PropertyUnbounded;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.commons.osgi.PropertiesUtil;
-import org.apache.sling.hc.api.HealthCheck;
-import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.api.ResultLog;
-import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
-import org.apache.sling.hc.util.HealthCheckFilter;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.component.ComponentContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** {@link HealthCheck} that executes a number of other HealthChecks,
- *  selected by their tags, and merges their Results.
- */
-@Component(
-        name="org.apache.sling.hc.CompositeHealthCheck",
-        configurationFactory=true,
-        policy=ConfigurationPolicy.REQUIRE,
-        metatype=true)
-@Properties({
-    @Property(name=HealthCheck.NAME),
-    @Property(name=HealthCheck.TAGS, unbounded=PropertyUnbounded.ARRAY),
-    @Property(name=HealthCheck.MBEAN_NAME)
-})
-@Service(value=HealthCheck.class)
-public class CompositeHealthCheck implements HealthCheck {
-
-    private final Logger log = LoggerFactory.getLogger(getClass());
-    private BundleContext bundleContext;
-
-    @Property(unbounded=PropertyUnbounded.ARRAY)
-    private static final String PROP_FILTER_TAGS = "filter.tags";
-    private String [] filterTags;
-
-    @Activate
-    public void activate(ComponentContext ctx) {
-        bundleContext = ctx.getBundleContext();
-        filterTags = PropertiesUtil.toStringArray(ctx.getProperties().get(PROP_FILTER_TAGS), new String[] {});
-        log.info("Activated, will select HealthCheck having tags {}", Arrays.asList(filterTags));
-    }
-
-    @Override
-    public Result execute() {
-        final FormattingResultLog resultLog = new FormattingResultLog();
-        final HealthCheckFilter filter = new HealthCheckFilter(bundleContext);
-        try {
-            final List<HealthCheck> checks = filter.getTaggedHealthChecks(filterTags);
-            if(checks.size() == 0) {
-                resultLog.warn("HealthCheckFilter returns no HealthCheck for tags {}", Arrays.asList(filterTags));
-                return new Result(resultLog);
-            }
-
-            int executed = 0;
-            resultLog.debug("Executing {} HealthCheck selected by the {} tags", checks.size(), Arrays.asList(filterTags));
-            int failures = 0;
-            for(HealthCheck hc : checks) {
-                if(hc == this) {
-                    resultLog.info("Cowardly forfeiting execution of this HealthCheck in an infinite loop, ignoring it");
-                    continue;
-                }
-                resultLog.debug("Executing {}", hc);
-                executed++;
-                final Result sub = hc.execute();
-                if(!sub.isOk()) {
-                    failures++;
-                }
-                for(ResultLog.Entry e : sub) {
-                    resultLog.add(e);
-                }
-            }
-
-            if(failures == 0) {
-                resultLog.debug("{} HealthCheck executed, all ok", executed);
-            } else {
-                resultLog.warn("{} HealthCheck executed, {} failures", executed, failures);
-            }
-        } finally {
-            filter.dispose();
-        }
-        return new Result(resultLog);
-    }
-}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java
index 72dfbcf..e882da5 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java
@@ -36,7 +36,7 @@ import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.hc.api.HealthCheck;
 import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
+import org.apache.sling.hc.util.FormattingResultLog;
 import org.apache.sling.jcr.api.SlingRepository;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
deleted file mode 100644
index 305b305..0000000
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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 SF 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.hc.healthchecks.impl;
-
-import java.lang.management.ManagementFactory;
-import java.util.Map;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.ConfigurationPolicy;
-import org.apache.felix.scr.annotations.Properties;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.PropertyUnbounded;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.commons.osgi.PropertiesUtil;
-import org.apache.sling.hc.api.HealthCheck;
-import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
-import org.apache.sling.hc.healthchecks.util.SimpleConstraintChecker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** {@link HealthCheck} that checks a single JMX attribute */
-@Component(
-        name="org.apache.sling.hc.JmxAttributeHealthCheck",
-        configurationFactory=true,
-        policy=ConfigurationPolicy.REQUIRE,
-        metatype=true)
-@Properties({
-    @Property(name=HealthCheck.NAME),
-    @Property(name=HealthCheck.TAGS, unbounded=PropertyUnbounded.ARRAY),
-    @Property(name=HealthCheck.MBEAN_NAME)
-})
-@Service(value=HealthCheck.class)
-public class JmxAttributeHealthCheck implements HealthCheck {
-
-    private final Logger log = LoggerFactory.getLogger(getClass());
-    private String mbeanName;
-    private String attributeName;
-    private String constraint;
-
-    @Property
-    public static final String PROP_OBJECT_NAME = "mbean.name";
-
-    @Property
-    public static final String PROP_ATTRIBUTE_NAME = "attribute.name";
-
-    @Property
-    public static final String PROP_CONSTRAINT = "attribute.value.constraint";
-
-    @Activate
-    public void activate(final Map<String, Object> properties) {
-        mbeanName = PropertiesUtil.toString(properties.get(PROP_OBJECT_NAME), "");
-        attributeName = PropertiesUtil.toString(properties.get(PROP_ATTRIBUTE_NAME), "");
-        constraint = PropertiesUtil.toString(properties.get(PROP_CONSTRAINT), "");
-
-        log.info("Activated with HealthCheck name={}, objectName={}, attribute={}, constraint={}",
-                new Object[] { properties.get(HealthCheck.NAME), mbeanName, attributeName, constraint });
-    }
-
-    @Override
-    public Result execute() {
-        final FormattingResultLog resultLog = new FormattingResultLog();
-        resultLog.debug("Checking {} / {} with constraint {}", mbeanName, attributeName, constraint);
-        try {
-            final MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer();
-            final ObjectName objectName = new ObjectName(mbeanName);
-            if(jmxServer.queryNames(objectName, null).size() == 0) {
-                resultLog.warn("MBean not found: {}", objectName);
-            } else {
-                final Object value = jmxServer.getAttribute(objectName, attributeName);
-                resultLog.debug("{} {} returns {}", mbeanName, attributeName, value);
-                new SimpleConstraintChecker().check(value, constraint, resultLog);
-            }
-        } catch(Exception e) {
-            log.warn("JMX attribute {}/{} check failed: {}", new Object []{ mbeanName, attributeName, e});
-            resultLog.healthCheckError("JMX attribute check failed: {}", e);
-        }
-        return new Result(resultLog);
-    }
-}
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxScriptBinding.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxScriptBinding.java
deleted file mode 100644
index 463a38e..0000000
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxScriptBinding.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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 SF 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.hc.healthchecks.impl;
-
-import java.lang.management.ManagementFactory;
-
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.ReflectionException;
-
-import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
-
-/** The JmxBinding is meant to be bound as "jmx" global variables
- *  in scripted rules, to allow for writing scripted expressions
- *  like jmx.attribute("java.lang:type=ClassLoading", "LoadedClassCount") > 100
- */
-public class JmxScriptBinding {
-    private MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer();
-    private final FormattingResultLog resultLog;
-    
-    public JmxScriptBinding(FormattingResultLog resultLog) {
-        this.resultLog = resultLog;
-    }
-    
-    public Object attribute(String objectNameString, String attributeName) 
-            throws MalformedObjectNameException, AttributeNotFoundException, InstanceNotFoundException, MBeanException, ReflectionException {
-        final ObjectName name = new ObjectName(objectNameString);
-        if(jmxServer.queryNames(name, null).size() == 0) {
-            final String msg = "JMX object name not found: [" + objectNameString + "]";
-            resultLog.warn(msg);
-            throw new IllegalStateException(msg);
-        }
-        resultLog.debug("Got JMX Object [{}]", name);
-        final Object value = jmxServer.getAttribute(name, attributeName);
-        resultLog.debug("JMX Object [{}] Attribute [{}] = [{}]", name, attributeName, value);
-        return value;
-    }
-}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/OsgiScriptBinding.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/OsgiScriptBinding.java
deleted file mode 100644
index a34f8c9..0000000
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/OsgiScriptBinding.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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 SF 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.hc.healthchecks.impl;
-
-import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-
-/** The OsgiBinding is meant to be bound as an "osgi" global variable
- *  in scripted rules, to allow for checking some OSGi states in
- *  a simple way
- */
-public class OsgiScriptBinding {
-    private final FormattingResultLog resultLog;
-    private final BundleContext bundleContext;
-    
-    public OsgiScriptBinding(BundleContext ctx, FormattingResultLog resultLog) {
-        this.resultLog = resultLog;
-        this.bundleContext = ctx;
-    }
-    
-    public int inactiveBundlesCount() {
-        int count = 0;
-        for(Bundle b : bundleContext.getBundles()) {
-            if(!isActive(b)) {
-                count++;
-            }
-        }
-        resultLog.debug("inactiveBundlesCount={}", count);
-        return count;
-    }
-    
-    private boolean isActive(Bundle b) {
-        boolean active = true;
-        if(!isFragment(b) && Bundle.ACTIVE != b.getState()) {
-            active = false;
-            resultLog.info("Bundle {} is not active, state={} ({})", b.getSymbolicName(), b.getState(), b.getState());
-        }
-        return active;
-    }
-    
-    private boolean isFragment(Bundle b) {
-        final String header = (String) b.getHeaders().get( Constants.FRAGMENT_HOST );
-        if(header!= null && header.trim().length() > 0) {
-            resultLog.debug("{} is a fragment bundle, state won't be checked", b);
-            return true;
-        } else {
-            return false;
-        }
-    }
-}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java
deleted file mode 100644
index a53c5d3..0000000
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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 SF 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.hc.healthchecks.impl;
-import javax.script.Bindings;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.ConfigurationPolicy;
-import org.apache.felix.scr.annotations.Properties;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.PropertyUnbounded;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.commons.osgi.PropertiesUtil;
-import org.apache.sling.hc.api.HealthCheck;
-import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.component.ComponentContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** {@link HealthCheck} that checks a scriptable expression */
-@Component(
-        name="org.apache.sling.hc.ScriptableHealthCheck",
-        configurationFactory=true,
-        policy=ConfigurationPolicy.REQUIRE,
-        metatype=true)
-@Properties({
-    @Property(name=HealthCheck.NAME),
-    @Property(name=HealthCheck.TAGS, unbounded=PropertyUnbounded.ARRAY),
-    @Property(name=HealthCheck.MBEAN_NAME)
-})
-@Service(value=HealthCheck.class)
-public class ScriptableHealthCheck implements HealthCheck {
-
-    private final Logger log = LoggerFactory.getLogger(getClass());
-    private String expression;
-    private String languageExtension;
-    private BundleContext bundleContext;
-
-    private static final String DEFAULT_LANGUAGE_EXTENSION = "ecma";
-
-    @Property
-    public static final String PROP_EXPRESSION = "expression";
-
-    @Property(value=DEFAULT_LANGUAGE_EXTENSION)
-    public static final String PROP_LANGUAGE_EXTENSION = "language.extension";
-
-    @Reference
-    private ScriptEngineManager scriptEngineManager;
-
-    @Activate
-    public void activate(ComponentContext ctx) {
-        bundleContext = ctx.getBundleContext();
-        expression = PropertiesUtil.toString(ctx.getProperties().get(PROP_EXPRESSION), "");
-        languageExtension = PropertiesUtil.toString(ctx.getProperties().get(PROP_LANGUAGE_EXTENSION), DEFAULT_LANGUAGE_EXTENSION);
-
-        log.debug("Activated scriptable health check name={}, languageExtension={}, expression={}",
-                new Object[] {ctx.getProperties().get(HealthCheck.NAME),
-                languageExtension, expression});
-    }
-
-    @Override
-    public Result execute() {
-        final FormattingResultLog resultLog = new FormattingResultLog();
-        resultLog.debug("Checking expression [{}], language extension=[{}]",  expression, languageExtension);
-        try {
-            final ScriptEngine engine = scriptEngineManager.getEngineByExtension(languageExtension);
-            if (engine == null) {
-                resultLog.healthCheckError("No ScriptEngine available for extension {}", languageExtension);
-            } else {
-                // TODO pluggable Bindings? Reuse the Sling bindings providers?
-                final Bindings b = engine.createBindings();
-                b.put("jmx", new JmxScriptBinding(resultLog));
-                b.put("osgi", new OsgiScriptBinding(bundleContext, resultLog));
-                final Object value = engine.eval(expression, b);
-                if(value!=null && "true".equals(value.toString().toLowerCase())) {
-                    resultLog.debug("Expression [{}] evaluates to true as expected", expression);
-                } else {
-                    resultLog.warn("Expression [{}] does not evaluate to true as expected, value=[{}]", expression, value);
-                }
-            }
-        } catch (final Exception e) {
-            resultLog.healthCheckError(
-                    "Exception while evaluating expression [{}] with language extension [{}]: {}",
-                    expression, languageExtension, e);
-        }
-        return new Result(resultLog);
-    }
-}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
index f27c524..682f412 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
@@ -35,7 +35,7 @@ import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.engine.SlingRequestProcessor;
 import org.apache.sling.hc.api.HealthCheck;
 import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
+import org.apache.sling.hc.util.FormattingResultLog;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/util/FormattingResultLog.java b/src/main/java/org/apache/sling/hc/healthchecks/util/FormattingResultLog.java
deleted file mode 100644
index 6933f08..0000000
--- a/src/main/java/org/apache/sling/hc/healthchecks/util/FormattingResultLog.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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 SF 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.hc.healthchecks.util;
-import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.api.ResultLog;
-import org.slf4j.helpers.MessageFormatter;
-
-/** Utility that provides a logging-like facade on a ResultLog */
-public class FormattingResultLog extends ResultLog {
-    
-    private ResultLog.Entry createEntry(Result.Status status, String format, Object ... args) {
-        return new ResultLog.Entry(status, MessageFormatter.arrayFormat(format, args).getMessage());
-    }
-    
-    public void debug(String format, Object ... args) {
-        add(createEntry(Result.Status.DEBUG, format, args));
-    }
-    
-    public void info(String format, Object ... args) {
-        add(createEntry(Result.Status.INFO, format, args));
-    }
-    
-    public void warn(String format, Object ... args) {
-        add(createEntry(Result.Status.WARN, format, args));
-    }
-    
-    public void critical(String format, Object ... args) {
-        add(createEntry(Result.Status.CRITICAL, format, args));
-    }
-
-    public void healthCheckError(String format, Object ... args) {
-        add(createEntry(Result.Status.HEALTH_CHECK_ERROR, format, args));
-    }
-}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/util/SimpleConstraintChecker.java b/src/main/java/org/apache/sling/hc/healthchecks/util/SimpleConstraintChecker.java
deleted file mode 100644
index 13c3b23..0000000
--- a/src/main/java/org/apache/sling/hc/healthchecks/util/SimpleConstraintChecker.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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 SF 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.hc.healthchecks.util;
-
-import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.api.ResultLog;
-
-/** Simple check of numeric values against expressions
- *  like < N, > N, between two values etc.
- *  See  {@link SimpleConstraintCheckerTest} for examples.
- */
-public class SimpleConstraintChecker {
-
-    public static final String CONTAINS = "contains";
-
-    /** Check value against expression and report to result */
-    public void check(Object inputValue, String constraint, ResultLog resultLog) {
-
-        final String stringValue = inputValue == null ? "" : inputValue.toString();
-
-        if(constraint == null || constraint.trim().length() == 0) {
-            throw new IllegalArgumentException("Empty constraint, cannot evaluate");
-        }
-
-        final String [] parts = constraint.split(" ");
-        boolean matches = false;
-        try {
-            if(constraint.startsWith(">") && parts.length == 2) {
-                final int value = Integer.valueOf(stringValue).intValue();
-                matches = value > Integer.valueOf(parts[1]);
-
-            } else if(constraint.startsWith("<") && parts.length == 2) {
-                final int value = Integer.valueOf(stringValue).intValue();
-                matches = value < Integer.valueOf(parts[1]);
-
-            } else if(parts.length == 4 && "between".equalsIgnoreCase(parts[0]) && "and".equalsIgnoreCase(parts[2]) ) {
-                final int value = Integer.valueOf(stringValue).intValue();
-                final int lowerBound = Integer.valueOf(parts[1]);
-                final int upperBound = Integer.valueOf(parts[3]);
-                matches = value > lowerBound && value < upperBound;
-
-            } else if(parts.length >1 && CONTAINS.equalsIgnoreCase(parts[0])) {
-                final String pattern = constraint.substring(CONTAINS.length()).trim();
-                matches = stringValue.contains(pattern);
-
-            } else {
-                matches = constraint.equals(stringValue);
-            }
-        } catch(NumberFormatException nfe) {
-            resultLog.add(new ResultLog.Entry(
-                    Result.Status.WARN,
-                    "Invalid numeric value [" + inputValue + "] while evaluating " + constraint));
-        }
-
-        if(matches) {
-            resultLog.add(new ResultLog.Entry(
-                    Result.Status.DEBUG,
-                    "Value [" + inputValue + "] matches constraint [" + constraint + "]"));
-        } else {
-            resultLog.add(new ResultLog.Entry(
-                    Result.Status.WARN,
-                    "Value [" + inputValue + "] does not match constraint [" + constraint + "]"));
-        }
-    }
-}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/util/package-info.java b/src/main/java/org/apache/sling/hc/healthchecks/util/package-info.java
deleted file mode 100644
index 73b5889..0000000
--- a/src/main/java/org/apache/sling/hc/healthchecks/util/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-@Version("1.0.0")
-package org.apache.sling.hc.healthchecks.util;
-
-import aQute.bnd.annotation.Version;
-
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/JmxAttributeHealthCheckTest.java b/src/test/java/org/apache/sling/hc/healthchecks/JmxAttributeHealthCheckTest.java
deleted file mode 100644
index a0d93ff..0000000
--- a/src/test/java/org/apache/sling/hc/healthchecks/JmxAttributeHealthCheckTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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 SF 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.hc.healthchecks;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.healthchecks.impl.JmxAttributeHealthCheck;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.osgi.service.component.ComponentContext;
-
-public class JmxAttributeHealthCheckTest {
-
-    static void assertJmxValue(String objectName, String attributeName, String constraint, boolean expected) {
-        final JmxAttributeHealthCheck hc = new JmxAttributeHealthCheck();
-
-        final ComponentContext ctx = Mockito.mock(ComponentContext.class);
-        final Map<String, Object> props = new HashMap<String, Object>();
-        props.put(JmxAttributeHealthCheck.PROP_OBJECT_NAME, objectName);
-        props.put(JmxAttributeHealthCheck.PROP_ATTRIBUTE_NAME, attributeName);
-        props.put(JmxAttributeHealthCheck.PROP_CONSTRAINT, constraint);
-        hc.activate(props);
-
-        final Result r = hc.execute();
-        assertEquals("Expected result " + expected, expected, r.isOk());
-    }
-
-    @Test
-    public void testJmxAttributeMatch() {
-        assertJmxValue("java.lang:type=ClassLoading", "LoadedClassCount", "> 10", true);
-    }
-
-    @Test
-    public void testJmxAttributeNoMatch() {
-        assertJmxValue("java.lang:type=ClassLoading", "LoadedClassCount", "< 10", false);
-    }
-}
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/JmxScriptBindingTest.java b/src/test/java/org/apache/sling/hc/healthchecks/JmxScriptBindingTest.java
deleted file mode 100644
index 8886c11..0000000
--- a/src/test/java/org/apache/sling/hc/healthchecks/JmxScriptBindingTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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 SF 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.hc.healthchecks;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.sling.hc.healthchecks.impl.JmxScriptBinding;
-import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
-import org.junit.Test;
-
-public class JmxScriptBindingTest {
-    
-    @Test
-    public void testJmxAttribute() throws Exception {
-        final FormattingResultLog resultLog = new FormattingResultLog();
-        final JmxScriptBinding b = new JmxScriptBinding(resultLog);
-        final Object value= b.attribute("java.lang:type=ClassLoading", "LoadedClassCount");
-        assertNotNull("Expecting non-null attribute value", value);
-        assertTrue("Expecting non-empty value", value.toString().length() > 0);
-    }
-}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/OsgiScriptBindingTest.java b/src/test/java/org/apache/sling/hc/healthchecks/OsgiScriptBindingTest.java
deleted file mode 100644
index 731c7d9..0000000
--- a/src/test/java/org/apache/sling/hc/healthchecks/OsgiScriptBindingTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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 SF 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.hc.healthchecks;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.apache.sling.hc.healthchecks.impl.OsgiScriptBinding;
-import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-
-public class OsgiScriptBindingTest {
-    
-    private Bundle mockBundle(boolean isFragment, boolean isActive) {
-        final Bundle b = Mockito.mock(Bundle.class);
-        Mockito.when(b.getState()).thenReturn(isActive ? Bundle.ACTIVE : Bundle.RESOLVED);
-        
-        final Dictionary<String, String> headers = new Hashtable<String, String>();
-        if(isFragment) {
-            headers.put(Constants.FRAGMENT_HOST, "FOO");
-        }
-        Mockito.when(b.getHeaders()).thenReturn(headers);
-        
-        return b;
-    }
-    
-    @Test
-    public void testInactiveBundles() throws Exception {
-        final BundleContext ctx = Mockito.mock(BundleContext.class);
-        final Bundle [] bundles = { 
-                mockBundle(false, true), 
-                mockBundle(false, false), 
-                mockBundle(false, true),
-                mockBundle(true, false)
-        };
-        Mockito.when(ctx.getBundles()).thenReturn(bundles);
-        
-        final FormattingResultLog resultLog = new FormattingResultLog();
-        final OsgiScriptBinding b = new OsgiScriptBinding(ctx, resultLog);
-        assertEquals(1, b.inactiveBundlesCount());
-    }
-}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/ScriptableHealthCheckTest.java b/src/test/java/org/apache/sling/hc/healthchecks/ScriptableHealthCheckTest.java
deleted file mode 100644
index 351b88f..0000000
--- a/src/test/java/org/apache/sling/hc/healthchecks/ScriptableHealthCheckTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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 SF 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.hc.healthchecks;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.lang.reflect.Field;
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-
-import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.healthchecks.impl.ScriptableHealthCheck;
-import org.junit.Test;
-import org.mockito.Matchers;
-import org.mockito.Mockito;
-import org.osgi.service.component.ComponentContext;
-
-public class ScriptableHealthCheckTest {
-    
-    private ScriptableHealthCheck hc;
-    private Dictionary<String, String> props;
-    private ComponentContext ctx;
-
-    private void assertExpression(String expression, String languageExtension, boolean expected) throws Exception {
-        hc = new ScriptableHealthCheck();
-        ctx = Mockito.mock(ComponentContext.class);
-        props = new Hashtable<String, String>();
-        
-        final ScriptEngine rhino = new ScriptEngineManager().getEngineByExtension("js");
-        assertNotNull("With the rhino jar in our classpath, we should get a js script engine", rhino);
-        final ScriptEngineManager manager = Mockito.mock(ScriptEngineManager.class);
-        Mockito.when(manager.getEngineByExtension(Matchers.same("ecma"))).thenReturn(rhino);
-        final Field f = hc.getClass().getDeclaredField("scriptEngineManager");
-        f.setAccessible(true);
-        f.set(hc, manager);
-        
-        props.put(ScriptableHealthCheck.PROP_EXPRESSION, expression);
-        if(languageExtension != null) {
-            props.put(ScriptableHealthCheck.PROP_LANGUAGE_EXTENSION, languageExtension);
-        }
-        Mockito.when(ctx.getProperties()).thenReturn(props);
-        hc.activate(ctx);
-        final Result r = hc.execute();
-        assertEquals("Expecting result " + expected, expected, r.isOk());
-    }
-    
-    @Test
-    public void testSimpleExpression() throws Exception {
-        assertExpression("2 + 3 == 5", null, true);
-    }
-    
-    @Test
-    public void testJmxExpression() throws Exception {
-        assertExpression(
-                "jmx.attribute('java.lang:type=ClassLoading', 'LoadedClassCount') > 10"
-                + " && jmx.attribute('java.lang:type=Runtime', 'ManagementSpecVersion') > 1", 
-                "ecma", true);
-    }
-    
-    @Test
-    public void testFalseExpression() throws Exception {
-        assertExpression("2 + 3 == 15", null, false);
-    }
-    
-    @Test
-    public void testSyntaxError() throws Exception {
-        assertExpression("{not [valid ok?", null, false);
-    }
-    
-    @Test
-    public void testNoEngine() throws Exception {
-        assertExpression("2 + 3 == 5", null, true);
-        assertExpression("2 + 3 == 5", "groovy", false);
-    }
-}
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/util/SimpleConstraintCheckerTest.java b/src/test/java/org/apache/sling/hc/healthchecks/util/SimpleConstraintCheckerTest.java
deleted file mode 100644
index d981876..0000000
--- a/src/test/java/org/apache/sling/hc/healthchecks/util/SimpleConstraintCheckerTest.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * 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 SF 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.hc.healthchecks.util;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.api.ResultLog;
-import org.apache.sling.hc.healthchecks.util.SimpleConstraintChecker;
-import org.junit.Before;
-import org.junit.Test;
-
-public class SimpleConstraintCheckerTest {
-    private ResultLog resultLog; 
-
-    private final SimpleConstraintChecker checker = new SimpleConstraintChecker();
-
-    @Before
-    public void setup() {
-        resultLog = new ResultLog();
-    }
-    
-    @Test
-    public void testStringEquals() {
-        final String s = "test_" + System.currentTimeMillis();
-        checker.check(s, s, resultLog);
-        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testStringNotEquals() {
-        final String s = "test_" + System.currentTimeMillis();
-        checker.check(s, "something else", resultLog);
-        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testFiveEquals() {
-        final String s = "5";
-        checker.check(s, s, resultLog);
-        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testIntTwelveEquals() {
-        checker.check(12, "12", resultLog);
-        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testIntTwelveGreaterThan() {
-        checker.check(12, "> 11", resultLog);
-        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testFiveNotEquals() {
-        checker.check("5", "foo", resultLog);
-        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testNullNotEquals() {
-        checker.check(null, "foo", resultLog);
-        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testNullNotGreater() {
-        checker.check(null, "> 2", resultLog);
-        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testGreaterThanTrue() {
-        checker.check("5", "> 2", resultLog);
-        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testGreaterThanFalse() {
-        checker.check("5", "> 12", resultLog);
-        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testLessThanTrue() {
-        checker.check("5", "< 12", resultLog);
-        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testLessThanFalse() {
-        checker.check("5", "< 2", resultLog);
-        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testBetweenA() {
-        checker.check("5", "between 2 and 6", resultLog);
-        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testBetweenB() {
-        checker.check("5", "between 12 and 16", resultLog);
-        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testBetweenC() {
-        checker.check(5L, "between 12 and 16", resultLog);
-        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testBetweenD() {
-        checker.check(5L, "between 4 and 16", resultLog);
-        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testBetweenE() {
-        checker.check(5L, "betWEEN 4 aND 16", resultLog);
-        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testNotAnInteger() {
-        checker.check("foo", "between 12 and 16", resultLog);
-        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testContainsA() {
-        checker.check("This is a NICE STRING ok?", "contains NICE STRING", resultLog);
-        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testContainsB() {
-        checker.check("This is a NICE TOUCH ok?", "contains NICE STRING", resultLog);
-        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-    
-    @Test
-    public void testContainsC() {
-        checker.check("This is a NICE TOUCH ok?", "contains NICE", resultLog);
-        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
-    }
-}

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

[sling-org-apache-sling-hc-support] 14/31: SLING-3034 - explain what this is for

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit 08e38a51138b9c26187a37859df00472d5380445
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Sep 2 13:32:04 2013 +0000

    SLING-3034 - explain what this is for
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/healthchecks@1519438 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java     | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
index 74c9e4b..f27c524 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
@@ -40,7 +40,9 @@ import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/** {@link HealthCheck} that checks the HTTP status of Sling requests */
+/** {@link HealthCheck} that checks the HTTP status of Sling requests.
+ *  Typically used to check that a freshly installed Sling-based system
+ *  is in good shape, contains all required content etc. */
 @Component(
         name="org.apache.sling.hc.SlingRequestStatusHealthCheck",
         configurationFactory=true,

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

[sling-org-apache-sling-hc-support] 28/31: [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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit 4c9cf8d06e755c06a714b47c089726b113cb1cf0
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Sep 26 14:42:46 2013 +0000

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

diff --git a/pom.xml b/pom.xml
index b60384b..3b72ad6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.hc.support</artifactId>
     <packaging>bundle</packaging>
-    <version>1.0.2</version>
+    <version>1.0.3-SNAPSHOT</version>
 
     <name>Apache Sling Health Check Support Components</name>
     <inceptionYear>2013</inceptionYear>
@@ -27,9 +27,9 @@
     </properties>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.core-1.0.2/bundles/extensions/healthcheck/support</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.core-1.0.2/bundles/extensions/healthcheck/support</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.hc.core-1.0.2/bundles/extensions/healthcheck/support</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/support</url>
     </scm>
 
     <build>
@@ -59,7 +59,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.hc.core</artifactId>
-            <version>1.0.2</version>
+            <version>1.0.3-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

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

[sling-org-apache-sling-hc-support] 07/31: SLING-3020 - Result is now immutable

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit bcce508d6e6d07f6659c0ec7b01fd84b89115b6d
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Aug 15 14:19:46 2013 +0000

    SLING-3020 - Result is now immutable
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/healthchecks@1514287 13f79535-47bb-0310-9956-ffa450edef68
---
 .../hc/healthchecks/impl/CompositeHealthCheck.java | 34 +++++++--------
 .../impl/DefaultLoginsHealthCheck.java             | 20 ++++-----
 .../healthchecks/impl/JmxAttributeHealthCheck.java | 21 ++++------
 .../hc/healthchecks/impl/JmxScriptBinding.java     | 19 ++++-----
 .../hc/healthchecks/impl/OsgiScriptBinding.java    | 20 ++++-----
 .../healthchecks/impl/ScriptableHealthCheck.java   | 34 ++++++---------
 .../impl/SlingRequestStatusHealthCheck.java        | 25 +++++------
 .../hc/healthchecks/util/FormattingResultLog.java  | 49 ++++++++++++++++++++++
 .../hc/healthchecks/JmxScriptBindingTest.java      | 10 ++---
 .../hc/healthchecks/OsgiScriptBindingTest.java     | 10 ++---
 10 files changed, 126 insertions(+), 116 deletions(-)

diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
index 59edcf6..e459b0d 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
@@ -30,7 +30,8 @@ import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.hc.api.Constants;
 import org.apache.sling.hc.api.HealthCheck;
 import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.api.ResultLogEntry;
+import org.apache.sling.hc.api.ResultLog;
+import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
 import org.apache.sling.hc.util.HealthCheckFilter;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.component.ComponentContext;
@@ -73,40 +74,39 @@ public class CompositeHealthCheck implements HealthCheck {
     
     @Override
     public Result execute() {
-        final Result result = new Result(log);
+        final FormattingResultLog resultLog = new FormattingResultLog();
         final List<HealthCheck> checks = new HealthCheckFilter(bundleContext).getTaggedHealthCheck(filterTags);
         if(checks.size() == 0) {
-            result.log(ResultLogEntry.LT_WARN, "HealthCheckFilter returns no HealthCheck for tags " + Arrays.asList(filterTags));
-            return result;
+            resultLog.warn("HealthCheckFilter returns no HealthCheck for tags {}", Arrays.asList(filterTags));
+            return new Result(resultLog);
         }
-            
-        result.log(ResultLogEntry.LT_DEBUG, 
-                "Executing " + checks.size() 
-                + " HealthCheck selected by the " + Arrays.asList(filterTags) + " tags");
+
+        int executed = 0;
+        resultLog.debug("Executing {} HealthCheck selected by the {} tags", checks.size(), Arrays.asList(filterTags));
         int failures = 0;
         for(HealthCheck hc : checks) {
             if(hc == this) {
-                result.log(ResultLogEntry.LT_WARN, 
-                        "Cowardly forfeiting execution of this HealthCheck in an infinite loop - do not include my tags in the filter tags!");
+                resultLog.info("Cowardly forfeiting execution of this HealthCheck in an infinite loop, ignoring it");
                 continue;
             }
-            result.log(ResultLogEntry.LT_DEBUG, "Executing " + hc); 
+            resultLog.debug("Executing {}", hc);
+            executed++;
             final Result sub = hc.execute();
             if(!sub.isOk()) {
                 failures++;
             }
-            result.merge(sub);
+            for(ResultLog.Entry e : sub) {
+                resultLog.add(e);
+            }
         }
         
         if(failures == 0) {
-            result.log(ResultLogEntry.LT_DEBUG, 
-                    checks.size() + " HealthCheck executed, all ok"); 
+            resultLog.debug("{} HealthCheck executed, all ok", executed);
         } else {
-            result.log(ResultLogEntry.LT_WARN, 
-                    checks.size() + " HealthCheck executed, " + failures + " failures"); 
+            resultLog.warn("{} HealthCheck executed, {} failures", executed, failures);
         }
         
-        return result;
+        return new Result(resultLog);
     }
 
     @Override
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java
index 357c5c1..d7196a9 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java
@@ -36,7 +36,7 @@ import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.hc.api.Constants;
 import org.apache.sling.hc.api.HealthCheck;
 import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.api.ResultLogEntry;
+import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
 import org.apache.sling.jcr.api.SlingRepository;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
@@ -80,14 +80,14 @@ public class DefaultLoginsHealthCheck implements HealthCheck {
     
     @Override
     public Result execute() {
-        final Result result = new Result(log);
+        final FormattingResultLog resultLog = new FormattingResultLog();
         int checked=0;
         int failures=0;
         
         for(String login : logins) {
             final String [] parts = login.split(":");
             if(parts.length != 2) {
-                result.log(ResultLogEntry.LT_WARN, "Expected login in the form username:password, got " + login);
+                resultLog.warn("Expected login in the form username:password, got [{}]", login);
                 continue;
             }
             checked++;
@@ -99,12 +99,12 @@ public class DefaultLoginsHealthCheck implements HealthCheck {
                 s = repository.login(creds);
                 if(s != null) {
                     failures++;
-                    result.log(ResultLogEntry.LT_WARN_SECURITY, "Login as [" + username + "] succeeded, was expecting it to fail");
+                    resultLog.warn("Login as [{}] succeeded, was expecting it to fail", username);
                 } else {
-                    result.log(ResultLogEntry.LT_DEBUG, "Login as [" + username + "] didn't throw an Exception but returned null Session");
+                    resultLog.debug("Login as [{}] didn't throw an Exception but returned null Session", username);
                 }
             } catch(RepositoryException re) {
-                result.log(ResultLogEntry.LT_DEBUG, "Login as [" + username + "] failed, as expected");
+                resultLog.debug("Login as [{}] failed, as expected", username);
             } finally {
                 if(s != null) {
                     s.logout();
@@ -113,13 +113,13 @@ public class DefaultLoginsHealthCheck implements HealthCheck {
         }
         
         if(checked==0) {
-            result.log(ResultLogEntry.LT_WARN, "Did not check any logins, configured logins=" + logins);
+            resultLog.warn("Did not check any logins, configured logins={}", logins);
         } else if(failures != 0){
-            result.log(ResultLogEntry.LT_WARN_SECURITY, "Checked " + checked + " logins, " + failures + " tests failed");
+            resultLog.warn("Checked {} logins, {} failures", checked, failures);
         } else {
-            result.log(ResultLogEntry.LT_DEBUG, "Checked " + checked + " logins, all tests successful");
+            resultLog.debug("Checked {} logins, all successful", checked, failures);
         }
-        return result;
+        return new Result(resultLog);
     }
 
     @Override
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
index 6e72e5d..f2ab2e4 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
@@ -32,12 +32,11 @@ import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.hc.api.Constants;
 import org.apache.sling.hc.api.HealthCheck;
 import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.api.ResultLogEntry;
+import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
 import org.apache.sling.hc.util.SimpleConstraintChecker;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.slf4j.helpers.MessageFormatter;
 
 /** {@link HealthCheck} that checks a single JMX attribute */
 @Component(
@@ -89,10 +88,8 @@ public class JmxAttributeHealthCheck implements HealthCheck {
     
     @Override
     public Result execute() {
-        final Result result = new Result(log);
-        result.log(ResultLogEntry.LT_DEBUG, 
-                MessageFormatter.arrayFormat("Checking {} / {} with constraint {}", 
-                        new Object[] { mbeanName, attributeName, constraint }).getMessage());
+        final FormattingResultLog resultLog = new FormattingResultLog();
+        resultLog.debug("Checking {} / {} with constraint {}", mbeanName, attributeName, constraint);
         try {
             final MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer();
             final ObjectName objectName = new ObjectName(mbeanName);
@@ -100,15 +97,13 @@ public class JmxAttributeHealthCheck implements HealthCheck {
                 log.error("MBean not found: {}", objectName);
             }
             final Object value = jmxServer.getAttribute(objectName, attributeName);
-            result.log(ResultLogEntry.LT_DEBUG,
-                    MessageFormatter.arrayFormat( 
-                    "{} {} returns {}", 
-                    new Object[] { mbeanName, attributeName, value }).getMessage());
-            new SimpleConstraintChecker().check(value, constraint, result);
+            resultLog.debug("{} {} returns {}", mbeanName, attributeName, value);
+            new SimpleConstraintChecker().check(value, constraint, resultLog);
         } catch(Exception e) {
-            log.warn(e.toString(), e);
+            log.warn("JMX attribute {}/{} check failed: {}", new Object []{ mbeanName, attributeName, e});
+            resultLog.healthCheckError("JMX attribute check failed: {}", e);
         }
-        return result;
+        return new Result(resultLog);
     }
 
     @Override
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxScriptBinding.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxScriptBinding.java
index 6773c56..463a38e 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxScriptBinding.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxScriptBinding.java
@@ -27,9 +27,7 @@ import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import javax.management.ReflectionException;
 
-import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.api.ResultLogEntry;
-import org.slf4j.helpers.MessageFormatter;
+import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
 
 /** The JmxBinding is meant to be bound as "jmx" global variables
  *  in scripted rules, to allow for writing scripted expressions
@@ -37,10 +35,10 @@ import org.slf4j.helpers.MessageFormatter;
  */
 public class JmxScriptBinding {
     private MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer();
-    private final Result result;
+    private final FormattingResultLog resultLog;
     
-    public JmxScriptBinding(Result result) {
-        this.result = result;
+    public JmxScriptBinding(FormattingResultLog resultLog) {
+        this.resultLog = resultLog;
     }
     
     public Object attribute(String objectNameString, String attributeName) 
@@ -48,15 +46,12 @@ public class JmxScriptBinding {
         final ObjectName name = new ObjectName(objectNameString);
         if(jmxServer.queryNames(name, null).size() == 0) {
             final String msg = "JMX object name not found: [" + objectNameString + "]";
-            result.log(ResultLogEntry.LT_WARN, msg);
+            resultLog.warn(msg);
             throw new IllegalStateException(msg);
         }
-        result.log(ResultLogEntry.LT_DEBUG, MessageFormatter.format("Got JMX Object [{}]", name).getMessage());
+        resultLog.debug("Got JMX Object [{}]", name);
         final Object value = jmxServer.getAttribute(name, attributeName);
-        result.log(ResultLogEntry.LT_DEBUG, 
-                MessageFormatter.arrayFormat(
-                        "JMX Object [{}] Attribute [{}] = [{}]", 
-                        new Object[] { name, attributeName, value }).getMessage());
+        resultLog.debug("JMX Object [{}] Attribute [{}] = [{}]", name, attributeName, value);
         return value;
     }
 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/OsgiScriptBinding.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/OsgiScriptBinding.java
index 29f80db..a34f8c9 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/OsgiScriptBinding.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/OsgiScriptBinding.java
@@ -17,23 +17,21 @@
  */
 package org.apache.sling.hc.healthchecks.impl;
 
-import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.api.ResultLogEntry;
+import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
-import org.slf4j.helpers.MessageFormatter;
 
 /** The OsgiBinding is meant to be bound as an "osgi" global variable
  *  in scripted rules, to allow for checking some OSGi states in
  *  a simple way
  */
 public class OsgiScriptBinding {
-    private final Result result;
+    private final FormattingResultLog resultLog;
     private final BundleContext bundleContext;
     
-    public OsgiScriptBinding(BundleContext ctx, Result result) {
-        this.result = result;
+    public OsgiScriptBinding(BundleContext ctx, FormattingResultLog resultLog) {
+        this.resultLog = resultLog;
         this.bundleContext = ctx;
     }
     
@@ -44,7 +42,7 @@ public class OsgiScriptBinding {
                 count++;
             }
         }
-        result.log(ResultLogEntry.LT_DEBUG, MessageFormatter.format("inactiveBundlesCount={}", count).getMessage());
+        resultLog.debug("inactiveBundlesCount={}", count);
         return count;
     }
     
@@ -52,10 +50,7 @@ public class OsgiScriptBinding {
         boolean active = true;
         if(!isFragment(b) && Bundle.ACTIVE != b.getState()) {
             active = false;
-            result.log(ResultLogEntry.LT_INFO, 
-                    MessageFormatter.arrayFormat(
-                            "Bundle {} is not active, state={} ({})", 
-                            new Object[] { b.getSymbolicName(), b.getState(), b.getState()}).getMessage());
+            resultLog.info("Bundle {} is not active, state={} ({})", b.getSymbolicName(), b.getState(), b.getState());
         }
         return active;
     }
@@ -63,8 +58,7 @@ public class OsgiScriptBinding {
     private boolean isFragment(Bundle b) {
         final String header = (String) b.getHeaders().get( Constants.FRAGMENT_HOST );
         if(header!= null && header.trim().length() > 0) {
-            result.log(ResultLogEntry.LT_DEBUG, 
-                    MessageFormatter.format("{} is a fragment bundle, state won't be checked", b).getMessage());
+            resultLog.debug("{} is a fragment bundle, state won't be checked", b);
             return true;
         } else {
             return false;
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java
index 6e5d82f..5979baa 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java
@@ -32,12 +32,11 @@ import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.hc.api.Constants;
 import org.apache.sling.hc.api.HealthCheck;
 import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.api.ResultLogEntry;
+import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.slf4j.helpers.MessageFormatter;
 
 /** {@link HealthCheck} that checks a scriptable expression */
 @Component(
@@ -89,39 +88,30 @@ public class ScriptableHealthCheck implements HealthCheck {
     
     @Override
     public Result execute() {
-        final Result result = new Result(log);
-        result.log(ResultLogEntry.LT_DEBUG, 
-                MessageFormatter.format(
-                        "Checking expression [{}], language extension=[{}]", 
-                        expression, languageExtension).getMessage());
+        final FormattingResultLog resultLog = new FormattingResultLog();
+        resultLog.debug("Checking expression [{}], language extension=[{}]",  expression, languageExtension);
         try {
             final ScriptEngine engine = scriptEngineManager.getEngineByExtension(languageExtension);
             if(engine == null) {
-                result.log(ResultLogEntry.LT_WARN, 
-                        MessageFormatter.format(
-                                "No ScriptEngine available for extension {}", 
-                                languageExtension).getMessage());
+                resultLog.healthCheckError("No ScriptEngine available for extension {}", languageExtension);
             } else {
                 // TODO pluggable Bindings? Reuse the Sling bindings providers?
                 final Bindings b = engine.createBindings();
-                b.put("jmx", new JmxScriptBinding(result));
-                b.put("osgi", new OsgiScriptBinding(bundleContext, result));
+                b.put("jmx", new JmxScriptBinding(resultLog));
+                b.put("osgi", new OsgiScriptBinding(bundleContext, resultLog));
                 final Object value = engine.eval(expression, b);
                 if(value!=null && "true".equals(value.toString())) {
-                    result.log(ResultLogEntry.LT_DEBUG, 
-                            MessageFormatter.format(
-                                    "Expression [{}] evaluates to true as expected", expression).getMessage());
+                    resultLog.debug("Expression [{}] evaluates to true as expected", expression);
                 } else {
-                    result.log(ResultLogEntry.LT_WARN, 
-                            MessageFormatter.format(
-                                    "Expression [{}] does not evaluate to true, value={}", 
-                                    expression, value).getMessage());
+                    resultLog.warn("Expression [{}] does not evaluate to true as expected, value=[{}]", expression, value); 
                 }
             }
         } catch(Exception e) {
-            result.log(ResultLogEntry.LT_WARN, e.toString()); 
+            resultLog.healthCheckError(
+                    "Exception while evaluating expression [{}] with language extension [{}]: {}", 
+                    expression, languageExtension, e); 
         }
-        return result;
+        return new Result(resultLog);
     }
 
     @Override
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
index 32fd6d4..8b8f2c4 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
@@ -35,11 +35,10 @@ import org.apache.sling.engine.SlingRequestProcessor;
 import org.apache.sling.hc.api.Constants;
 import org.apache.sling.hc.api.HealthCheck;
 import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.api.ResultLogEntry;
+import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.slf4j.helpers.MessageFormatter;
 
 /** {@link HealthCheck} that checks the HTTP status of Sling requests */
 @Component(
@@ -101,15 +100,17 @@ public class SlingRequestStatusHealthCheck implements HealthCheck {
     
     @Override
     public Result execute() {
-        final Result result = new Result(log);
+        final FormattingResultLog resultLog = new FormattingResultLog();
         
         ResourceResolver resolver = null;
         int checked = 0;
         int failed = 0;
+        String lastPath = null;
         
         try {
             resolver = resolverFactory.getAdministrativeResourceResolver(null);
             for(String p : paths) {
+                lastPath = p;
                 final PathSpec ps = new PathSpec(p);
                 final HttpServletRequest request = new InternalRequest(ps.path);
                 final InternalResponse response = new InternalResponse();
@@ -117,18 +118,14 @@ public class SlingRequestStatusHealthCheck implements HealthCheck {
                 final int status = response.getStatus();
                 if(status != ps.status) {
                     failed++;
-                    result.log(ResultLogEntry.LT_WARN,
-                            MessageFormatter.arrayFormat(
-                            "[{}] returns status {}, expected {}", new Object[] { ps.path, status, ps.status }).getMessage());
+                    resultLog.warn("[{}] returns status {}, expected {}", new Object[] { ps.path, status, ps.status });
                 } else {
-                    result.log(ResultLogEntry.LT_DEBUG,
-                            MessageFormatter.format(
-                            "[{}] returns status {} as expected", ps.path, status).getMessage());
+                    resultLog.debug("[{}] returns status {} as expected", ps.path, status);
                 }
                 checked++;
             }
         } catch(Exception e) {
-            result.log(ResultLogEntry.LT_WARN, "Exception while executing request: " + e.toString());
+            resultLog.warn("Exception while executing request [{}]: {}", lastPath, e);
         } finally {
             if(resolver != null) {
                 resolver.close();
@@ -136,14 +133,12 @@ public class SlingRequestStatusHealthCheck implements HealthCheck {
         }
         
         if(checked == 0) {
-            result.log(ResultLogEntry.LT_WARN, "No paths checked, empty paths list?");
+            resultLog.warn("No paths checked, empty paths list?");
         } else {
-            result.log(ResultLogEntry.LT_DEBUG, 
-                    MessageFormatter.format(
-                            "{} paths checked, {} failures", checked, failed).getMessage());
+            resultLog.debug("{} paths checked, {} failures", checked, failed);
         }
         
-        return result;
+        return new Result(resultLog);
     }
 
     @Override
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/util/FormattingResultLog.java b/src/main/java/org/apache/sling/hc/healthchecks/util/FormattingResultLog.java
new file mode 100644
index 0000000..6933f08
--- /dev/null
+++ b/src/main/java/org/apache/sling/hc/healthchecks/util/FormattingResultLog.java
@@ -0,0 +1,49 @@
+/*
+ * 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 SF 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.hc.healthchecks.util;
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.api.ResultLog;
+import org.slf4j.helpers.MessageFormatter;
+
+/** Utility that provides a logging-like facade on a ResultLog */
+public class FormattingResultLog extends ResultLog {
+    
+    private ResultLog.Entry createEntry(Result.Status status, String format, Object ... args) {
+        return new ResultLog.Entry(status, MessageFormatter.arrayFormat(format, args).getMessage());
+    }
+    
+    public void debug(String format, Object ... args) {
+        add(createEntry(Result.Status.DEBUG, format, args));
+    }
+    
+    public void info(String format, Object ... args) {
+        add(createEntry(Result.Status.INFO, format, args));
+    }
+    
+    public void warn(String format, Object ... args) {
+        add(createEntry(Result.Status.WARN, format, args));
+    }
+    
+    public void critical(String format, Object ... args) {
+        add(createEntry(Result.Status.CRITICAL, format, args));
+    }
+
+    public void healthCheckError(String format, Object ... args) {
+        add(createEntry(Result.Status.HEALTH_CHECK_ERROR, format, args));
+    }
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/JmxScriptBindingTest.java b/src/test/java/org/apache/sling/hc/healthchecks/JmxScriptBindingTest.java
index 7cad43b..8886c11 100644
--- a/src/test/java/org/apache/sling/hc/healthchecks/JmxScriptBindingTest.java
+++ b/src/test/java/org/apache/sling/hc/healthchecks/JmxScriptBindingTest.java
@@ -20,20 +20,16 @@ package org.apache.sling.hc.healthchecks;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
-import org.apache.sling.hc.api.Result;
 import org.apache.sling.hc.healthchecks.impl.JmxScriptBinding;
+import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class JmxScriptBindingTest {
     
-    private final Logger logger = LoggerFactory.getLogger(getClass());
-    
     @Test
     public void testJmxAttribute() throws Exception {
-        final Result r = new Result(logger);
-        final JmxScriptBinding b = new JmxScriptBinding(r);
+        final FormattingResultLog resultLog = new FormattingResultLog();
+        final JmxScriptBinding b = new JmxScriptBinding(resultLog);
         final Object value= b.attribute("java.lang:type=ClassLoading", "LoadedClassCount");
         assertNotNull("Expecting non-null attribute value", value);
         assertTrue("Expecting non-empty value", value.toString().length() > 0);
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/OsgiScriptBindingTest.java b/src/test/java/org/apache/sling/hc/healthchecks/OsgiScriptBindingTest.java
index b9dcf83..731c7d9 100644
--- a/src/test/java/org/apache/sling/hc/healthchecks/OsgiScriptBindingTest.java
+++ b/src/test/java/org/apache/sling/hc/healthchecks/OsgiScriptBindingTest.java
@@ -22,20 +22,16 @@ import static org.junit.Assert.assertEquals;
 import java.util.Dictionary;
 import java.util.Hashtable;
 
-import org.apache.sling.hc.api.Result;
 import org.apache.sling.hc.healthchecks.impl.OsgiScriptBinding;
+import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
 import org.junit.Test;
 import org.mockito.Mockito;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class OsgiScriptBindingTest {
     
-    private final Logger logger = LoggerFactory.getLogger(getClass());
-    
     private Bundle mockBundle(boolean isFragment, boolean isActive) {
         final Bundle b = Mockito.mock(Bundle.class);
         Mockito.when(b.getState()).thenReturn(isActive ? Bundle.ACTIVE : Bundle.RESOLVED);
@@ -60,8 +56,8 @@ public class OsgiScriptBindingTest {
         };
         Mockito.when(ctx.getBundles()).thenReturn(bundles);
         
-        final Result r = new Result(logger);
-        final OsgiScriptBinding b = new OsgiScriptBinding(ctx, r);
+        final FormattingResultLog resultLog = new FormattingResultLog();
+        final OsgiScriptBinding b = new OsgiScriptBinding(ctx, resultLog);
         assertEquals(1, b.inactiveBundlesCount());
     }
 }
\ 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-hc-support] 11/31: Clean up maven pom - remove unused dependencies, wrong plugin instructions etc.

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit aeee81c79cbd573d9f21f62e850677a58d8a9616
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Aug 19 07:46:59 2013 +0000

    Clean up maven pom - remove unused dependencies, wrong plugin instructions etc.
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/healthchecks@1515302 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 47 +++-------------------
 .../sling/hc/healthchecks/util/package-info.java   | 24 +++++++++++
 2 files changed, 30 insertions(+), 41 deletions(-)

diff --git a/pom.xml b/pom.xml
index e0a55d1..a3c65a3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,8 +9,8 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>16</version>
-        <relativePath>16</relativePath>
+        <version>17</version>
+        <relativePath/>
     </parent>
 
     <groupId>org.apache.sling</groupId>
@@ -25,6 +25,9 @@
         Default Sling Health Check Services
     </description>
 
+    <properties>
+        <sling.java.version>6</sling.java.version>
+    </properties>
     <build>
         <plugins>
             <plugin>
@@ -35,32 +38,6 @@
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
                 <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <Private-Package>
-                            org.apache.sling.hc.healthchecks.*
-                        </Private-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>1.6</source>
-                    <target>1.6</target>
-                </configuration>
-            </plugin>
-           <plugin>
-              <groupId>org.codehaus.mojo</groupId>
-              <artifactId>animal-sniffer-maven-plugin</artifactId>
-              <configuration>
-                <signature>
-                  <groupId>org.codehaus.mojo.signature</groupId>
-                  <artifactId>java16</artifactId>
-                  <version>1.0</version>
-                </signature>
-              </configuration>
             </plugin>
         </plugins>
     </build>
@@ -69,21 +46,15 @@
         <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
-            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.compendium</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.scr.annotations</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.hc.api</artifactId>
-            <version>${project.version}</version>
+            <version>0.0.2-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -114,29 +85,23 @@
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
             <version>1.6.2</version>
-            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>servlet-api</artifactId>
-            <scope>provided</scope>
         </dependency>
        <dependency>
             <groupId>javax.jcr</groupId>
             <artifactId>jcr</artifactId>
-            <scope>provided</scope>
         </dependency>
          <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-simple</artifactId>
             <version>1.6.2</version>
-            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <version>4.11</version>
-            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.mockito</groupId>
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/util/package-info.java b/src/main/java/org/apache/sling/hc/healthchecks/util/package-info.java
new file mode 100644
index 0000000..73b5889
--- /dev/null
+++ b/src/main/java/org/apache/sling/hc/healthchecks/util/package-info.java
@@ -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.
+ */
+
+@Version("1.0.0")
+package org.apache.sling.hc.healthchecks.util;
+
+import aQute.bnd.annotation.Version;
+

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

[sling-org-apache-sling-hc-support] 29/31: SLING-3127 - prepare for release

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit 9fa3bf9d17ed6767a4d73d41b5327d0c2a58266f
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Sep 26 14:53:42 2013 +0000

    SLING-3127 - prepare for release
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support@1526523 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 3b72ad6..9ad0a2a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -59,7 +59,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.hc.core</artifactId>
-            <version>1.0.3-SNAPSHOT</version>
+            <version>1.0.4</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

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

[sling-org-apache-sling-hc-support] 20/31: add missing metatype to core module, and fix and check metatype in support 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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit 0cc7be77c8335306dec171c3d1c42845b6aa2890
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Sep 11 12:54:37 2013 +0000

    add missing metatype to core module, and fix and check metatype in support module
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/support@1521823 13f79535-47bb-0310-9956-ffa450edef68
---
 .../OSGI-INF/metatype/metatype.properties          | 47 +++++-----------------
 1 file changed, 10 insertions(+), 37 deletions(-)

diff --git a/src/main/resources/OSGI-INF/metatype/metatype.properties b/src/main/resources/OSGI-INF/metatype/metatype.properties
index be5ecee..193b63b 100644
--- a/src/main/resources/OSGI-INF/metatype/metatype.properties
+++ b/src/main/resources/OSGI-INF/metatype/metatype.properties
@@ -22,13 +22,6 @@
 # descriptions as used in the metatype.xml descriptor generated by the
 # the Sling SCR plugin
 
-org.apache.sling.hc.JmxAttributeHealthCheck.name = JMX Attribute Health Check
-org.apache.sling.hc.JmxAttributeHealthCheck.description = Checks the value of a single JMX attribute.
-
-org.apache.sling.hc.ScriptableHealthCheck.name = Apache Sling Scriptable Health Check
-org.apache.sling.hc.ScriptableHealthCheck.description = Uses scripted expressions to verify multiple JMX \
-  attributes or other values.
-
 org.apache.sling.hc.DefaultLoginsHealthCheck.name = Apache Sling  Default Logins Health Check 
 org.apache.sling.hc.DefaultLoginsHealthCheck.description = Expects default logins to fail, used to verify \
     that they are disabled on production systems
@@ -36,24 +29,8 @@ org.apache.sling.hc.DefaultLoginsHealthCheck.description = Expects default login
 org.apache.sling.hc.SlingRequestStatusHealthCheck.name = Apache Sling  Sling Request Status Health Check
 org.apache.sling.hc.SlingRequestStatusHealthCheck.description = Checks the HTTP status of Sling requests.
 
-org.apache.sling.hc.CompositeHealthCheck.name = Apache Sling  Composite Health Check 
-org.apache.sling.hc.CompositeHealthCheck.description = Executes a set of Health Checks, selected by tags. 
-
-filter.tags.name = Filter tags
-filter.tags.description = Tags used to select which Health Checks the composite Health Check executes.
-
-mbean.name.name = MBean name
-mbean.name.description = The name of the MBean to check.
-
-attribute.name.name = Attribute name
-attribute.name.description = The name of the MBean attribute to check.
-
-attribute.value.constraint.name = Attribute value constraint
-attribute.value.constraint.description = Constraint on the MBean attribute value.
-
 hc.mbean.name.name = MBean name
-hc.mbean.name.description = Name of the MBean to create for this Health Check. \
-    Defaults to the Health Check name.
+hc.mbean.name.description = Name of the MBean to create for this Health Check.
 
 hc.tags.name = Health Check tags
 hc.tags.description = List of tags for this Health Check service, used to select \
@@ -63,17 +40,13 @@ hc.name.name = Health Check Name
 hc.name.description = Name of this Health Check service. Used for the MBean that's created \
     for this Health Check as well, unless a specific MBean name is configured.
 
-expression.name = Expression
-expression.description = The value of this expression must be "true" for the Health Check \
-    to be successful.
-
-language.extension.name = Language extension
-language.extension.description = File extension of the language to use to evaluate the \
-    expression, for example "ecma" or "groovy", asssuming the corresponding script engine \
-    is available.
-    
-username.name = Username
-username.description = The username to use to test logins.
+logins.name = Login credentials
+logins.description = Which credentials to check. Each one is in the format "user:password" \
+    like "admin:admin" for example. Do *not* put any confidential passwords here, the goal \
+    is just to check that the default/demo logins, which passwords are known anyway, are \
+    disabled.
 
-password.name = Password
-password.description = The password to use to test logins.        
\ No newline at end of file
+path.name = Paths to check
+path.description = The list of paths to check, optionally with expected HTTP status responses. \
+    An entry like "/tmp/test.txt:301", for example, checks that /tmp/test.txt returns a \
+    301 response. 

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

[sling-org-apache-sling-hc-support] 04/31: SLING-2987 - metatype and samples config tweaks

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit 4301c266644b3c79fdc10b4244f32be14dfe1a8a
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Aug 13 11:58:33 2013 +0000

    SLING-2987 - metatype and samples config tweaks
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/healthchecks@1513446 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java  | 4 +++-
 src/main/resources/OSGI-INF/metatype/metatype.properties         | 9 +++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
index 0b37da7..863001c 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
@@ -58,7 +58,9 @@ public class CompositeHealthCheck implements HealthCheck {
     @Property(cardinality=50)
     public static final String PROP_FILTER_TAGS = "filter.tags";
     private String [] filterTags;
-    
+
+    @Property
+    public static final String PROP_MBEAN_NAME = Constants.HC_MBEAN_NAME;
     
     @Activate
     public void activate(ComponentContext ctx) {
diff --git a/src/main/resources/OSGI-INF/metatype/metatype.properties b/src/main/resources/OSGI-INF/metatype/metatype.properties
index 2b2482c..088ac97 100644
--- a/src/main/resources/OSGI-INF/metatype/metatype.properties
+++ b/src/main/resources/OSGI-INF/metatype/metatype.properties
@@ -40,7 +40,7 @@ org.apache.sling.hc.CompositeHealthCheck.name = Composite Health Check
 org.apache.sling.hc.CompositeHealthCheck.description = Executes a set of Health Checks, selected by tags. 
 
 filter.tags.name = Filter tags
-filter.tags.description = Tags used to select Health Checks.
+filter.tags.description = Tags used to select which Health Checks the composite Health Check executes.
 
 mbean.name.name = MBean name
 mbean.name.description = The name of the MBean to check.
@@ -52,15 +52,16 @@ attribute.value.constraint.name = Attribute value constraint
 attribute.value.constraint.description = Constraint on the MBean attribute value.
 
 hc.mbean.name.name = MBean name
-hc.mbean.name.description = Name of the MBean to create for this Health Check.
+hc.mbean.name.description = Name of the MBean to create for this Health Check. \
+    Defaults to the Health Check name.
 
 hc.tags.name = Health Check tags
 hc.tags.description = List of tags for this Health Check service, used to select \
     subsets of Health Check services for execution.
 
 hc.name.name = Health Check Name
-hc.name.description = Name of this Health Check service, used for example to identify the \
-    corresponding JMX MBean.
+hc.name.description = Name of this Health Check service. Used for the MBean that's created \
+    for this Health Check as well, unless a specific MBean name is configured.
 
 expression.name = Expression
 expression.description = The value of this expression must be "true" for the Health Check \

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

[sling-org-apache-sling-hc-support] 30/31: [maven-release-plugin] prepare release org.apache.sling.hc.support-1.0.4

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit 354b479ab2fe50e5faf94b41ea284822e3745a0e
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Sep 26 14:54:31 2013 +0000

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

diff --git a/pom.xml b/pom.xml
index 9ad0a2a..e813163 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.hc.support</artifactId>
     <packaging>bundle</packaging>
-    <version>1.0.3-SNAPSHOT</version>
+    <version>1.0.4</version>
 
     <name>Apache Sling Health Check Support Components</name>
     <inceptionYear>2013</inceptionYear>
@@ -27,9 +27,9 @@
     </properties>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/support</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.support-1.0.4</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.support-1.0.4</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.hc.support-1.0.4</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-hc-support] 26/31: [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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit 3d57fbf1220d7728117b0836bb91b06d7112a8c1
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Sep 26 14:29:30 2013 +0000

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

diff --git a/pom.xml b/pom.xml
index c0d98f1..d13cb11 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.hc.support</artifactId>
     <packaging>bundle</packaging>
-    <version>1.0.0</version>
+    <version>1.0.1-SNAPSHOT</version>
 
     <name>Apache Sling Health Check Support Components</name>
     <inceptionYear>2013</inceptionYear>
@@ -27,9 +27,9 @@
     </properties>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.core-1.0.0/bundles/extensions/healthcheck/support</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.core-1.0.0/bundles/extensions/healthcheck/support</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.hc.core-1.0.0/bundles/extensions/healthcheck/support</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/support</url>
     </scm>
 
     <build>
@@ -59,7 +59,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.hc.core</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

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

[sling-org-apache-sling-hc-support] 18/31: SLING-3034 - rename modules: api to core and healthchecks to support

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit 5fd6a7b34c4c3d02c35cd7ee56c50618e3e900d8
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Sep 3 12:54:21 2013 +0000

    SLING-3034 - rename modules: api to core and healthchecks to support
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/support@1519670 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                                           | 8 ++++----
 .../{healthchecks => support}/impl/DefaultLoginsHealthCheck.java  | 4 ++--
 .../sling/hc/{healthchecks => support}/impl/InternalRequest.java  | 2 +-
 .../sling/hc/{healthchecks => support}/impl/InternalResponse.java | 2 +-
 .../impl/SlingRequestStatusHealthCheck.java                       | 4 ++--
 .../sling/hc/healthchecks/DefaultLoginsHealthCheckTest.java       | 2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/pom.xml b/pom.xml
index 4594916..ce31b77 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,15 +14,15 @@
     </parent>
 
     <groupId>org.apache.sling</groupId>
-    <artifactId>org.apache.sling.hc.healthchecks</artifactId>
+    <artifactId>org.apache.sling.hc.support</artifactId>
     <packaging>bundle</packaging>
     <version>0.0.2-SNAPSHOT</version>
 
-    <name>Sling Health Check Services</name>
+    <name>Sling Health Check Support Components</name>
     <inceptionYear>2013</inceptionYear>
     
     <description>
-        Default Sling Health Check Services
+        Default Sling Health Check Support Components
     </description>
 
     <properties>
@@ -54,7 +54,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.hc.api</artifactId>
+            <artifactId>org.apache.sling.hc.core</artifactId>
             <version>0.0.2-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java b/src/main/java/org/apache/sling/hc/support/impl/DefaultLoginsHealthCheck.java
similarity index 97%
rename from src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java
rename to src/main/java/org/apache/sling/hc/support/impl/DefaultLoginsHealthCheck.java
index e882da5..adb2b23 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/support/impl/DefaultLoginsHealthCheck.java
@@ -15,7 +15,7 @@
  * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations under the License.
  */
-package org.apache.sling.hc.healthchecks.impl;
+package org.apache.sling.hc.support.impl;
 
 import java.util.Arrays;
 import java.util.List;
@@ -45,7 +45,7 @@ import org.slf4j.LoggerFactory;
 /** {@link HealthCheck} that checks that Sling default logins fail.
  *  Used to verify that those logins are disabled on production systems */
 @Component(
-        name="org.apache.sling.hc.DefaultLoginsHealthCheck",
+        name="org.apache.sling.hc.support.DefaultLoginsHealthCheck",
         configurationFactory=true,
         policy=ConfigurationPolicy.REQUIRE,
         metatype=true)
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/InternalRequest.java b/src/main/java/org/apache/sling/hc/support/impl/InternalRequest.java
similarity index 99%
rename from src/main/java/org/apache/sling/hc/healthchecks/impl/InternalRequest.java
rename to src/main/java/org/apache/sling/hc/support/impl/InternalRequest.java
index 570e57c..b79fdfe 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/InternalRequest.java
+++ b/src/main/java/org/apache/sling/hc/support/impl/InternalRequest.java
@@ -15,7 +15,7 @@
  * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations under the License.
  */
-package org.apache.sling.hc.healthchecks.impl;
+package org.apache.sling.hc.support.impl;
 
 import java.io.BufferedReader;
 import java.io.IOException;
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/InternalResponse.java b/src/main/java/org/apache/sling/hc/support/impl/InternalResponse.java
similarity index 98%
rename from src/main/java/org/apache/sling/hc/healthchecks/impl/InternalResponse.java
rename to src/main/java/org/apache/sling/hc/support/impl/InternalResponse.java
index ead7da5..8752628 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/InternalResponse.java
+++ b/src/main/java/org/apache/sling/hc/support/impl/InternalResponse.java
@@ -15,7 +15,7 @@
  * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations under the License.
  */
-package org.apache.sling.hc.healthchecks.impl;
+package org.apache.sling.hc.support.impl;
 
 import java.io.IOException;
 import java.io.PrintWriter;
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java b/src/main/java/org/apache/sling/hc/support/impl/SlingRequestStatusHealthCheck.java
similarity index 97%
rename from src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
rename to src/main/java/org/apache/sling/hc/support/impl/SlingRequestStatusHealthCheck.java
index 682f412..b982a9e 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/support/impl/SlingRequestStatusHealthCheck.java
@@ -15,7 +15,7 @@
  * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations under the License.
  */
-package org.apache.sling.hc.healthchecks.impl;
+package org.apache.sling.hc.support.impl;
 
 import java.util.Arrays;
 
@@ -44,7 +44,7 @@ import org.slf4j.LoggerFactory;
  *  Typically used to check that a freshly installed Sling-based system
  *  is in good shape, contains all required content etc. */
 @Component(
-        name="org.apache.sling.hc.SlingRequestStatusHealthCheck",
+        name="org.apache.sling.hc.support.SlingRequestStatusHealthCheck",
         configurationFactory=true,
         policy=ConfigurationPolicy.REQUIRE,
         metatype=true)
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/DefaultLoginsHealthCheckTest.java b/src/test/java/org/apache/sling/hc/healthchecks/DefaultLoginsHealthCheckTest.java
index 1c48f00..7ce900b 100644
--- a/src/test/java/org/apache/sling/hc/healthchecks/DefaultLoginsHealthCheckTest.java
+++ b/src/test/java/org/apache/sling/hc/healthchecks/DefaultLoginsHealthCheckTest.java
@@ -28,7 +28,7 @@ import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
 
 import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.healthchecks.impl.DefaultLoginsHealthCheck;
+import org.apache.sling.hc.support.impl.DefaultLoginsHealthCheck;
 import org.apache.sling.jcr.api.SlingRepository;
 import org.junit.Test;
 import org.mockito.Matchers;

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

[sling-org-apache-sling-hc-support] 10/31: SLING-3024 : Move SimpleConstraintChecker to healthchecks bundle

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit 1315652f7345863297beb6018f91b024ba9f910e
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Aug 19 07:21:14 2013 +0000

    SLING-3024 :  Move SimpleConstraintChecker to healthchecks bundle
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/healthchecks@1515292 13f79535-47bb-0310-9956-ffa450edef68
---
 .../healthchecks/impl/JmxAttributeHealthCheck.java |   2 +-
 .../healthchecks/util/SimpleConstraintChecker.java |  80 ++++++++++
 .../util/SimpleConstraintCheckerTest.java          | 167 +++++++++++++++++++++
 3 files changed, 248 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
index 193615d..cc67845 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
@@ -31,7 +31,7 @@ import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.hc.api.HealthCheck;
 import org.apache.sling.hc.api.Result;
 import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
-import org.apache.sling.hc.util.SimpleConstraintChecker;
+import org.apache.sling.hc.healthchecks.util.SimpleConstraintChecker;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/util/SimpleConstraintChecker.java b/src/main/java/org/apache/sling/hc/healthchecks/util/SimpleConstraintChecker.java
new file mode 100644
index 0000000..13c3b23
--- /dev/null
+++ b/src/main/java/org/apache/sling/hc/healthchecks/util/SimpleConstraintChecker.java
@@ -0,0 +1,80 @@
+/*
+ * 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 SF 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.hc.healthchecks.util;
+
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.api.ResultLog;
+
+/** Simple check of numeric values against expressions
+ *  like < N, > N, between two values etc.
+ *  See  {@link SimpleConstraintCheckerTest} for examples.
+ */
+public class SimpleConstraintChecker {
+
+    public static final String CONTAINS = "contains";
+
+    /** Check value against expression and report to result */
+    public void check(Object inputValue, String constraint, ResultLog resultLog) {
+
+        final String stringValue = inputValue == null ? "" : inputValue.toString();
+
+        if(constraint == null || constraint.trim().length() == 0) {
+            throw new IllegalArgumentException("Empty constraint, cannot evaluate");
+        }
+
+        final String [] parts = constraint.split(" ");
+        boolean matches = false;
+        try {
+            if(constraint.startsWith(">") && parts.length == 2) {
+                final int value = Integer.valueOf(stringValue).intValue();
+                matches = value > Integer.valueOf(parts[1]);
+
+            } else if(constraint.startsWith("<") && parts.length == 2) {
+                final int value = Integer.valueOf(stringValue).intValue();
+                matches = value < Integer.valueOf(parts[1]);
+
+            } else if(parts.length == 4 && "between".equalsIgnoreCase(parts[0]) && "and".equalsIgnoreCase(parts[2]) ) {
+                final int value = Integer.valueOf(stringValue).intValue();
+                final int lowerBound = Integer.valueOf(parts[1]);
+                final int upperBound = Integer.valueOf(parts[3]);
+                matches = value > lowerBound && value < upperBound;
+
+            } else if(parts.length >1 && CONTAINS.equalsIgnoreCase(parts[0])) {
+                final String pattern = constraint.substring(CONTAINS.length()).trim();
+                matches = stringValue.contains(pattern);
+
+            } else {
+                matches = constraint.equals(stringValue);
+            }
+        } catch(NumberFormatException nfe) {
+            resultLog.add(new ResultLog.Entry(
+                    Result.Status.WARN,
+                    "Invalid numeric value [" + inputValue + "] while evaluating " + constraint));
+        }
+
+        if(matches) {
+            resultLog.add(new ResultLog.Entry(
+                    Result.Status.DEBUG,
+                    "Value [" + inputValue + "] matches constraint [" + constraint + "]"));
+        } else {
+            resultLog.add(new ResultLog.Entry(
+                    Result.Status.WARN,
+                    "Value [" + inputValue + "] does not match constraint [" + constraint + "]"));
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/util/SimpleConstraintCheckerTest.java b/src/test/java/org/apache/sling/hc/healthchecks/util/SimpleConstraintCheckerTest.java
new file mode 100644
index 0000000..d981876
--- /dev/null
+++ b/src/test/java/org/apache/sling/hc/healthchecks/util/SimpleConstraintCheckerTest.java
@@ -0,0 +1,167 @@
+/*
+ * 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 SF 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.hc.healthchecks.util;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.api.ResultLog;
+import org.apache.sling.hc.healthchecks.util.SimpleConstraintChecker;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SimpleConstraintCheckerTest {
+    private ResultLog resultLog; 
+
+    private final SimpleConstraintChecker checker = new SimpleConstraintChecker();
+
+    @Before
+    public void setup() {
+        resultLog = new ResultLog();
+    }
+    
+    @Test
+    public void testStringEquals() {
+        final String s = "test_" + System.currentTimeMillis();
+        checker.check(s, s, resultLog);
+        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testStringNotEquals() {
+        final String s = "test_" + System.currentTimeMillis();
+        checker.check(s, "something else", resultLog);
+        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testFiveEquals() {
+        final String s = "5";
+        checker.check(s, s, resultLog);
+        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testIntTwelveEquals() {
+        checker.check(12, "12", resultLog);
+        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testIntTwelveGreaterThan() {
+        checker.check(12, "> 11", resultLog);
+        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testFiveNotEquals() {
+        checker.check("5", "foo", resultLog);
+        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testNullNotEquals() {
+        checker.check(null, "foo", resultLog);
+        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testNullNotGreater() {
+        checker.check(null, "> 2", resultLog);
+        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testGreaterThanTrue() {
+        checker.check("5", "> 2", resultLog);
+        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testGreaterThanFalse() {
+        checker.check("5", "> 12", resultLog);
+        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testLessThanTrue() {
+        checker.check("5", "< 12", resultLog);
+        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testLessThanFalse() {
+        checker.check("5", "< 2", resultLog);
+        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testBetweenA() {
+        checker.check("5", "between 2 and 6", resultLog);
+        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testBetweenB() {
+        checker.check("5", "between 12 and 16", resultLog);
+        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testBetweenC() {
+        checker.check(5L, "between 12 and 16", resultLog);
+        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testBetweenD() {
+        checker.check(5L, "between 4 and 16", resultLog);
+        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testBetweenE() {
+        checker.check(5L, "betWEEN 4 aND 16", resultLog);
+        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testNotAnInteger() {
+        checker.check("foo", "between 12 and 16", resultLog);
+        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testContainsA() {
+        checker.check("This is a NICE STRING ok?", "contains NICE STRING", resultLog);
+        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testContainsB() {
+        checker.check("This is a NICE TOUCH ok?", "contains NICE STRING", resultLog);
+        assertFalse(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+    
+    @Test
+    public void testContainsC() {
+        checker.check("This is a NICE TOUCH ok?", "contains NICE", resultLog);
+        assertTrue(resultLog.getAggregateStatus().equals(Result.Status.OK));
+    }
+}

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

[sling-org-apache-sling-hc-support] 21/31: SLING-3127 - prepare Health Check tools release

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit b0bbcd280a339608ee4c8db2959ceaf87adf1cb0
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Sep 26 13:17:13 2013 +0000

    SLING-3127 - prepare Health Check tools release
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support@1526476 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-hc-support] 08/31: SLING-3020 - error reporting tweaks

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit baa4b252d0f8d7cc05cfa1497453b365e2c2279f
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Aug 15 14:35:25 2013 +0000

    SLING-3020 - error reporting tweaks
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/healthchecks@1514300 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java      | 9 +++++----
 .../hc/healthchecks/impl/SlingRequestStatusHealthCheck.java      | 6 +++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
index f2ab2e4..e18767d 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
@@ -94,11 +94,12 @@ public class JmxAttributeHealthCheck implements HealthCheck {
             final MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer();
             final ObjectName objectName = new ObjectName(mbeanName);
             if(jmxServer.queryNames(objectName, null).size() == 0) {
-                log.error("MBean not found: {}", objectName);
+                resultLog.warn("MBean not found: {}", objectName);
+            } else {
+                final Object value = jmxServer.getAttribute(objectName, attributeName);
+                resultLog.debug("{} {} returns {}", mbeanName, attributeName, value);
+                new SimpleConstraintChecker().check(value, constraint, resultLog);
             }
-            final Object value = jmxServer.getAttribute(objectName, attributeName);
-            resultLog.debug("{} {} returns {}", mbeanName, attributeName, value);
-            new SimpleConstraintChecker().check(value, constraint, resultLog);
         } catch(Exception e) {
             log.warn("JMX attribute {}/{} check failed: {}", new Object []{ mbeanName, attributeName, e});
             resultLog.healthCheckError("JMX attribute check failed: {}", e);
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
index 8b8f2c4..c2ba539 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
@@ -57,7 +57,7 @@ public class SlingRequestStatusHealthCheck implements HealthCheck {
         int status;
         String path;
         
-        PathSpec(String configuredPath) {
+        PathSpec(String configuredPath, FormattingResultLog resultLog) {
             path = configuredPath;
             status = 200;
             
@@ -67,7 +67,7 @@ public class SlingRequestStatusHealthCheck implements HealthCheck {
                     status = Integer.valueOf(parts[1].trim());
                     path = parts[0].trim();
                 } catch(NumberFormatException nfe) {
-                    log.warn("NumberFormatException while parsing [{}], invalid status value?", configuredPath);
+                    resultLog.healthCheckError("NumberFormatException while parsing [{}], invalid status value?", configuredPath);
                 }
             } 
         }
@@ -111,7 +111,7 @@ public class SlingRequestStatusHealthCheck implements HealthCheck {
             resolver = resolverFactory.getAdministrativeResourceResolver(null);
             for(String p : paths) {
                 lastPath = p;
-                final PathSpec ps = new PathSpec(p);
+                final PathSpec ps = new PathSpec(p, resultLog);
                 final HttpServletRequest request = new InternalRequest(ps.path);
                 final InternalResponse response = new InternalResponse();
                 requestProcessor.processRequest(request, response, resolver);

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

[sling-org-apache-sling-hc-support] 17/31: SLING-3034 - rename modules: healthchecks to support

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit bb224b137307cebd388e7a744510bec5408cbda6
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Sep 3 12:36:40 2013 +0000

    SLING-3034 - rename modules: healthchecks to support
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/support@1519667 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-hc-support] 23/31: SLING-3127 - add scm info

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit fafd1c587eaa6eb6bdce8730972b8395fd8960a7
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Sep 26 13:31:20 2013 +0000

    SLING-3127 - add scm info
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support@1526483 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/pom.xml b/pom.xml
index 1ac3ef5..49b8230 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,6 +28,13 @@
     <properties>
         <sling.java.version>6</sling.java.version>
     </properties>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/support</url>
+    </scm>
+
     <build>
         <plugins>
             <plugin>

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

[sling-org-apache-sling-hc-support] 06/31: SLING-2987 - add filter.tags to info

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit 9b083825fd49e3b0b711ebe78a06a4e207966683
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Aug 13 13:51:12 2013 +0000

    SLING-2987 - add filter.tags to info
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/healthchecks@1513493 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
index 863001c..59edcf6 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
@@ -67,6 +67,7 @@ public class CompositeHealthCheck implements HealthCheck {
         bundleContext = ctx.getBundleContext();
         info = new HealthCheckInfo(ctx.getProperties());
         filterTags = PropertiesUtil.toStringArray(ctx.getProperties().get(PROP_FILTER_TAGS), new String[] {});
+        info.put(PROP_FILTER_TAGS, Arrays.asList(filterTags).toString());
         log.info("Activated, will select HealthCheck having tags {}", Arrays.asList(filterTags));
     }
     

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

[sling-org-apache-sling-hc-support] 19/31: SLING-3034 - SlingRequestStatusHealthCheckTest added

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit f445623626b07373d1517f968de85a87a115189d
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Sep 3 13:36:03 2013 +0000

    SLING-3034 - SlingRequestStatusHealthCheckTest added
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/support@1519678 13f79535-47bb-0310-9956-ffa450edef68
---
 .../impl/SlingRequestStatusHealthCheck.java        |  6 +-
 .../healthchecks/DefaultLoginsHealthCheckTest.java | 11 +--
 .../org/apache/sling/hc/healthchecks/SetField.java | 30 +++++++
 .../SlingRequestStatusHealthCheckTest.java         | 96 ++++++++++++++++++++++
 4 files changed, 131 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/apache/sling/hc/support/impl/SlingRequestStatusHealthCheck.java b/src/main/java/org/apache/sling/hc/support/impl/SlingRequestStatusHealthCheck.java
index b982a9e..968174e 100644
--- a/src/main/java/org/apache/sling/hc/support/impl/SlingRequestStatusHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/support/impl/SlingRequestStatusHealthCheck.java
@@ -18,6 +18,7 @@
 package org.apache.sling.hc.support.impl;
 
 import java.util.Arrays;
+import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -36,7 +37,6 @@ import org.apache.sling.engine.SlingRequestProcessor;
 import org.apache.sling.hc.api.HealthCheck;
 import org.apache.sling.hc.api.Result;
 import org.apache.sling.hc.util.FormattingResultLog;
-import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -89,8 +89,8 @@ public class SlingRequestStatusHealthCheck implements HealthCheck {
     private ResourceResolverFactory resolverFactory;
 
     @Activate
-    public void activate(ComponentContext ctx) {
-        paths = PropertiesUtil.toStringArray(ctx.getProperties().get(PROP_PATH), new String [] {});
+    public void activate(final Map<String, Object> properties) {
+        paths = PropertiesUtil.toStringArray(properties.get(PROP_PATH), new String [] {});
         log.info("Activated, paths={}", Arrays.asList(paths));
     }
 
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/DefaultLoginsHealthCheckTest.java b/src/test/java/org/apache/sling/hc/healthchecks/DefaultLoginsHealthCheckTest.java
index 7ce900b..862b6f8 100644
--- a/src/test/java/org/apache/sling/hc/healthchecks/DefaultLoginsHealthCheckTest.java
+++ b/src/test/java/org/apache/sling/hc/healthchecks/DefaultLoginsHealthCheckTest.java
@@ -20,7 +20,6 @@ package org.apache.sling.hc.healthchecks;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import java.lang.reflect.Field;
 import java.util.Arrays;
 
 import javax.jcr.Credentials;
@@ -40,10 +39,10 @@ public class DefaultLoginsHealthCheckTest {
     
     private Result getTestResult(String login) throws Exception {
         final DefaultLoginsHealthCheck c = new DefaultLoginsHealthCheck();
-        setField(c, "logins", Arrays.asList(new String[] { login }));
+        SetField.set(c, "logins", Arrays.asList(new String[] { login }));
         
         final SlingRepository repo = Mockito.mock(SlingRepository.class);
-        setField(c, "repository", repo);
+        SetField.set(c, "repository", repo);
         final Session s = Mockito.mock(Session.class);
         Mockito.when(repo.login(Matchers.any(Credentials.class))).thenAnswer(new Answer<Session>() {
             @Override
@@ -59,12 +58,6 @@ public class DefaultLoginsHealthCheckTest {
         return c.execute();
     }
     
-    private void setField(Object o, String name, Object value) throws Exception {
-        final Field f = o.getClass().getDeclaredField(name);
-        f.setAccessible(true);
-        f.set(o, value);
-    }
-    
     @Test
     public void testHealthCheckFails() throws Exception {
         assertFalse("Expecting failed check", getTestResult("admin:admin").isOk());
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/SetField.java b/src/test/java/org/apache/sling/hc/healthchecks/SetField.java
new file mode 100644
index 0000000..c4577a3
--- /dev/null
+++ b/src/test/java/org/apache/sling/hc/healthchecks/SetField.java
@@ -0,0 +1,30 @@
+/*
+ * 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 SF 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.hc.healthchecks;
+
+import java.lang.reflect.Field;
+
+public class SetField {
+    
+    public static void set(Object o, String name, Object value) throws Exception {
+        final Field f = o.getClass().getDeclaredField(name);
+        f.setAccessible(true);
+        f.set(o, value);
+    }
+    
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/SlingRequestStatusHealthCheckTest.java b/src/test/java/org/apache/sling/hc/healthchecks/SlingRequestStatusHealthCheckTest.java
new file mode 100644
index 0000000..6731465
--- /dev/null
+++ b/src/test/java/org/apache/sling/hc/healthchecks/SlingRequestStatusHealthCheckTest.java
@@ -0,0 +1,96 @@
+package org.apache.sling.hc.healthchecks;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceResolverFactory;
+import org.apache.sling.engine.SlingRequestProcessor;
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.support.impl.SlingRequestStatusHealthCheck;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+@RunWith(Parameterized.class)
+public class SlingRequestStatusHealthCheckTest {
+    private SlingRequestStatusHealthCheck hc;
+    private final Result.Status expectedStatus;
+    private final String [] paths;
+    
+    @Parameters(name="{0}")
+    public static List<Object[]> data() {
+            final List<Object[]> result = new ArrayList<Object[]>();
+            result.add(new Object[] { "200.html:200,502.html:1234,436.json:436", Result.Status.WARN });
+            
+            result.add(new Object[] { "", Result.Status.OK }); 
+            result.add(new Object[] { "200.x", Result.Status.OK }); 
+            result.add(new Object[] { "404.html:404", Result.Status.OK }); 
+            result.add(new Object[] { "200.html:200,502.html:502,436.json:436" , Result.Status.OK }); 
+            result.add(new Object[] { "200.html:1234,502.html:502,436.json:436" , Result.Status.WARN }); 
+            result.add(new Object[] { "200.html:200,502.html:1234,436.json:436" , Result.Status.WARN }); 
+            result.add(new Object[] { "200.html:200,502.html:502,436.json:1234" , Result.Status.WARN }); 
+            result.add(new Object[] { "200.html:1234,502.html:1234,436.json:1234" , Result.Status.WARN }); 
+            return result;
+    }
+    
+    @Before
+    public void setup() throws Exception {
+        hc = new SlingRequestStatusHealthCheck();
+        
+        final ResourceResolverFactory rrf = Mockito.mock(ResourceResolverFactory.class);
+        SetField.set(hc, "resolverFactory", rrf);
+        
+        final Answer<Void> a = new Answer<Void> () {
+            @Override
+            public Void answer(InvocationOnMock invocation) {
+                final HttpServletRequest request = (HttpServletRequest)invocation.getArguments()[0];
+                final HttpServletResponse response = (HttpServletResponse)invocation.getArguments()[1];
+                final String path = request.getPathInfo();
+                if(path.length() > 0) {
+                    final String status = path.substring(0, path.indexOf('.'));
+                    response.setStatus(Integer.valueOf(status));
+                }
+                return null;
+            }
+            
+        };
+        
+        final SlingRequestProcessor srp = Mockito.mock(SlingRequestProcessor.class);
+        SetField.set(hc, "requestProcessor", srp);
+        Mockito.doAnswer(a).when(srp).processRequest(
+                Matchers.any(HttpServletRequest.class),  
+                Matchers.any(HttpServletResponse.class), 
+                Matchers.any(ResourceResolver.class));
+        
+        
+        final Map<String, Object> properties = new HashMap<String, Object>();
+        properties.put("path", paths);
+        hc.activate(properties);
+    }
+    
+    public SlingRequestStatusHealthCheckTest(String paths, Result.Status expectedStatus) {
+        this.paths = paths.split(",");
+        this.expectedStatus = expectedStatus;
+        
+    }
+    
+    @Test
+    public void testResult() {
+        assertEquals("Expecting result " + expectedStatus + " for paths=" + paths,
+                expectedStatus, hc.execute().getStatus());
+    }
+}

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

[sling-org-apache-sling-hc-support] 25/31: [maven-release-plugin] prepare release org.apache.sling.hc.core-1.0.0

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit ed95aef7a94a3be7cff3781ea663aa565da6fa3c
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Sep 26 14:28:11 2013 +0000

    [maven-release-plugin] prepare release org.apache.sling.hc.core-1.0.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support@1526506 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/pom.xml b/pom.xml
index c0b3e7c..c0d98f1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,8 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<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">
+<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>
 
@@ -16,7 +13,7 @@
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.hc.support</artifactId>
     <packaging>bundle</packaging>
-    <version>0.0.2-SNAPSHOT</version>
+    <version>1.0.0</version>
 
     <name>Apache Sling Health Check Support Components</name>
     <inceptionYear>2013</inceptionYear>
@@ -30,9 +27,9 @@
     </properties>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/support</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.core-1.0.0/bundles/extensions/healthcheck/support</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.core-1.0.0/bundles/extensions/healthcheck/support</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.hc.core-1.0.0/bundles/extensions/healthcheck/support</url>
     </scm>
 
     <build>
@@ -62,7 +59,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.hc.core</artifactId>
-            <version>0.0.2-SNAPSHOT</version>
+            <version>1.0.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

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

[sling-org-apache-sling-hc-support] 02/31: SLING-2987 - split into several bundles

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit c6decffb22461b4e8b17c198ac053e2604d7f8ce
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Aug 12 16:06:12 2013 +0000

    SLING-2987 - split into several bundles
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/healthchecks@1513183 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index b146639..e0a55d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,7 @@
     <packaging>bundle</packaging>
     <version>0.0.2-SNAPSHOT</version>
 
-    <name>Sling Health Check Module - Health Check Services</name>
+    <name>Sling Health Check Services</name>
     <inceptionYear>2013</inceptionYear>
     
     <description>

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

[sling-org-apache-sling-hc-support] 12/31: A little code cleanup of annotations

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit e3ba14d0efb5a10eaeb46c641420b7b6c634c57f
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Aug 30 09:34:59 2013 +0000

    A little code cleanup of annotations
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/healthchecks@1518922 13f79535-47bb-0310-9956-ffa450edef68
---
 .../hc/healthchecks/impl/CompositeHealthCheck.java | 19 +++++++------
 .../impl/DefaultLoginsHealthCheck.java             | 23 ++++++++--------
 .../healthchecks/impl/JmxAttributeHealthCheck.java | 30 ++++++++++----------
 .../healthchecks/impl/ScriptableHealthCheck.java   | 32 +++++++++++-----------
 .../impl/SlingRequestStatusHealthCheck.java        | 22 +++++++--------
 .../healthchecks/JmxAttributeHealthCheckTest.java  | 19 ++++++-------
 6 files changed, 70 insertions(+), 75 deletions(-)

diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
index 65f400f..57a4a63 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
@@ -23,7 +23,9 @@ import java.util.List;
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.ConfigurationPolicy;
+import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.PropertyUnbounded;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.hc.api.HealthCheck;
@@ -44,22 +46,21 @@ import org.slf4j.LoggerFactory;
         configurationFactory=true,
         policy=ConfigurationPolicy.REQUIRE,
         metatype=true)
-@Service
+@Properties({
+    @Property(name=HealthCheck.NAME),
+    @Property(name=HealthCheck.TAGS, unbounded=PropertyUnbounded.ARRAY),
+    @Property(name=HealthCheck.MBEAN_NAME)
+})
+@Service(value=HealthCheck.class)
 public class CompositeHealthCheck implements HealthCheck {
 
     private final Logger log = LoggerFactory.getLogger(getClass());
     private BundleContext bundleContext;
 
-    @Property(cardinality=50)
-    public static final String PROP_TAGS = HealthCheck.TAGS;
-
-    @Property(cardinality=50)
-    public static final String PROP_FILTER_TAGS = "filter.tags";
+    @Property(unbounded=PropertyUnbounded.ARRAY)
+    private static final String PROP_FILTER_TAGS = "filter.tags";
     private String [] filterTags;
 
-    @Property
-    public static final String PROP_MBEAN_NAME = HealthCheck.MBEAN_NAME;
-
     @Activate
     public void activate(ComponentContext ctx) {
         bundleContext = ctx.getBundleContext();
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java
index 781e76d..72dfbcf 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java
@@ -28,7 +28,9 @@ import javax.jcr.SimpleCredentials;
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.ConfigurationPolicy;
+import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.PropertyUnbounded;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.commons.osgi.PropertiesUtil;
@@ -47,23 +49,20 @@ import org.slf4j.LoggerFactory;
         configurationFactory=true,
         policy=ConfigurationPolicy.REQUIRE,
         metatype=true)
-@Service
+@Properties({
+    @Property(name=HealthCheck.NAME),
+    @Property(name=HealthCheck.TAGS, unbounded=PropertyUnbounded.ARRAY),
+    @Property(name=HealthCheck.MBEAN_NAME)
+})
+@Service(value=HealthCheck.class)
 public class DefaultLoginsHealthCheck implements HealthCheck {
 
     private final Logger log = LoggerFactory.getLogger(getClass());
 
-    @Property(cardinality=500)
-    public static final String PROP_LOGINS = "logins";
-    private List<String> logins;
-
-    @Property(cardinality=50)
-    public static final String PROP_TAGS = HealthCheck.TAGS;
+    @Property(unbounded=PropertyUnbounded.ARRAY)
+    private static final String PROP_LOGINS = "logins";
 
-    @Property
-    public static final String PROP_NAME = HealthCheck.NAME;
-
-    @Property
-    public static final String PROP_MBEAN_NAME = HealthCheck.MBEAN_NAME;
+    private List<String> logins;
 
     @Reference
     private SlingRepository repository;
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
index cc67845..305b305 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
@@ -18,6 +18,7 @@
 package org.apache.sling.hc.healthchecks.impl;
 
 import java.lang.management.ManagementFactory;
+import java.util.Map;
 
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
@@ -25,14 +26,15 @@ import javax.management.ObjectName;
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.ConfigurationPolicy;
+import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.PropertyUnbounded;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.hc.api.HealthCheck;
 import org.apache.sling.hc.api.Result;
 import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
 import org.apache.sling.hc.healthchecks.util.SimpleConstraintChecker;
-import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -42,7 +44,12 @@ import org.slf4j.LoggerFactory;
         configurationFactory=true,
         policy=ConfigurationPolicy.REQUIRE,
         metatype=true)
-@Service
+@Properties({
+    @Property(name=HealthCheck.NAME),
+    @Property(name=HealthCheck.TAGS, unbounded=PropertyUnbounded.ARRAY),
+    @Property(name=HealthCheck.MBEAN_NAME)
+})
+@Service(value=HealthCheck.class)
 public class JmxAttributeHealthCheck implements HealthCheck {
 
     private final Logger log = LoggerFactory.getLogger(getClass());
@@ -59,23 +66,14 @@ public class JmxAttributeHealthCheck implements HealthCheck {
     @Property
     public static final String PROP_CONSTRAINT = "attribute.value.constraint";
 
-    @Property(cardinality=50)
-    public static final String PROP_TAGS = HealthCheck.TAGS;
-
-    @Property
-    public static final String PROP_NAME = HealthCheck.NAME;
-
-    @Property
-    public static final String PROP_MBEAN_NAME = HealthCheck.MBEAN_NAME;
-
     @Activate
-    public void activate(ComponentContext ctx) {
-        mbeanName = PropertiesUtil.toString(ctx.getProperties().get(PROP_OBJECT_NAME), "");
-        attributeName = PropertiesUtil.toString(ctx.getProperties().get(PROP_ATTRIBUTE_NAME), "");
-        constraint = PropertiesUtil.toString(ctx.getProperties().get(PROP_CONSTRAINT), "");
+    public void activate(final Map<String, Object> properties) {
+        mbeanName = PropertiesUtil.toString(properties.get(PROP_OBJECT_NAME), "");
+        attributeName = PropertiesUtil.toString(properties.get(PROP_ATTRIBUTE_NAME), "");
+        constraint = PropertiesUtil.toString(properties.get(PROP_CONSTRAINT), "");
 
         log.info("Activated with HealthCheck name={}, objectName={}, attribute={}, constraint={}",
-                new Object[] { ctx.getProperties().get(HealthCheck.NAME), mbeanName, attributeName, constraint });
+                new Object[] { properties.get(HealthCheck.NAME), mbeanName, attributeName, constraint });
     }
 
     @Override
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java
index 1f0ba8b..a53c5d3 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java
@@ -23,7 +23,9 @@ import javax.script.ScriptEngineManager;
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.ConfigurationPolicy;
+import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.PropertyUnbounded;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.commons.osgi.PropertiesUtil;
@@ -41,7 +43,12 @@ import org.slf4j.LoggerFactory;
         configurationFactory=true,
         policy=ConfigurationPolicy.REQUIRE,
         metatype=true)
-@Service
+@Properties({
+    @Property(name=HealthCheck.NAME),
+    @Property(name=HealthCheck.TAGS, unbounded=PropertyUnbounded.ARRAY),
+    @Property(name=HealthCheck.MBEAN_NAME)
+})
+@Service(value=HealthCheck.class)
 public class ScriptableHealthCheck implements HealthCheck {
 
     private final Logger log = LoggerFactory.getLogger(getClass());
@@ -49,23 +56,14 @@ public class ScriptableHealthCheck implements HealthCheck {
     private String languageExtension;
     private BundleContext bundleContext;
 
-    public static final String DEFAULT_LANGUAGE_EXTENSION = "ecma";
+    private static final String DEFAULT_LANGUAGE_EXTENSION = "ecma";
 
     @Property
     public static final String PROP_EXPRESSION = "expression";
 
-    @Property
+    @Property(value=DEFAULT_LANGUAGE_EXTENSION)
     public static final String PROP_LANGUAGE_EXTENSION = "language.extension";
 
-    @Property(cardinality=50)
-    public static final String PROP_TAGS = HealthCheck.TAGS;
-
-    @Property
-    public static final String PROP_NAME = HealthCheck.NAME;
-
-    @Property
-    public static final String PROP_MBEAN_NAME = HealthCheck.MBEAN_NAME;
-
     @Reference
     private ScriptEngineManager scriptEngineManager;
 
@@ -75,7 +73,9 @@ public class ScriptableHealthCheck implements HealthCheck {
         expression = PropertiesUtil.toString(ctx.getProperties().get(PROP_EXPRESSION), "");
         languageExtension = PropertiesUtil.toString(ctx.getProperties().get(PROP_LANGUAGE_EXTENSION), DEFAULT_LANGUAGE_EXTENSION);
 
-        log.info("Activated, name={}, languageExtension={}, expression={}", languageExtension, expression);
+        log.debug("Activated scriptable health check name={}, languageExtension={}, expression={}",
+                new Object[] {ctx.getProperties().get(HealthCheck.NAME),
+                languageExtension, expression});
     }
 
     @Override
@@ -84,7 +84,7 @@ public class ScriptableHealthCheck implements HealthCheck {
         resultLog.debug("Checking expression [{}], language extension=[{}]",  expression, languageExtension);
         try {
             final ScriptEngine engine = scriptEngineManager.getEngineByExtension(languageExtension);
-            if(engine == null) {
+            if (engine == null) {
                 resultLog.healthCheckError("No ScriptEngine available for extension {}", languageExtension);
             } else {
                 // TODO pluggable Bindings? Reuse the Sling bindings providers?
@@ -92,13 +92,13 @@ public class ScriptableHealthCheck implements HealthCheck {
                 b.put("jmx", new JmxScriptBinding(resultLog));
                 b.put("osgi", new OsgiScriptBinding(bundleContext, resultLog));
                 final Object value = engine.eval(expression, b);
-                if(value!=null && "true".equals(value.toString())) {
+                if(value!=null && "true".equals(value.toString().toLowerCase())) {
                     resultLog.debug("Expression [{}] evaluates to true as expected", expression);
                 } else {
                     resultLog.warn("Expression [{}] does not evaluate to true as expected, value=[{}]", expression, value);
                 }
             }
-        } catch(Exception e) {
+        } catch (final Exception e) {
             resultLog.healthCheckError(
                     "Exception while evaluating expression [{}] with language extension [{}]: {}",
                     expression, languageExtension, e);
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
index ab22c8e..74c9e4b 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
@@ -24,7 +24,9 @@ import javax.servlet.http.HttpServletRequest;
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.ConfigurationPolicy;
+import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.PropertyUnbounded;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.resource.ResourceResolver;
@@ -44,7 +46,12 @@ import org.slf4j.LoggerFactory;
         configurationFactory=true,
         policy=ConfigurationPolicy.REQUIRE,
         metatype=true)
-@Service
+@Properties({
+    @Property(name=HealthCheck.NAME),
+    @Property(name=HealthCheck.TAGS, unbounded=PropertyUnbounded.ARRAY),
+    @Property(name=HealthCheck.MBEAN_NAME)
+})
+@Service(value=HealthCheck.class)
 public class SlingRequestStatusHealthCheck implements HealthCheck {
 
     private static final Logger log = LoggerFactory.getLogger(SlingRequestStatusHealthCheck.class);
@@ -70,17 +77,8 @@ public class SlingRequestStatusHealthCheck implements HealthCheck {
         }
     }
 
-    @Property(cardinality=Integer.MAX_VALUE)
-    public static final String PROP_PATH = "path";
-
-    @Property(cardinality=50)
-    public static final String PROP_TAGS = HealthCheck.TAGS;
-
-    @Property
-    public static final String PROP_NAME = HealthCheck.NAME;
-
-    @Property
-    public static final String PROP_MBEAN_NAME = HealthCheck.MBEAN_NAME;
+    @Property(unbounded=PropertyUnbounded.ARRAY)
+    private static final String PROP_PATH = "path";
 
     @Reference
     private SlingRequestProcessor requestProcessor;
diff --git a/src/test/java/org/apache/sling/hc/healthchecks/JmxAttributeHealthCheckTest.java b/src/test/java/org/apache/sling/hc/healthchecks/JmxAttributeHealthCheckTest.java
index 81f68fc..a0d93ff 100644
--- a/src/test/java/org/apache/sling/hc/healthchecks/JmxAttributeHealthCheckTest.java
+++ b/src/test/java/org/apache/sling/hc/healthchecks/JmxAttributeHealthCheckTest.java
@@ -19,8 +19,8 @@ package org.apache.sling.hc.healthchecks;
 
 import static org.junit.Assert.assertEquals;
 
-import java.util.Dictionary;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.apache.sling.hc.api.Result;
 import org.apache.sling.hc.healthchecks.impl.JmxAttributeHealthCheck;
@@ -29,27 +29,26 @@ import org.mockito.Mockito;
 import org.osgi.service.component.ComponentContext;
 
 public class JmxAttributeHealthCheckTest {
-    
+
     static void assertJmxValue(String objectName, String attributeName, String constraint, boolean expected) {
         final JmxAttributeHealthCheck hc = new JmxAttributeHealthCheck();
-        
+
         final ComponentContext ctx = Mockito.mock(ComponentContext.class);
-        final Dictionary<String, String> props = new Hashtable<String, String>();
+        final Map<String, Object> props = new HashMap<String, Object>();
         props.put(JmxAttributeHealthCheck.PROP_OBJECT_NAME, objectName);
         props.put(JmxAttributeHealthCheck.PROP_ATTRIBUTE_NAME, attributeName);
         props.put(JmxAttributeHealthCheck.PROP_CONSTRAINT, constraint);
-        Mockito.when(ctx.getProperties()).thenReturn(props);
-        hc.activate(ctx);
-        
+        hc.activate(props);
+
         final Result r = hc.execute();
         assertEquals("Expected result " + expected, expected, r.isOk());
     }
-    
+
     @Test
     public void testJmxAttributeMatch() {
         assertJmxValue("java.lang:type=ClassLoading", "LoadedClassCount", "> 10", true);
     }
-    
+
     @Test
     public void testJmxAttributeNoMatch() {
         assertJmxValue("java.lang:type=ClassLoading", "LoadedClassCount", "< 10", false);

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

[sling-org-apache-sling-hc-support] 27/31: [maven-release-plugin] prepare release org.apache.sling.hc.core-1.0.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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit 83d1ba67eb09ed00cf03ee4fd35e68d95d809f9c
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Sep 26 14:41:41 2013 +0000

    [maven-release-plugin] prepare release org.apache.sling.hc.core-1.0.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support@1526513 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index d13cb11..b60384b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.hc.support</artifactId>
     <packaging>bundle</packaging>
-    <version>1.0.1-SNAPSHOT</version>
+    <version>1.0.2</version>
 
     <name>Apache Sling Health Check Support Components</name>
     <inceptionYear>2013</inceptionYear>
@@ -27,9 +27,9 @@
     </properties>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/support</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.core-1.0.2/bundles/extensions/healthcheck/support</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.core-1.0.2/bundles/extensions/healthcheck/support</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.hc.core-1.0.2/bundles/extensions/healthcheck/support</url>
     </scm>
 
     <build>
@@ -59,7 +59,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.hc.core</artifactId>
-            <version>1.0.1-SNAPSHOT</version>
+            <version>1.0.2</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

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

[sling-org-apache-sling-hc-support] 09/31: SLING-3021 : Use service properties for HC meta data and improve JMX registration

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit 3abcf33ac2eee1652a1d6fab12f35d5e6d1643f1
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Aug 19 06:21:19 2013 +0000

    SLING-3021 :  Use service properties for HC meta data and improve JMX registration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/healthchecks@1515281 13f79535-47bb-0310-9956-ffa450edef68
---
 .../hc/healthchecks/impl/CompositeHealthCheck.java | 32 +++++--------
 .../impl/DefaultLoginsHealthCheck.java             | 37 ++++++---------
 .../hc/healthchecks/impl/HealthCheckInfo.java      | 42 -----------------
 .../healthchecks/impl/JmxAttributeHealthCheck.java | 43 ++++++------------
 .../healthchecks/impl/ScriptableHealthCheck.java   | 47 +++++++------------
 .../impl/SlingRequestStatusHealthCheck.java        | 53 +++++++++-------------
 6 files changed, 79 insertions(+), 175 deletions(-)

diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
index e459b0d..65f400f 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/CompositeHealthCheck.java
@@ -19,7 +19,6 @@ package org.apache.sling.hc.healthchecks.impl;
 
 import java.util.Arrays;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
@@ -27,7 +26,6 @@ import org.apache.felix.scr.annotations.ConfigurationPolicy;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.commons.osgi.PropertiesUtil;
-import org.apache.sling.hc.api.Constants;
 import org.apache.sling.hc.api.HealthCheck;
 import org.apache.sling.hc.api.Result;
 import org.apache.sling.hc.api.ResultLog;
@@ -43,39 +41,36 @@ import org.slf4j.LoggerFactory;
  */
 @Component(
         name="org.apache.sling.hc.CompositeHealthCheck",
-        configurationFactory=true, 
-        policy=ConfigurationPolicy.REQUIRE, 
+        configurationFactory=true,
+        policy=ConfigurationPolicy.REQUIRE,
         metatype=true)
 @Service
 public class CompositeHealthCheck implements HealthCheck {
 
     private final Logger log = LoggerFactory.getLogger(getClass());
-    private Map<String, String> info;
     private BundleContext bundleContext;
-    
+
     @Property(cardinality=50)
-    public static final String PROP_TAGS = Constants.HC_TAGS;
-    
+    public static final String PROP_TAGS = HealthCheck.TAGS;
+
     @Property(cardinality=50)
     public static final String PROP_FILTER_TAGS = "filter.tags";
     private String [] filterTags;
 
     @Property
-    public static final String PROP_MBEAN_NAME = Constants.HC_MBEAN_NAME;
-    
+    public static final String PROP_MBEAN_NAME = HealthCheck.MBEAN_NAME;
+
     @Activate
     public void activate(ComponentContext ctx) {
         bundleContext = ctx.getBundleContext();
-        info = new HealthCheckInfo(ctx.getProperties());
         filterTags = PropertiesUtil.toStringArray(ctx.getProperties().get(PROP_FILTER_TAGS), new String[] {});
-        info.put(PROP_FILTER_TAGS, Arrays.asList(filterTags).toString());
         log.info("Activated, will select HealthCheck having tags {}", Arrays.asList(filterTags));
     }
-    
+
     @Override
     public Result execute() {
         final FormattingResultLog resultLog = new FormattingResultLog();
-        final List<HealthCheck> checks = new HealthCheckFilter(bundleContext).getTaggedHealthCheck(filterTags);
+        final List<HealthCheck> checks = new HealthCheckFilter(bundleContext).getTaggedHealthChecks(filterTags);
         if(checks.size() == 0) {
             resultLog.warn("HealthCheckFilter returns no HealthCheck for tags {}", Arrays.asList(filterTags));
             return new Result(resultLog);
@@ -99,18 +94,13 @@ public class CompositeHealthCheck implements HealthCheck {
                 resultLog.add(e);
             }
         }
-        
+
         if(failures == 0) {
             resultLog.debug("{} HealthCheck executed, all ok", executed);
         } else {
             resultLog.warn("{} HealthCheck executed, {} failures", executed, failures);
         }
-        
-        return new Result(resultLog);
-    }
 
-    @Override
-    public Map<String, String> getInfo() {
-        return info;
+        return new Result(resultLog);
     }
 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java
index d7196a9..781e76d 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/DefaultLoginsHealthCheck.java
@@ -19,7 +19,6 @@ package org.apache.sling.hc.healthchecks.impl;
 
 import java.util.Arrays;
 import java.util.List;
-import java.util.Map;
 
 import javax.jcr.Credentials;
 import javax.jcr.RepositoryException;
@@ -33,7 +32,6 @@ import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.commons.osgi.PropertiesUtil;
-import org.apache.sling.hc.api.Constants;
 import org.apache.sling.hc.api.HealthCheck;
 import org.apache.sling.hc.api.Result;
 import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
@@ -46,44 +44,42 @@ import org.slf4j.LoggerFactory;
  *  Used to verify that those logins are disabled on production systems */
 @Component(
         name="org.apache.sling.hc.DefaultLoginsHealthCheck",
-        configurationFactory=true, 
-        policy=ConfigurationPolicy.REQUIRE, 
+        configurationFactory=true,
+        policy=ConfigurationPolicy.REQUIRE,
         metatype=true)
 @Service
 public class DefaultLoginsHealthCheck implements HealthCheck {
 
     private final Logger log = LoggerFactory.getLogger(getClass());
-    private Map<String, String> info;
-    
+
     @Property(cardinality=500)
     public static final String PROP_LOGINS = "logins";
     private List<String> logins;
-    
+
     @Property(cardinality=50)
-    public static final String PROP_TAGS = Constants.HC_TAGS;
-    
+    public static final String PROP_TAGS = HealthCheck.TAGS;
+
     @Property
-    public static final String PROP_NAME = Constants.HC_NAME;
-    
+    public static final String PROP_NAME = HealthCheck.NAME;
+
     @Property
-    public static final String PROP_MBEAN_NAME = Constants.HC_MBEAN_NAME;
-    
+    public static final String PROP_MBEAN_NAME = HealthCheck.MBEAN_NAME;
+
     @Reference
     private SlingRepository repository;
-    
+
     @Activate
     public void activate(ComponentContext ctx) {
-        info = new HealthCheckInfo(ctx.getProperties());
         logins = Arrays.asList(PropertiesUtil.toStringArray(ctx.getProperties().get(PROP_LOGINS), new String[] {}));
         log.info("Activated, logins={}", logins);
     }
-    
+
     @Override
     public Result execute() {
         final FormattingResultLog resultLog = new FormattingResultLog();
         int checked=0;
         int failures=0;
-        
+
         for(String login : logins) {
             final String [] parts = login.split(":");
             if(parts.length != 2) {
@@ -111,7 +107,7 @@ public class DefaultLoginsHealthCheck implements HealthCheck {
                 }
             }
         }
-        
+
         if(checked==0) {
             resultLog.warn("Did not check any logins, configured logins={}", logins);
         } else if(failures != 0){
@@ -121,9 +117,4 @@ public class DefaultLoginsHealthCheck implements HealthCheck {
         }
         return new Result(resultLog);
     }
-
-    @Override
-    public Map<String, String> getInfo() {
-        return info;
-    }
 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/HealthCheckInfo.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/HealthCheckInfo.java
deleted file mode 100644
index ac3dc61..0000000
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/HealthCheckInfo.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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 SF 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.hc.healthchecks.impl;
-
-import java.util.Arrays;
-import java.util.Dictionary;
-import java.util.HashMap;
-
-import org.apache.sling.commons.osgi.PropertiesUtil;
-import org.apache.sling.hc.api.Constants;
-
-// TODO move to services bundle
-
-/** Utility that copies useful HealthCheck service
- *  properties to a Map that can be used as the Result's
- *  info(). Copies all service properties that have names
- *  that start with the {#Constants.HC_PROP_PREFIX} */
-public class HealthCheckInfo extends HashMap<String, String> {
-    private static final long serialVersionUID = 8661195387931574705L;
-
-    public HealthCheckInfo(Dictionary<?, ?> serviceProperties) {
-        put(Constants.HC_NAME, PropertiesUtil.toString(serviceProperties.get(Constants.HC_NAME), ""));
-        put(Constants.HC_MBEAN_NAME, PropertiesUtil.toString(serviceProperties.get(Constants.HC_MBEAN_NAME), ""));
-        put(Constants.HC_TAGS, 
-                Arrays.asList(PropertiesUtil.toStringArray(serviceProperties.get(Constants.HC_TAGS), new String[] {})).toString());
-    }
-}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
index e18767d..193615d 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java
@@ -18,7 +18,6 @@
 package org.apache.sling.hc.healthchecks.impl;
 
 import java.lang.management.ManagementFactory;
-import java.util.Map;
 
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
@@ -29,7 +28,6 @@ import org.apache.felix.scr.annotations.ConfigurationPolicy;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.commons.osgi.PropertiesUtil;
-import org.apache.sling.hc.api.Constants;
 import org.apache.sling.hc.api.HealthCheck;
 import org.apache.sling.hc.api.Result;
 import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
@@ -41,51 +39,45 @@ import org.slf4j.LoggerFactory;
 /** {@link HealthCheck} that checks a single JMX attribute */
 @Component(
         name="org.apache.sling.hc.JmxAttributeHealthCheck",
-        configurationFactory=true, 
-        policy=ConfigurationPolicy.REQUIRE, 
+        configurationFactory=true,
+        policy=ConfigurationPolicy.REQUIRE,
         metatype=true)
 @Service
 public class JmxAttributeHealthCheck implements HealthCheck {
 
     private final Logger log = LoggerFactory.getLogger(getClass());
-    private Map<String, String> info;
     private String mbeanName;
     private String attributeName;
     private String constraint;
 
     @Property
     public static final String PROP_OBJECT_NAME = "mbean.name";
-    
+
     @Property
     public static final String PROP_ATTRIBUTE_NAME = "attribute.name";
-    
+
     @Property
     public static final String PROP_CONSTRAINT = "attribute.value.constraint";
-    
+
     @Property(cardinality=50)
-    public static final String PROP_TAGS = Constants.HC_TAGS;
-    
+    public static final String PROP_TAGS = HealthCheck.TAGS;
+
     @Property
-    public static final String PROP_NAME = Constants.HC_NAME;
-    
+    public static final String PROP_NAME = HealthCheck.NAME;
+
     @Property
-    public static final String PROP_MBEAN_NAME = Constants.HC_MBEAN_NAME;
-    
+    public static final String PROP_MBEAN_NAME = HealthCheck.MBEAN_NAME;
+
     @Activate
     public void activate(ComponentContext ctx) {
-        info = new HealthCheckInfo(ctx.getProperties());
         mbeanName = PropertiesUtil.toString(ctx.getProperties().get(PROP_OBJECT_NAME), "");
         attributeName = PropertiesUtil.toString(ctx.getProperties().get(PROP_ATTRIBUTE_NAME), "");
         constraint = PropertiesUtil.toString(ctx.getProperties().get(PROP_CONSTRAINT), "");
-        
-        info.put(PROP_OBJECT_NAME, mbeanName);
-        info.put(PROP_ATTRIBUTE_NAME, attributeName);
-        info.put(PROP_CONSTRAINT, constraint);
-        
-        log.info("Activated with HealthCheck name={}, objectName={}, attribute={}, constraint={}", 
-                new Object[] { info.get(Constants.HC_NAME), mbeanName, attributeName, constraint });
+
+        log.info("Activated with HealthCheck name={}, objectName={}, attribute={}, constraint={}",
+                new Object[] { ctx.getProperties().get(HealthCheck.NAME), mbeanName, attributeName, constraint });
     }
-    
+
     @Override
     public Result execute() {
         final FormattingResultLog resultLog = new FormattingResultLog();
@@ -106,9 +98,4 @@ public class JmxAttributeHealthCheck implements HealthCheck {
         }
         return new Result(resultLog);
     }
-
-    @Override
-    public Map<String, String> getInfo() {
-        return info;
-    }
 }
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java
index 5979baa..1f0ba8b 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/ScriptableHealthCheck.java
@@ -16,8 +16,6 @@
  * specific language governing permissions and limitations under the License.
  */
 package org.apache.sling.hc.healthchecks.impl;
-import java.util.Map;
-
 import javax.script.Bindings;
 import javax.script.ScriptEngine;
 import javax.script.ScriptEngineManager;
@@ -29,7 +27,6 @@ import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.commons.osgi.PropertiesUtil;
-import org.apache.sling.hc.api.Constants;
 import org.apache.sling.hc.api.HealthCheck;
 import org.apache.sling.hc.api.Result;
 import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
@@ -41,51 +38,46 @@ import org.slf4j.LoggerFactory;
 /** {@link HealthCheck} that checks a scriptable expression */
 @Component(
         name="org.apache.sling.hc.ScriptableHealthCheck",
-        configurationFactory=true, 
-        policy=ConfigurationPolicy.REQUIRE, 
+        configurationFactory=true,
+        policy=ConfigurationPolicy.REQUIRE,
         metatype=true)
 @Service
 public class ScriptableHealthCheck implements HealthCheck {
 
     private final Logger log = LoggerFactory.getLogger(getClass());
-    private Map<String, String> info;
     private String expression;
     private String languageExtension;
     private BundleContext bundleContext;
-    
+
     public static final String DEFAULT_LANGUAGE_EXTENSION = "ecma";
 
     @Property
     public static final String PROP_EXPRESSION = "expression";
-    
+
     @Property
     public static final String PROP_LANGUAGE_EXTENSION = "language.extension";
-    
+
     @Property(cardinality=50)
-    public static final String PROP_TAGS = Constants.HC_TAGS;
-    
+    public static final String PROP_TAGS = HealthCheck.TAGS;
+
     @Property
-    public static final String PROP_NAME = Constants.HC_NAME;
-    
+    public static final String PROP_NAME = HealthCheck.NAME;
+
     @Property
-    public static final String PROP_MBEAN_NAME = Constants.HC_MBEAN_NAME;
-    
+    public static final String PROP_MBEAN_NAME = HealthCheck.MBEAN_NAME;
+
     @Reference
     private ScriptEngineManager scriptEngineManager;
-    
+
     @Activate
     public void activate(ComponentContext ctx) {
-        info = new HealthCheckInfo(ctx.getProperties());
         bundleContext = ctx.getBundleContext();
         expression = PropertiesUtil.toString(ctx.getProperties().get(PROP_EXPRESSION), "");
         languageExtension = PropertiesUtil.toString(ctx.getProperties().get(PROP_LANGUAGE_EXTENSION), DEFAULT_LANGUAGE_EXTENSION);
-        
-        info.put(PROP_EXPRESSION, expression);
-        info.put(PROP_LANGUAGE_EXTENSION, languageExtension);
-        
+
         log.info("Activated, name={}, languageExtension={}, expression={}", languageExtension, expression);
     }
-    
+
     @Override
     public Result execute() {
         final FormattingResultLog resultLog = new FormattingResultLog();
@@ -103,19 +95,14 @@ public class ScriptableHealthCheck implements HealthCheck {
                 if(value!=null && "true".equals(value.toString())) {
                     resultLog.debug("Expression [{}] evaluates to true as expected", expression);
                 } else {
-                    resultLog.warn("Expression [{}] does not evaluate to true as expected, value=[{}]", expression, value); 
+                    resultLog.warn("Expression [{}] does not evaluate to true as expected, value=[{}]", expression, value);
                 }
             }
         } catch(Exception e) {
             resultLog.healthCheckError(
-                    "Exception while evaluating expression [{}] with language extension [{}]: {}", 
-                    expression, languageExtension, e); 
+                    "Exception while evaluating expression [{}] with language extension [{}]: {}",
+                    expression, languageExtension, e);
         }
         return new Result(resultLog);
     }
-
-    @Override
-    public Map<String, String> getInfo() {
-        return info;
-    }
 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
index c2ba539..ab22c8e 100644
--- a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
+++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java
@@ -18,7 +18,6 @@
 package org.apache.sling.hc.healthchecks.impl;
 
 import java.util.Arrays;
-import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -32,7 +31,6 @@ import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.resource.ResourceResolverFactory;
 import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.engine.SlingRequestProcessor;
-import org.apache.sling.hc.api.Constants;
 import org.apache.sling.hc.api.HealthCheck;
 import org.apache.sling.hc.api.Result;
 import org.apache.sling.hc.healthchecks.util.FormattingResultLog;
@@ -43,24 +41,23 @@ import org.slf4j.LoggerFactory;
 /** {@link HealthCheck} that checks the HTTP status of Sling requests */
 @Component(
         name="org.apache.sling.hc.SlingRequestStatusHealthCheck",
-        configurationFactory=true, 
-        policy=ConfigurationPolicy.REQUIRE, 
+        configurationFactory=true,
+        policy=ConfigurationPolicy.REQUIRE,
         metatype=true)
 @Service
 public class SlingRequestStatusHealthCheck implements HealthCheck {
 
     private static final Logger log = LoggerFactory.getLogger(SlingRequestStatusHealthCheck.class);
-    private Map<String, String> info;
     private String [] paths;
-    
+
     static class PathSpec {
         int status;
         String path;
-        
+
         PathSpec(String configuredPath, FormattingResultLog resultLog) {
             path = configuredPath;
             status = 200;
-            
+
             final String [] parts  = configuredPath.split(":");
             if(parts.length == 2) {
                 try {
@@ -69,44 +66,43 @@ public class SlingRequestStatusHealthCheck implements HealthCheck {
                 } catch(NumberFormatException nfe) {
                     resultLog.healthCheckError("NumberFormatException while parsing [{}], invalid status value?", configuredPath);
                 }
-            } 
+            }
         }
     }
-    
+
     @Property(cardinality=Integer.MAX_VALUE)
     public static final String PROP_PATH = "path";
-    
+
     @Property(cardinality=50)
-    public static final String PROP_TAGS = Constants.HC_TAGS;
-    
+    public static final String PROP_TAGS = HealthCheck.TAGS;
+
     @Property
-    public static final String PROP_NAME = Constants.HC_NAME;
-    
+    public static final String PROP_NAME = HealthCheck.NAME;
+
     @Property
-    public static final String PROP_MBEAN_NAME = Constants.HC_MBEAN_NAME;
-    
+    public static final String PROP_MBEAN_NAME = HealthCheck.MBEAN_NAME;
+
     @Reference
     private SlingRequestProcessor requestProcessor;
-    
+
     @Reference
-    private ResourceResolverFactory resolverFactory;  
-    
+    private ResourceResolverFactory resolverFactory;
+
     @Activate
     public void activate(ComponentContext ctx) {
-        info = new HealthCheckInfo(ctx.getProperties());
         paths = PropertiesUtil.toStringArray(ctx.getProperties().get(PROP_PATH), new String [] {});
         log.info("Activated, paths={}", Arrays.asList(paths));
     }
-    
+
     @Override
     public Result execute() {
         final FormattingResultLog resultLog = new FormattingResultLog();
-        
+
         ResourceResolver resolver = null;
         int checked = 0;
         int failed = 0;
         String lastPath = null;
-        
+
         try {
             resolver = resolverFactory.getAdministrativeResourceResolver(null);
             for(String p : paths) {
@@ -131,18 +127,13 @@ public class SlingRequestStatusHealthCheck implements HealthCheck {
                 resolver.close();
             }
         }
-        
+
         if(checked == 0) {
             resultLog.warn("No paths checked, empty paths list?");
         } else {
             resultLog.debug("{} paths checked, {} failures", checked, failed);
         }
-        
-        return new Result(resultLog);
-    }
 
-    @Override
-    public Map<String, String> getInfo() {
-        return info;
+        return new Result(resultLog);
     }
 }
\ 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-hc-support] 22/31: SLING-3127 - it's Apache Sling ; -)

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.hc.support-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git

commit da8fb7414dca762298698852ed99f1e5cd431b9f
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Sep 26 13:22:04 2013 +0000

    SLING-3127 - it's Apache Sling ;-)
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/support@1526480 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index ce31b77..1ac3ef5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,7 @@
     <packaging>bundle</packaging>
     <version>0.0.2-SNAPSHOT</version>
 
-    <name>Sling Health Check Support Components</name>
+    <name>Apache Sling Health Check Support Components</name>
     <inceptionYear>2013</inceptionYear>
     
     <description>

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