[cxf] branch 3.2.x-fixes updated (532804e -> 19116f4)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[cxf] branch 3.2.x-fixes updated (532804e -> 19116f4)

ffang
This is an automated email from the ASF dual-hosted git repository.

ffang pushed a change to branch 3.2.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git.


    from 532804e  CXF-8127: LoggingFeature - Wrong address concatenation
     new 410667d  CXF-8128: Fill address field in case of responses
     new 19116f4  CXF-8128: Fill address field in case of responses - fix tests

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../cxf/ext/logging/event/DefaultLogEventMapper.java   | 18 ++++++++++++++----
 .../org/apache/cxf/jaxws/logging/SOAPLoggingTest.java  |  4 ++--
 2 files changed, 16 insertions(+), 6 deletions(-)

Reply | Threaded
Open this post in threaded view
|

[cxf] 01/02: CXF-8128: Fill address field in case of responses

ffang
This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch 3.2.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 410667dafe0c7cd40f9286c53fa83937589fc8d6
Author: kkrisz1 <[hidden email]>
AuthorDate: Tue Oct 1 10:18:23 2019 +0200

    CXF-8128: Fill address field in case of responses
   
    (cherry picked from commit c46694d554cd087d2fccb35b10a691af501720fc)
    (cherry picked from commit 51c0446ff43c0ffe5350e268b20f023bfacf3784)
---
 .../cxf/ext/logging/event/DefaultLogEventMapper.java   | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/DefaultLogEventMapper.java b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/DefaultLogEventMapper.java
index 755a4d3..cde46a9 100644
--- a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/DefaultLogEventMapper.java
+++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/DefaultLogEventMapper.java
@@ -77,10 +77,7 @@ public class DefaultLogEventMapper {
         Map<String, String> headerMap = getHeaders(message);
         event.setHeaders(headerMap);
 
-        String uri = getUri(message);
-        if (uri != null) {
-            event.setAddress(uri);
-        }
+        event.setAddress(getAddress(message, event));
 
         event.setPrincipal(getPrincipal(message));
         event.setBinaryContent(isBinaryContent(message));
@@ -146,6 +143,19 @@ public class DefaultLogEventMapper {
         return result;
     }
 
+    private String getAddress(Message message, LogEvent event) {
+        final Message observedMessage;
+        if (event.getType() == EventType.RESP_IN) {
+            observedMessage = message.getExchange().getOutMessage();
+        } else if (event.getType() == EventType.RESP_OUT) {
+            observedMessage = message.getExchange().getInMessage();
+        } else {
+            observedMessage = message;
+        }
+
+        return getUri(observedMessage);
+    }
+
     private String getUri(Message message) {
         String uri = safeGet(message, Message.REQUEST_URL);
         if (uri == null) {

Reply | Threaded
Open this post in threaded view
|

[cxf] 02/02: CXF-8128: Fill address field in case of responses - fix tests

ffang
In reply to this post by ffang
This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch 3.2.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 19116f430088ab80379360a36f9aecf73bf4550d
Author: kkrisz1 <[hidden email]>
AuthorDate: Tue Oct 1 20:06:23 2019 +0200

    CXF-8128: Fill address field in case of responses - fix tests
   
    (cherry picked from commit 67b6fdccd64b8c45d622f9e7e44ec51d454ae00c)
    (cherry picked from commit f78bca2cbabff47b5c9ef3f29906f897eddbc61c)
---
 .../src/test/java/org/apache/cxf/jaxws/logging/SOAPLoggingTest.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/logging/SOAPLoggingTest.java b/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/logging/SOAPLoggingTest.java
index bea6b00..aa92e1d 100644
--- a/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/logging/SOAPLoggingTest.java
+++ b/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/logging/SOAPLoggingTest.java
@@ -137,7 +137,7 @@ public class SOAPLoggingTest extends AbstractJaxWsTest {
 
     private void checkResponseOut(LogEvent responseOut) {
         // Not yet available
-        Assert.assertNull(responseOut.getAddress());
+        Assert.assertEquals(SERVICE_URI, responseOut.getAddress());
         Assert.assertEquals("text/xml", responseOut.getContentType());
         Assert.assertEquals(EventType.RESP_OUT, responseOut.getType());
         Assert.assertEquals(StandardCharsets.UTF_8.name(), responseOut.getEncoding());
@@ -153,7 +153,7 @@ public class SOAPLoggingTest extends AbstractJaxWsTest {
     }
 
     private void checkResponseIn(LogEvent responseIn) {
-        Assert.assertNull(responseIn.getAddress());
+        Assert.assertEquals(SERVICE_URI, responseIn.getAddress());
         Assert.assertTrue(responseIn.getContentType(), responseIn.getContentType().contains("text/xml"));
         Assert.assertEquals(EventType.RESP_IN, responseIn.getType());
         Assert.assertEquals(StandardCharsets.UTF_8.name(), responseIn.getEncoding());