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/10/18 23:20:10 UTC
[sling-org-apache-sling-hc-it] branch master created (now 4696f3f)
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git.
at 4696f3f Fixed broken build in HelthCheck Core IT tests
This branch includes the following new commits:
new 3f93b20 SLING-3127 - prepare Health Check tools release
new 54a473a SLING-3127 - it's Apache Sling ;-)
new 81ce4c0 SLING-3127 - add scm info
new 0b81bc5 SLING-3127 - use latest parent pom
new 8bcc352 [maven-release-plugin] prepare release org.apache.sling.hc.core-1.0.0
new 8ed1444 [maven-release-plugin] prepare for next development iteration
new a53c579 [maven-release-plugin] prepare release org.apache.sling.hc.core-1.0.2
new 258eda8 [maven-release-plugin] prepare for next development iteration
new 21400be SLING-3127 - prepare for release
new 7b2cee7 [maven-release-plugin] prepare release org.apache.sling.hc.it-1.0.4
new 1ca63f2 [maven-release-plugin] prepare for next development iteration
new 9fb709a SLING-3127 - switch to snapshots (we might switch back once hc.core is released)
new 8a95dc0 Use latest core snapshot
new 0236320 Correct snapshot version
new d65d38a SLING-3278 broke integration tests
new d13f99a Use latest snapshot for testing
new 9b54651 Update to parent pom v19
new a3be2a2 SLING-3744 - add missing dependency - integration tests failed
new 65dc05a SLING-3624 - test the annotated health check sample
new f083a75 SLING-3744 - test async health check with cron expression
new 216a613 SLING-3624 - test DynamicMBean registration from annotation
new 004a5a9 Updated to parent version 20
new e82c975 Back to snapshots, until the released modules are available
new 1e6b20d Update to Sling Parent POM 22 with baselining enabled
new 3c14344 SLING-3501 - prepare for more HealthCheckExecutor testing
new 080f55c SLING-3501 - HealthCheckExecutorSelectionTest added
new 785417a SLING-3501 - add tests for OR selection option in HealthCheckExecutor
new 550e1b5 Correct health check dependencies
new 8a7ff42 Use latest snapshot version of hc core
new e969597 Add missing licence header
new 11c0b73 SLING-4698 - Set parent.relativePath to empty for all modules
new a462fec Update to Sling Parent 23
new 5167ae0 Remove superflous sling.java.version=6 as it's the default now
new f276436 set parent version to 24 and add empty relativePath where missing
new bc33e40 SLING-4862 - add missing dependencies for IT
new ed635e0 SLING-4862 - add test for HC servlet activation
new 1779ceb Update the main reactor to parent 25
new b46e39c Switch to parent pom 26
new bc27423 SLING-4941 - tests for JmxAdjustableStatusForTesting, contributed by Georg Henzler, thanks!
new 1615e4b SLING-4941 - restructure tests and add testAnotherTag()
new f64d35b SLING-5569 - move Health Checks core integration tests to the core module
new 9837ba9 SLING-6074 - Healthcheck ITs fail in isolated job on Jenkins
new fa3f623 SLING-6773 - separate HC API from Core
new 9053580 Update some bundles and framework version to get it tests running again
new 2231e17 SLING-6804 - allow selecting health checks by name
new d91f301 Correct versions
new c240f1f Remove the commons.json bundle from the hc it tests
new c46c5ae SLING-7167 Adjust READMEs
new 4696f3f Fixed broken build in HelthCheck Core IT tests
The 49 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-it] 12/49: SLING-3127 - switch to
snapshots (we might switch back once hc.core is released)
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 9fb709a2b396927adf243a04a8bb4a7eb5fea4ab
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Sep 26 15:27:20 2013 +0000
SLING-3127 - switch to snapshots (we might switch back once hc.core is released)
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1526572 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 77ec907..8fe42e4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,7 +52,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.hc.core</artifactId>
- <version>1.0.4</version>
+ <version>1.0.5-SNAPSHOT</version>
<scope>test</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-it] 11/49: [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 branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 1ca63f2138b79a935498e731965026846c4bde4f
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Sep 26 15:09:05 2013 +0000
[maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1526553 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index f104e4f..77ec907 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.hc.it</artifactId>
<packaging>jar</packaging>
- <version>1.0.4</version>
+ <version>1.0.5-SNAPSHOT</version>
<name>Apache Sling Health Check Integration Tests</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.it-1.0.4</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.it-1.0.4</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.hc.it-1.0.4</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/it</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/it</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/it</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-it] 10/49: [maven-release-plugin]
prepare release org.apache.sling.hc.it-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 branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 7b2cee753fd68aa697dcf9bf0663f6961d0bdec3
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Sep 26 15:08:43 2013 +0000
[maven-release-plugin] prepare release org.apache.sling.hc.it-1.0.4
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1526551 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index e59012f..f104e4f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.hc.it</artifactId>
<packaging>jar</packaging>
- <version>1.0.3-SNAPSHOT</version>
+ <version>1.0.4</version>
<name>Apache Sling Health Check Integration Tests</name>
<inceptionYear>2013</inceptionYear>
@@ -27,9 +27,9 @@
</properties>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/it</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/it</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/it</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.it-1.0.4</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.it-1.0.4</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.hc.it-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-it] 02/49: 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 branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 54a473a50dcc658861bec950cdc3b95e533c96d7
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@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 9bbda57..24982af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,7 @@
<packaging>jar</packaging>
<version>0.0.2-SNAPSHOT</version>
- <name>Sling Health Check Integration Tests</name>
+ <name>Apache Sling Health Check Integration Tests</name>
<inceptionYear>2013</inceptionYear>
<properties>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 39/49: SLING-4941 - tests for
JmxAdjustableStatusForTesting, contributed by Georg Henzler, thanks!
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit bc27423294075d41f94207b0a760ae9ac7e8923b
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Feb 29 09:16:10 2016 +0000
SLING-4941 - tests for JmxAdjustableStatusForTesting, contributed by Georg Henzler, thanks!
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1732836 13f79535-47bb-0310-9956-ffa450edef68
---
.../it/core/JmxAdjustableStatusForTestingTest.java | 153 +++++++++++++++++++++
1 file changed, 153 insertions(+)
diff --git a/src/test/java/org/apache/sling/hc/it/core/JmxAdjustableStatusForTestingTest.java b/src/test/java/org/apache/sling/hc/it/core/JmxAdjustableStatusForTestingTest.java
new file mode 100644
index 0000000..96ed2fa
--- /dev/null
+++ b/src/test/java/org/apache/sling/hc/it/core/JmxAdjustableStatusForTestingTest.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.it.core;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.management.DynamicMBean;
+
+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.api.ResultLog.Entry;
+import org.apache.sling.hc.api.execution.HealthCheckExecutionResult;
+import org.apache.sling.hc.api.execution.HealthCheckExecutor;
+import org.apache.sling.hc.util.FormattingResultLog;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+/** Test jmx-adjustable status for testing HC. */
+@RunWith(PaxExam.class)
+public class JmxAdjustableStatusForTestingTest {
+
+ @Inject
+ private HealthCheckExecutor executor;
+
+ @Inject
+ private BundleContext bundleContext;
+
+ private static String testTag = "testTagName";
+
+ @SuppressWarnings("rawtypes")
+ private List<ServiceRegistration> regs = new ArrayList<ServiceRegistration>();
+
+ @Configuration
+ public Option[] config() {
+ return U.config();
+ }
+
+ @Before
+ public void setup() {
+ U.expectHealthChecks(0, executor, testTag);
+ registerHC(testTag);
+ }
+
+ @After
+ @SuppressWarnings("rawtypes")
+ public void cleanup() {
+ for (ServiceRegistration r : regs) {
+ r.unregister();
+ }
+ regs.clear();
+ U.expectHealthChecks(0, executor, testTag);
+ }
+
+ @Test
+ public void testJmxAdjustableStatusForTesting() throws Exception {
+
+ U.expectHealthChecks(1, executor, testTag);
+
+ Result result = getOverallResult(executor.execute(testTag));
+ assertEquals(Result.Status.OK, result.getStatus());
+
+ invokeMBean("addWarnResultForTags", new Object[] { testTag }, new String[] { String.class.getName() });
+
+ U.expectHealthChecks(2, executor, testTag);
+ result = getOverallResult(executor.execute(testTag));
+ assertEquals(Result.Status.WARN, result.getStatus());
+
+ invokeMBean("reset", new Object[] {}, new String[] {});
+
+ U.expectHealthChecks(1, executor, testTag);
+ result = getOverallResult(executor.execute(testTag));
+ assertEquals(Result.Status.OK, result.getStatus());
+
+ invokeMBean("addCriticalResultForTags", new Object[] { "anotherTag," + testTag },
+ new String[] { String.class.getName() });
+
+ U.expectHealthChecks(2, executor, testTag);
+ result = getOverallResult(executor.execute(testTag));
+ assertEquals(Result.Status.CRITICAL, result.getStatus());
+
+ invokeMBean("reset", new Object[] {}, new String[] {});
+
+ U.expectHealthChecks(1, executor, testTag);
+ result = getOverallResult(executor.execute(testTag));
+ assertEquals(Result.Status.OK, result.getStatus());
+
+ }
+
+ private void registerHC(final String... tags) {
+ final HealthCheck hc = new HealthCheck() {
+ @Override
+ public Result execute() {
+ return new Result(Result.Status.OK, "All good for " + tags[0]);
+ }
+ };
+
+ final Dictionary<String, Object> props = new Hashtable<String, Object>();
+ props.put(HealthCheck.NAME, "name_" + tags[0]);
+ props.put(HealthCheck.TAGS, tags);
+
+ regs.add(bundleContext.registerService(HealthCheck.class, hc, props));
+ }
+
+ private void invokeMBean(String operation, Object[] args, String[] signature) throws Exception {
+
+ ServiceReference<?>[] serviceReference = bundleContext.getServiceReferences(DynamicMBean.class.getName(),
+ "(jmx.objectname=org.apache.sling.healthcheck:type=AdjustableHealthCheckForTesting)");
+ DynamicMBean mBean = (DynamicMBean) bundleContext.getService(serviceReference[0]);
+ mBean.invoke(operation, args, signature);
+
+ }
+
+ private Result getOverallResult(List<HealthCheckExecutionResult> results) {
+ FormattingResultLog resultLog = new FormattingResultLog();
+ for (HealthCheckExecutionResult executionResult : results) {
+ for (Entry entry : executionResult.getHealthCheckResult()) {
+ resultLog.add(new ResultLog.Entry(entry.getStatus(), entry.getMessage(), entry.getException()));
+ }
+ }
+ return new Result(resultLog);
+ }
+
+}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 37/49: Update the main reactor to
parent 25
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 1779ceb763aa50859bc4aac59356ad8b1a58833a
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Mon Oct 5 10:03:45 2015 +0000
Update the main reactor to parent 25
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1706780 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index eb7b03f..418b5ab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>24</version>
+ <version>25</version>
<relativePath/>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 25/49: SLING-3501 - prepare for more
HealthCheckExecutor testing
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 3c1434435831bc249a888d6f52b07b09b6a537f1
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Jan 5 15:59:18 2015 +0000
SLING-3501 - prepare for more HealthCheckExecutor testing
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1649564 13f79535-47bb-0310-9956-ffa450edef68
---
.../sling/hc/it/core/AsyncHealthCheckTest.java | 18 ++---------------
src/test/java/org/apache/sling/hc/it/core/U.java | 23 ++++++++++++++++++++++
2 files changed, 25 insertions(+), 16 deletions(-)
diff --git a/src/test/java/org/apache/sling/hc/it/core/AsyncHealthCheckTest.java b/src/test/java/org/apache/sling/hc/it/core/AsyncHealthCheckTest.java
index 38068f1..acbd8c9 100644
--- a/src/test/java/org/apache/sling/hc/it/core/AsyncHealthCheckTest.java
+++ b/src/test/java/org/apache/sling/hc/it/core/AsyncHealthCheckTest.java
@@ -21,7 +21,6 @@ import static org.junit.Assert.assertTrue;
import java.util.Dictionary;
import java.util.Hashtable;
-import java.util.List;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
@@ -29,7 +28,6 @@ import javax.inject.Inject;
import org.apache.sling.hc.api.HealthCheck;
import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.api.execution.HealthCheckExecutionResult;
import org.apache.sling.hc.api.execution.HealthCheckExecutor;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -75,20 +73,8 @@ public class AsyncHealthCheckTest {
final ServiceRegistration reg = bundleContext.registerService(HealthCheck.class, hc, props);
try {
- {
- // Wait for HC to be registered
- final long timeout = System.currentTimeMillis() + 10000L;
- boolean hcFound = false;
- while(System.currentTimeMillis() < timeout) {
- final List<HealthCheckExecutionResult> results = executor.execute(id);
- if(!results.isEmpty()) {
- hcFound = true;
- break;
- }
- Thread.sleep(100L);
- }
- assertTrue("Expecting HC to become active", hcFound);
- }
+ // Wait for HC to be registered
+ U.expectHealthChecks(1, executor, id);
// Now reset the counter and check that HC increments it even if we don't
// use the executor
diff --git a/src/test/java/org/apache/sling/hc/it/core/U.java b/src/test/java/org/apache/sling/hc/it/core/U.java
index cb9f445..99dc4ab 100644
--- a/src/test/java/org/apache/sling/hc/it/core/U.java
+++ b/src/test/java/org/apache/sling/hc/it/core/U.java
@@ -17,6 +17,7 @@
*/
package org.apache.sling.hc.it.core;
+import static org.junit.Assert.fail;
import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
@@ -24,10 +25,32 @@ import static org.ops4j.pax.exam.CoreOptions.provision;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import static org.ops4j.pax.exam.CoreOptions.when;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.sling.hc.api.execution.HealthCheckExecutionResult;
+import org.apache.sling.hc.api.execution.HealthCheckExecutor;
import org.ops4j.pax.exam.Option;
/** Test utilities */
public class U {
+
+ /** Wait until the specified number of health checks are seen by supplied executor */
+ static void expectHealthChecks(int howMany, HealthCheckExecutor executor, String ... tags) {
+ final long timeout = System.currentTimeMillis() + 10000L;
+ while(System.currentTimeMillis() < timeout) {
+ final List<HealthCheckExecutionResult> results = executor.execute(tags);
+ if(results.size() == howMany) {
+ return;
+ }
+ try {
+ Thread.sleep(100L);
+ } catch(InterruptedException iex) {
+ throw new RuntimeException("Unexpected InterruptedException");
+ }
+ }
+ fail("Did not get " + howMany + " health checks with tags " + Arrays.asList(tags) + " after " + timeout + " msec");
+ }
static Option[] config() {
final String coreVersion = System.getProperty("sling.hc.core.version");
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 14/49: Correct snapshot version
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 02363207c5482f588f5d1438d3ee9d6d480ce987
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Oct 25 11:13:12 2013 +0000
Correct snapshot version
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1535687 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 374f9ad..c878701 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.hc.it</artifactId>
<packaging>jar</packaging>
- <version>1.0.5-SNAPSHOT</version>
+ <version>1.0.7-SNAPSHOT</version>
<name>Apache Sling Health Check Integration Tests</name>
<inceptionYear>2013</inceptionYear>
@@ -52,7 +52,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.hc.core</artifactId>
- <version>1.0.7-SNAPSHOT</version>
+ <version>${project.version}</version>
<scope>test</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-it] 16/49: Use latest snapshot for
testing
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit d13f99a5bc4ec3469314ba6f68819df2e0fd7809
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Jan 27 16:37:39 2014 +0000
Use latest snapshot for testing
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1561738 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index c878701..d124bb6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.hc.it</artifactId>
<packaging>jar</packaging>
- <version>1.0.7-SNAPSHOT</version>
+ <version>1.1.1-SNAPSHOT</version>
<name>Apache Sling Health Check Integration Tests</name>
<inceptionYear>2013</inceptionYear>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 41/49: SLING-5569 - move Health
Checks core integration tests to the core module
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit f64d35ba89217a212a57502b5a2b5a768776c36b
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Feb 29 13:10:27 2016 +0000
SLING-5569 - move Health Checks core integration tests to the core module
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1732889 13f79535-47bb-0310-9956-ffa450edef68
---
.../sling/hc/it/core/AsyncHealthCheckTest.java | 110 ----------
.../it/core/HealthCheckExecutorSelectionTest.java | 147 --------------
.../sling/hc/it/core/HealthCheckFilterTest.java | 221 ---------------------
.../sling/hc/it/core/HealthCheckServletTest.java | 121 -----------
.../it/core/JmxAdjustableStatusForTestingTest.java | 155 ---------------
.../apache/sling/hc/it/core/MockHttpService.java | 55 -----
6 files changed, 809 deletions(-)
diff --git a/src/test/java/org/apache/sling/hc/it/core/AsyncHealthCheckTest.java b/src/test/java/org/apache/sling/hc/it/core/AsyncHealthCheckTest.java
deleted file mode 100644
index acbd8c9..0000000
--- a/src/test/java/org/apache/sling/hc/it/core/AsyncHealthCheckTest.java
+++ /dev/null
@@ -1,110 +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.it.core;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import javax.inject.Inject;
-
-import org.apache.sling.hc.api.HealthCheck;
-import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.api.execution.HealthCheckExecutor;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-@RunWith(PaxExam.class)
-public class AsyncHealthCheckTest {
-
- @Inject
- private HealthCheckExecutor executor;
-
- @Inject
- private BundleContext bundleContext;
-
- @Configuration
- public Option[] config() {
- return U.config();
- }
-
- @Test
- public void testAsyncHealthCheck() throws InterruptedException {
- final String id = UUID.randomUUID().toString();
- final AtomicInteger counter = new AtomicInteger(Integer.MIN_VALUE);
- final HealthCheck hc = new HealthCheck() {
- @Override
- public Result execute() {
- final int v = counter.incrementAndGet();
- return new Result(Result.Status.OK, "counter is now " + v);
- }
-
- };
-
- final Dictionary<String, Object> props = new Hashtable<String, Object>();
- props.put(HealthCheck.NAME, "name_" + id);
- props.put(HealthCheck.TAGS, id);
- props.put(HealthCheck.ASYNC_CRON_EXPRESSION, "*/1 * * * * ?");
-
- @SuppressWarnings("rawtypes")
- final ServiceRegistration reg = bundleContext.registerService(HealthCheck.class, hc, props);
-
- try {
- // Wait for HC to be registered
- U.expectHealthChecks(1, executor, id);
-
- // Now reset the counter and check that HC increments it even if we don't
- // use the executor
- {
- counter.set(0);
- final long timeout = System.currentTimeMillis() + 5000L;
- while(System.currentTimeMillis() < timeout) {
- if(counter.get() > 0) {
- break;
- }
- Thread.sleep(100L);
- }
- assertTrue("Expecting counter to be incremented", counter.get() > 0);
- }
-
- // Verify that we get the right log
- final String msg = executor.execute(id).get(0).getHealthCheckResult().iterator().next().getMessage();
- assertTrue("Expecting the right message: " + msg, msg.contains("counter is now"));
-
- // And verify that calling executor lots of times doesn't increment as much
- final int previous = counter.get();
- final int n = 100;
- for(int i=0; i < n; i++) {
- executor.execute(id);
- }
- assertTrue("Expecting counter to increment asynchronously", counter.get() < previous + n);
- } finally {
- reg.unregister();
- }
-
- }
-
-}
diff --git a/src/test/java/org/apache/sling/hc/it/core/HealthCheckExecutorSelectionTest.java b/src/test/java/org/apache/sling/hc/it/core/HealthCheckExecutorSelectionTest.java
deleted file mode 100644
index 88c9bfe..0000000
--- a/src/test/java/org/apache/sling/hc/it/core/HealthCheckExecutorSelectionTest.java
+++ /dev/null
@@ -1,147 +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.it.core;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.UUID;
-
-import javax.inject.Inject;
-
-import org.apache.sling.hc.api.HealthCheck;
-import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.api.execution.HealthCheckExecutionOptions;
-import org.apache.sling.hc.api.execution.HealthCheckExecutor;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-/** Test the HealthCheckExecutor selection mechanism */
-@RunWith(PaxExam.class)
-public class HealthCheckExecutorSelectionTest {
-
- @Inject
- private HealthCheckExecutor executor;
-
- @Inject
- private BundleContext bundleContext;
-
- private static String idA;
- private static String idB;
- private HealthCheckExecutionOptions options;
-
- @SuppressWarnings("rawtypes")
- private List<ServiceRegistration> regs = new ArrayList<ServiceRegistration>();
-
- @Configuration
- public Option[] config() {
- return U.config();
- }
-
- private void registerHC(final String ... tags) {
- final HealthCheck hc = new HealthCheck() {
- @Override
- public Result execute() {
- return new Result(Result.Status.OK, "All good for " + tags[0]);
- }
-
- };
-
- final Dictionary<String, Object> props = new Hashtable<String, Object>();
- props.put(HealthCheck.NAME, "name_" + tags[0]);
- props.put(HealthCheck.TAGS, tags);
-
- regs.add(bundleContext.registerService(HealthCheck.class, hc, props));
- }
-
- @BeforeClass
- public static void setId() {
- idA = UUID.randomUUID().toString();
- idB = UUID.randomUUID().toString();
- }
-
- @Before
- public void setup() {
- options = new HealthCheckExecutionOptions();
-
- U.expectHealthChecks(0, executor, idA);
- U.expectHealthChecks(0, executor, idB);
-
- registerHC(idA);
- registerHC(idB);
- registerHC(idB);
- registerHC(idA, idB);
- }
-
- @After
- @SuppressWarnings("rawtypes")
- public void cleanup() {
- for(ServiceRegistration r : regs) {
- r.unregister();
- }
- regs.clear();
-
- U.expectHealthChecks(0, executor, idA);
- U.expectHealthChecks(0, executor, idB);
- }
-
- @Test
- public void testDefaultSelectionA(){
- U.expectHealthChecks(2, executor, idA);
- U.expectHealthChecks(2, executor, options, idA);
- }
-
- @Test
- public void testDefaultSelectionB(){
- U.expectHealthChecks(3, executor, idB);
- U.expectHealthChecks(3, executor, options, idB);
- }
-
- @Test
- public void testDefaultSelectionAB(){
- U.expectHealthChecks(1, executor, idA, idB);
- U.expectHealthChecks(1, executor, options, idA, idB);
- }
-
- @Test
- public void testOrSelectionA(){
- options.setCombineTagsWithOr(true);
- U.expectHealthChecks(1, executor, options, idA);
- }
-
- @Test
- public void testOrSelectionB(){
- options.setCombineTagsWithOr(true);
- U.expectHealthChecks(3, executor, options, idB);
- }
-
- @Test
- public void testOrSelectionAB(){
- options.setCombineTagsWithOr(true);
- U.expectHealthChecks(4, executor, options, idA, idB);
- }
-}
diff --git a/src/test/java/org/apache/sling/hc/it/core/HealthCheckFilterTest.java b/src/test/java/org/apache/sling/hc/it/core/HealthCheckFilterTest.java
deleted file mode 100644
index 4a154f7..0000000
--- a/src/test/java/org/apache/sling/hc/it/core/HealthCheckFilterTest.java
+++ /dev/null
@@ -1,221 +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.it.core;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.apache.sling.hc.api.HealthCheck;
-import org.apache.sling.hc.api.Result;
-import org.apache.sling.hc.util.HealthCheckFilter;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@RunWith(PaxExam.class)
-public class HealthCheckFilterTest {
-
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- private HealthCheckFilter filter;
-
- @Inject
- private BundleContext bundleContext;
-
- private List<TestHealthCheck> testServices = new ArrayList<TestHealthCheck>();
- private static int instanceCounter = 0;
-
- class TestHealthCheck implements HealthCheck {
-
- private final int id;
- private final ServiceRegistration<?> reg;
- final String[] tags;
-
- TestHealthCheck(String... tags) {
- id = instanceCounter++;
- this.tags = tags;
- final Dictionary<String, Object> props = new Hashtable<String, Object>();
- if (tags != null) {
- props.put(HealthCheck.TAGS, tags);
- }
- props.put(HealthCheck.TAGS, tags);
- reg = bundleContext.registerService(HealthCheck.class.getName(),
- this, props);
- log.info("Registered {} with {}={}", new Object[] { this,
- HealthCheck.TAGS, props.get(HealthCheck.TAGS) });
- }
-
- @Override
- public String toString() {
- return Arrays.asList(tags).toString();
- }
-
- @Override
- public boolean equals(Object other) {
- return other instanceof TestHealthCheck
- && ((TestHealthCheck) other).id == id;
- }
-
- @Override
- public int hashCode() {
- return id;
- }
-
- @Override
- public Result execute() {
- return null;
- }
-
- void unregister() {
- reg.unregister();
- }
- }
-
- @Configuration
- public Option[] config() {
- return U.config();
- }
-
- @Before
- public void setup() {
- testServices.add(new TestHealthCheck("foo"));
- testServices.add(new TestHealthCheck("bar"));
- testServices.add(new TestHealthCheck("foo", "bar"));
- testServices.add(new TestHealthCheck("other", "thing"));
- testServices.add(new TestHealthCheck());
- filter = new HealthCheckFilter(bundleContext);
- }
-
- @After
- public void cleanup() {
- for (TestHealthCheck tc : testServices) {
- tc.unregister();
- }
- }
-
- /**
- * @param included
- * true or false, in the same order as testServices
- */
- private void assertServices(List<HealthCheck> s, boolean... included) {
- final Iterator<TestHealthCheck> it = testServices.iterator();
- for (boolean inc : included) {
- final TestHealthCheck thc = it.next();
- if (inc) {
- assertTrue("Expecting list of services to include " + thc,
- s.contains(thc));
- } else {
- assertFalse("Not expecting list of services to include " + thc,
- s.contains(thc));
- }
- }
- }
-
- @Test
- public void testSelectorService() {
- assertNotNull("Expecting HealthCheckSelector service to be provided",
- filter);
- }
-
- @Test
- public void testAllServices() {
- final List<HealthCheck> s = filter.getTaggedHealthChecks();
- assertServices(s, true, true, true, true, true);
- }
-
- @Test
- public void testEmptyTags() {
- final List<HealthCheck> s = filter.getTaggedHealthChecks("", "", "");
- assertServices(s, true, true, true, true, true);
- }
-
- @Test
- public void testFooTag() {
- final List<HealthCheck> s = filter.getTaggedHealthChecks("foo");
- assertServices(s, true, false, true, false, false);
- }
-
- @Test
- public void testBarTag() {
- final List<HealthCheck> s = filter.getTaggedHealthChecks("bar");
- assertServices(s, false, true, true, false, false);
- }
-
- @Test
- public void testFooAndBar() {
- final List<HealthCheck> s = filter.getTaggedHealthChecks("foo", "bar");
- assertServices(s, false, false, true, false, false);
- }
-
- @Test
- public void testFooMinusBar() {
- final List<HealthCheck> s = filter
- .getTaggedHealthChecks("foo", "-bar");
- assertServices(s, true, false, false, false, false);
- }
-
- @Test
- public void testWhitespace() {
- final List<HealthCheck> s = filter.getTaggedHealthChecks(
- "\t \n\r foo \t", "", " \t-bar\n", "");
- assertServices(s, true, false, false, false, false);
- }
-
- @Test
- public void testOther() {
- final List<HealthCheck> s = filter.getTaggedHealthChecks("other");
- assertServices(s, false, false, false, true, false);
- }
-
- @Test
- public void testMinusOther() {
- final List<HealthCheck> s = filter.getTaggedHealthChecks("-other");
- assertServices(s, true, true, true, false, true);
- }
-
- @Test
- public void testMinusOtherFoo() {
- final List<HealthCheck> s = filter.getTaggedHealthChecks("-other",
- "-foo");
- assertServices(s, false, true, false, false, true);
- }
-
- @Test
- public void testNoResults() {
- final List<HealthCheck> s = filter.getTaggedHealthChecks("NOT A TAG");
- assertTrue("Expecting no services", s.isEmpty());
- }
-}
diff --git a/src/test/java/org/apache/sling/hc/it/core/HealthCheckServletTest.java b/src/test/java/org/apache/sling/hc/it/core/HealthCheckServletTest.java
deleted file mode 100644
index b62ca67..0000000
--- a/src/test/java/org/apache/sling/hc/it/core/HealthCheckServletTest.java
+++ /dev/null
@@ -1,121 +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.it.core;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.UUID;
-
-import javax.inject.Inject;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.http.HttpService;
-
-/** Verify that the HealthCheckExecutorServlet becomes available
- * after creating the corresponding config
- */
-@RunWith(PaxExam.class)
-public class HealthCheckServletTest {
-
- @Inject
- private ConfigurationAdmin configAdmin;
-
- @Inject
- private BundleContext bundleContext;
-
- private MockHttpService httpService;
- private ServiceRegistration reg;
-
- @Configuration
- public Option[] config() {
- return U.config();
- }
-
- private int countServletServices(String packageNamePrefix) throws InvalidSyntaxException {
- final ServiceReference<?> [] refs = bundleContext.getServiceReferences("javax.servlet.Servlet", null);
- int count = 0;
- if(refs != null) {
- for(ServiceReference ref : refs) {
- final Object o = bundleContext.getService(ref);
- if(o.getClass().getName().startsWith(packageNamePrefix)) {
- count++;
- }
- bundleContext.ungetService(ref);
- }
- }
- return count;
- }
-
- @Before
- public void setup() {
- httpService = new MockHttpService();
- reg = bundleContext.registerService(HttpService.class, httpService, null);
- }
-
- @After
- public void cleanup() {
- reg.unregister();
- reg = null;
- httpService = null;
- }
-
- @Test
- public void testServletBecomesActive() throws InvalidSyntaxException, IOException, InterruptedException {
- final String property = "servletPath";
- final String path = "/test/" + UUID.randomUUID();
- final String packagePrefix = "org.apache.sling.hc";
- assertEquals("Initially expecting no servlet from " + packagePrefix, 0, countServletServices(packagePrefix));
- final int pathsBefore = httpService.getPaths().size();
-
- // Activate servlet and wait for it to show up
- final String pid = "org.apache.sling.hc.core.impl.servlet.HealthCheckExecutorServlet";
- final org.osgi.service.cm.Configuration cfg = configAdmin.getConfiguration(pid, null);
- final Dictionary<String, Object> props = new Hashtable<String, Object>();
- props.put(property, path);
- cfg.update(props);
-
- final long timeoutMsec = 5000L;
- final long endTime = System.currentTimeMillis() + timeoutMsec;
- while(System.currentTimeMillis() < endTime) {
- if(countServletServices(packagePrefix) > 0) {
- break;
- }
- Thread.sleep(50L);
- }
-
- assertEquals("After adding configuration, expecting one servlet from " + packagePrefix, 1, countServletServices(packagePrefix));
- final List<String> paths = httpService.getPaths();
- assertEquals("Expecting one new servlet registration", pathsBefore + 1, paths.size());
- assertEquals("Expecting the HC servlet to be registered at " + path, path, paths.get(paths.size() - 1));
- }
-}
diff --git a/src/test/java/org/apache/sling/hc/it/core/JmxAdjustableStatusForTestingTest.java b/src/test/java/org/apache/sling/hc/it/core/JmxAdjustableStatusForTestingTest.java
deleted file mode 100644
index 15a5425..0000000
--- a/src/test/java/org/apache/sling/hc/it/core/JmxAdjustableStatusForTestingTest.java
+++ /dev/null
@@ -1,155 +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.it.core;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.List;
-
-import javax.inject.Inject;
-import javax.management.DynamicMBean;
-
-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.api.ResultLog.Entry;
-import org.apache.sling.hc.api.execution.HealthCheckExecutionResult;
-import org.apache.sling.hc.api.execution.HealthCheckExecutor;
-import org.apache.sling.hc.util.FormattingResultLog;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-
-/** Test jmx-adjustable status for testing HC. */
-@RunWith(PaxExam.class)
-public class JmxAdjustableStatusForTestingTest {
-
- @Inject
- private HealthCheckExecutor executor;
-
- @Inject
- private BundleContext bundleContext;
-
- private static String testTag = "testTagName";
-
- @SuppressWarnings("rawtypes")
- private List<ServiceRegistration> regs = new ArrayList<ServiceRegistration>();
-
- @Configuration
- public Option[] config() {
- return U.config();
- }
-
- private void assertResult(String tag, Result.Status expected) {
- final Result result = getOverallResult(executor.execute(tag));
- assertEquals("Expected status " + expected + " for tag " + tag, expected, result.getStatus());
- }
-
- @Before
- public void setup() {
- U.expectHealthChecks(0, executor, testTag);
- registerHC(testTag);
- U.expectHealthChecks(1, executor, testTag);
- assertResult(testTag, Result.Status.OK);
- }
-
- @After
- @SuppressWarnings("rawtypes")
- public void cleanup() throws Exception {
- invokeMBean("reset", new Object[] {}, new String[] {});
-
- U.expectHealthChecks(1, executor, testTag);
- assertResult(testTag, Result.Status.OK);
-
- for (ServiceRegistration r : regs) {
- r.unregister();
- }
- regs.clear();
- U.expectHealthChecks(0, executor, testTag);
- }
-
- @Test
- public void testWarnStatus() throws Exception {
- invokeMBean("addWarnResultForTags", new Object[] { testTag }, new String[] { String.class.getName() });
- U.expectHealthChecks(2, executor, testTag);
- assertResult(testTag, Result.Status.WARN);
- }
-
- @Test
- public void testCriticalStatus() throws Exception {
- invokeMBean("addCriticalResultForTags", new Object[] { "anotherTag," + testTag },
- new String[] { String.class.getName() });
-
- final String [] tags = { "anotherTag", testTag };
- for(String tag : tags) {
- U.expectHealthChecks(2, executor, testTag);
- assertResult(tag, Result.Status.CRITICAL);
- }
- }
-
- @Test
- public void testAnotherTag() throws Exception {
- // Selecting an unused tag returns WARN - not sure why but
- // if that changes we should detect it.
- assertResult("some_unused_tag", Result.Status.WARN);
- }
-
- private void registerHC(final String... tags) {
- final HealthCheck hc = new HealthCheck() {
- @Override
- public Result execute() {
- return new Result(Result.Status.OK, "All good for " + tags[0]);
- }
- };
-
- final Dictionary<String, Object> props = new Hashtable<String, Object>();
- props.put(HealthCheck.NAME, "name_" + tags[0]);
- props.put(HealthCheck.TAGS, tags);
-
- regs.add(bundleContext.registerService(HealthCheck.class, hc, props));
- }
-
- private void invokeMBean(String operation, Object[] args, String[] signature) throws Exception {
-
- ServiceReference<?>[] serviceReference = bundleContext.getServiceReferences(DynamicMBean.class.getName(),
- "(jmx.objectname=org.apache.sling.healthcheck:type=AdjustableHealthCheckForTesting)");
- DynamicMBean mBean = (DynamicMBean) bundleContext.getService(serviceReference[0]);
- mBean.invoke(operation, args, signature);
-
- }
-
- private Result getOverallResult(List<HealthCheckExecutionResult> results) {
- FormattingResultLog resultLog = new FormattingResultLog();
- for (HealthCheckExecutionResult executionResult : results) {
- for (Entry entry : executionResult.getHealthCheckResult()) {
- resultLog.add(new ResultLog.Entry(entry.getStatus(), entry.getMessage(), entry.getException()));
- }
- }
- return new Result(resultLog);
- }
-}
diff --git a/src/test/java/org/apache/sling/hc/it/core/MockHttpService.java b/src/test/java/org/apache/sling/hc/it/core/MockHttpService.java
deleted file mode 100644
index 13d6548..0000000
--- a/src/test/java/org/apache/sling/hc/it/core/MockHttpService.java
+++ /dev/null
@@ -1,55 +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.it.core;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.List;
-
-import javax.servlet.Servlet;
-
-import org.osgi.service.http.HttpContext;
-import org.osgi.service.http.HttpService;
-
-class MockHttpService implements HttpService {
-
- private List<String> paths = new ArrayList<String>();
-
- @Override
- public void registerResources(String alias, String name, HttpContext context) {
- }
-
- @Override
- public void registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context) {
- paths.add(alias);
- }
-
- public void unregister(String alias) {
- paths.remove(alias);
- }
-
- @Override
- public HttpContext createDefaultHttpContext() {
- return null;
- }
-
- List<String> getPaths() {
- return Collections.unmodifiableList(paths);
- }
-}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 15/49: SLING-3278 broke integration
tests
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit d65d38a68d430d685debe2de2cdfc2d442f80dbe
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Dec 23 17:28:52 2013 +0000
SLING-3278 broke integration tests
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1553155 13f79535-47bb-0310-9956-ffa450edef68
---
src/test/java/org/apache/sling/hc/it/core/U.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/test/java/org/apache/sling/hc/it/core/U.java b/src/test/java/org/apache/sling/hc/it/core/U.java
index 6503add..70d71d3 100644
--- a/src/test/java/org/apache/sling/hc/it/core/U.java
+++ b/src/test/java/org/apache/sling/hc/it/core/U.java
@@ -59,9 +59,11 @@ public class U {
mavenBundle("org.apache.sling", "org.apache.sling.settings", "1.2.2"),
mavenBundle("org.apache.sling", "org.apache.sling.launchpad.api", "1.1.0"),
mavenBundle("org.apache.sling", "org.apache.sling.scripting.api", "2.1.0"),
+ mavenBundle("org.apache.sling", "org.apache.sling.commons.threads", "3.1.0"),
mavenBundle("commons-collections", "commons-collections", "3.2.1"),
mavenBundle("commons-io", "commons-io", "1.4"),
mavenBundle("commons-fileupload", "commons-fileupload", "1.2.2"),
+ mavenBundle("commons-lang", "commons-lang", "2.5"),
mavenBundle("org.mortbay.jetty", "servlet-api-2.5", "6.1.14")
)
);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 21/49: SLING-3624 - test
DynamicMBean registration from annotation
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 216a61315d5107805445ad0d4b721074c69a4c84
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Jul 31 09:31:34 2014 +0000
SLING-3624 - test DynamicMBean registration from annotation
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1614840 13f79535-47bb-0310-9956-ffa450edef68
---
.../sling/hc/it/core/SampleHealthChecksTest.java | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/sling/hc/it/core/SampleHealthChecksTest.java b/src/test/java/org/apache/sling/hc/it/core/SampleHealthChecksTest.java
index be0f901..e8ed466 100644
--- a/src/test/java/org/apache/sling/hc/it/core/SampleHealthChecksTest.java
+++ b/src/test/java/org/apache/sling/hc/it/core/SampleHealthChecksTest.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue;
import java.util.List;
import javax.inject.Inject;
+import javax.management.DynamicMBean;
import org.apache.sling.hc.api.execution.HealthCheckExecutionResult;
import org.apache.sling.hc.api.execution.HealthCheckExecutor;
@@ -32,6 +33,9 @@ import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
@RunWith(PaxExam.class)
public class SampleHealthChecksTest {
@@ -39,13 +43,16 @@ public class SampleHealthChecksTest {
@Inject
private HealthCheckExecutor executor;
+ @Inject
+ private BundleContext bundleContext;
+
@Configuration
public Option[] config() {
return U.config();
}
-
+
@Test
- public void testAnnotatedHealthCheck() {
+ public void testAnnotatedHC() {
final List<HealthCheckExecutionResult> results = executor.execute("annotation","sample");
assertNotNull("Expecting non-null results");
assertEquals("Expecting a single result", 1, results.size());
@@ -56,4 +63,13 @@ public class SampleHealthChecksTest {
"Expecting first log message to contain " + expected,
r.getHealthCheckResult().iterator().next().getMessage().contains(expected));
}
+
+ @Test
+ public void testAnnotatedHCMBean() throws InvalidSyntaxException {
+ // Verify that we have a DynamicMBean service with the right name, the JMX whiteboard will do the rest
+ final String filter = "(jmx.objectname=org.apache.sling.healthcheck:type=HealthCheck,name=annotatedHC)";
+ final ServiceReference<?> [] refs = bundleContext.getServiceReferences(DynamicMBean.class.getName(), filter);
+ assertNotNull("Expecting non-null ServiceReferences for " + filter, refs);
+ assertEquals("Expecting a single ServiceReference for " + filter, 1, refs.length);
+ }
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 23/49: Back to snapshots,
until the released modules are available
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit e82c975bc3619ba669b2e7d6db275584081eab19
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Sep 1 16:25:57 2014 +0000
Back to snapshots, until the released modules are available
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1621837 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index 65d8625..fa03034 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,8 +24,8 @@
<org.ops4j.pax.logging.DefaultServiceLog.level>INFO</org.ops4j.pax.logging.DefaultServiceLog.level>
<felix.shell>false</felix.shell>
<sling.java.version>6</sling.java.version>
- <sling.hc.samples.version>1.0.5-SNAPSHOT</sling.hc.samples.version>
- <sling.hc.core.version>${project.version}</sling.hc.core.version>
+ <sling.hc.samples.version>1.0.7-SNAPSHOT</sling.hc.samples.version>
+ <sling.hc.core.version>1.1.3-SNAPSHOT</sling.hc.core.version>
</properties>
<scm>
@@ -55,7 +55,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.hc.core</artifactId>
- <version>${project.version}</version>
+ <version>${sling.hc.core.version}</version>
<scope>test</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-it] 29/49: Use latest snapshot version
of hc core
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 8a7ff4215aa283d347880e37d195659cf830f0d2
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Apr 27 08:55:41 2015 +0000
Use latest snapshot version of hc core
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1676229 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 1363a88..fdd1d33 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
<felix.shell>false</felix.shell>
<sling.java.version>6</sling.java.version>
<sling.hc.samples.version>1.0.7-SNAPSHOT</sling.hc.samples.version>
- <sling.hc.core.version>1.2.1-SNAPSHOT</sling.hc.core.version>
+ <sling.hc.core.version>1.2.3-SNAPSHOT</sling.hc.core.version>
</properties>
<scm>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 03/49: 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 branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 81ce4c0ccdff1c85f958a761de8651381d31e5af
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@1526483 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/pom.xml b/pom.xml
index 24982af..5c35732 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,6 +29,12 @@
<sling.java.version>6</sling.java.version>
</properties>
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/it</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/it</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/it</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-it] 34/49: set parent version to 24 and
add empty relativePath where missing
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit f27643686641489ba7c6a1f2f81fb1ecfe02570e
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jul 7 08:09:17 2015 +0000
set parent version to 24 and add empty relativePath where missing
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1689593 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 8e97f45..b0da36e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>23</version>
+ <version>24</version>
<relativePath/>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 46/49: Correct versions
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit d91f301222113c5133ac3fdd8a79392aac78648e
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue May 16 12:18:02 2017 +0000
Correct versions
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1795302 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index 65ac818..78752ee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -42,9 +42,9 @@
<org.ops4j.pax.logging.DefaultServiceLog.level>INFO</org.ops4j.pax.logging.DefaultServiceLog.level>
<felix.shell>false</felix.shell>
<sling.hc.samples.version>1.0.7-SNAPSHOT</sling.hc.samples.version>
- <sling.hc.api.version>0.0.99-SNAPSHOT</sling.hc.api.version>
- <sling.hc.core.version>1.2.7-SNAPSHOT</sling.hc.core.version>
- <sling.johnzon.version>0.1.0-SNAPSHOT</sling.johnzon.version>
+ <sling.hc.api.version>1.0.1-SNAPSHOT</sling.hc.api.version>
+ <sling.hc.core.version>1.2.9-SNAPSHOT</sling.hc.core.version>
+ <sling.johnzon.version>1.0.0</sling.johnzon.version>
</properties>
<scm>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 26/49: SLING-3501 -
HealthCheckExecutorSelectionTest added
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 080f55cac26cf5d4b0a4bd6a17a341d407d78c35
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Jan 5 16:20:43 2015 +0000
SLING-3501 - HealthCheckExecutorSelectionTest added
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1649570 13f79535-47bb-0310-9956-ffa450edef68
---
.../it/core/HealthCheckExecutorSelectionTest.java | 121 +++++++++++++++++++++
src/test/java/org/apache/sling/hc/it/core/U.java | 6 +-
2 files changed, 125 insertions(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/sling/hc/it/core/HealthCheckExecutorSelectionTest.java b/src/test/java/org/apache/sling/hc/it/core/HealthCheckExecutorSelectionTest.java
new file mode 100644
index 0000000..91054b3
--- /dev/null
+++ b/src/test/java/org/apache/sling/hc/it/core/HealthCheckExecutorSelectionTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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.it.core;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.UUID;
+
+import javax.inject.Inject;
+
+import org.apache.sling.hc.api.HealthCheck;
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.api.execution.HealthCheckExecutor;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/** Test the HealthCheckExecutor selection mechanism */
+@RunWith(PaxExam.class)
+public class HealthCheckExecutorSelectionTest {
+
+ @Inject
+ private HealthCheckExecutor executor;
+
+ @Inject
+ private BundleContext bundleContext;
+
+ private static String idA;
+ private static String idB;
+
+ @SuppressWarnings("rawtypes")
+ private List<ServiceRegistration> regs = new ArrayList<ServiceRegistration>();
+
+ @Configuration
+ public Option[] config() {
+ return U.config();
+ }
+
+ private void registerHC(final String id) {
+ final HealthCheck hc = new HealthCheck() {
+ @Override
+ public Result execute() {
+ return new Result(Result.Status.OK, "All good for " + id);
+ }
+
+ };
+
+ final Dictionary<String, Object> props = new Hashtable<String, Object>();
+ props.put(HealthCheck.NAME, "name_" + id);
+ props.put(HealthCheck.TAGS, id);
+
+ regs.add(bundleContext.registerService(HealthCheck.class, hc, props));
+ }
+
+ @BeforeClass
+ public static void setId() {
+ idA = UUID.randomUUID().toString();
+ idB = UUID.randomUUID().toString();
+ }
+
+ @Before
+ public void setup() {
+ U.expectHealthChecks(0, executor, idA);
+ U.expectHealthChecks(0, executor, idB);
+
+ registerHC(idA);
+ registerHC(idB);
+ registerHC(idB);
+ registerHC(idB);
+ }
+
+ @After
+ @SuppressWarnings("rawtypes")
+ public void cleanup() {
+ for(ServiceRegistration r : regs) {
+ r.unregister();
+ }
+ regs.clear();
+
+ U.expectHealthChecks(0, executor, idA);
+ U.expectHealthChecks(0, executor, idB);
+ }
+
+ @Test
+ public void testDefaultSelectionA(){
+ U.expectHealthChecks(1, executor, idA);
+ }
+
+ @Test
+ public void testDefaultSelectionB(){
+ U.expectHealthChecks(3, executor, idB);
+ }
+ @Test
+ public void testDefaultSelectionAandB(){
+ U.expectHealthChecks(0, executor, idA, idB);
+ }
+}
diff --git a/src/test/java/org/apache/sling/hc/it/core/U.java b/src/test/java/org/apache/sling/hc/it/core/U.java
index 99dc4ab..91333d7 100644
--- a/src/test/java/org/apache/sling/hc/it/core/U.java
+++ b/src/test/java/org/apache/sling/hc/it/core/U.java
@@ -38,9 +38,11 @@ public class U {
/** Wait until the specified number of health checks are seen by supplied executor */
static void expectHealthChecks(int howMany, HealthCheckExecutor executor, String ... tags) {
final long timeout = System.currentTimeMillis() + 10000L;
+ int count = 0;
while(System.currentTimeMillis() < timeout) {
final List<HealthCheckExecutionResult> results = executor.execute(tags);
- if(results.size() == howMany) {
+ count = results.size();
+ if(count== howMany) {
return;
}
try {
@@ -49,7 +51,7 @@ public class U {
throw new RuntimeException("Unexpected InterruptedException");
}
}
- fail("Did not get " + howMany + " health checks with tags " + Arrays.asList(tags) + " after " + timeout + " msec");
+ fail("Did not get " + howMany + " health checks with tags " + Arrays.asList(tags) + " after " + timeout + " msec (last count=" + count + ")");
}
static Option[] config() {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 31/49: SLING-4698 - Set
parent.relativePath to empty for all modules
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 11c0b735975a60c4f5ff28ddfbb4ec9a578b349b
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu May 7 10:14:40 2015 +0000
SLING-4698 - Set parent.relativePath to empty for all modules
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1678154 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index e4b9fa1..dae897c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
<version>22</version>
- <relativePath>../../../../parent/pom.xml</relativePath>
+ <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-it] 49/49: Fixed broken build in
HelthCheck Core IT tests
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 4696f3f0ac7c8bdaa9a14fbaba53b855c7d04622
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Oct 12 15:13:05 2017 +0000
Fixed broken build in HelthCheck Core IT tests
Submitted-By: Ian Boston
Closes #254
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1811978 13f79535-47bb-0310-9956-ffa450edef68
---
src/test/java/org/apache/sling/hc/it/core/U.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/test/java/org/apache/sling/hc/it/core/U.java b/src/test/java/org/apache/sling/hc/it/core/U.java
index 1bf33f4..a063808 100644
--- a/src/test/java/org/apache/sling/hc/it/core/U.java
+++ b/src/test/java/org/apache/sling/hc/it/core/U.java
@@ -113,7 +113,8 @@ public class U {
mavenBundle("commons-collections", "commons-collections", "3.2.1"),
mavenBundle("commons-io", "commons-io", "1.4"),
mavenBundle("commons-fileupload", "commons-fileupload", "1.2.2"),
- mavenBundle("commons-lang", "commons-lang", "2.5") )
+ mavenBundle("commons-lang", "commons-lang", "2.5") ,
+ mavenBundle("org.apache.commons", "commons-lang3", "3.6"))
);
}
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 07/49: [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 branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit a53c57975d3e0e2ae46d331d38ef7fa795855878
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@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 b46c2f5..5a0d3f3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.hc.it</artifactId>
<packaging>jar</packaging>
- <version>1.0.1-SNAPSHOT</version>
+ <version>1.0.2</version>
<name>Apache Sling Health Check Integration Tests</name>
<inceptionYear>2013</inceptionYear>
@@ -27,9 +27,9 @@
</properties>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/it</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/it</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/it</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.core-1.0.2/bundles/extensions/healthcheck/it</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.core-1.0.2/bundles/extensions/healthcheck/it</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.hc.core-1.0.2/bundles/extensions/healthcheck/it</url>
</scm>
<build>
@@ -52,7 +52,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>test</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-it] 40/49: SLING-4941 - restructure
tests and add testAnotherTag()
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 1615e4b7ed7e9f5f4d67d16ecd9c53e031ee1f17
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Feb 29 09:50:27 2016 +0000
SLING-4941 - restructure tests and add testAnotherTag()
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1732840 13f79535-47bb-0310-9956-ffa450edef68
---
.../it/core/JmxAdjustableStatusForTestingTest.java | 66 +++++++++++-----------
1 file changed, 34 insertions(+), 32 deletions(-)
diff --git a/src/test/java/org/apache/sling/hc/it/core/JmxAdjustableStatusForTestingTest.java b/src/test/java/org/apache/sling/hc/it/core/JmxAdjustableStatusForTestingTest.java
index 96ed2fa..15a5425 100644
--- a/src/test/java/org/apache/sling/hc/it/core/JmxAdjustableStatusForTestingTest.java
+++ b/src/test/java/org/apache/sling/hc/it/core/JmxAdjustableStatusForTestingTest.java
@@ -64,16 +64,28 @@ public class JmxAdjustableStatusForTestingTest {
public Option[] config() {
return U.config();
}
+
+ private void assertResult(String tag, Result.Status expected) {
+ final Result result = getOverallResult(executor.execute(tag));
+ assertEquals("Expected status " + expected + " for tag " + tag, expected, result.getStatus());
+ }
@Before
public void setup() {
U.expectHealthChecks(0, executor, testTag);
registerHC(testTag);
+ U.expectHealthChecks(1, executor, testTag);
+ assertResult(testTag, Result.Status.OK);
}
@After
@SuppressWarnings("rawtypes")
- public void cleanup() {
+ public void cleanup() throws Exception {
+ invokeMBean("reset", new Object[] {}, new String[] {});
+
+ U.expectHealthChecks(1, executor, testTag);
+ assertResult(testTag, Result.Status.OK);
+
for (ServiceRegistration r : regs) {
r.unregister();
}
@@ -82,40 +94,31 @@ public class JmxAdjustableStatusForTestingTest {
}
@Test
- public void testJmxAdjustableStatusForTesting() throws Exception {
-
- U.expectHealthChecks(1, executor, testTag);
-
- Result result = getOverallResult(executor.execute(testTag));
- assertEquals(Result.Status.OK, result.getStatus());
-
+ public void testWarnStatus() throws Exception {
invokeMBean("addWarnResultForTags", new Object[] { testTag }, new String[] { String.class.getName() });
-
- U.expectHealthChecks(2, executor, testTag);
- result = getOverallResult(executor.execute(testTag));
- assertEquals(Result.Status.WARN, result.getStatus());
-
- invokeMBean("reset", new Object[] {}, new String[] {});
-
- U.expectHealthChecks(1, executor, testTag);
- result = getOverallResult(executor.execute(testTag));
- assertEquals(Result.Status.OK, result.getStatus());
-
- invokeMBean("addCriticalResultForTags", new Object[] { "anotherTag," + testTag },
- new String[] { String.class.getName() });
-
U.expectHealthChecks(2, executor, testTag);
- result = getOverallResult(executor.execute(testTag));
- assertEquals(Result.Status.CRITICAL, result.getStatus());
-
- invokeMBean("reset", new Object[] {}, new String[] {});
-
- U.expectHealthChecks(1, executor, testTag);
- result = getOverallResult(executor.execute(testTag));
- assertEquals(Result.Status.OK, result.getStatus());
-
+ assertResult(testTag, Result.Status.WARN);
}
+ @Test
+ public void testCriticalStatus() throws Exception {
+ invokeMBean("addCriticalResultForTags", new Object[] { "anotherTag," + testTag },
+ new String[] { String.class.getName() });
+
+ final String [] tags = { "anotherTag", testTag };
+ for(String tag : tags) {
+ U.expectHealthChecks(2, executor, testTag);
+ assertResult(tag, Result.Status.CRITICAL);
+ }
+ }
+
+ @Test
+ public void testAnotherTag() throws Exception {
+ // Selecting an unused tag returns WARN - not sure why but
+ // if that changes we should detect it.
+ assertResult("some_unused_tag", Result.Status.WARN);
+ }
+
private void registerHC(final String... tags) {
final HealthCheck hc = new HealthCheck() {
@Override
@@ -149,5 +152,4 @@ public class JmxAdjustableStatusForTestingTest {
}
return new Result(resultLog);
}
-
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 30/49: Add missing licence header
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit e96959796d184bc04301cdad55c45a230d49bdcd
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Apr 27 14:55:57 2015 +0000
Add missing licence header
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1676286 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/pom.xml b/pom.xml
index fdd1d33..e4b9fa1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,4 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 48/49: SLING-7167 Adjust READMEs
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit c46c5ae0d03f636a9ee82ff4be3b13a8915f295b
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Oct 3 09:22:30 2017 +0000
SLING-7167 Adjust READMEs
add missing README
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1810695 13f79535-47bb-0310-9956-ffa450edef68
---
README.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..d144794
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+# Apache Sling Health Check Integration Tests
+
+This module is part of the [Apache Sling](https://sling.apache.org) project.
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 06/49: [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 branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 8ed14441ecad1343b714a0d844c848cc8e56c897
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@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 3f32f2f..b46c2f5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.hc.it</artifactId>
<packaging>jar</packaging>
- <version>1.0.0</version>
+ <version>1.0.1-SNAPSHOT</version>
<name>Apache Sling Health Check Integration Tests</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/it</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.core-1.0.0/bundles/extensions/healthcheck/it</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.hc.core-1.0.0/bundles/extensions/healthcheck/it</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/it</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/it</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/it</url>
</scm>
<build>
@@ -52,7 +52,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>test</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-it] 36/49: SLING-4862 - add test for HC
servlet activation
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit ed635e0b50996760ec457fd4930cfc753d53bd9f
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Aug 14 11:31:39 2015 +0000
SLING-4862 - add test for HC servlet activation
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1695866 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 13 ++-
.../sling/hc/it/core/HealthCheckServletTest.java | 121 +++++++++++++++++++++
.../apache/sling/hc/it/core/MockHttpService.java | 55 ++++++++++
src/test/java/org/apache/sling/hc/it/core/U.java | 4 +-
4 files changed, 191 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index b0da36e..eb7b03f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -121,5 +121,16 @@
<version>4.2.1</version>
<scope>test</scope>
</dependency>
- </dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.http.servlet-api</artifactId>
+ <version>1.1.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
diff --git a/src/test/java/org/apache/sling/hc/it/core/HealthCheckServletTest.java b/src/test/java/org/apache/sling/hc/it/core/HealthCheckServletTest.java
new file mode 100644
index 0000000..b62ca67
--- /dev/null
+++ b/src/test/java/org/apache/sling/hc/it/core/HealthCheckServletTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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.it.core;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.UUID;
+
+import javax.inject.Inject;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.http.HttpService;
+
+/** Verify that the HealthCheckExecutorServlet becomes available
+ * after creating the corresponding config
+ */
+@RunWith(PaxExam.class)
+public class HealthCheckServletTest {
+
+ @Inject
+ private ConfigurationAdmin configAdmin;
+
+ @Inject
+ private BundleContext bundleContext;
+
+ private MockHttpService httpService;
+ private ServiceRegistration reg;
+
+ @Configuration
+ public Option[] config() {
+ return U.config();
+ }
+
+ private int countServletServices(String packageNamePrefix) throws InvalidSyntaxException {
+ final ServiceReference<?> [] refs = bundleContext.getServiceReferences("javax.servlet.Servlet", null);
+ int count = 0;
+ if(refs != null) {
+ for(ServiceReference ref : refs) {
+ final Object o = bundleContext.getService(ref);
+ if(o.getClass().getName().startsWith(packageNamePrefix)) {
+ count++;
+ }
+ bundleContext.ungetService(ref);
+ }
+ }
+ return count;
+ }
+
+ @Before
+ public void setup() {
+ httpService = new MockHttpService();
+ reg = bundleContext.registerService(HttpService.class, httpService, null);
+ }
+
+ @After
+ public void cleanup() {
+ reg.unregister();
+ reg = null;
+ httpService = null;
+ }
+
+ @Test
+ public void testServletBecomesActive() throws InvalidSyntaxException, IOException, InterruptedException {
+ final String property = "servletPath";
+ final String path = "/test/" + UUID.randomUUID();
+ final String packagePrefix = "org.apache.sling.hc";
+ assertEquals("Initially expecting no servlet from " + packagePrefix, 0, countServletServices(packagePrefix));
+ final int pathsBefore = httpService.getPaths().size();
+
+ // Activate servlet and wait for it to show up
+ final String pid = "org.apache.sling.hc.core.impl.servlet.HealthCheckExecutorServlet";
+ final org.osgi.service.cm.Configuration cfg = configAdmin.getConfiguration(pid, null);
+ final Dictionary<String, Object> props = new Hashtable<String, Object>();
+ props.put(property, path);
+ cfg.update(props);
+
+ final long timeoutMsec = 5000L;
+ final long endTime = System.currentTimeMillis() + timeoutMsec;
+ while(System.currentTimeMillis() < endTime) {
+ if(countServletServices(packagePrefix) > 0) {
+ break;
+ }
+ Thread.sleep(50L);
+ }
+
+ assertEquals("After adding configuration, expecting one servlet from " + packagePrefix, 1, countServletServices(packagePrefix));
+ final List<String> paths = httpService.getPaths();
+ assertEquals("Expecting one new servlet registration", pathsBefore + 1, paths.size());
+ assertEquals("Expecting the HC servlet to be registered at " + path, path, paths.get(paths.size() - 1));
+ }
+}
diff --git a/src/test/java/org/apache/sling/hc/it/core/MockHttpService.java b/src/test/java/org/apache/sling/hc/it/core/MockHttpService.java
new file mode 100644
index 0000000..13d6548
--- /dev/null
+++ b/src/test/java/org/apache/sling/hc/it/core/MockHttpService.java
@@ -0,0 +1,55 @@
+/*
+ * 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.it.core;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.List;
+
+import javax.servlet.Servlet;
+
+import org.osgi.service.http.HttpContext;
+import org.osgi.service.http.HttpService;
+
+class MockHttpService implements HttpService {
+
+ private List<String> paths = new ArrayList<String>();
+
+ @Override
+ public void registerResources(String alias, String name, HttpContext context) {
+ }
+
+ @Override
+ public void registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context) {
+ paths.add(alias);
+ }
+
+ public void unregister(String alias) {
+ paths.remove(alias);
+ }
+
+ @Override
+ public HttpContext createDefaultHttpContext() {
+ return null;
+ }
+
+ List<String> getPaths() {
+ return Collections.unmodifiableList(paths);
+ }
+}
diff --git a/src/test/java/org/apache/sling/hc/it/core/U.java b/src/test/java/org/apache/sling/hc/it/core/U.java
index 53aaaa0..38b3f91 100644
--- a/src/test/java/org/apache/sling/hc/it/core/U.java
+++ b/src/test/java/org/apache/sling/hc/it/core/U.java
@@ -75,11 +75,13 @@ public class U {
provision(
mavenBundle("org.apache.felix", "org.apache.felix.gogo.shell", "0.10.0"),
mavenBundle("org.apache.felix", "org.apache.felix.gogo.runtime", "0.10.0"),
- mavenBundle("org.apache.felix", "org.apache.felix.gogo.command", "0.12.0")
+ mavenBundle("org.apache.felix", "org.apache.felix.gogo.command", "0.12.0"),
+ mavenBundle("org.apache.felix", "org.apache.felix.shell.remote", "1.1.2")
)
),
provision(
mavenBundle("org.apache.felix", "org.apache.felix.scr", "1.6.2"),
+ mavenBundle("org.apache.felix", "org.apache.felix.configadmin", "1.8.8"),
mavenBundle("org.apache.felix", "org.apache.felix.http.servlet-api", "1.1.0"),
mavenBundle("org.apache.sling", "org.apache.sling.hc.core", coreVersion),
mavenBundle("org.apache.sling", "org.apache.sling.hc.samples", samplesVersion),
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 17/49: Update to parent pom v19
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 9b54651073f37da2de47f3a7fd017c94b91b7dca
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Mar 31 14:39:20 2014 +0000
Update to parent pom v19
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1583337 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index d124bb6..2c950bc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>18</version>
+ <version>19</version>
<relativePath>../../../../parent/pom.xml</relativePath>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 28/49: Correct health check
dependencies
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 550e1b5051736803c2d9fe99ef08ca2ff9080351
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Apr 10 11:49:08 2015 +0000
Correct health check dependencies
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1672617 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 836a6c5..1363a88 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
<felix.shell>false</felix.shell>
<sling.java.version>6</sling.java.version>
<sling.hc.samples.version>1.0.7-SNAPSHOT</sling.hc.samples.version>
- <sling.hc.core.version>1.1.3-SNAPSHOT</sling.hc.core.version>
+ <sling.hc.core.version>1.2.1-SNAPSHOT</sling.hc.core.version>
</properties>
<scm>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 24/49: Update to Sling Parent POM 22
with baselining enabled
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 1e6b20d2c9811bc2d463f784128dd361c2877f2b
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Oct 1 06:57:44 2014 +0000
Update to Sling Parent POM 22 with baselining enabled
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1628622 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index fa03034..836a6c5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>20</version>
+ <version>22</version>
<relativePath>../../../../parent/pom.xml</relativePath>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 13/49: Use latest core snapshot
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 8a95dc00f2bd0889727d561865c0d13981d6016f
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Oct 21 11:27:33 2013 +0000
Use latest core snapshot
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1534100 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 8fe42e4..374f9ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,7 +52,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.hc.core</artifactId>
- <version>1.0.5-SNAPSHOT</version>
+ <version>1.0.7-SNAPSHOT</version>
<scope>test</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-it] 47/49: Remove the commons.json
bundle from the hc it tests
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit c240f1f7677e2a3ebbc82540bd23d09373505f05
Author: Karl Pauls <pa...@apache.org>
AuthorDate: Fri Jun 2 11:10:37 2017 +0000
Remove the commons.json bundle from the hc it tests
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1797371 13f79535-47bb-0310-9956-ffa450edef68
---
src/test/java/org/apache/sling/hc/it/core/U.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/test/java/org/apache/sling/hc/it/core/U.java b/src/test/java/org/apache/sling/hc/it/core/U.java
index e9a8c6a..1bf33f4 100644
--- a/src/test/java/org/apache/sling/hc/it/core/U.java
+++ b/src/test/java/org/apache/sling/hc/it/core/U.java
@@ -99,7 +99,6 @@ public class U {
mavenBundle("org.apache.sling", "org.apache.sling.hc.core", coreVersion),
mavenBundle("org.apache.sling", "org.apache.sling.hc.samples", samplesVersion),
mavenBundle("org.apache.sling", "org.apache.sling.commons.osgi", "2.2.0"),
- mavenBundle("org.apache.sling", "org.apache.sling.commons.json", "2.0.10"),
mavenBundle("org.apache.sling", "org.apache.sling.jcr.jcr-wrapper", "2.0.0"),
mavenBundle("org.apache.sling", "org.apache.sling.api", "2.4.2"),
mavenBundle("org.apache.sling", "org.apache.sling.jcr.api", "2.1.0"),
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 33/49: Remove superflous
sling.java.version=6 as it's the default now
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 5167ae0e3b75694ef6686869bce6dcf26227a714
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Jun 25 13:14:53 2015 +0000
Remove superflous sling.java.version=6 as it's the default now
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1687505 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 1 -
1 file changed, 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 5f7abc1..8e97f45 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,7 +41,6 @@
<url.version>1.5.2</url.version>
<org.ops4j.pax.logging.DefaultServiceLog.level>INFO</org.ops4j.pax.logging.DefaultServiceLog.level>
<felix.shell>false</felix.shell>
- <sling.java.version>6</sling.java.version>
<sling.hc.samples.version>1.0.7-SNAPSHOT</sling.hc.samples.version>
<sling.hc.core.version>1.2.3-SNAPSHOT</sling.hc.core.version>
</properties>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 42/49: SLING-6074 - Healthcheck ITs
fail in isolated job on Jenkins
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 9837ba97d44d70fb8452d46e21bf50f29dd1c147
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Sep 29 13:50:22 2016 +0000
SLING-6074 - Healthcheck ITs fail in isolated job on Jenkins
Manually define the repositories to be used by pax-exam. I had
to define both manually as just adding the apache snapshots one
resulted in maven central no longer being used.
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1762778 13f79535-47bb-0310-9956-ffa450edef68
---
src/test/java/org/apache/sling/hc/it/core/U.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/test/java/org/apache/sling/hc/it/core/U.java b/src/test/java/org/apache/sling/hc/it/core/U.java
index 38b3f91..514066a 100644
--- a/src/test/java/org/apache/sling/hc/it/core/U.java
+++ b/src/test/java/org/apache/sling/hc/it/core/U.java
@@ -22,6 +22,7 @@ import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.provision;
+import static org.ops4j.pax.exam.CoreOptions.repository;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import static org.ops4j.pax.exam.CoreOptions.when;
@@ -67,6 +68,8 @@ public class U {
final boolean felixShell = "true".equals(System.getProperty("felix.shell", "false"));
return options(
+ repository("https://repo.maven.apache.org/maven2/").id("central"),
+ repository("https://repository.apache.org/snapshots/").id("apache-snapshots").allowSnapshots(),
when(localRepo.length() > 0).useOptions(
systemProperty("org.ops4j.pax.url.mvn.localRepository").value(localRepo)
),
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 22/49: Updated to parent version 20
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 004a5a9a78f4ebe96d8546af6e8031e197b74840
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Fri Aug 1 19:16:26 2014 +0000
Updated to parent version 20
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1615208 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 54b9344..65d8625 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>19</version>
+ <version>20</version>
<relativePath>../../../../parent/pom.xml</relativePath>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 44/49: Update some bundles and
framework version to get it tests running again
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 9053580686223780689f764f5a261206499d2380
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Apr 28 09:42:39 2017 +0000
Update some bundles and framework version to get it tests running again
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1793027 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
src/test/java/org/apache/sling/hc/it/core/U.java | 19 +++++++++++--------
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/pom.xml b/pom.xml
index 59d24b6..65ac818 100644
--- a/pom.xml
+++ b/pom.xml
@@ -122,7 +122,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
- <version>4.2.1</version>
+ <version>5.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/src/test/java/org/apache/sling/hc/it/core/U.java b/src/test/java/org/apache/sling/hc/it/core/U.java
index 3812163..f99461d 100644
--- a/src/test/java/org/apache/sling/hc/it/core/U.java
+++ b/src/test/java/org/apache/sling/hc/it/core/U.java
@@ -41,7 +41,7 @@ public class U {
static void expectHealthChecks(int howMany, HealthCheckExecutor executor, String ... tags) {
expectHealthChecks(howMany, executor, new HealthCheckExecutionOptions(), tags);
}
-
+
/** Wait until the specified number of health checks are seen by supplied executor */
static void expectHealthChecks(int howMany, HealthCheckExecutor executor, HealthCheckExecutionOptions options, String ... tags) {
final long timeout = System.currentTimeMillis() + 10000L;
@@ -60,7 +60,7 @@ public class U {
}
fail("Did not get " + howMany + " health checks with tags " + Arrays.asList(tags) + " after " + timeout + " msec (last count=" + count + ")");
}
-
+
static Option[] config() {
final String apiVersion = System.getProperty("sling.hc.api.version");
final String coreVersion = System.getProperty("sling.hc.core.version");
@@ -74,7 +74,7 @@ public class U {
repository("https://repository.apache.org/snapshots/").id("apache-snapshots").allowSnapshots(),
when(localRepo.length() > 0).useOptions(
systemProperty("org.ops4j.pax.url.mvn.localRepository").value(localRepo)
- ),
+ ),
junitBundles(),
when(felixShell).useOptions(
provision(
@@ -85,8 +85,13 @@ public class U {
)
),
provision(
- mavenBundle("org.apache.felix", "org.apache.felix.scr", "1.6.2"),
- mavenBundle("org.apache.felix", "org.apache.felix.configadmin", "1.8.8"),
+ mavenBundle("org.apache.sling", "org.apache.sling.commons.log", "4.0.6"),
+ mavenBundle("org.apache.sling", "org.apache.sling.commons.logservice", "1.0.6"),
+ mavenBundle("org.slf4j", "slf4j-api", "1.7.13"),
+ mavenBundle("org.slf4j", "jcl-over-slf4j", "1.7.13"),
+ mavenBundle("org.slf4j", "log4j-over-slf4j", "1.7.13"),
+ mavenBundle("org.apache.felix", "org.apache.felix.scr", "2.0.8"),
+ mavenBundle("org.apache.felix", "org.apache.felix.configadmin", "1.8.10"),
mavenBundle("org.apache.felix", "org.apache.felix.http.servlet-api", "1.1.0"),
mavenBundle("org.apache.sling", "org.apache.sling.commons.johnzon", johnzonVersion),
mavenBundle("org.apache.sling", "org.apache.sling.hc.api", apiVersion),
@@ -108,9 +113,7 @@ public class U {
mavenBundle("commons-collections", "commons-collections", "3.2.1"),
mavenBundle("commons-io", "commons-io", "1.4"),
mavenBundle("commons-fileupload", "commons-fileupload", "1.2.2"),
- mavenBundle("commons-lang", "commons-lang", "2.5"),
- mavenBundle("org.mortbay.jetty", "servlet-api-2.5", "6.1.14")
- )
+ mavenBundle("commons-lang", "commons-lang", "2.5") )
);
}
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 27/49: SLING-3501 - add tests for OR
selection option in HealthCheckExecutor
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 785417aa11c99ac6255f127e3df311e506f26a93
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Jan 5 16:41:16 2015 +0000
SLING-3501 - add tests for OR selection option in HealthCheckExecutor
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1649583 13f79535-47bb-0310-9956-ffa450edef68
---
.../it/core/HealthCheckExecutorSelectionTest.java | 42 +++++++++++++++++-----
src/test/java/org/apache/sling/hc/it/core/U.java | 8 ++++-
2 files changed, 41 insertions(+), 9 deletions(-)
diff --git a/src/test/java/org/apache/sling/hc/it/core/HealthCheckExecutorSelectionTest.java b/src/test/java/org/apache/sling/hc/it/core/HealthCheckExecutorSelectionTest.java
index 91054b3..88c9bfe 100644
--- a/src/test/java/org/apache/sling/hc/it/core/HealthCheckExecutorSelectionTest.java
+++ b/src/test/java/org/apache/sling/hc/it/core/HealthCheckExecutorSelectionTest.java
@@ -27,6 +27,7 @@ import javax.inject.Inject;
import org.apache.sling.hc.api.HealthCheck;
import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.api.execution.HealthCheckExecutionOptions;
import org.apache.sling.hc.api.execution.HealthCheckExecutor;
import org.junit.After;
import org.junit.Before;
@@ -51,6 +52,7 @@ public class HealthCheckExecutorSelectionTest {
private static String idA;
private static String idB;
+ private HealthCheckExecutionOptions options;
@SuppressWarnings("rawtypes")
private List<ServiceRegistration> regs = new ArrayList<ServiceRegistration>();
@@ -60,18 +62,18 @@ public class HealthCheckExecutorSelectionTest {
return U.config();
}
- private void registerHC(final String id) {
+ private void registerHC(final String ... tags) {
final HealthCheck hc = new HealthCheck() {
@Override
public Result execute() {
- return new Result(Result.Status.OK, "All good for " + id);
+ return new Result(Result.Status.OK, "All good for " + tags[0]);
}
};
final Dictionary<String, Object> props = new Hashtable<String, Object>();
- props.put(HealthCheck.NAME, "name_" + id);
- props.put(HealthCheck.TAGS, id);
+ props.put(HealthCheck.NAME, "name_" + tags[0]);
+ props.put(HealthCheck.TAGS, tags);
regs.add(bundleContext.registerService(HealthCheck.class, hc, props));
}
@@ -84,13 +86,15 @@ public class HealthCheckExecutorSelectionTest {
@Before
public void setup() {
+ options = new HealthCheckExecutionOptions();
+
U.expectHealthChecks(0, executor, idA);
U.expectHealthChecks(0, executor, idB);
registerHC(idA);
registerHC(idB);
registerHC(idB);
- registerHC(idB);
+ registerHC(idA, idB);
}
@After
@@ -107,15 +111,37 @@ public class HealthCheckExecutorSelectionTest {
@Test
public void testDefaultSelectionA(){
- U.expectHealthChecks(1, executor, idA);
+ U.expectHealthChecks(2, executor, idA);
+ U.expectHealthChecks(2, executor, options, idA);
}
@Test
public void testDefaultSelectionB(){
U.expectHealthChecks(3, executor, idB);
+ U.expectHealthChecks(3, executor, options, idB);
+ }
+
+ @Test
+ public void testDefaultSelectionAB(){
+ U.expectHealthChecks(1, executor, idA, idB);
+ U.expectHealthChecks(1, executor, options, idA, idB);
+ }
+
+ @Test
+ public void testOrSelectionA(){
+ options.setCombineTagsWithOr(true);
+ U.expectHealthChecks(1, executor, options, idA);
+ }
+
+ @Test
+ public void testOrSelectionB(){
+ options.setCombineTagsWithOr(true);
+ U.expectHealthChecks(3, executor, options, idB);
}
+
@Test
- public void testDefaultSelectionAandB(){
- U.expectHealthChecks(0, executor, idA, idB);
+ public void testOrSelectionAB(){
+ options.setCombineTagsWithOr(true);
+ U.expectHealthChecks(4, executor, options, idA, idB);
}
}
diff --git a/src/test/java/org/apache/sling/hc/it/core/U.java b/src/test/java/org/apache/sling/hc/it/core/U.java
index 91333d7..36a1026 100644
--- a/src/test/java/org/apache/sling/hc/it/core/U.java
+++ b/src/test/java/org/apache/sling/hc/it/core/U.java
@@ -28,6 +28,7 @@ import static org.ops4j.pax.exam.CoreOptions.when;
import java.util.Arrays;
import java.util.List;
+import org.apache.sling.hc.api.execution.HealthCheckExecutionOptions;
import org.apache.sling.hc.api.execution.HealthCheckExecutionResult;
import org.apache.sling.hc.api.execution.HealthCheckExecutor;
import org.ops4j.pax.exam.Option;
@@ -37,10 +38,15 @@ public class U {
/** Wait until the specified number of health checks are seen by supplied executor */
static void expectHealthChecks(int howMany, HealthCheckExecutor executor, String ... tags) {
+ expectHealthChecks(howMany, executor, new HealthCheckExecutionOptions(), tags);
+ }
+
+ /** Wait until the specified number of health checks are seen by supplied executor */
+ static void expectHealthChecks(int howMany, HealthCheckExecutor executor, HealthCheckExecutionOptions options, String ... tags) {
final long timeout = System.currentTimeMillis() + 10000L;
int count = 0;
while(System.currentTimeMillis() < timeout) {
- final List<HealthCheckExecutionResult> results = executor.execute(tags);
+ final List<HealthCheckExecutionResult> results = executor.execute(options, tags);
count = results.size();
if(count== howMany) {
return;
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 20/49: SLING-3744 - test async
health check with cron expression
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit f083a75f18b60e2cddd4f3ff002ba424edefa6d1
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Jul 30 20:41:18 2014 +0000
SLING-3744 - test async health check with cron expression
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1614761 13f79535-47bb-0310-9956-ffa450edef68
---
.../sling/hc/it/core/AsyncHealthCheckTest.java | 124 +++++++++++++++++++++
1 file changed, 124 insertions(+)
diff --git a/src/test/java/org/apache/sling/hc/it/core/AsyncHealthCheckTest.java b/src/test/java/org/apache/sling/hc/it/core/AsyncHealthCheckTest.java
new file mode 100644
index 0000000..38068f1
--- /dev/null
+++ b/src/test/java/org/apache/sling/hc/it/core/AsyncHealthCheckTest.java
@@ -0,0 +1,124 @@
+/*
+ * 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.it.core;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.inject.Inject;
+
+import org.apache.sling.hc.api.HealthCheck;
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.api.execution.HealthCheckExecutionResult;
+import org.apache.sling.hc.api.execution.HealthCheckExecutor;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+@RunWith(PaxExam.class)
+public class AsyncHealthCheckTest {
+
+ @Inject
+ private HealthCheckExecutor executor;
+
+ @Inject
+ private BundleContext bundleContext;
+
+ @Configuration
+ public Option[] config() {
+ return U.config();
+ }
+
+ @Test
+ public void testAsyncHealthCheck() throws InterruptedException {
+ final String id = UUID.randomUUID().toString();
+ final AtomicInteger counter = new AtomicInteger(Integer.MIN_VALUE);
+ final HealthCheck hc = new HealthCheck() {
+ @Override
+ public Result execute() {
+ final int v = counter.incrementAndGet();
+ return new Result(Result.Status.OK, "counter is now " + v);
+ }
+
+ };
+
+ final Dictionary<String, Object> props = new Hashtable<String, Object>();
+ props.put(HealthCheck.NAME, "name_" + id);
+ props.put(HealthCheck.TAGS, id);
+ props.put(HealthCheck.ASYNC_CRON_EXPRESSION, "*/1 * * * * ?");
+
+ @SuppressWarnings("rawtypes")
+ final ServiceRegistration reg = bundleContext.registerService(HealthCheck.class, hc, props);
+
+ try {
+ {
+ // Wait for HC to be registered
+ final long timeout = System.currentTimeMillis() + 10000L;
+ boolean hcFound = false;
+ while(System.currentTimeMillis() < timeout) {
+ final List<HealthCheckExecutionResult> results = executor.execute(id);
+ if(!results.isEmpty()) {
+ hcFound = true;
+ break;
+ }
+ Thread.sleep(100L);
+ }
+ assertTrue("Expecting HC to become active", hcFound);
+ }
+
+ // Now reset the counter and check that HC increments it even if we don't
+ // use the executor
+ {
+ counter.set(0);
+ final long timeout = System.currentTimeMillis() + 5000L;
+ while(System.currentTimeMillis() < timeout) {
+ if(counter.get() > 0) {
+ break;
+ }
+ Thread.sleep(100L);
+ }
+ assertTrue("Expecting counter to be incremented", counter.get() > 0);
+ }
+
+ // Verify that we get the right log
+ final String msg = executor.execute(id).get(0).getHealthCheckResult().iterator().next().getMessage();
+ assertTrue("Expecting the right message: " + msg, msg.contains("counter is now"));
+
+ // And verify that calling executor lots of times doesn't increment as much
+ final int previous = counter.get();
+ final int n = 100;
+ for(int i=0; i < n; i++) {
+ executor.execute(id);
+ }
+ assertTrue("Expecting counter to increment asynchronously", counter.get() < previous + n);
+ } finally {
+ reg.unregister();
+ }
+
+ }
+
+}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 05/49: [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 branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 8bcc3529ca3eda434b00f4f1d5b96d031cba5f85
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@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 30c4d17..3f32f2f 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.it</artifactId>
<packaging>jar</packaging>
- <version>0.0.2-SNAPSHOT</version>
+ <version>1.0.0</version>
<name>Apache Sling Health Check Integration Tests</name>
<inceptionYear>2013</inceptionYear>
@@ -30,9 +27,9 @@
</properties>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/it</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/it</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/it</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.core-1.0.0/bundles/extensions/healthcheck/it</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.core-1.0.0/bundles/extensions/healthcheck/it</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.hc.core-1.0.0/bundles/extensions/healthcheck/it</url>
</scm>
<build>
@@ -55,7 +52,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>test</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-it] 43/49: SLING-6773 - separate HC API
from Core
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit fa3f623f7ce3d734cf17bda02f8a804de0d3f3b8
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Mon Apr 10 17:13:25 2017 +0000
SLING-6773 - separate HC API from Core
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1790879 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 10 +++++++---
src/test/java/org/apache/sling/hc/it/core/U.java | 4 ++++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index 3edcc92..59d24b6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -42,7 +42,9 @@
<org.ops4j.pax.logging.DefaultServiceLog.level>INFO</org.ops4j.pax.logging.DefaultServiceLog.level>
<felix.shell>false</felix.shell>
<sling.hc.samples.version>1.0.7-SNAPSHOT</sling.hc.samples.version>
- <sling.hc.core.version>1.2.3-SNAPSHOT</sling.hc.core.version>
+ <sling.hc.api.version>0.0.99-SNAPSHOT</sling.hc.api.version>
+ <sling.hc.core.version>1.2.7-SNAPSHOT</sling.hc.core.version>
+ <sling.johnzon.version>0.1.0-SNAPSHOT</sling.johnzon.version>
</properties>
<scm>
@@ -60,7 +62,9 @@
<systemProperties>
<org.ops4j.pax.logging.DefaultServiceLog.level>${org.ops4j.pax.logging.DefaultServiceLog.level}</org.ops4j.pax.logging.DefaultServiceLog.level>
<sling.hc.core.version>${sling.hc.core.version}</sling.hc.core.version>
+ <sling.hc.api.version>${sling.hc.api.version}</sling.hc.api.version>
<sling.hc.samples.version>${sling.hc.samples.version}</sling.hc.samples.version>
+ <sling.johnzon.version>${sling.johnzon.version}</sling.johnzon.version>
<felix.shell>${felix.shell}</felix.shell>
</systemProperties>
</configuration>
@@ -71,8 +75,8 @@
<dependencies>
<dependency>
<groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.hc.core</artifactId>
- <version>${sling.hc.core.version}</version>
+ <artifactId>org.apache.sling.hc.api</artifactId>
+ <version>${sling.hc.api.version}</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/src/test/java/org/apache/sling/hc/it/core/U.java b/src/test/java/org/apache/sling/hc/it/core/U.java
index 514066a..3812163 100644
--- a/src/test/java/org/apache/sling/hc/it/core/U.java
+++ b/src/test/java/org/apache/sling/hc/it/core/U.java
@@ -62,8 +62,10 @@ public class U {
}
static Option[] config() {
+ final String apiVersion = System.getProperty("sling.hc.api.version");
final String coreVersion = System.getProperty("sling.hc.core.version");
final String samplesVersion = System.getProperty("sling.hc.samples.version");
+ final String johnzonVersion = System.getProperty("sling.johnzon.version");
final String localRepo = System.getProperty("maven.repo.local", "");
final boolean felixShell = "true".equals(System.getProperty("felix.shell", "false"));
@@ -86,6 +88,8 @@ public class U {
mavenBundle("org.apache.felix", "org.apache.felix.scr", "1.6.2"),
mavenBundle("org.apache.felix", "org.apache.felix.configadmin", "1.8.8"),
mavenBundle("org.apache.felix", "org.apache.felix.http.servlet-api", "1.1.0"),
+ mavenBundle("org.apache.sling", "org.apache.sling.commons.johnzon", johnzonVersion),
+ mavenBundle("org.apache.sling", "org.apache.sling.hc.api", apiVersion),
mavenBundle("org.apache.sling", "org.apache.sling.hc.core", coreVersion),
mavenBundle("org.apache.sling", "org.apache.sling.hc.samples", samplesVersion),
mavenBundle("org.apache.sling", "org.apache.sling.commons.osgi", "2.2.0"),
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 38/49: Switch to parent pom 26
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit b46e39c0377e054092b66233ab20b2d029b02f2e
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Sun Jan 3 14:07:46 2016 +0000
Switch to parent pom 26
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1722720 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 418b5ab..3edcc92 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>25</version>
+ <version>26</version>
<relativePath/>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 01/49: 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 branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 3f93b208bc1f552840e765b98b5bf61f8276e7b0
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@1526476 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 102 ++++++++++
.../sling/hc/it/core/HealthCheckFilterTest.java | 221 +++++++++++++++++++++
src/test/java/org/apache/sling/hc/it/core/U.java | 69 +++++++
3 files changed, 392 insertions(+)
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..9bbda57
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,102 @@
+<?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>17</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.hc.it</artifactId>
+ <packaging>jar</packaging>
+ <version>0.0.2-SNAPSHOT</version>
+
+ <name>Sling Health Check Integration Tests</name>
+ <inceptionYear>2013</inceptionYear>
+
+ <properties>
+ <exam.version>3.0.3</exam.version>
+ <url.version>1.5.2</url.version>
+ <org.ops4j.pax.logging.DefaultServiceLog.level>INFO</org.ops4j.pax.logging.DefaultServiceLog.level>
+ <felix.shell>false</felix.shell>
+ <sling.java.version>6</sling.java.version>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <org.ops4j.pax.logging.DefaultServiceLog.level>${org.ops4j.pax.logging.DefaultServiceLog.level}</org.ops4j.pax.logging.DefaultServiceLog.level>
+ <sling.hc.core.version>${project.version}</sling.hc.core.version>
+ <felix.shell>${felix.shell}</felix.shell>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.hc.core</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.6.2</version>
+ <scope>test</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>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-native</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit4</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-link-mvn</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-aether</artifactId>
+ <version>${url.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>4.2.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/src/test/java/org/apache/sling/hc/it/core/HealthCheckFilterTest.java b/src/test/java/org/apache/sling/hc/it/core/HealthCheckFilterTest.java
new file mode 100644
index 0000000..4a154f7
--- /dev/null
+++ b/src/test/java/org/apache/sling/hc/it/core/HealthCheckFilterTest.java
@@ -0,0 +1,221 @@
+/*
+ * 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.it.core;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.sling.hc.api.HealthCheck;
+import org.apache.sling.hc.api.Result;
+import org.apache.sling.hc.util.HealthCheckFilter;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@RunWith(PaxExam.class)
+public class HealthCheckFilterTest {
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ private HealthCheckFilter filter;
+
+ @Inject
+ private BundleContext bundleContext;
+
+ private List<TestHealthCheck> testServices = new ArrayList<TestHealthCheck>();
+ private static int instanceCounter = 0;
+
+ class TestHealthCheck implements HealthCheck {
+
+ private final int id;
+ private final ServiceRegistration<?> reg;
+ final String[] tags;
+
+ TestHealthCheck(String... tags) {
+ id = instanceCounter++;
+ this.tags = tags;
+ final Dictionary<String, Object> props = new Hashtable<String, Object>();
+ if (tags != null) {
+ props.put(HealthCheck.TAGS, tags);
+ }
+ props.put(HealthCheck.TAGS, tags);
+ reg = bundleContext.registerService(HealthCheck.class.getName(),
+ this, props);
+ log.info("Registered {} with {}={}", new Object[] { this,
+ HealthCheck.TAGS, props.get(HealthCheck.TAGS) });
+ }
+
+ @Override
+ public String toString() {
+ return Arrays.asList(tags).toString();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return other instanceof TestHealthCheck
+ && ((TestHealthCheck) other).id == id;
+ }
+
+ @Override
+ public int hashCode() {
+ return id;
+ }
+
+ @Override
+ public Result execute() {
+ return null;
+ }
+
+ void unregister() {
+ reg.unregister();
+ }
+ }
+
+ @Configuration
+ public Option[] config() {
+ return U.config();
+ }
+
+ @Before
+ public void setup() {
+ testServices.add(new TestHealthCheck("foo"));
+ testServices.add(new TestHealthCheck("bar"));
+ testServices.add(new TestHealthCheck("foo", "bar"));
+ testServices.add(new TestHealthCheck("other", "thing"));
+ testServices.add(new TestHealthCheck());
+ filter = new HealthCheckFilter(bundleContext);
+ }
+
+ @After
+ public void cleanup() {
+ for (TestHealthCheck tc : testServices) {
+ tc.unregister();
+ }
+ }
+
+ /**
+ * @param included
+ * true or false, in the same order as testServices
+ */
+ private void assertServices(List<HealthCheck> s, boolean... included) {
+ final Iterator<TestHealthCheck> it = testServices.iterator();
+ for (boolean inc : included) {
+ final TestHealthCheck thc = it.next();
+ if (inc) {
+ assertTrue("Expecting list of services to include " + thc,
+ s.contains(thc));
+ } else {
+ assertFalse("Not expecting list of services to include " + thc,
+ s.contains(thc));
+ }
+ }
+ }
+
+ @Test
+ public void testSelectorService() {
+ assertNotNull("Expecting HealthCheckSelector service to be provided",
+ filter);
+ }
+
+ @Test
+ public void testAllServices() {
+ final List<HealthCheck> s = filter.getTaggedHealthChecks();
+ assertServices(s, true, true, true, true, true);
+ }
+
+ @Test
+ public void testEmptyTags() {
+ final List<HealthCheck> s = filter.getTaggedHealthChecks("", "", "");
+ assertServices(s, true, true, true, true, true);
+ }
+
+ @Test
+ public void testFooTag() {
+ final List<HealthCheck> s = filter.getTaggedHealthChecks("foo");
+ assertServices(s, true, false, true, false, false);
+ }
+
+ @Test
+ public void testBarTag() {
+ final List<HealthCheck> s = filter.getTaggedHealthChecks("bar");
+ assertServices(s, false, true, true, false, false);
+ }
+
+ @Test
+ public void testFooAndBar() {
+ final List<HealthCheck> s = filter.getTaggedHealthChecks("foo", "bar");
+ assertServices(s, false, false, true, false, false);
+ }
+
+ @Test
+ public void testFooMinusBar() {
+ final List<HealthCheck> s = filter
+ .getTaggedHealthChecks("foo", "-bar");
+ assertServices(s, true, false, false, false, false);
+ }
+
+ @Test
+ public void testWhitespace() {
+ final List<HealthCheck> s = filter.getTaggedHealthChecks(
+ "\t \n\r foo \t", "", " \t-bar\n", "");
+ assertServices(s, true, false, false, false, false);
+ }
+
+ @Test
+ public void testOther() {
+ final List<HealthCheck> s = filter.getTaggedHealthChecks("other");
+ assertServices(s, false, false, false, true, false);
+ }
+
+ @Test
+ public void testMinusOther() {
+ final List<HealthCheck> s = filter.getTaggedHealthChecks("-other");
+ assertServices(s, true, true, true, false, true);
+ }
+
+ @Test
+ public void testMinusOtherFoo() {
+ final List<HealthCheck> s = filter.getTaggedHealthChecks("-other",
+ "-foo");
+ assertServices(s, false, true, false, false, true);
+ }
+
+ @Test
+ public void testNoResults() {
+ final List<HealthCheck> s = filter.getTaggedHealthChecks("NOT A TAG");
+ assertTrue("Expecting no services", s.isEmpty());
+ }
+}
diff --git a/src/test/java/org/apache/sling/hc/it/core/U.java b/src/test/java/org/apache/sling/hc/it/core/U.java
new file mode 100644
index 0000000..6503add
--- /dev/null
+++ b/src/test/java/org/apache/sling/hc/it/core/U.java
@@ -0,0 +1,69 @@
+/*
+ * 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.it.core;
+
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.provision;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.CoreOptions.when;
+
+import org.ops4j.pax.exam.Option;
+
+/** Test utilities */
+public class U {
+
+ static Option[] config() {
+ final String coreVersion = System.getProperty("sling.hc.core.version");
+ final String localRepo = System.getProperty("maven.repo.local", "");
+ final boolean felixShell = "true".equals(System.getProperty("felix.shell", "false"));
+
+ return options(
+ when(localRepo.length() > 0).useOptions(
+ systemProperty("org.ops4j.pax.url.mvn.localRepository").value(localRepo)
+ ),
+ junitBundles(),
+ when(felixShell).useOptions(
+ provision(
+ mavenBundle("org.apache.felix", "org.apache.felix.gogo.shell", "0.10.0"),
+ mavenBundle("org.apache.felix", "org.apache.felix.gogo.runtime", "0.10.0"),
+ mavenBundle("org.apache.felix", "org.apache.felix.gogo.command", "0.12.0")
+ )
+ ),
+ provision(
+ mavenBundle("org.apache.felix", "org.apache.felix.scr", "1.6.2"),
+ mavenBundle("org.apache.sling", "org.apache.sling.hc.core", coreVersion),
+ mavenBundle("org.apache.sling", "org.apache.sling.commons.osgi", "2.2.0"),
+ mavenBundle("org.apache.sling", "org.apache.sling.jcr.jcr-wrapper", "2.0.0"),
+ mavenBundle("org.apache.sling", "org.apache.sling.api", "2.4.2"),
+ mavenBundle("org.apache.sling", "org.apache.sling.jcr.api", "2.1.0"),
+ mavenBundle("org.apache.sling", "org.apache.sling.engine", "2.2.8"),
+ mavenBundle("org.apache.sling", "org.apache.sling.auth.core", "1.1.2"),
+ mavenBundle("org.apache.sling", "org.apache.sling.commons.mime", "2.1.4"),
+ mavenBundle("org.apache.sling", "org.apache.sling.settings", "1.2.2"),
+ mavenBundle("org.apache.sling", "org.apache.sling.launchpad.api", "1.1.0"),
+ mavenBundle("org.apache.sling", "org.apache.sling.scripting.api", "2.1.0"),
+ mavenBundle("commons-collections", "commons-collections", "3.2.1"),
+ mavenBundle("commons-io", "commons-io", "1.4"),
+ mavenBundle("commons-fileupload", "commons-fileupload", "1.2.2"),
+ mavenBundle("org.mortbay.jetty", "servlet-api-2.5", "6.1.14")
+ )
+ );
+ }
+}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 09/49: 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 branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 21400be08692a4f0b75302c4d341a88e951351a6
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Sep 26 15:07:55 2013 +0000
SLING-3127 - prepare for release
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1526549 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 172e976..e59012f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,7 +52,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>test</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-it] 32/49: Update to Sling Parent 23
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit a462fec38d0dc1c4bbaa58dafdeb7ecce31089fb
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Jun 25 13:08:16 2015 +0000
Update to Sling Parent 23
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1687500 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index dae897c..5f7abc1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>22</version>
+ <version>23</version>
<relativePath/>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 04/49: 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 branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 0b81bc58794963ad0e42276c6ed98ac40803754e
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@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 5c35732..30c4d17 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-it] 18/49: SLING-3744 - add missing
dependency - integration tests failed
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit a3be2a230650003476515cb8b6632763db748b0b
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Jul 30 13:24:40 2014 +0000
SLING-3744 - add missing dependency - integration tests failed
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1614656 13f79535-47bb-0310-9956-ffa450edef68
---
src/test/java/org/apache/sling/hc/it/core/U.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/test/java/org/apache/sling/hc/it/core/U.java b/src/test/java/org/apache/sling/hc/it/core/U.java
index 70d71d3..8a993d3 100644
--- a/src/test/java/org/apache/sling/hc/it/core/U.java
+++ b/src/test/java/org/apache/sling/hc/it/core/U.java
@@ -60,6 +60,7 @@ public class U {
mavenBundle("org.apache.sling", "org.apache.sling.launchpad.api", "1.1.0"),
mavenBundle("org.apache.sling", "org.apache.sling.scripting.api", "2.1.0"),
mavenBundle("org.apache.sling", "org.apache.sling.commons.threads", "3.1.0"),
+ mavenBundle("org.apache.sling", "org.apache.sling.commons.scheduler", "2.4.2"),
mavenBundle("commons-collections", "commons-collections", "3.2.1"),
mavenBundle("commons-io", "commons-io", "1.4"),
mavenBundle("commons-fileupload", "commons-fileupload", "1.2.2"),
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 08/49: [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 branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 258eda8087266e37e435cef3eee35bd3c90a94fd
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@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 5a0d3f3..172e976 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.hc.it</artifactId>
<packaging>jar</packaging>
- <version>1.0.2</version>
+ <version>1.0.3-SNAPSHOT</version>
<name>Apache Sling Health Check Integration Tests</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/it</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hc.core-1.0.2/bundles/extensions/healthcheck/it</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.hc.core-1.0.2/bundles/extensions/healthcheck/it</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/it</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/it</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/it</url>
</scm>
<build>
@@ -52,7 +52,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>test</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-it] 45/49: SLING-6804 - allow selecting
health checks by name
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 2231e175a6a98eeee6760f1e897839b0179ebde2
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Thu May 11 20:05:21 2017 +0000
SLING-6804 - allow selecting health checks by name
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1794887 13f79535-47bb-0310-9956-ffa450edef68
---
src/test/java/org/apache/sling/hc/it/core/SampleHealthChecksTest.java | 3 ++-
src/test/java/org/apache/sling/hc/it/core/U.java | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/sling/hc/it/core/SampleHealthChecksTest.java b/src/test/java/org/apache/sling/hc/it/core/SampleHealthChecksTest.java
index e8ed466..8504566 100644
--- a/src/test/java/org/apache/sling/hc/it/core/SampleHealthChecksTest.java
+++ b/src/test/java/org/apache/sling/hc/it/core/SampleHealthChecksTest.java
@@ -28,6 +28,7 @@ import javax.management.DynamicMBean;
import org.apache.sling.hc.api.execution.HealthCheckExecutionResult;
import org.apache.sling.hc.api.execution.HealthCheckExecutor;
+import org.apache.sling.hc.api.execution.HealthCheckSelector;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
@@ -53,7 +54,7 @@ public class SampleHealthChecksTest {
@Test
public void testAnnotatedHC() {
- final List<HealthCheckExecutionResult> results = executor.execute("annotation","sample");
+ final List<HealthCheckExecutionResult> results = executor.execute(HealthCheckSelector.tags("annotation","sample"));
assertNotNull("Expecting non-null results");
assertEquals("Expecting a single result", 1, results.size());
final HealthCheckExecutionResult r = results.get(0);
diff --git a/src/test/java/org/apache/sling/hc/it/core/U.java b/src/test/java/org/apache/sling/hc/it/core/U.java
index f99461d..e9a8c6a 100644
--- a/src/test/java/org/apache/sling/hc/it/core/U.java
+++ b/src/test/java/org/apache/sling/hc/it/core/U.java
@@ -32,6 +32,7 @@ import java.util.List;
import org.apache.sling.hc.api.execution.HealthCheckExecutionOptions;
import org.apache.sling.hc.api.execution.HealthCheckExecutionResult;
import org.apache.sling.hc.api.execution.HealthCheckExecutor;
+import org.apache.sling.hc.api.execution.HealthCheckSelector;
import org.ops4j.pax.exam.Option;
/** Test utilities */
@@ -47,7 +48,7 @@ public class U {
final long timeout = System.currentTimeMillis() + 10000L;
int count = 0;
while(System.currentTimeMillis() < timeout) {
- final List<HealthCheckExecutionResult> results = executor.execute(options, tags);
+ final List<HealthCheckExecutionResult> results = executor.execute(HealthCheckSelector.tags(tags), options);
count = results.size();
if(count== howMany) {
return;
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 19/49: SLING-3624 - test the
annotated health check sample
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit 65dc05a14b8a4cc42325cfd1f12fa7c5c82e5cb1
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Jul 30 20:40:33 2014 +0000
SLING-3624 - test the annotated health check sample
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1614760 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 5 +-
.../sling/hc/it/core/SampleHealthChecksTest.java | 59 ++++++++++++++++++++++
src/test/java/org/apache/sling/hc/it/core/U.java | 2 +
3 files changed, 65 insertions(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 2c950bc..54b9344 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,6 +24,8 @@
<org.ops4j.pax.logging.DefaultServiceLog.level>INFO</org.ops4j.pax.logging.DefaultServiceLog.level>
<felix.shell>false</felix.shell>
<sling.java.version>6</sling.java.version>
+ <sling.hc.samples.version>1.0.5-SNAPSHOT</sling.hc.samples.version>
+ <sling.hc.core.version>${project.version}</sling.hc.core.version>
</properties>
<scm>
@@ -40,7 +42,8 @@
<configuration>
<systemProperties>
<org.ops4j.pax.logging.DefaultServiceLog.level>${org.ops4j.pax.logging.DefaultServiceLog.level}</org.ops4j.pax.logging.DefaultServiceLog.level>
- <sling.hc.core.version>${project.version}</sling.hc.core.version>
+ <sling.hc.core.version>${sling.hc.core.version}</sling.hc.core.version>
+ <sling.hc.samples.version>${sling.hc.samples.version}</sling.hc.samples.version>
<felix.shell>${felix.shell}</felix.shell>
</systemProperties>
</configuration>
diff --git a/src/test/java/org/apache/sling/hc/it/core/SampleHealthChecksTest.java b/src/test/java/org/apache/sling/hc/it/core/SampleHealthChecksTest.java
new file mode 100644
index 0000000..be0f901
--- /dev/null
+++ b/src/test/java/org/apache/sling/hc/it/core/SampleHealthChecksTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.it.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.sling.hc.api.execution.HealthCheckExecutionResult;
+import org.apache.sling.hc.api.execution.HealthCheckExecutor;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+
+@RunWith(PaxExam.class)
+public class SampleHealthChecksTest {
+
+ @Inject
+ private HealthCheckExecutor executor;
+
+ @Configuration
+ public Option[] config() {
+ return U.config();
+ }
+
+ @Test
+ public void testAnnotatedHealthCheck() {
+ final List<HealthCheckExecutionResult> results = executor.execute("annotation","sample");
+ assertNotNull("Expecting non-null results");
+ assertEquals("Expecting a single result", 1, results.size());
+ final HealthCheckExecutionResult r = results.get(0);
+ assertTrue("Expecting non-empty HC log", r.getHealthCheckResult().iterator().hasNext());
+ final String expected = "All good";
+ assertTrue(
+ "Expecting first log message to contain " + expected,
+ r.getHealthCheckResult().iterator().next().getMessage().contains(expected));
+ }
+}
diff --git a/src/test/java/org/apache/sling/hc/it/core/U.java b/src/test/java/org/apache/sling/hc/it/core/U.java
index 8a993d3..cb9f445 100644
--- a/src/test/java/org/apache/sling/hc/it/core/U.java
+++ b/src/test/java/org/apache/sling/hc/it/core/U.java
@@ -31,6 +31,7 @@ public class U {
static Option[] config() {
final String coreVersion = System.getProperty("sling.hc.core.version");
+ final String samplesVersion = System.getProperty("sling.hc.samples.version");
final String localRepo = System.getProperty("maven.repo.local", "");
final boolean felixShell = "true".equals(System.getProperty("felix.shell", "false"));
@@ -49,6 +50,7 @@ public class U {
provision(
mavenBundle("org.apache.felix", "org.apache.felix.scr", "1.6.2"),
mavenBundle("org.apache.sling", "org.apache.sling.hc.core", coreVersion),
+ mavenBundle("org.apache.sling", "org.apache.sling.hc.samples", samplesVersion),
mavenBundle("org.apache.sling", "org.apache.sling.commons.osgi", "2.2.0"),
mavenBundle("org.apache.sling", "org.apache.sling.jcr.jcr-wrapper", "2.0.0"),
mavenBundle("org.apache.sling", "org.apache.sling.api", "2.4.2"),
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-hc-it] 35/49: SLING-4862 - add missing
dependencies for IT
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-it.git
commit bc33e40056340f7a6bc7cc9941a999824cf08a1c
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Aug 14 08:22:25 2015 +0000
SLING-4862 - add missing dependencies for IT
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1695834 13f79535-47bb-0310-9956-ffa450edef68
---
src/test/java/org/apache/sling/hc/it/core/U.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/test/java/org/apache/sling/hc/it/core/U.java b/src/test/java/org/apache/sling/hc/it/core/U.java
index 36a1026..53aaaa0 100644
--- a/src/test/java/org/apache/sling/hc/it/core/U.java
+++ b/src/test/java/org/apache/sling/hc/it/core/U.java
@@ -80,9 +80,11 @@ public class U {
),
provision(
mavenBundle("org.apache.felix", "org.apache.felix.scr", "1.6.2"),
+ mavenBundle("org.apache.felix", "org.apache.felix.http.servlet-api", "1.1.0"),
mavenBundle("org.apache.sling", "org.apache.sling.hc.core", coreVersion),
mavenBundle("org.apache.sling", "org.apache.sling.hc.samples", samplesVersion),
mavenBundle("org.apache.sling", "org.apache.sling.commons.osgi", "2.2.0"),
+ mavenBundle("org.apache.sling", "org.apache.sling.commons.json", "2.0.10"),
mavenBundle("org.apache.sling", "org.apache.sling.jcr.jcr-wrapper", "2.0.0"),
mavenBundle("org.apache.sling", "org.apache.sling.api", "2.4.2"),
mavenBundle("org.apache.sling", "org.apache.sling.jcr.api", "2.1.0"),
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.