aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring
diff options
context:
space:
mode:
authorBen David, Elad (eb7504) <eb7504@intl.att.com>2019-11-03 17:22:48 +0200
committerBen David, Elad (eb7504) <eb7504@intl.att.com>2019-11-05 15:52:05 +0200
commit1e61754c29fc99636de692a0fb9d2ef1a4ba9e61 (patch)
tree90c20331d442c82dc955b0426d60b64a6ca353be /openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring
parent4a6e592af14fd3941df6e56e5b75c9ac5d5eb01b (diff)
Align logging to Onap-ELS 2019.11
Change-Id: I1750493d5c9f2eab8c1395f0fbc9ae66cf74b0a6 Issue-ID: SDC-2639 Signed-off-by: Ben David, Elad (eb7504) <eb7504@intl.att.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring')
-rw-r--r--openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/main/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptor.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/test/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptorTest.java23
2 files changed, 16 insertions, 17 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/main/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptor.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/main/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptor.java
index 7ee942a180..393a061987 100644
--- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/main/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptor.java
+++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/main/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptor.java
@@ -16,17 +16,17 @@
package org.openecomp.sdc.logging.servlet.spring;
-import static org.openecomp.sdc.logging.api.StatusCode.COMPLETE;
-import static org.openecomp.sdc.logging.api.StatusCode.ERROR;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.*;
import static org.springframework.http.HttpStatus.Series.REDIRECTION;
import static org.springframework.http.HttpStatus.Series.SUCCESSFUL;
import java.util.Objects;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
+import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.logging.api.StatusCode;
import org.openecomp.sdc.logging.servlet.AuditTracker;
import org.openecomp.sdc.logging.servlet.CombinedTracker;
import org.openecomp.sdc.logging.servlet.ContextTracker;
@@ -120,7 +120,7 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter {
}
@Override
- public StatusCode getStatusCode() {
+ public ResponseStatus getStatusCode() {
return statusInfo.getStatusCode();
}
@@ -154,7 +154,7 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter {
return reasonPhrase;
}
- private StatusCode getStatusCode() {
+ private ResponseStatus getStatusCode() {
return series.equals(SUCCESSFUL) || series.equals(REDIRECTION) ? COMPLETE : ERROR;
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/test/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptorTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/test/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptorTest.java
index 406f8b6dbd..86a4318ec9 100644
--- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/test/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/test/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptorTest.java
@@ -22,13 +22,12 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static org.openecomp.sdc.logging.api.StatusCode.COMPLETE;
-import static org.openecomp.sdc.logging.api.StatusCode.ERROR;
import static org.openecomp.sdc.logging.servlet.spring.LoggingInterceptor.LOGGING_TRACKER_KEY;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Test;
+import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus;
import org.openecomp.sdc.logging.servlet.HttpHeader;
import org.openecomp.sdc.logging.servlet.RequestProcessingResult;
import org.openecomp.sdc.logging.servlet.Tracker;
@@ -80,7 +79,7 @@ public class LoggingInterceptorTest {
final int status = 101;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(ERROR, result.getStatusCode());
+ assertEquals(ResponseStatus.ERROR, result.getStatusCode());
}
@Test
@@ -88,7 +87,7 @@ public class LoggingInterceptorTest {
final int status = 404;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(ERROR, result.getStatusCode());
+ assertEquals(ResponseStatus.ERROR, result.getStatusCode());
}
@Test
@@ -96,7 +95,7 @@ public class LoggingInterceptorTest {
final int status = 503;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(ERROR, result.getStatusCode());
+ assertEquals(ResponseStatus.ERROR, result.getStatusCode());
}
@Test
@@ -104,7 +103,7 @@ public class LoggingInterceptorTest {
final int status = 204;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(COMPLETE, result.getStatusCode());
+ assertEquals(ResponseStatus.COMPLETE, result.getStatusCode());
}
@Test
@@ -112,7 +111,7 @@ public class LoggingInterceptorTest {
final int status = 307;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(COMPLETE, result.getStatusCode());
+ assertEquals(ResponseStatus.COMPLETE, result.getStatusCode());
}
@Test
@@ -120,7 +119,7 @@ public class LoggingInterceptorTest {
final int status = 133;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(ERROR, result.getStatusCode());
+ assertEquals(ResponseStatus.ERROR, result.getStatusCode());
}
@Test
@@ -128,7 +127,7 @@ public class LoggingInterceptorTest {
final int status = 485;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(ERROR, result.getStatusCode());
+ assertEquals(ResponseStatus.ERROR, result.getStatusCode());
}
@Test
@@ -136,7 +135,7 @@ public class LoggingInterceptorTest {
final int status = 547;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(ERROR, result.getStatusCode());
+ assertEquals(ResponseStatus.ERROR, result.getStatusCode());
}
@Test
@@ -144,7 +143,7 @@ public class LoggingInterceptorTest {
final int status = 277;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(COMPLETE, result.getStatusCode());
+ assertEquals(ResponseStatus.COMPLETE, result.getStatusCode());
}
@Test
@@ -152,6 +151,6 @@ public class LoggingInterceptorTest {
final int status = 364;
LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status);
assertEquals(status, result.getStatus());
- assertEquals(COMPLETE, result.getStatusCode());
+ assertEquals(ResponseStatus.COMPLETE, result.getStatusCode());
}
}