Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions cf-smoke/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.6.1</version>
<version>3.6.2</version>
<executions>
<execution>
<id>enforce-maven-version</id>
Expand Down Expand Up @@ -77,15 +77,13 @@
</execution>
</executions>
</plugin>
<!-- Compile for Java 8 and higher -->
<!-- Compile for Java 11 and higher -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
<source>8</source>
<target>8</target>
<release>11</release>
</configuration>
</plugin>
<!-- Always generate javadoc jar to catch errors early -->
Expand Down Expand Up @@ -257,7 +255,7 @@
<dependency>
<groupId>com.adobe.cq</groupId>
<artifactId>aem-cloud-testing-clients</artifactId>
<version>1.3.0</version>
<version>2.0.0-SNAPSHOT</version>
</dependency>

<!-- logging -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import java.util.stream.Stream;

import static java.lang.Integer.MAX_VALUE;
import static org.apache.http.HttpStatus.SC_OK;
import static org.apache.hc.core5.http.HttpStatus.SC_OK;

/**
* Install the test content package from resources.
Expand Down
10 changes: 4 additions & 6 deletions smoke/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.6.1</version>
<version>3.6.2</version>
<executions>
<execution>
<id>enforce-maven-version</id>
Expand Down Expand Up @@ -78,15 +78,13 @@
</execution>
</executions>
</plugin>
<!-- Compile for Java 8 and higher -->
<!-- Compile for Java 11 and higher -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
<source>8</source>
<target>8</target>
<release>11</release>
</configuration>
</plugin>
<!-- Always generate javadoc jar to catch errors early -->
Expand Down Expand Up @@ -304,7 +302,7 @@
<dependency>
<groupId>com.adobe.cq</groupId>
<artifactId>aem-cloud-testing-clients</artifactId>
<version>1.3.0</version>
<version>2.0.0-SNAPSHOT</version>
</dependency>

<!-- logging -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.adobe.cq.testing.junit.rules.TemporaryContentAuthorGroup;
import com.adobe.cq.testing.junit.rules.TemporaryUser;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpStatus;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.sling.testing.clients.ClientException;
import org.apache.sling.testing.clients.SlingClient;
import org.apache.sling.testing.clients.SlingHttpResponse;
Expand Down Expand Up @@ -87,7 +87,7 @@ public void testCreatePageAsAuthor() throws InterruptedException, ClientExceptio
SlingHttpResponse response = createTestPage(pageName, 1)
) {
assert response != null;
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
if (response.getCode() == HttpStatus.SC_UNAUTHORIZED) {
AssumptionViolatedException e = new AssumptionViolatedException("Author User " + userRule.getClient().getUser() + " not authorized to create page. Skipping...");
LOG.error("Unable to create test page", e);
throw e;
Expand Down Expand Up @@ -138,7 +138,7 @@ private SlingHttpResponse createTestPage(String pageName, int authRetries) throw
);

// retry in case not fully synced on time
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED && authRetries > 0) {
if (response.getCode() == HttpStatus.SC_UNAUTHORIZED && authRetries > 0) {
LOG.info("Got response status {} while creating page {}, retrying...", HttpStatus.SC_UNAUTHORIZED, pageName);
SECONDS.sleep(5);
return createTestPage(pageName, --authRetries);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

import java.util.UUID;

import static org.apache.http.HttpStatus.SC_FORBIDDEN;
import static org.apache.http.HttpStatus.SC_UNAUTHORIZED;
import static org.apache.hc.core5.http.HttpStatus.SC_FORBIDDEN;
import static org.apache.hc.core5.http.HttpStatus.SC_UNAUTHORIZED;

/**
* This test class is protecting from flawed AEM error handler implementations that are not returning 404s in case
Expand Down Expand Up @@ -85,7 +85,7 @@ public void testAuthorResponseCode404() throws ClientException {
SlingHttpResponse response = adminAuthor.doGet(path, 404, SC_UNAUTHORIZED, SC_FORBIDDEN);

if (response != null &&
(response.getStatusLine().getStatusCode() == SC_UNAUTHORIZED || response.getStatusLine().getStatusCode() == SC_FORBIDDEN)) {
(response.getCode() == SC_UNAUTHORIZED || response.getCode() == SC_FORBIDDEN)) {
throw new AssumptionViolatedException("Skipping test...");
}
} catch (ClientException e) {
Expand All @@ -108,7 +108,7 @@ public void testPublishResponseCode404() throws ClientException {
SlingHttpResponse response = adminPublish.doGet(path, 404, SC_UNAUTHORIZED, SC_FORBIDDEN);

if (response != null &&
(response.getStatusLine().getStatusCode() == SC_UNAUTHORIZED || response.getStatusLine().getStatusCode() == SC_FORBIDDEN)) {
(response.getCode() == SC_UNAUTHORIZED || response.getCode() == SC_FORBIDDEN)) {
throw new AssumptionViolatedException("Skipping test...");
}
} catch (ClientException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import org.apache.http.HttpEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.InputStreamEntity;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.io.entity.InputStreamEntity;
import org.apache.sling.testing.clients.SlingHttpResponse;
import org.apache.sling.testing.clients.util.poller.Polling;
import org.junit.BeforeClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpStatus;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.sling.testing.clients.ClientException;
import org.apache.sling.testing.clients.SlingClientConfig;
import org.apache.sling.testing.clients.SlingHttpResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import com.fasterxml.jackson.databind.JsonNode;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.Header;
import org.apache.hc.core5.http.Header;
import org.apache.sling.testing.clients.ClientException;
import org.apache.sling.testing.clients.SlingHttpResponse;

Expand All @@ -37,7 +37,7 @@ public class ReplicationResponse {

public static ReplicationResponse from(SlingHttpResponse response) {
ReplicationResponse res = new ReplicationResponse();
res.setCode(response.getStatusLine().getStatusCode());
res.setCode(response.getCode());
Header[] ct = response.getHeaders(HEADER_CONTENT_TYPE);
if (ct.length == 0) {
res.setContentType("(no content header set)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
import com.adobe.cq.cloud.testing.it.smoke.replication.data.ReplicationResponse;
import com.adobe.cq.testing.client.CQClient;
import com.adobe.cq.testing.junit.rules.Page;
import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.message.BasicNameValuePair;
import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.classic.methods.HttpUriRequest;
import org.apache.hc.core5.http.NameValuePair;
import org.apache.hc.core5.http.message.BasicNameValuePair;
import org.apache.hc.core5.net.URIBuilder;
import org.apache.sling.testing.clients.ClientException;
import org.apache.sling.testing.clients.SlingHttpResponse;
import org.apache.sling.testing.clients.util.poller.Polling;
Expand All @@ -51,12 +51,12 @@
import static com.adobe.cq.cloud.testing.it.smoke.exception.ReplicationException.QUEUE_BLOCKED;
import static com.adobe.cq.cloud.testing.it.smoke.exception.ReplicationException.REPLICATION_NOT_AVAILABLE;
import static com.adobe.cq.cloud.testing.it.smoke.replication.ReplicationClient.checkPackageInQueue;
import static org.apache.http.HttpStatus.SC_FORBIDDEN;
import static org.apache.http.HttpStatus.SC_MOVED_PERMANENTLY;
import static org.apache.http.HttpStatus.SC_MOVED_TEMPORARILY;
import static org.apache.http.HttpStatus.SC_NOT_FOUND;
import static org.apache.http.HttpStatus.SC_OK;
import static org.apache.http.HttpStatus.SC_UNAUTHORIZED;
import static org.apache.hc.core5.http.HttpStatus.SC_FORBIDDEN;
import static org.apache.hc.core5.http.HttpStatus.SC_MOVED_PERMANENTLY;
import static org.apache.hc.core5.http.HttpStatus.SC_MOVED_TEMPORARILY;
import static org.apache.hc.core5.http.HttpStatus.SC_NOT_FOUND;
import static org.apache.hc.core5.http.HttpStatus.SC_OK;
import static org.apache.hc.core5.http.HttpStatus.SC_UNAUTHORIZED;

/**
* Junit test rule to check content distribution functionality
Expand Down Expand Up @@ -167,16 +167,16 @@ private void checkPage(boolean skipDispatcherCache, final int expectedStatus) th
res = getPublishClient().doStreamRequest(request, null);

// Special handling for 401,403, logging for 301,302
if (null != res && (res.getStatusLine().getStatusCode() == SC_UNAUTHORIZED
|| res.getStatusLine().getStatusCode() == SC_FORBIDDEN)) {
log.warn("Got status {} while checking page, expected status {}", res.getStatusLine().getStatusCode(),
if (null != res && (res.getCode() == SC_UNAUTHORIZED
|| res.getCode() == SC_FORBIDDEN)) {
log.warn("Got status {} while checking page, expected status {}", res.getCode(),
expectedStatus);
throw new AssumptionViolatedException("Publish requires auth for (SAML?) or not authorized. Skipping...");
} else if (null != res && (res.getStatusLine().getStatusCode() == SC_MOVED_PERMANENTLY
|| res.getStatusLine().getStatusCode() == SC_MOVED_TEMPORARILY)) {
log.info("Redirect status {} detected for page {}", res.getStatusLine().getStatusCode(), path);
} else if (null != res && (res.getStatusLine().getStatusCode() == expectedStatus)) {
log.info("Page check completed with status {}", res.getStatusLine().getStatusCode());
} else if (null != res && (res.getCode() == SC_MOVED_PERMANENTLY
|| res.getCode() == SC_MOVED_TEMPORARILY)) {
log.info("Redirect status {} detected for page {}", res.getCode(), path);
} else if (null != res && (res.getCode() == expectedStatus)) {
log.info("Page check completed with status {}", res.getCode());
return;
}

Expand All @@ -190,7 +190,7 @@ private void checkPage(boolean skipDispatcherCache, final int expectedStatus) th
: Collections.emptyList();
SlingHttpResponse slingHttpResponse =
getPublishClient().doGet(path, newQueryParams, Collections.emptyList(), expectedStatus);
log.info("Page check completed with status {}", slingHttpResponse.getStatusLine().getStatusCode());
log.info("Page check completed with status {}", slingHttpResponse.getCode());
return true;
});
// Changing the delay to be 10 seconds so that the check page runs every 10 seconds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@

import com.adobe.cq.cloud.testing.it.smoke.exception.ServiceException;
import com.adobe.cq.testing.client.CQClient;
import org.apache.http.HttpResponse;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.util.Timeout;
import org.apache.sling.testing.clients.util.poller.Polling;
import org.apache.sling.testing.clients.ClientException;
import org.apache.sling.testing.clients.SlingClient;
Expand Down Expand Up @@ -67,8 +68,8 @@ public Statement apply(Statement base, Description description) {
try {
// Alternatively, rely on setting -Dsling.client.connection.timeout.seconds=10 from the outside
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(10000)
.setSocketTimeout(10000)
.setConnectTimeout(Timeout.ofMilliseconds(10000))
.setResponseTimeout(Timeout.ofMilliseconds(10000))
.build();

// See https://github.com/apache/sling-org-apache-sling-testing-clients#how-can-i-customize-the-underlying-httpclient
Expand All @@ -80,8 +81,8 @@ public Statement apply(Statement base, Description description) {
AtomicInteger counter = new AtomicInteger();
polling = new Polling(() -> {
counter.incrementAndGet();
HttpResponse httpResponse = client.execute(new HttpGet(adminClient.getUrl(SYSTEM_READY)));
int status = httpResponse.getStatusLine().getStatusCode();
CloseableHttpResponse httpResponse = client.execute(new HttpGet(adminClient.getUrl(SYSTEM_READY)));
int status = httpResponse.getCode();
String response = EntityUtils.toString(httpResponse.getEntity());
if (status != 200) {
String errMsg = String.format("Status Code - %s, response - %s", status, response);
Expand Down
17 changes: 10 additions & 7 deletions wcm-smoke/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.6.1</version>
<version>3.6.2</version>
<executions>
<execution>
<id>enforce-maven-version</id>
Expand Down Expand Up @@ -77,15 +77,13 @@
</execution>
</executions>
</plugin>
<!-- Compile for Java 8 and higher -->
<!-- Compile for Java 11 and higher -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
<source>8</source>
<target>8</target>
<release>11</release>
</configuration>
</plugin>
<!-- Always generate javadoc jar to catch errors early -->
Expand Down Expand Up @@ -256,14 +254,19 @@
<dependency>
<groupId>org.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>4.13.0</version>
<version>4.17.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.14</version>
</dependency>

<!-- integration testing -->
<dependency>
<groupId>com.adobe.cq</groupId>
<artifactId>aem-cloud-testing-clients</artifactId>
<version>1.3.0</version>
<version>2.0.0-SNAPSHOT</version>
</dependency>

<!-- logging -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private static void verifyPageAndResources(HtmlUnitClient client, String path) t
for (URI ref : client.getResourceRefs(path)) {
if (isSameOrigin(baseURI, ref)) {
SlingHttpResponse response = client.doGet(ref.getRawPath());
int statusCode = response.getStatusLine().getStatusCode();
int statusCode = response.getCode();
assertEquals("Unexpected status returned from [" + ref + "]", 200, statusCode);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/
package com.adobe.cq.cloud.testing.it.wcm.smoke;

import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.Credentials;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.sling.testing.clients.ClientException;
import org.apache.sling.testing.clients.SlingClientConfig;
Expand Down
10 changes: 4 additions & 6 deletions xf-smoke/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.6.1</version>
<version>3.6.2</version>
<executions>
<execution>
<id>enforce-maven-version</id>
Expand Down Expand Up @@ -77,15 +77,13 @@
</execution>
</executions>
</plugin>
<!-- Compile for Java 8 and higher -->
<!-- Compile for Java 11 and higher -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
<source>8</source>
<target>8</target>
<release>11</release>
</configuration>
</plugin>
<!-- Always generate javadoc jar to catch errors early -->
Expand Down Expand Up @@ -257,7 +255,7 @@
<dependency>
<groupId>com.adobe.cq</groupId>
<artifactId>aem-cloud-testing-clients</artifactId>
<version>1.3.0</version>
<version>2.0.0-SNAPSHOT</version>
</dependency>

<!-- logging -->
Expand Down
Loading
Loading