diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-logging-lib')
13 files changed, 44 insertions, 44 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggerFactory.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggerFactory.java index b790a02042..826f6d509f 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggerFactory.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggerFactory.java @@ -16,7 +16,7 @@ package org.openecomp.sdc.logging.api; -import org.openecomp.sdc.logging.provider.LoggerCreationService; +import org.openecomp.sdc.logging.spi.LoggerCreationService; import java.util.Objects; diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggingContext.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggingContext.java index 542f709074..f827fec50f 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggingContext.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggingContext.java @@ -16,7 +16,7 @@ package org.openecomp.sdc.logging.api; -import org.openecomp.sdc.logging.provider.LoggingContextService; +import org.openecomp.sdc.logging.spi.LoggingContextService; import java.util.Objects; import java.util.concurrent.Callable; @@ -59,12 +59,12 @@ public class LoggingContext { SERVICE.clear(); } - public static Runnable toRunnable(Runnable runnable) { - return SERVICE.toRunnable(runnable); + public static Runnable copyToRunnable(Runnable runnable) { + return SERVICE.copyToRunnable(runnable); } - public static <V> Callable<V> toCallable(Callable<V> callable) { - return SERVICE.toCallable(callable); + public static <V> Callable<V> copyToCallable(Callable<V> callable) { + return SERVICE.copyToCallable(callable); } private static class NoOpLoggingContextService implements LoggingContextService { @@ -95,13 +95,13 @@ public class LoggingContext { } @Override - public Runnable toRunnable(Runnable runnable) { + public Runnable copyToRunnable(Runnable runnable) { Objects.requireNonNull(runnable, "Runnable cannot be null"); return runnable; } @Override - public <V> Callable<V> toCallable(Callable<V> callable) { + public <V> Callable<V> copyToCallable(Callable<V> callable) { Objects.requireNonNull(callable, "Callable cannot be null"); return callable; } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/ServiceBinder.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/ServiceBinder.java index b16f3944e9..e3c9ea02de 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/ServiceBinder.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/ServiceBinder.java @@ -16,9 +16,9 @@ package org.openecomp.sdc.logging.api; -import org.openecomp.sdc.logging.provider.LoggerCreationService; -import org.openecomp.sdc.logging.provider.LoggingContextService; -import org.openecomp.sdc.logging.provider.LoggingServiceProvider; +import org.openecomp.sdc.logging.spi.LoggerCreationService; +import org.openecomp.sdc.logging.spi.LoggingContextService; +import org.openecomp.sdc.logging.spi.LoggingServiceProvider; import java.util.Iterator; import java.util.Optional; diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/provider/LoggerCreationService.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/spi/LoggerCreationService.java index 344d23688e..90aebfa221 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/provider/LoggerCreationService.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/spi/LoggerCreationService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openecomp.sdc.logging.provider; +package org.openecomp.sdc.logging.spi; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/provider/LoggingContextService.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/spi/LoggingContextService.java index 8e725e7cc5..7aed0fc7dc 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/provider/LoggingContextService.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/spi/LoggingContextService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openecomp.sdc.logging.provider; +package org.openecomp.sdc.logging.spi; import java.util.concurrent.Callable; @@ -60,11 +60,11 @@ public interface LoggingContextService { * Copies logging context of current thread onto a {@link Runnable}, so that the context is available * when this {@link Runnable} runs in another thread. */ - Runnable toRunnable(Runnable runnable); + Runnable copyToRunnable(Runnable runnable); /** * Copies logging context of current thread onto a {@link Callable}, so that the context is available * when this {@link Callable} runs in another thread */ - <V> Callable<V> toCallable(Callable<V> callable); + <V> Callable<V> copyToCallable(Callable<V> callable); } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/provider/LoggingServiceProvider.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/spi/LoggingServiceProvider.java index baf99f0e55..12e4040feb 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/provider/LoggingServiceProvider.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/spi/LoggingServiceProvider.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openecomp.sdc.logging.provider; +package org.openecomp.sdc.logging.spi; /** * <p>From the application code (consumer) perspective, logger creation (factory) and logging context are independent diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/LoggingContextTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/LoggingContextTest.java index 7899eebd51..79252cde0b 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/LoggingContextTest.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/LoggingContextTest.java @@ -80,22 +80,22 @@ public class LoggingContextTest { @Test public void toRunnableReturnsSameInstance() { Runnable test = () -> { /* do nothing */ }; - assertTrue(test == LoggingContext.toRunnable(test)); + assertTrue(test == LoggingContext.copyToRunnable(test)); } @Test(expectedExceptions = NullPointerException.class) public void throwNpeWhenToRunnableWithNull() { - LoggingContext.toRunnable(null); + LoggingContext.copyToRunnable(null); } @Test public void toCallableReturnsSameInstance() { Callable<String> test = () -> ""; - assertTrue(test == LoggingContext.toCallable(test)); + assertTrue(test == LoggingContext.copyToCallable(test)); } @Test(expectedExceptions = NullPointerException.class) public void throwNpeWhenToCallableWithNull() { - LoggingContext.toCallable(null); + LoggingContext.copyToCallable(null); } }
\ No newline at end of file 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(); |