[cxf] branch 3.3.x-fixes updated (fcd4d7a -> f78bca2)

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

[cxf] branch 3.3.x-fixes updated (fcd4d7a -> f78bca2)

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

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


    from fcd4d7a  CXF-8127: LoggingFeature - Wrong address concatenation
     new 51c0446  CXF-8128: Fill address field in case of responses
     new f78bca2  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.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 51c0446ff43c0ffe5350e268b20f023bfacf3784
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)
---
 .../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 dd3bcdb..1510200 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
@@ -86,10 +86,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));
@@ -155,6 +152,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.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit f78bca2cbabff47b5c9ef3f29906f897eddbc61c
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)
---
 .../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());