forked from clusterbench/clusterbench
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade to org.apache.httpcomponents.client5:httpclient5 - Tomcat mod…
…ule clusterbench#525
- Loading branch information
Showing
15 changed files
with
180 additions
and
170 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
...c/main/java/org/jboss/test/clusterbench/it/shared/AbstractAverageSystemLoadServletIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright The ClusterBench Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.jboss.test.clusterbench.it.shared; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.apache.hc.client5.http.classic.methods.HttpGet; | ||
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; | ||
import org.apache.hc.client5.http.impl.classic.HttpClients; | ||
import org.apache.hc.core5.http.io.entity.EntityUtils; | ||
import org.jboss.arquillian.container.test.api.RunAsClient; | ||
import org.jboss.arquillian.junit5.ArquillianExtension; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
/** | ||
* Smoke test for {@link org.jboss.test.clusterbench.web.load.AverageSystemLoadServlet}. | ||
* | ||
* @author Radoslav Husar | ||
*/ | ||
@ExtendWith(ArquillianExtension.class) | ||
@RunAsClient | ||
public abstract class AbstractAverageSystemLoadServletIT { | ||
|
||
@Test | ||
public void test() throws Exception { | ||
try (CloseableHttpClient httpClient = HttpClients.createDefault()) { | ||
HttpGet httpGet = new HttpGet("http://localhost:8080/clusterbench/averagesystemload?milliseconds=1000&threads=4"); | ||
|
||
httpClient.execute(httpGet, response -> { | ||
assertEquals(200, response.getCode()); | ||
|
||
String responseBody = EntityUtils.toString(response.getEntity()); | ||
assertEquals("DONE", responseBody); | ||
|
||
return null; | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...red/src/main/java/org/jboss/test/clusterbench/it/shared/AbstractHttpSessionServletIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright The ClusterBench Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.jboss.test.clusterbench.it.shared; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.util.Arrays; | ||
import java.util.Optional; | ||
|
||
import org.apache.hc.client5.http.classic.methods.HttpGet; | ||
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; | ||
import org.apache.hc.client5.http.impl.classic.HttpClients; | ||
import org.apache.hc.core5.http.Header; | ||
import org.apache.hc.core5.http.io.entity.EntityUtils; | ||
import org.jboss.arquillian.container.test.api.RunAsClient; | ||
import org.jboss.arquillian.junit5.ArquillianExtension; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
/** | ||
* @author Radoslav Husar | ||
*/ | ||
@ExtendWith(ArquillianExtension.class) | ||
@RunAsClient | ||
public abstract class AbstractHttpSessionServletIT { | ||
|
||
@Test | ||
public void test() throws Exception { | ||
try (CloseableHttpClient httpClient = HttpClients.createDefault()) { | ||
HttpGet httpGet = new HttpGet("http://localhost:8080/clusterbench/session"); | ||
|
||
httpClient.execute(httpGet, response -> { | ||
assertEquals(200, response.getCode()); | ||
|
||
String responseBody = EntityUtils.toString(response.getEntity()); | ||
assertEquals("0", responseBody); | ||
|
||
// Also ensure session is created | ||
Optional<String> jsessionIdCookie = Arrays.stream(response.getHeaders("Set-Cookie")).map(Header::getValue).filter(cookie -> cookie.startsWith("JSESSIONID=")).findFirst(); | ||
assertTrue(jsessionIdCookie.isPresent()); | ||
|
||
return null; | ||
}); | ||
|
||
httpClient.execute(httpGet, response -> { | ||
assertEquals(200, response.getCode()); | ||
|
||
String responseBody = EntityUtils.toString(response.getEntity()); | ||
assertEquals("1", responseBody); | ||
|
||
return null; | ||
}); | ||
} | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
...s/shared/src/main/java/org/jboss/test/clusterbench/it/shared/AbstractLoggerServletIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
...sts/tomcat-10.1/src/test/java/org/jboss/test/clusterbench/it/tomcat/AbstractTomcatIT.java
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
...-10.1/src/test/java/org/jboss/test/clusterbench/it/tomcat/AverageSystemLoadServletIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright The ClusterBench Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.jboss.test.clusterbench.it.tomcat; | ||
|
||
import org.jboss.test.clusterbench.it.shared.AbstractAverageSystemLoadServletIT; | ||
|
||
/** | ||
* @author Radoslav Husar | ||
*/ | ||
public class AverageSystemLoadServletIT extends AbstractAverageSystemLoadServletIT { | ||
// Inherit. | ||
} |
47 changes: 0 additions & 47 deletions
47
...src/test/java/org/jboss/test/clusterbench/it/tomcat/AverageSystemLoadServletTomcatIT.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.