diff options
author | vempo <vitaliy.emporopulo@amdocs.com> | 2018-01-14 16:01:12 +0200 |
---|---|---|
committer | vempo <vitaliy.emporopulo@amdocs.com> | 2018-01-14 16:01:12 +0200 |
commit | 66b612c13079d066cebd9629fb1eab0215e684c4 (patch) | |
tree | 2c6599f33ba2a4815467fb0f36fce8390e5edf18 /openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src | |
parent | 1eb66b78d3b1f1fc60a82ce6dbd16b12f2845e9a (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-api/src')
7 files changed, 20 insertions, 20 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 |