diff options
author | 2019-10-07 19:23:26 +0000 | |
---|---|---|
committer | 2019-10-08 16:43:15 +0000 | |
commit | d7e9d6e8db709ebd67791795f9d08020773fdd48 (patch) | |
tree | 2512680c9617182d8c8564718e01407d608074d7 /reference/logging-filter/logging-filter-base/src/test/java/org | |
parent | 2ef607c851f540a5a6172f73dcab9c26dd7b4751 (diff) |
Update method setMDCPartnerName in MDCSetup class
read partner name from authorization header when possible
Issue-ID: LOG-1161
Signed-off-by: Smokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Change-Id: I489a0cfe88e845b7e8a4234240601064f8728640
Diffstat (limited to 'reference/logging-filter/logging-filter-base/src/test/java/org')
-rw-r--r-- | reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/MDCSetupTest.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/MDCSetupTest.java b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/MDCSetupTest.java index 31d8da6..22ab9c3 100644 --- a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/MDCSetupTest.java +++ b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/MDCSetupTest.java @@ -191,6 +191,18 @@ public class MDCSetupTest extends MDCSetup { } @Test + public void setMDCPartnerNameFromBasicAuth() { + MultivaluedMap<String, String> headerMap = new MultivaluedHashMap<>(); + String value = "Basic dXNlcjpwYXNz"; // decodes to user:pass + headerMap.putSingle(HttpHeaders.AUTHORIZATION, value); + SimpleMap headers = new SimpleJaxrsHeadersMap(headerMap); + + setMDCPartnerName(headers); + + assertEquals("user", MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + } + + @Test public void setMDCPartnerNameTest() { MultivaluedMap<String, String> headerMap = new MultivaluedHashMap<>(); headerMap.putSingle(ONAPLogConstants.Headers.PARTNER_NAME, "SO"); |