aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src
diff options
context:
space:
mode:
authorvempo <vitaliy.emporopulo@amdocs.com>2018-01-14 16:01:12 +0200
committervempo <vitaliy.emporopulo@amdocs.com>2018-01-14 16:01:12 +0200
commit66b612c13079d066cebd9629fb1eab0215e684c4 (patch)
tree2c6599f33ba2a4815467fb0f36fce8390e5edf18 /openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src
parent1eb66b78d3b1f1fc60a82ce6dbd16b12f2845e9a (diff)
Minor refactor of logging API
Change-Id: I926ba95c7145eb98aade3f9009a252ad995a346d Issue-ID: SDC-772 Signed-off-by: vempo <vitaliy.emporopulo@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src')
-rw-r--r--openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/SLF4JLoggingServiceProvider.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/resources/META-INF/services/org.openecomp.sdc.logging.spi.LoggingServiceProvider (renamed from openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/resources/META-INF/services/org.openecomp.sdc.logging.provider.LoggingServiceProvider)0
-rw-r--r--openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/BaseContextPropagationTest.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/CallableContextPropagationTest.java12
-rw-r--r--openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/LoggingContextTest.java8
-rw-r--r--openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/RunnableContextPropagationTest.java12
6 files changed, 24 insertions, 24 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/SLF4JLoggingServiceProvider.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/SLF4JLoggingServiceProvider.java
index 015875bdc8..d2fb0b0226 100644
--- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/SLF4JLoggingServiceProvider.java
+++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/SLF4JLoggingServiceProvider.java
@@ -17,7 +17,7 @@
package org.openecomp.sdc.logging.slf4j;
import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.provider.LoggingServiceProvider;
+import org.openecomp.sdc.logging.spi.LoggingServiceProvider;
import org.slf4j.MDC;
import java.util.Objects;
@@ -67,13 +67,13 @@ public class SLF4JLoggingServiceProvider implements LoggingServiceProvider {
}
@Override
- public Runnable toRunnable(Runnable runnable) {
+ public Runnable copyToRunnable(Runnable runnable) {
Objects.requireNonNull(runnable, "Runnable cannot be null");
return new MDCRunnableWrapper(runnable);
}
@Override
- public <V> Callable<V> toCallable(Callable<V> callable) {
+ public <V> Callable<V> copyToCallable(Callable<V> callable) {
Objects.requireNonNull(callable, "Runnable cannot be null");
return new MDCCallableWrapper<>(callable);
}
diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/resources/META-INF/services/org.openecomp.sdc.logging.provider.LoggingServiceProvider b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/resources/META-INF/services/org.openecomp.sdc.logging.spi.LoggingServiceProvider
index 7e438b7a49..7e438b7a49 100644
--- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/resources/META-INF/services/org.openecomp.sdc.logging.provider.LoggingServiceProvider
+++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/resources/META-INF/services/org.openecomp.sdc.logging.spi.LoggingServiceProvider
diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/BaseContextPropagationTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/BaseContextPropagationTest.java
index a430de7d22..636ff94a39 100644
--- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/BaseContextPropagationTest.java
+++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/BaseContextPropagationTest.java
@@ -17,7 +17,7 @@
package org.openecomp.sdc.logging.slf4j;
import org.openecomp.sdc.logging.api.LoggingContext;
-import org.openecomp.sdc.logging.provider.LoggingContextService;
+import org.openecomp.sdc.logging.spi.LoggingContextService;
import org.testng.annotations.DataProvider;
import java.util.concurrent.Callable;
@@ -81,13 +81,13 @@ public abstract class BaseContextPropagationTest {
}
@Override
- public Runnable toRunnable(Runnable runnable) {
- return LoggingContext.toRunnable(runnable);
+ public Runnable copyToRunnable(Runnable runnable) {
+ return LoggingContext.copyToRunnable(runnable);
}
@Override
- public <V> Callable<V> toCallable(Callable<V> callable) {
- return LoggingContext.toCallable(callable);
+ public <V> Callable<V> copyToCallable(Callable<V> callable) {
+ return LoggingContext.copyToCallable(callable);
}
@Override
diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/CallableContextPropagationTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/CallableContextPropagationTest.java
index 5fad3f70c5..0c8de97e1a 100644
--- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/CallableContextPropagationTest.java
+++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/CallableContextPropagationTest.java
@@ -16,7 +16,7 @@
package org.openecomp.sdc.logging.slf4j;
-import org.openecomp.sdc.logging.provider.LoggingContextService;
+import org.openecomp.sdc.logging.spi.LoggingContextService;
import org.testng.annotations.Test;
import java.util.UUID;
@@ -46,7 +46,7 @@ public class CallableContextPropagationTest extends BaseContextPropagationTest {
AtomicBoolean complete = new AtomicBoolean(false);
// pass the callable to the context service first
- execute(ctx.toCallable(() -> {
+ execute(ctx.copyToCallable(() -> {
assertEquals(ctx.get(KEY), uuid, EXPECT_PROPAGATED_TO_CHILD);
complete.set(true);
return null;
@@ -65,7 +65,7 @@ public class CallableContextPropagationTest extends BaseContextPropagationTest {
AtomicBoolean innerComplete = new AtomicBoolean(false);
// should run with the context of main thread
- Callable inner = ctx.toCallable(() -> {
+ Callable inner = ctx.copyToCallable(() -> {
assertEquals(ctx.get(KEY), innerRandom, EXPECT_PROPAGATED_TO_CHILD);
innerComplete.set(true);
return null;
@@ -94,7 +94,7 @@ public class CallableContextPropagationTest extends BaseContextPropagationTest {
assertNull(ctx.get(KEY), EXPECT_EMPTY);
final AtomicBoolean complete = new AtomicBoolean(false);
- execute(ctx.toCallable(() -> {
+ execute(ctx.copyToCallable(() -> {
assertNull(ctx.get(KEY), EXPECT_EMPTY);
complete.set(true);
return null;
@@ -112,7 +112,7 @@ public class CallableContextPropagationTest extends BaseContextPropagationTest {
AtomicBoolean innerComplete = new AtomicBoolean(false);
// should run with the context of main thread
- Callable inner = ctx.toCallable((() -> {
+ Callable inner = ctx.copyToCallable((() -> {
assertEquals(ctx.get(KEY), innerRandom, EXPECT_PROPAGATED_TO_CHILD);
innerComplete.set(true);
return null;
@@ -141,7 +141,7 @@ public class CallableContextPropagationTest extends BaseContextPropagationTest {
// should run with the context of main thread
AtomicBoolean innerComplete = new AtomicBoolean(false);
- Callable inner = ctx.toCallable(() -> {
+ Callable inner = ctx.copyToCallable(() -> {
assertEquals(ctx.get(KEY), innerRandom, EXPECT_PROPAGATED_TO_CHILD);
innerComplete.set(true);
throw new IllegalArgumentException();
diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/LoggingContextTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/LoggingContextTest.java
index 516a27f2cd..e93c114193 100644
--- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/LoggingContextTest.java
+++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/LoggingContextTest.java
@@ -33,22 +33,22 @@ public class LoggingContextTest {
@Test
public void returnMdcWrapperWhenToRunnableCalled() {
- assertEquals(LoggingContext.toRunnable(() -> {}).getClass(), MDCRunnableWrapper.class);
+ assertEquals(LoggingContext.copyToRunnable(() -> {}).getClass(), MDCRunnableWrapper.class);
}
@Test(expectedExceptions = NullPointerException.class)
public void throwNpeWhenToRunnableWithNull() {
- LoggingContext.toRunnable(null);
+ LoggingContext.copyToRunnable(null);
}
@Test
public void returnMdcWrapperWhenToCallableCalled() {
- assertEquals(LoggingContext.toCallable(() -> "").getClass(), MDCCallableWrapper.class);
+ assertEquals(LoggingContext.copyToCallable(() -> "").getClass(), MDCCallableWrapper.class);
}
@Test(expectedExceptions = NullPointerException.class)
public void throwNpeWhenToCallableWithNull() {
- LoggingContext.toCallable(null);
+ LoggingContext.copyToCallable(null);
}
@Test
diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/RunnableContextPropagationTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/RunnableContextPropagationTest.java
index a617abd69c..90d6cda52a 100644
--- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/RunnableContextPropagationTest.java
+++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/RunnableContextPropagationTest.java
@@ -16,7 +16,7 @@
package org.openecomp.sdc.logging.slf4j;
-import org.openecomp.sdc.logging.provider.LoggingContextService;
+import org.openecomp.sdc.logging.spi.LoggingContextService;
import org.testng.annotations.Test;
import java.util.UUID;
@@ -65,7 +65,7 @@ public class RunnableContextPropagationTest extends BaseContextPropagationTest {
AtomicBoolean complete = new AtomicBoolean(false);
// pass the runnable to the context service first
- Thread thread = new Thread(ctx.toRunnable(() -> {
+ Thread thread = new Thread(ctx.copyToRunnable(() -> {
assertEquals(ctx.get(KEY), uuid, EXPECT_PROPAGATED_TO_CHILD);
complete.set(true);
}));
@@ -87,7 +87,7 @@ public class RunnableContextPropagationTest extends BaseContextPropagationTest {
AtomicBoolean innerComplete = new AtomicBoolean(false);
// should run with the context of main thread
- Runnable inner = ctx.toRunnable(() -> {
+ Runnable inner = ctx.copyToRunnable(() -> {
assertEquals(ctx.get(KEY), innerRandom, EXPECT_PROPAGATED_TO_CHILD);
innerComplete.set(true);
});
@@ -118,7 +118,7 @@ public class RunnableContextPropagationTest extends BaseContextPropagationTest {
assertNull(ctx.get(KEY), EXPECT_EMPTY);
final AtomicBoolean complete = new AtomicBoolean(false);
- Runnable runnable = ctx.toRunnable(() -> {
+ Runnable runnable = ctx.copyToRunnable(() -> {
assertNull(ctx.get(KEY), EXPECT_EMPTY);
complete.set(true);
});
@@ -140,7 +140,7 @@ public class RunnableContextPropagationTest extends BaseContextPropagationTest {
AtomicBoolean innerComplete = new AtomicBoolean(false);
// should run with the context of main thread
- Runnable inner = ctx.toRunnable(() -> {
+ Runnable inner = ctx.copyToRunnable(() -> {
assertEquals(ctx.get(KEY), innerRandom, EXPECT_PROPAGATED_TO_CHILD);
innerComplete.set(true);
});
@@ -171,7 +171,7 @@ public class RunnableContextPropagationTest extends BaseContextPropagationTest {
// should run with the context of main thread
AtomicBoolean innerComplete = new AtomicBoolean(false);
- Runnable inner = ctx.toRunnable(() -> {
+ Runnable inner = ctx.copyToRunnable(() -> {
assertEquals(ctx.get(KEY), innerRandom, EXPECT_PROPAGATED_TO_CHILD);
innerComplete.set(true);
throw new IllegalArgumentException();