aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test
diff options
context:
space:
mode:
authorolegb <olegb@amdocs.com>2018-02-19 16:11:35 +0200
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2018-03-04 09:31:51 +0000
commit313dce44ae1ab2328c33a6448e87b3fbb81b15f0 (patch)
tree6957ccea17705639cc4b5b278e57252a2e677f58 /openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test
parentf86741b693d54f0cb074028c484835f42c991923 (diff)
Changed audit API of logger
Change-Id: I3e091ba7ce592fae536da1eaf28a220284b846c3 Issue-ID: SDC-772 Signed-off-by: olegb <olegb@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test')
-rw-r--r--openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/LogFileCreationTest.java (renamed from openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/api/LoggerTest.java)64
-rw-r--r--openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/aspects/MetricsAspectTest.java23
2 files changed, 54 insertions, 33 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/api/LoggerTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/LogFileCreationTest.java
index 1359a1ff2a..4595e567c8 100644
--- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/api/LoggerTest.java
+++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/LogFileCreationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright © 2016-2017 European Support Limited
+ * Copyright © 2016-2018 European Support Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,20 +14,16 @@
* limitations under the License.
*/
-package org.openecomp.sdc.logging.api;
+package org.openecomp.sdc.logging;
+import org.openecomp.sdc.logging.api.AuditData;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.testng.annotations.Test;
-/**
- * This is only for manual testing - change {@link #ENABLED} to 'true'
- *
- * @author evitaliy
- * @since 13/09/2016.
- */
-public class LoggerTest {
-
+public class LogFileCreationTest {
private static final boolean ENABLED = false; // for manual testing change to 'true'
- private static final Logger LOGGER = LoggerFactory.getLogger(LoggerTest.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(LogFileCreationTest.class);
@Test(enabled = ENABLED)
public void testMetrics() {
@@ -36,7 +32,8 @@ public class LoggerTest {
@Test(enabled = ENABLED)
public void testAudit() {
- LOGGER.audit("This is audit");
+ SpyAuditData auditData = new SpyAuditData();
+ LOGGER.audit(auditData);
}
@Test(enabled = ENABLED)
@@ -58,4 +55,47 @@ public class LoggerTest {
public void testError() {
LOGGER.error("This is error");
}
+
+ private class SpyAuditData implements AuditData {
+ @Override
+ public long getStartTime() {
+
+ return 0;
+
+ }
+
+ @Override
+ public long getEndTime(){
+
+ return 0;
+ }
+
+ @Override
+ public StatusCode getStatusCode(){
+
+ return null;
+
+ }
+
+ @Override
+ public String getResponseCode(){
+
+ return null;
+
+ }
+
+ @Override
+ public String getResponseDescription(){
+
+ return null;
+
+ }
+
+ @Override
+ public String getClientIpAddress(){
+
+ return null;
+
+ }
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/aspects/MetricsAspectTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/aspects/MetricsAspectTest.java
index 42cbdcef14..4d3d6be34b 100644
--- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/aspects/MetricsAspectTest.java
+++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/aspects/MetricsAspectTest.java
@@ -21,6 +21,7 @@ import org.aspectj.lang.Signature;
import org.aspectj.lang.reflect.SourceLocation;
import org.aspectj.runtime.internal.AroundClosure;
import org.easymock.EasyMock;
+import org.openecomp.sdc.logging.api.AuditData;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.powermock.api.easymock.PowerMock;
@@ -296,27 +297,7 @@ public class MetricsAspectTest extends PowerMockTestCase {
}
@Override
- public void audit(String var1) {
- throw new RuntimeException("Not implemented");
- }
-
- @Override
- public void audit(String var1, Object var2) {
- throw new RuntimeException("Not implemented");
- }
-
- @Override
- public void audit(String var1, Object var2, Object var3) {
- throw new RuntimeException("Not implemented");
- }
-
- @Override
- public void audit(String var1, Object... var2) {
- throw new RuntimeException("Not implemented");
- }
-
- @Override
- public void audit(String var1, Throwable throwable) {
+ public void audit(AuditData var1) {
throw new RuntimeException("Not implemented");
}