Skip to content
Permalink
Browse files
CXF-8635: Fix org.apache.cxf.jaxrs.client.logging.RESTLoggingTest.tes…
…tSlf4 (#889)
  • Loading branch information
reta committed Jan 15, 2022
1 parent 81e12eb commit 0cd2e514c7776974cc51f98684a232c1da9a84e5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
@@ -440,8 +440,7 @@ protected ResponseBuilder setResponseBuilder(Message outMessage, Exchange exchan
return currentResponseBuilder;
}

String reasonPhrase = (String)MessageUtils.getContextualProperty(
responseMessage, HTTPConduit.HTTP_RESPONSE_MESSAGE, null);
final String reasonPhrase = (String)responseMessage.get(HTTPConduit.HTTP_RESPONSE_MESSAGE);
if (reasonPhrase != null) {
currentResponseBuilder.status(status, reasonPhrase);
}
@@ -38,14 +38,18 @@
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.hello_world.Greeter;
import org.apache.hello_world.services.SOAPService;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

@@ -169,17 +173,35 @@ private Greeter getMortimerGreeter() throws MalformedURLException {
return mortimer;
}

@Test
public void testResponseMessage() throws Exception {
startServer("Mortimer");
Greeter mortimer = getMortimerGreeter();
Client client = ClientProxy.getClient(mortimer);
client.getRequestContext().put(HTTPConduit.SET_HTTP_RESPONSE_MESSAGE, true);

String answer = mortimer.sayHi();
answer = mortimer.sayHi();
answer = mortimer.sayHi();
assertTrue("Unexpected answer: " + answer,
"Bonjour from Mortimer".equals(answer));
assertProxyRequestCount(3);
assertThat(client.getResponseContext().get(HTTPConduit.HTTP_RESPONSE_MESSAGE), equalTo("OK"));
}

@Test
public void testBasicConnection() throws Exception {
startServer("Mortimer");
Greeter mortimer = getMortimerGreeter();
Client client = ClientProxy.getClient(mortimer);

String answer = mortimer.sayHi();
answer = mortimer.sayHi();
answer = mortimer.sayHi();
assertTrue("Unexpected answer: " + answer,
"Bonjour from Mortimer".equals(answer));
assertProxyRequestCount(3);
assertThat(client.getResponseContext().get(HTTPConduit.HTTP_RESPONSE_MESSAGE), nullValue());
}

@Test

0 comments on commit 0cd2e51

Please sign in to comment.