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:23:00 UTC
[sling-org-apache-sling-jobs-it] 02/09: SLING-5645 Improved IT
tests, improved config checking and reduced dependency footprint
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-jobs-it.git
commit d7e103c0f5f31edd5befaaca1d1d3a1bd3ae7537
Author: Ian Boston <ie...@apache.org>
AuthorDate: Tue Oct 4 09:23:13 2016 +0000
SLING-5645 Improved IT tests, improved config checking and reduced dependency footprint
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1763255 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 12 ------
.../java/org/apache/sling/jobs/it/CheckRootIT.java | 47 +++++++++++++++++-----
src/test/java/org/apache/sling/jobs/it/Models.java | 19 +++++++++
.../apache/sling/jobs/it/TestSuiteLauncherIT.java | 19 +++++++++
.../resources/provisioning-model/jobs-runtime.txt | 3 +-
5 files changed, 77 insertions(+), 23 deletions(-)
diff --git a/pom.xml b/pom.xml
index 8ac0d0c..7fe60f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -58,18 +58,6 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
diff --git a/src/test/java/org/apache/sling/jobs/it/CheckRootIT.java b/src/test/java/org/apache/sling/jobs/it/CheckRootIT.java
index a40846f..d6eb67a 100644
--- a/src/test/java/org/apache/sling/jobs/it/CheckRootIT.java
+++ b/src/test/java/org/apache/sling/jobs/it/CheckRootIT.java
@@ -1,21 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package org.apache.sling.jobs.it;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.conn.HttpHostConnectException;
import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.sling.commons.testing.junit.Retry;
import org.apache.sling.commons.testing.junit.RetryRule;
-import org.apache.sling.crankstart.junit.CrankstartSetup;
+import org.junit.Assert;
import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import java.io.IOException;
+import java.lang.System;
-import static org.junit.Assert.*;
/**
*/
@@ -34,17 +51,29 @@ public class CheckRootIT {
}
@Test
- @Retry(timeoutMsec=Models.LONG_TIMEOUT_MSEC, intervalMsec=Models.STD_INTERVAL)
public void testHttpRoot() throws Exception {
final HttpUriRequest get = new HttpGet(TestSuiteLauncherIT.crankstartSetup.getBaseUrl());
HttpResponse response = null;
+ long timeout = System.currentTimeMillis() + 60000L;
+ boolean found = false;
try {
- response = client.execute(get);
- assertEquals("Expecting page not found at " + get.getURI(), 404, response.getStatusLine().getStatusCode());
+ while (System.currentTimeMillis() < timeout) {
+ try {
+ response = client.execute(get);
+ if (response.getStatusLine().getStatusCode() == 404) {
+ found = true;
+ break;
+ }
+ } catch (HttpHostConnectException e) {
+ Thread.sleep(1000);
+ }
+ }
+ if (!found) {
+ Assert.fail("Expected to get 404 from " + get.getURI());
+ }
} finally {
Models.closeConnection(response);
}
}
-
}
diff --git a/src/test/java/org/apache/sling/jobs/it/Models.java b/src/test/java/org/apache/sling/jobs/it/Models.java
index 7fcd479..b9dc2f0 100644
--- a/src/test/java/org/apache/sling/jobs/it/Models.java
+++ b/src/test/java/org/apache/sling/jobs/it/Models.java
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package org.apache.sling.jobs.it;
import org.apache.http.HttpResponse;
diff --git a/src/test/java/org/apache/sling/jobs/it/TestSuiteLauncherIT.java b/src/test/java/org/apache/sling/jobs/it/TestSuiteLauncherIT.java
index 18c6662..f67c026 100644
--- a/src/test/java/org/apache/sling/jobs/it/TestSuiteLauncherIT.java
+++ b/src/test/java/org/apache/sling/jobs/it/TestSuiteLauncherIT.java
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package org.apache.sling.jobs.it;
import static org.junit.Assert.assertEquals;
diff --git a/src/test/resources/provisioning-model/jobs-runtime.txt b/src/test/resources/provisioning-model/jobs-runtime.txt
index 1649559..021e876 100644
--- a/src/test/resources/provisioning-model/jobs-runtime.txt
+++ b/src/test/resources/provisioning-model/jobs-runtime.txt
@@ -21,11 +21,10 @@
[feature name=sling.extensions.jobs]
[artifacts]
- com.google.code.gson/gson/2.2.4
org.apache.geronimo.specs/geronimo-j2ee-management_1.1_spec/1.0.1
org.apache.geronimo.specs/geronimo-jms_1.1_spec/1.1.1
org.ow2.asm/asm/4.1
- com.google.guava/guava/16.0.1
+ com.google.guava/guava/15.0
org.apache.commons/commons-pool2/2.4.2
org.apache.sling/org.apache.sling.mom/0.0.1-SNAPSHOT
org.apache.sling/org.apache.sling.jobs/0.0.1-SNAPSHOT
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.