Skip to content

Commit

Permalink
chore(deps): upgrade to spring v6.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bbortt committed Nov 26, 2024
1 parent 70785df commit b4210cb
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@

package org.citrusframework.http.client;

import java.io.IOException;

import org.citrusframework.exceptions.CitrusRuntimeException;
import org.citrusframework.message.ErrorHandlingStrategy;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatusCode;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.lang.Nullable;
import org.springframework.web.client.DefaultResponseErrorHandler;

import java.io.IOException;
import java.net.URI;

/**
* @since 2.7
*/
Expand All @@ -32,17 +36,15 @@ public class HttpResponseErrorHandler extends DefaultResponseErrorHandler {

/**
* Default constructor using error handling strategy.
* @param errorHandlingStrategy
*/
public HttpResponseErrorHandler(ErrorHandlingStrategy errorHandlingStrategy) {
this.errorHandlingStrategy = errorHandlingStrategy;
}

@Override
public void handleError(ClientHttpResponse response) throws IOException {
protected void handleError(ClientHttpResponse response, HttpStatusCode statusCode, @Nullable URI url, @Nullable HttpMethod method) throws IOException {
if (errorHandlingStrategy.equals(ErrorHandlingStrategy.PROPAGATE)) {
throw new HttpErrorPropagatingException(response.getStatusCode(), response.getStatusText(),
response.getHeaders(), getResponseBody(response), getCharset(response));
throw new HttpErrorPropagatingException(response.getStatusCode(), response.getStatusText(), response.getHeaders(), getResponseBody(response), getCharset(response));
} else if (errorHandlingStrategy.equals(ErrorHandlingStrategy.THROWS_EXCEPTION)) {
super.handleError(response);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

package org.citrusframework.http.server;

import java.util.Random;

import org.apache.hc.core5.http.ContentType;
import org.citrusframework.context.SpringBeanReferenceResolver;
import org.citrusframework.context.TestContext;
import org.citrusframework.endpoint.EndpointAdapter;
Expand All @@ -29,7 +28,6 @@
import org.citrusframework.message.MessageHeaders;
import org.citrusframework.testng.AbstractTestNGUnitTest;
import org.citrusframework.util.SocketUtils;
import org.apache.hc.core5.http.ContentType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
Expand All @@ -39,10 +37,16 @@
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.util.Random;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
import static org.testng.Assert.fail;

/**
* Simple unit test for HttpServer
Expand Down Expand Up @@ -79,7 +83,7 @@ public void shutdown() {
try {
client.send(new HttpMessage().method(HttpMethod.GET), context);

Assert.fail("Server supposed to be in shutdown state, but was accessible via client request");
fail("Server supposed to be in shutdown state, but was accessible via client request");
} catch (ResourceAccessException e) {
Assert.assertTrue(e.getMessage().contains("Connection refused"));
}
Expand Down Expand Up @@ -224,4 +228,26 @@ public void testCustomContentType() {
verify(mockResponseEndpointAdapter).handleMessage(any(Message.class));
}

@Test
public void testHttpResponseErrorHandlerWithPropagateStrategy() {
TestContext context = testContextFactory.getObject();

reset(mockResponseEndpointAdapter);
doReturn(new HttpMessage().status(INTERNAL_SERVER_ERROR))
.when(mockResponseEndpointAdapter).handleMessage(any(Message.class));

client.send(new HttpMessage()
.path("/hello")
.method(HttpMethod.GET), context);

Message response = client.receive(context);

assertThat(response)
.isInstanceOf(HttpMessage.class)
.satisfies(
r -> assertThat(((HttpMessage) r).getStatusCode()).isEqualTo(INTERNAL_SERVER_ERROR)
);

verify(mockResponseEndpointAdapter).handleMessage(any(Message.class));
}
}
32 changes: 16 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -195,26 +195,26 @@
<ascii-table-version>1.8.0</ascii-table-version>
<assertj.version>3.26.3</assertj.version>
<awaitility.version>4.2.2</awaitility.version>
<aws-java-sdk2.version>2.27.19</aws-java-sdk2.version>
<bouncycastle.version>1.78.1</bouncycastle.version>
<byte.buddy.version>1.15.7</byte.buddy.version>
<aws-java-sdk2.version>2.29.21</aws-java-sdk2.version>
<bouncycastle.version>1.79</bouncycastle.version>
<byte.buddy.version>1.15.10</byte.buddy.version>
<commons.dbcp2.version>2.12.0</commons.dbcp2.version>
<commons.cli.version>1.9.0</commons.cli.version>
<commons.codec.version>1.17.1</commons.codec.version>
<commons.io.version>2.17.0</commons.io.version>
<commons.io.version>2.18.0</commons.io.version>
<commons.lang.version>3.17.0</commons.lang.version>
<commons.logging.version>1.3.4</commons.logging.version>
<commons.net.version>3.11.1</commons.net.version>
<cucumber.version>7.20.1</cucumber.version>
<docker-java.version>3.4.0</docker-java.version>
<dropwizard.metrics.version>4.2.28</dropwizard.metrics.version>
<ftpserver.version>1.2.0</ftpserver.version>
<groovy.version>3.0.22</groovy.version>
<greenmail.version>2.1.0</greenmail.version>
<groovy.version>3.0.23</groovy.version>
<greenmail.version>2.1.1</greenmail.version>
<hamcrest.version>3.0</hamcrest.version>
<htmlunit.version>4.13.0</htmlunit.version>
<httpclient.version>5.4.1</httpclient.version>
<hsqldb.version>2.7.3</hsqldb.version>
<hsqldb.version>2.7.4</hsqldb.version>
<jackson.version>2.18.1</jackson.version>
<jakarta.activation.api.version>2.1.3</jakarta.activation.api.version>
<jakarta.activation.version>2.0.1</jakarta.activation.version>
Expand All @@ -233,7 +233,7 @@
<jetty.websocket-api.version>2.0.0</jetty.websocket-api.version>
<jsch.version>0.1.55</jsch.version>
<json-path.version>2.9.0</json-path.version>
<json-schema-validator.version>1.5.2</json-schema-validator.version>
<json-schema-validator.version>1.5.4</json-schema-validator.version>
<json-smart.version>2.5.1</json-smart.version>
<jtidy.version>r938</jtidy.version>
<junit.jupiter.version>5.11.3</junit.jupiter.version>
Expand All @@ -242,36 +242,36 @@
<junixsocket.version>2.10.1</junixsocket.version>
<k8s.client.version>6.13.4</k8s.client.version>
<k8s.model.version>6.13.4</k8s.model.version>
<kafka.version>3.8.0</kafka.version>
<kafka.version>3.9.0</kafka.version>
<knative-client.version>6.13.4</knative-client.version>
<log4j2.version>2.22.1</log4j2.version>
<mockito.version>5.14.2</mockito.version>
<mockftpserver.version>3.2.0</mockftpserver.version>
<netty.version>4.1.105.Final</netty.version>
<okhttp.version>4.12.0</okhttp.version>
<picoli-version>4.7.6</picoli-version>
<postgresql.version>42.7.3</postgresql.version>
<postgresql.version>42.7.4</postgresql.version>
<saaj.version>3.0.4</saaj.version>
<selenium.version>4.25.0</selenium.version>
<selenium.version>4.27.0</selenium.version>
<slf4j.version>2.0.11</slf4j.version>
<snappy.version>1.1.10.7</snappy.version>
<snakeyaml.version>2.3</snakeyaml.version>
<spring.version>6.1.14</spring.version>
<spring.version>6.2.0</spring.version>
<spring.ws.version>4.0.11</spring.ws.version>
<spring.integration.version>6.3.5</spring.integration.version>
<spring.restdocs.version>3.0.2</spring.restdocs.version>
<spring.integration.version>6.4.0</spring.integration.version>
<spring.restdocs.version>3.0.3</spring.restdocs.version>
<sshd.version>2.14.0</sshd.version>
<swagger.version>1.6.9</swagger.version>
<swagger.parser.version>2.1.22</swagger.parser.version>
<testcontainers.version>1.20.1</testcontainers.version>
<testcontainers.version>1.20.4</testcontainers.version>
<testng.version>7.10.2</testng.version>
<vertx.version>4.5.10</vertx.version>
<wsdl4j.version>1.6.3</wsdl4j.version>
<xbean-spring.version>4.26</xbean-spring.version>
<xmlbeans.version>5.2.1</xmlbeans.version>
<xmlbeans-xpath.version>2.6.0</xmlbeans-xpath.version>
<xerces.version>2.12.2</xerces.version>
<xstream.version>1.4.20</xstream.version>
<xstream.version>1.4.21</xstream.version>
<zookeeper.version>3.9.3</zookeeper.version>

<skip.integration.tests>false</skip.integration.tests>
Expand Down

0 comments on commit b4210cb

Please sign in to comment.