You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/08/15 05:43:44 UTC
[camel] 06/06: CAMEL-13852: use constants for http status code
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 74e9af30469d0a820438e11912862d8ef0e874c3
Author: Marc Giger <gi...@gmx.ch>
AuthorDate: Wed Aug 14 20:06:47 2019 +0200
CAMEL-13852: use constants for http status code
---
.../org/apache/camel/component/olingo4/Olingo4AppAPITest.java | 8 ++++----
.../camel/component/olingo4/Olingo4ComponentProducerTest.java | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/components/camel-olingo4/camel-olingo4-api/src/test/java/org/apache/camel/component/olingo4/Olingo4AppAPITest.java b/components/camel-olingo4/camel-olingo4-api/src/test/java/org/apache/camel/component/olingo4/Olingo4AppAPITest.java
index e8385a8..7422298 100644
--- a/components/camel-olingo4/camel-olingo4-api/src/test/java/org/apache/camel/component/olingo4/Olingo4AppAPITest.java
+++ b/components/camel-olingo4/camel-olingo4-api/src/test/java/org/apache/camel/component/olingo4/Olingo4AppAPITest.java
@@ -420,7 +420,7 @@ public class Olingo4AppAPITest {
olingoApp.action(edm, TEST_UNBOUND_ACTION_RESETDATASOURCE, null, null, responseHandler);
final HttpStatusCode statusCode = responseHandler.await();
- assertEquals(204, statusCode.getStatusCode());
+ assertEquals(HttpStatusCode.NO_CONTENT, statusCode);
}
@Test
@@ -433,7 +433,7 @@ public class Olingo4AppAPITest {
olingoApp.action(edm, TEST_BOUND_ACTION_PEOPLE_SHARETRIP, null, clientEntity, responseHandler);
final HttpStatusCode statusCode = responseHandler.await();
- assertEquals(204, statusCode.getStatusCode());
+ assertEquals(HttpStatusCode.NO_CONTENT, statusCode);
}
@@ -447,13 +447,13 @@ public class Olingo4AppAPITest {
httpClientBuilder.addInterceptorFirst(new HttpResponseInterceptor() {
@Override
public void process(HttpResponse response, HttpContext context) throws HttpException, IOException {
- if (response.getStatusLine().getStatusCode() == 204) {
+ if (response.getStatusLine().getStatusCode() == HttpStatusCode.NO_CONTENT.getStatusCode()) {
try {
response.setEntity(
new InputStreamEntity(
odataWriter.writeEntity(createEntity(), ContentType.JSON),
org.apache.http.entity.ContentType.parse(ContentType.JSON.toContentTypeString())));
- response.setStatusCode(200);
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
} catch (ODataSerializerException e) {
throw new IOException(e);
}
diff --git a/components/camel-olingo4/camel-olingo4-component/src/test/java/org/apache/camel/component/olingo4/Olingo4ComponentProducerTest.java b/components/camel-olingo4/camel-olingo4-component/src/test/java/org/apache/camel/component/olingo4/Olingo4ComponentProducerTest.java
index 13a1de6..46e899e 100644
--- a/components/camel-olingo4/camel-olingo4-component/src/test/java/org/apache/camel/component/olingo4/Olingo4ComponentProducerTest.java
+++ b/components/camel-olingo4/camel-olingo4-component/src/test/java/org/apache/camel/component/olingo4/Olingo4ComponentProducerTest.java
@@ -276,7 +276,7 @@ public class Olingo4ComponentProducerTest extends AbstractOlingo4TestSupport {
@Test
public void testUnboundActionRequest() throws Exception {
final HttpStatusCode status = requestBody("direct:unbound-action-ResetDataSource", null);
- assertEquals(204, status.getStatusCode());
+ assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), status.getStatusCode());
}
@Test
@@ -286,7 +286,7 @@ public class Olingo4ComponentProducerTest extends AbstractOlingo4TestSupport {
clientEntity.getProperties().add(objFactory.newPrimitiveProperty("tripId", objFactory.newPrimitiveValueBuilder().buildInt32(0)));
final HttpStatusCode status = requestBody("direct:bound-action-people", clientEntity);
- assertEquals(204, status.getStatusCode());
+ assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), status.getStatusCode());
}
@SuppressWarnings("unchecked")