diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/NettyFutureBinders.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/NettyFutureBinders.java index b82939617..072d91edc 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/NettyFutureBinders.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/NettyFutureBinders.java @@ -7,8 +7,8 @@ import java.util.function.Function; import java.util.function.Supplier; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.channel.EventLoop; import io.netty.util.concurrent.Future; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/ClientConnectionPool.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/ClientConnectionPool.java index 6be5780f3..0b0b2023d 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/ClientConnectionPool.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/ClientConnectionPool.java @@ -7,8 +7,8 @@ import org.opensearch.migrations.NettyFutureBinders; import org.opensearch.migrations.replay.datatypes.ConnectionReplaySession; import org.opensearch.migrations.replay.tracing.IReplayContexts; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/ReplayEngine.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/ReplayEngine.java index 8517617d4..898680593 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/ReplayEngine.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/ReplayEngine.java @@ -10,7 +10,7 @@ import org.opensearch.migrations.replay.datatypes.IndexedChannelInteraction; import org.opensearch.migrations.replay.tracing.IReplayContexts; import org.opensearch.migrations.replay.traffic.source.BufferedFlowController; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.util.concurrent.ScheduledFuture; import lombok.extern.slf4j.Slf4j; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/RequestSenderOrchestrator.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/RequestSenderOrchestrator.java index f501a523a..110cb9957 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/RequestSenderOrchestrator.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/RequestSenderOrchestrator.java @@ -21,8 +21,8 @@ import org.opensearch.migrations.replay.datatypes.UniqueReplayerRequestKey; import org.opensearch.migrations.replay.tracing.IReplayContexts; import org.opensearch.migrations.replay.util.RefSafeHolder; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.buffer.ByteBuf; import io.netty.channel.EventLoop; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/RequestTransformerAndSender.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/RequestTransformerAndSender.java index c375d994c..2aba945b2 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/RequestTransformerAndSender.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/RequestTransformerAndSender.java @@ -11,8 +11,8 @@ import org.opensearch.migrations.replay.datatypes.TransformedOutputAndResult; import org.opensearch.migrations.replay.http.retries.IRetryVisitorFactory; import org.opensearch.migrations.replay.tracing.IReplayContexts; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.buffer.Unpooled; import lombok.AllArgsConstructor; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/TrafficReplayer.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/TrafficReplayer.java index 4a167257a..e50824839 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/TrafficReplayer.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/TrafficReplayer.java @@ -15,7 +15,6 @@ import org.opensearch.migrations.replay.traffic.source.TrafficStreamLimiter; import org.opensearch.migrations.replay.util.ActiveContextMonitor; import org.opensearch.migrations.replay.util.OrderedWorkerTracker; -import org.opensearch.migrations.replay.util.TrackedFutureJsonFormatter; import org.opensearch.migrations.tracing.ActiveContextTracker; import org.opensearch.migrations.tracing.ActiveContextTrackerByActivityType; import org.opensearch.migrations.tracing.CompositeContextTracker; @@ -28,6 +27,7 @@ import org.opensearch.migrations.transform.TransformerConfigUtils; import org.opensearch.migrations.transform.TransformerParams; import org.opensearch.migrations.utils.ProcessHelpers; +import org.opensearch.migrations.utils.TrackedFutureJsonFormatter; import com.beust.jcommander.JCommander; import com.beust.jcommander.Parameter; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/TrafficReplayerCore.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/TrafficReplayerCore.java index ef9761d79..6cc3a76dd 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/TrafficReplayerCore.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/TrafficReplayerCore.java @@ -23,11 +23,11 @@ import org.opensearch.migrations.replay.traffic.source.ITrafficCaptureSource; import org.opensearch.migrations.replay.traffic.source.ITrafficStreamWithKey; import org.opensearch.migrations.replay.traffic.source.TrafficStreamLimiter; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; import org.opensearch.migrations.trafficcapture.protos.TrafficStreamUtils; import org.opensearch.migrations.transform.IAuthTransformerFactory; import org.opensearch.migrations.transform.IJsonTransformer; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import lombok.AllArgsConstructor; import lombok.Lombok; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/TrafficReplayerTopLevel.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/TrafficReplayerTopLevel.java index 56770800a..74c533ce6 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/TrafficReplayerTopLevel.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/TrafficReplayerTopLevel.java @@ -23,10 +23,10 @@ import org.opensearch.migrations.replay.tracing.IRootReplayerContext; import org.opensearch.migrations.replay.traffic.source.BlockingTrafficSource; import org.opensearch.migrations.replay.traffic.source.TrafficStreamLimiter; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; import org.opensearch.migrations.transform.IAuthTransformerFactory; import org.opensearch.migrations.transform.IJsonTransformer; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslContextBuilder; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/IPacketConsumer.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/IPacketConsumer.java index c0c484a87..697d4ed4d 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/IPacketConsumer.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/IPacketConsumer.java @@ -1,6 +1,6 @@ package org.opensearch.migrations.replay.datahandlers; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/IPacketFinalizingConsumer.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/IPacketFinalizingConsumer.java index 53e381a7f..1cbfcb71b 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/IPacketFinalizingConsumer.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/IPacketFinalizingConsumer.java @@ -1,6 +1,6 @@ package org.opensearch.migrations.replay.datahandlers; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; /** * This class consumes arrays of bytes or ByteBufs, potentially asynchronously, diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/NettyPacketToHttpConsumer.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/NettyPacketToHttpConsumer.java index 3dfc2054c..69b3b2b90 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/NettyPacketToHttpConsumer.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/NettyPacketToHttpConsumer.java @@ -19,10 +19,10 @@ import org.opensearch.migrations.replay.netty.BacksideHttpWatcherHandler; import org.opensearch.migrations.replay.netty.BacksideSnifferHandler; import org.opensearch.migrations.replay.tracing.IReplayContexts; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; import org.opensearch.migrations.tracing.IScopedInstrumentationAttributes; import org.opensearch.migrations.tracing.IWithTypedEnclosingScope; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.bootstrap.Bootstrap; import io.netty.buffer.ByteBuf; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/TransformedPacketReceiver.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/TransformedPacketReceiver.java index 86a707cfa..eec3ab6f7 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/TransformedPacketReceiver.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/TransformedPacketReceiver.java @@ -1,7 +1,7 @@ package org.opensearch.migrations.replay.datahandlers; import org.opensearch.migrations.replay.datatypes.ByteBufList; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.buffer.ByteBuf; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/http/HttpJsonTransformingConsumer.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/http/HttpJsonTransformingConsumer.java index c83f466ab..8c2dca816 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/http/HttpJsonTransformingConsumer.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/http/HttpJsonTransformingConsumer.java @@ -11,10 +11,10 @@ import org.opensearch.migrations.replay.datatypes.HttpRequestTransformationStatus; import org.opensearch.migrations.replay.datatypes.TransformedOutputAndResult; import org.opensearch.migrations.replay.tracing.IReplayContexts; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; import org.opensearch.migrations.transform.IAuthTransformerFactory; import org.opensearch.migrations.transform.IJsonTransformer; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.buffer.ByteBuf; import io.netty.channel.embedded.EmbeddedChannel; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/http/NettySendByteBufsToPacketHandlerHandler.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/http/NettySendByteBufsToPacketHandlerHandler.java index e470ef02e..436dfee0f 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/http/NettySendByteBufsToPacketHandlerHandler.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datahandlers/http/NettySendByteBufsToPacketHandlerHandler.java @@ -7,8 +7,8 @@ import org.opensearch.migrations.replay.datatypes.HttpRequestTransformationStatus; import org.opensearch.migrations.replay.datatypes.TransformedOutputAndResult; import org.opensearch.migrations.replay.tracing.IReplayContexts; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datatypes/ChannelTask.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datatypes/ChannelTask.java index e45ead7a3..9cb4c5400 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datatypes/ChannelTask.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datatypes/ChannelTask.java @@ -1,5 +1,7 @@ package org.opensearch.migrations.replay.datatypes; +import org.opensearch.migrations.utils.FutureTransformer; + import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datatypes/ConnectionReplaySession.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datatypes/ConnectionReplaySession.java index 909fd263e..1402fbfdb 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datatypes/ConnectionReplaySession.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datatypes/ConnectionReplaySession.java @@ -3,9 +3,9 @@ import java.util.function.BiFunction; import org.opensearch.migrations.replay.tracing.IReplayContexts; -import org.opensearch.migrations.replay.util.OnlineRadixSorter; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.OnlineRadixSorter; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.channel.ChannelFuture; import io.netty.channel.EventLoop; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datatypes/TimeToResponseFulfillmentFutureMap.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datatypes/TimeToResponseFulfillmentFutureMap.java index 5fdfa85f9..2ab967106 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datatypes/TimeToResponseFulfillmentFutureMap.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datatypes/TimeToResponseFulfillmentFutureMap.java @@ -5,8 +5,8 @@ import java.util.Deque; import java.util.StringJoiner; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; public class TimeToResponseFulfillmentFutureMap { diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/DefaultRetry.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/DefaultRetry.java index dcf1ca62d..e0f99f1a8 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/DefaultRetry.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/DefaultRetry.java @@ -8,8 +8,8 @@ import org.opensearch.migrations.replay.HttpByteBufFormatter; import org.opensearch.migrations.replay.IRequestResponsePacketPair; import org.opensearch.migrations.replay.RequestSenderOrchestrator; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.buffer.ByteBuf; import io.netty.handler.codec.http.HttpResponse; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/IRetryVisitorFactory.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/IRetryVisitorFactory.java index fa9593012..3d0b92f41 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/IRetryVisitorFactory.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/IRetryVisitorFactory.java @@ -4,7 +4,7 @@ import org.opensearch.migrations.replay.RequestSenderOrchestrator; import org.opensearch.migrations.replay.datatypes.ByteBufList; import org.opensearch.migrations.replay.datatypes.TransformedOutputAndResult; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; public interface IRetryVisitorFactory { RequestSenderOrchestrator.RetryVisitor diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/NoRetryEvaluatorFactory.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/NoRetryEvaluatorFactory.java index 6ac766252..7ff72d34f 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/NoRetryEvaluatorFactory.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/NoRetryEvaluatorFactory.java @@ -5,8 +5,8 @@ import org.opensearch.migrations.replay.RequestSenderOrchestrator; import org.opensearch.migrations.replay.datatypes.ByteBufList; import org.opensearch.migrations.replay.datatypes.TransformedOutputAndResult; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.buffer.ByteBuf; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/OpenSearchDefaultRetry.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/OpenSearchDefaultRetry.java index d90d75781..9401fabd6 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/OpenSearchDefaultRetry.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/OpenSearchDefaultRetry.java @@ -9,8 +9,8 @@ import org.opensearch.migrations.replay.HttpByteBufFormatter; import org.opensearch.migrations.replay.IRequestResponsePacketPair; import org.opensearch.migrations.replay.RequestSenderOrchestrator; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonParser; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/RequestRetryEvaluator.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/RequestRetryEvaluator.java index 4c9f3efe9..379ce550e 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/RequestRetryEvaluator.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/RequestRetryEvaluator.java @@ -5,7 +5,7 @@ import org.opensearch.migrations.replay.AggregatedRawResponse; import org.opensearch.migrations.replay.IRequestResponsePacketPair; import org.opensearch.migrations.replay.RequestSenderOrchestrator; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.buffer.ByteBuf; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/RetryCollectingVisitorFactory.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/RetryCollectingVisitorFactory.java index 0be084929..040456c99 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/RetryCollectingVisitorFactory.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/http/retries/RetryCollectingVisitorFactory.java @@ -7,8 +7,8 @@ import org.opensearch.migrations.replay.TransformedTargetRequestAndResponseList; import org.opensearch.migrations.replay.datatypes.ByteBufList; import org.opensearch.migrations.replay.datatypes.TransformedOutputAndResult; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; public class RetryCollectingVisitorFactory implements IRetryVisitorFactory { private final RequestRetryEvaluator shouldRetry; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/ActiveContextMonitor.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/ActiveContextMonitor.java index 98ceda5dc..8216e932b 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/ActiveContextMonitor.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/ActiveContextMonitor.java @@ -23,6 +23,7 @@ import org.opensearch.migrations.tracing.ActiveContextTracker; import org.opensearch.migrations.tracing.ActiveContextTrackerByActivityType; import org.opensearch.migrations.tracing.IScopedInstrumentationAttributes; +import org.opensearch.migrations.utils.TrackedFuture; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/OrderedWorkerTracker.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/OrderedWorkerTracker.java index c32a887aa..3f6c96753 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/OrderedWorkerTracker.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/OrderedWorkerTracker.java @@ -8,6 +8,7 @@ import org.opensearch.migrations.replay.TrafficReplayerTopLevel; import org.opensearch.migrations.replay.datatypes.UniqueReplayerRequestKey; +import org.opensearch.migrations.utils.TrackedFuture; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/utils/TrackedFutureJsonFormatter.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/utils/TrackedFutureJsonFormatter.java new file mode 100644 index 000000000..31c9968f8 --- /dev/null +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/utils/TrackedFutureJsonFormatter.java @@ -0,0 +1,29 @@ +package org.opensearch.migrations.utils; + +import java.util.function.Function; + +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.Lombok; +import lombok.NonNull; + +public class TrackedFutureJsonFormatter { + + static ObjectMapper objectMapper = new ObjectMapper(); + + private TrackedFutureJsonFormatter() {} + + public static String format(TrackedFuture tf) { + return format(tf, x -> null); + } + + public static String format( + TrackedFuture tf, + @NonNull Function, String> resultFormatter + ) { + try { + return objectMapper.writeValueAsString(TrackedFutureMapConverter.makeJson(tf, resultFormatter)); + } catch (Exception e) { + throw Lombok.sneakyThrow(e); + } + } +} diff --git a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/RequestSenderOrchestratorTest.java b/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/RequestSenderOrchestratorTest.java index e5b8140ad..0af9c4cf8 100644 --- a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/RequestSenderOrchestratorTest.java +++ b/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/RequestSenderOrchestratorTest.java @@ -21,11 +21,11 @@ import org.opensearch.migrations.replay.http.retries.NoRetryEvaluatorFactory; import org.opensearch.migrations.replay.util.NettyUtils; import org.opensearch.migrations.replay.util.RefSafeHolder; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; import org.opensearch.migrations.testutils.SimpleHttpServer; import org.opensearch.migrations.testutils.WrapWithNettyLeakDetection; import org.opensearch.migrations.tracing.InstrumentationTest; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; diff --git a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/datahandlers/NettyPacketToHttpConsumerTest.java b/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/datahandlers/NettyPacketToHttpConsumerTest.java index e0b4eeb8d..9ef1f3bed 100644 --- a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/datahandlers/NettyPacketToHttpConsumerTest.java +++ b/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/datahandlers/NettyPacketToHttpConsumerTest.java @@ -26,7 +26,6 @@ import org.opensearch.migrations.replay.datatypes.ConnectionReplaySession; import org.opensearch.migrations.replay.http.retries.NoRetryEvaluatorFactory; import org.opensearch.migrations.replay.traffic.source.BufferedFlowController; -import org.opensearch.migrations.replay.util.TextTrackedFuture; import org.opensearch.migrations.testutils.HttpRequest; import org.opensearch.migrations.testutils.SimpleHttpClientForTesting; import org.opensearch.migrations.testutils.SimpleHttpResponse; @@ -35,6 +34,7 @@ import org.opensearch.migrations.tracing.InstrumentationTest; import org.opensearch.migrations.tracing.TestContext; import org.opensearch.migrations.transform.TransformationLoader; +import org.opensearch.migrations.utils.TextTrackedFuture; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.handler.codec.http.HttpHeaderNames; diff --git a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/datahandlers/http/HttpJsonTransformingConsumerTest.java b/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/datahandlers/http/HttpJsonTransformingConsumerTest.java index 7e106b433..8dcf6ba49 100644 --- a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/datahandlers/http/HttpJsonTransformingConsumerTest.java +++ b/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/datahandlers/http/HttpJsonTransformingConsumerTest.java @@ -16,7 +16,6 @@ import org.opensearch.migrations.replay.TestCapturePacketToHttpHandler; import org.opensearch.migrations.replay.TestUtils; import org.opensearch.migrations.replay.datatypes.HttpRequestTransformationStatus; -import org.opensearch.migrations.replay.util.TrackedFuture; import org.opensearch.migrations.testutils.WrapWithNettyLeakDetection; import org.opensearch.migrations.tracing.InstrumentationTest; import org.opensearch.migrations.transform.IJsonTransformer; @@ -24,6 +23,7 @@ import org.opensearch.migrations.transform.JsonKeysForHttpMessage; import org.opensearch.migrations.transform.RemovingAuthTransformerFactory; import org.opensearch.migrations.transform.TransformationLoader; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; diff --git a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/http/retries/HttpRetryTest.java b/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/http/retries/HttpRetryTest.java index dacc7fec3..42562e00b 100644 --- a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/http/retries/HttpRetryTest.java +++ b/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/http/retries/HttpRetryTest.java @@ -18,8 +18,6 @@ import org.opensearch.migrations.replay.datatypes.ByteBufList; import org.opensearch.migrations.replay.datatypes.HttpRequestTransformationStatus; import org.opensearch.migrations.replay.datatypes.TransformedOutputAndResult; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; import org.opensearch.migrations.testutils.SharedDockerImageNames; import org.opensearch.migrations.testutils.SimpleHttpResponse; import org.opensearch.migrations.testutils.SimpleHttpServer; @@ -27,6 +25,8 @@ import org.opensearch.migrations.testutils.WrapWithNettyLeakDetection; import org.opensearch.migrations.tracing.InMemoryInstrumentationBundle; import org.opensearch.migrations.tracing.TestContext; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.buffer.Unpooled; import io.netty.util.concurrent.DefaultThreadFactory; diff --git a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/http/retries/OpenSearchDefaultRetryTest.java b/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/http/retries/OpenSearchDefaultRetryTest.java index 0b78e1fa6..2888cfd54 100644 --- a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/http/retries/OpenSearchDefaultRetryTest.java +++ b/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/http/retries/OpenSearchDefaultRetryTest.java @@ -11,7 +11,7 @@ import org.opensearch.migrations.replay.AggregatedRawResponse; import org.opensearch.migrations.replay.HttpByteBufFormatter; import org.opensearch.migrations.replay.RequestSenderOrchestrator; -import org.opensearch.migrations.replay.util.TextTrackedFuture; +import org.opensearch.migrations.utils.TextTrackedFuture; import io.netty.buffer.Unpooled; import org.junit.jupiter.api.Assertions; diff --git a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/transform/HeaderTransformerTest.java b/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/transform/HeaderTransformerTest.java index 2ac621929..f56a4777f 100644 --- a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/transform/HeaderTransformerTest.java +++ b/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/transform/HeaderTransformerTest.java @@ -15,11 +15,11 @@ import org.opensearch.migrations.replay.TestUtils; import org.opensearch.migrations.replay.datahandlers.http.HttpJsonTransformingConsumer; import org.opensearch.migrations.replay.datatypes.HttpRequestTransformationStatus; -import org.opensearch.migrations.replay.util.TrackedFuture; import org.opensearch.migrations.testutils.WrapWithNettyLeakDetection; import org.opensearch.migrations.tracing.InstrumentationTest; import org.opensearch.migrations.transform.StaticAuthTransformerFactory; import org.opensearch.migrations.transform.TransformationLoader; +import org.opensearch.migrations.utils.TrackedFuture; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Assertions; diff --git a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/util/ActiveContextMonitorTest.java b/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/util/ActiveContextMonitorTest.java index 7f7507c64..5ff398ef2 100644 --- a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/util/ActiveContextMonitorTest.java +++ b/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/util/ActiveContextMonitorTest.java @@ -15,6 +15,7 @@ import org.opensearch.migrations.tracing.CompositeContextTracker; import org.opensearch.migrations.tracing.IScopedInstrumentationAttributes; import org.opensearch.migrations.tracing.TestContext; +import org.opensearch.migrations.utils.TrackedFuture; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Assertions; diff --git a/TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/replay/GenerateRandomNestedJsonObject.java b/TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/replay/GenerateRandomNestedJsonObject.java index 29886bba3..5dac9951f 100644 --- a/TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/replay/GenerateRandomNestedJsonObject.java +++ b/TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/replay/GenerateRandomNestedJsonObject.java @@ -9,7 +9,7 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; -import org.opensearch.migrations.PruferTreeGenerator; +import org.opensearch.migrations.utils.PruferTreeGenerator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/replay/TestCapturePacketToHttpHandler.java b/TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/replay/TestCapturePacketToHttpHandler.java index c78a03342..aba31e5e0 100644 --- a/TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/replay/TestCapturePacketToHttpHandler.java +++ b/TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/replay/TestCapturePacketToHttpHandler.java @@ -8,8 +8,8 @@ import java.util.concurrent.atomic.AtomicInteger; import org.opensearch.migrations.replay.datahandlers.IPacketFinalizingConsumer; -import org.opensearch.migrations.replay.util.TextTrackedFuture; -import org.opensearch.migrations.replay.util.TrackedFuture; +import org.opensearch.migrations.utils.TextTrackedFuture; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.buffer.ByteBuf; import lombok.Getter; diff --git a/TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/replay/TestUtils.java b/TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/replay/TestUtils.java index a72338536..f8409eaa0 100644 --- a/TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/replay/TestUtils.java +++ b/TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/replay/TestUtils.java @@ -18,10 +18,10 @@ import org.opensearch.migrations.Utils; import org.opensearch.migrations.replay.datahandlers.IPacketConsumer; import org.opensearch.migrations.replay.datahandlers.http.HttpJsonTransformingConsumer; -import org.opensearch.migrations.replay.util.TrackedFuture; import org.opensearch.migrations.tracing.TestContext; import org.opensearch.migrations.transform.IAuthTransformerFactory; import org.opensearch.migrations.transform.IJsonTransformer; +import org.opensearch.migrations.utils.TrackedFuture; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; diff --git a/coreUtilities/build.gradle b/coreUtilities/build.gradle index 8494c3f30..1c95ddce1 100644 --- a/coreUtilities/build.gradle +++ b/coreUtilities/build.gradle @@ -48,8 +48,8 @@ dependencies { implementation group: 'io.opentelemetry', name: 'opentelemetry-exporter-otlp' implementation group: 'io.opentelemetry.semconv', name: 'opentelemetry-semconv' - implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind' - implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core' + testImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind' + testImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-core' testImplementation group: 'org.mockito', name: 'mockito-core' testImplementation group: 'org.hamcrest', name: 'hamcrest' diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datatypes/FutureTransformer.java b/coreUtilities/src/main/java/org/opensearch/migrations/utils/FutureTransformer.java similarity index 71% rename from TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datatypes/FutureTransformer.java rename to coreUtilities/src/main/java/org/opensearch/migrations/utils/FutureTransformer.java index b5ebb7e94..1895d2d00 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datatypes/FutureTransformer.java +++ b/coreUtilities/src/main/java/org/opensearch/migrations/utils/FutureTransformer.java @@ -1,9 +1,7 @@ -package org.opensearch.migrations.replay.datatypes; +package org.opensearch.migrations.utils; import java.util.function.Function; -import org.opensearch.migrations.replay.util.TrackedFuture; - /** * This is a function rather than just a supplier so that the future returned can be * chained to its logical parent dependency. diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/OnlineRadixSorter.java b/coreUtilities/src/main/java/org/opensearch/migrations/utils/OnlineRadixSorter.java similarity index 97% rename from TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/OnlineRadixSorter.java rename to coreUtilities/src/main/java/org/opensearch/migrations/utils/OnlineRadixSorter.java index a6eaafc57..74dd2142b 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/OnlineRadixSorter.java +++ b/coreUtilities/src/main/java/org/opensearch/migrations/utils/OnlineRadixSorter.java @@ -1,4 +1,4 @@ -package org.opensearch.migrations.replay.util; +package org.opensearch.migrations.utils; import java.util.Optional; import java.util.SortedMap; @@ -6,9 +6,6 @@ import java.util.concurrent.CompletableFuture; import java.util.stream.IntStream; -import org.opensearch.migrations.replay.datatypes.FutureTransformer; -import org.opensearch.migrations.utils.SequentialSpanCompressingReducer; - import lombok.AllArgsConstructor; import lombok.Getter; import lombok.extern.slf4j.Slf4j; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/TextTrackedFuture.java b/coreUtilities/src/main/java/org/opensearch/migrations/utils/TextTrackedFuture.java similarity index 97% rename from TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/TextTrackedFuture.java rename to coreUtilities/src/main/java/org/opensearch/migrations/utils/TextTrackedFuture.java index 71950e7e9..6fe2e9f77 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/TextTrackedFuture.java +++ b/coreUtilities/src/main/java/org/opensearch/migrations/utils/TextTrackedFuture.java @@ -1,4 +1,4 @@ -package org.opensearch.migrations.replay.util; +package org.opensearch.migrations.utils; import java.util.Arrays; import java.util.concurrent.CompletableFuture; diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/TrackedFuture.java b/coreUtilities/src/main/java/org/opensearch/migrations/utils/TrackedFuture.java similarity index 97% rename from TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/TrackedFuture.java rename to coreUtilities/src/main/java/org/opensearch/migrations/utils/TrackedFuture.java index 7412d31d1..5d8cf4d07 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/TrackedFuture.java +++ b/coreUtilities/src/main/java/org/opensearch/migrations/utils/TrackedFuture.java @@ -1,4 +1,4 @@ -package org.opensearch.migrations.replay.util; +package org.opensearch.migrations.utils; import java.time.Duration; import java.util.Optional; @@ -244,8 +244,4 @@ public String toString() { public String formatAsString(@NonNull Function, String> resultFormatter) { return TrackedFutureStringFormatter.format(this, resultFormatter); } - - public String formatAsJson(@NonNull Function, String> resultFormatter) { - return TrackedFutureJsonFormatter.format(this, resultFormatter); - } } diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/TrackedFutureJsonFormatter.java b/coreUtilities/src/main/java/org/opensearch/migrations/utils/TrackedFutureMapConverter.java similarity index 69% rename from TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/TrackedFutureJsonFormatter.java rename to coreUtilities/src/main/java/org/opensearch/migrations/utils/TrackedFutureMapConverter.java index 26f778269..417ddaa04 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/TrackedFutureJsonFormatter.java +++ b/coreUtilities/src/main/java/org/opensearch/migrations/utils/TrackedFutureMapConverter.java @@ -1,4 +1,4 @@ -package org.opensearch.migrations.replay.util; +package org.opensearch.migrations.utils; import java.util.LinkedHashMap; import java.util.List; @@ -7,32 +7,13 @@ import java.util.function.Function; import java.util.stream.Collectors; -import com.fasterxml.jackson.databind.ObjectMapper; -import lombok.Lombok; import lombok.NonNull; import lombok.SneakyThrows; -public class TrackedFutureJsonFormatter { - - static ObjectMapper objectMapper = new ObjectMapper(); - - private TrackedFutureJsonFormatter() {} - - public static String format(TrackedFuture tf) { - return format(tf, x -> null); - } - - public static String format( - TrackedFuture tf, - @NonNull Function, String> resultFormatter - ) { - try { - return objectMapper.writeValueAsString(makeJson(tf, resultFormatter)); - } catch (Exception e) { - throw Lombok.sneakyThrow(e); - } - } +public class TrackedFutureMapConverter { + private TrackedFutureMapConverter() {} + public static List makeJson( TrackedFuture tf, @NonNull Function, String> resultFormatter diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/TrackedFutureStringFormatter.java b/coreUtilities/src/main/java/org/opensearch/migrations/utils/TrackedFutureStringFormatter.java similarity index 96% rename from TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/TrackedFutureStringFormatter.java rename to coreUtilities/src/main/java/org/opensearch/migrations/utils/TrackedFutureStringFormatter.java index 06bff5caf..662418d41 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/util/TrackedFutureStringFormatter.java +++ b/coreUtilities/src/main/java/org/opensearch/migrations/utils/TrackedFutureStringFormatter.java @@ -1,4 +1,4 @@ -package org.opensearch.migrations.replay.util; +package org.opensearch.migrations.utils; import java.util.Optional; import java.util.function.Function; diff --git a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/PruferTreeGeneratorTest.java b/coreUtilities/src/test/java/org/opensearch/migrations/PruferTreeGeneratorTest.java similarity index 94% rename from TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/PruferTreeGeneratorTest.java rename to coreUtilities/src/test/java/org/opensearch/migrations/PruferTreeGeneratorTest.java index 3cbe7346a..3006f8e97 100644 --- a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/PruferTreeGeneratorTest.java +++ b/coreUtilities/src/test/java/org/opensearch/migrations/PruferTreeGeneratorTest.java @@ -7,13 +7,12 @@ import java.util.Random; import java.util.stream.IntStream; -import org.opensearch.migrations.testutils.WrapWithNettyLeakDetection; +import org.opensearch.migrations.utils.PruferTreeGenerator; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -@WrapWithNettyLeakDetection(disableLeakChecks = true) public class PruferTreeGeneratorTest { @Test diff --git a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/util/OnlineRadixSorterTest.java b/coreUtilities/src/test/java/org/opensearch/migrations/utils/OnlineRadixSorterTest.java similarity index 98% rename from TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/util/OnlineRadixSorterTest.java rename to coreUtilities/src/test/java/org/opensearch/migrations/utils/OnlineRadixSorterTest.java index 42bd67190..cb4a33d25 100644 --- a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/util/OnlineRadixSorterTest.java +++ b/coreUtilities/src/test/java/org/opensearch/migrations/utils/OnlineRadixSorterTest.java @@ -1,4 +1,4 @@ -package org.opensearch.migrations.replay.util; +package org.opensearch.migrations.utils; import java.util.ArrayList; import java.util.HashMap; diff --git a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/util/TextTrackedFutureTest.java b/coreUtilities/src/test/java/org/opensearch/migrations/utils/TextTrackedFutureTest.java similarity index 87% rename from TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/util/TextTrackedFutureTest.java rename to coreUtilities/src/test/java/org/opensearch/migrations/utils/TextTrackedFutureTest.java index d6db04138..c5847f28d 100644 --- a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/util/TextTrackedFutureTest.java +++ b/coreUtilities/src/test/java/org/opensearch/migrations/utils/TextTrackedFutureTest.java @@ -1,17 +1,18 @@ -package org.opensearch.migrations.replay.util; +package org.opensearch.migrations.utils; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; +import java.util.function.Function; -import org.opensearch.migrations.testutils.WrapWithNettyLeakDetection; - +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.NonNull; import lombok.SneakyThrows; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -@WrapWithNettyLeakDetection(disableLeakChecks = true) class TextTrackedFutureTest { + private final static ObjectMapper objectMapper = new ObjectMapper(); @SneakyThrows private static void sneakyWait(CompletableFuture o) { o.get(5, TimeUnit.MINUTES); @@ -59,7 +60,7 @@ public void futureWithThreeStages() throws Exception { Assertions.assertEquals( "[{\"idHash\":" + id1 + ",\"label\":\"A\",\"value\":\"…\"}]", - TrackedFutureJsonFormatter.format(stcf1) + format(stcf1) ); Assertions.assertEquals( "[" @@ -69,7 +70,7 @@ public void futureWithThreeStages() throws Exception { + "{\"idHash\":" + id1 + ",\"label\":\"A\",\"value\":\"…\"}]", - TrackedFutureJsonFormatter.format(stcf2) + format(stcf2) ); Assertions.assertEquals( "[" @@ -82,7 +83,7 @@ public void futureWithThreeStages() throws Exception { + "{\"idHash\":" + id1 + ",\"label\":\"A\",\"value\":\"…\"}]", - TrackedFutureJsonFormatter.format(stcf3) + format(stcf3) ); notifyAndWaitForGet(stcf1, notifier1); @@ -99,7 +100,7 @@ public void futureWithThreeStages() throws Exception { Assertions.assertEquals( "[{\"idHash\":" + id1 + ",\"label\":\"A\",\"value\":\"^\"}]", - TrackedFutureJsonFormatter.format(stcf1) + format(stcf1) ); Assertions.assertEquals( "[" @@ -109,7 +110,7 @@ public void futureWithThreeStages() throws Exception { + "{\"idHash\":" + id1 + ",\"label\":\"A\",\"value\":\"^\"}]", - TrackedFutureJsonFormatter.format(stcf2) + format(stcf2) ); Assertions.assertEquals( "[" @@ -122,7 +123,7 @@ public void futureWithThreeStages() throws Exception { + "{\"idHash\":" + id1 + ",\"label\":\"A\",\"value\":\"^\"}]", - TrackedFutureJsonFormatter.format(stcf3) + format(stcf3) ); notifyAndWaitForGet(stcf2, notifier2); @@ -139,7 +140,7 @@ public void futureWithThreeStages() throws Exception { Assertions.assertEquals( "[{\"idHash\":" + id1 + ",\"label\":\"A\",\"value\":\"^\"}]", - TrackedFutureJsonFormatter.format(stcf1) + format(stcf1) ); Assertions.assertEquals( "[" @@ -149,7 +150,7 @@ public void futureWithThreeStages() throws Exception { + "{\"idHash\":" + id1 + ",\"label\":\"A\",\"value\":\"^\"}]", - TrackedFutureJsonFormatter.format(stcf2) + format(stcf2) ); Assertions.assertEquals( "[" @@ -162,7 +163,7 @@ public void futureWithThreeStages() throws Exception { + "{\"idHash\":" + id1 + ",\"label\":\"A\",\"value\":\"^\"}]", - TrackedFutureJsonFormatter.format(stcf3) + format(stcf3) ); Assertions.assertEquals( "[" @@ -175,7 +176,7 @@ public void futureWithThreeStages() throws Exception { + "{\"idHash\":" + id1 + ",\"label\":\"A\",\"value\":\"1\"}]", - stcf3.formatAsJson(TextTrackedFutureTest::formatCompletableFuture) + format(stcf3, TextTrackedFutureTest::formatCompletableFuture) ); // A is clipped because of grandparent culling @@ -192,10 +193,21 @@ public void futureWithThreeStages() throws Exception { + "{\"idHash\":" + id2 + ",\"label\":\"B\",\"value\":\"11\"}]", - stcf3.formatAsJson(TextTrackedFutureTest::formatCompletableFuture) + format(stcf3, TextTrackedFutureTest::formatCompletableFuture) ); } + @SneakyThrows + private String format(TrackedFuture tf) { + return objectMapper.writeValueAsString(TrackedFutureMapConverter.makeJson(tf, x -> null)); + } + + @SneakyThrows + private static String format(TrackedFuture tf, + @NonNull Function, String> resultFormatter) { + return objectMapper.writeValueAsString(TrackedFutureMapConverter.makeJson(tf, resultFormatter)); + } + public static String formatCompletableFuture(TrackedFuture cf) { try { return "" + cf.get(); diff --git a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/util/TrackedFutureTest.java b/coreUtilities/src/test/java/org/opensearch/migrations/utils/TrackedFutureTest.java similarity index 97% rename from TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/util/TrackedFutureTest.java rename to coreUtilities/src/test/java/org/opensearch/migrations/utils/TrackedFutureTest.java index 4f5898212..6c740c10a 100644 --- a/TrafficCapture/trafficReplayer/src/test/java/org/opensearch/migrations/replay/util/TrackedFutureTest.java +++ b/coreUtilities/src/test/java/org/opensearch/migrations/utils/TrackedFutureTest.java @@ -1,4 +1,4 @@ -package org.opensearch.migrations.replay.util; +package org.opensearch.migrations.utils; import java.util.concurrent.Semaphore; diff --git a/TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/replay/util/OnlineRadixSorterForIntegratedKeys.java b/coreUtilities/src/testFixtures/java/org/opensearch/migrations/utils/OnlineRadixSorterForIntegratedKeys.java similarity index 95% rename from TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/replay/util/OnlineRadixSorterForIntegratedKeys.java rename to coreUtilities/src/testFixtures/java/org/opensearch/migrations/utils/OnlineRadixSorterForIntegratedKeys.java index 6baf03bef..03fe43fdf 100644 --- a/TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/replay/util/OnlineRadixSorterForIntegratedKeys.java +++ b/coreUtilities/src/testFixtures/java/org/opensearch/migrations/utils/OnlineRadixSorterForIntegratedKeys.java @@ -1,4 +1,4 @@ -package org.opensearch.migrations.replay.util; +package org.opensearch.migrations.utils; import java.util.function.ToIntFunction; diff --git a/TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/PruferTreeGenerator.java b/coreUtilities/src/testFixtures/java/org/opensearch/migrations/utils/PruferTreeGenerator.java similarity index 99% rename from TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/PruferTreeGenerator.java rename to coreUtilities/src/testFixtures/java/org/opensearch/migrations/utils/PruferTreeGenerator.java index b0b2b07c4..2dff8dee3 100644 --- a/TrafficCapture/trafficReplayer/src/testFixtures/java/org/opensearch/migrations/PruferTreeGenerator.java +++ b/coreUtilities/src/testFixtures/java/org/opensearch/migrations/utils/PruferTreeGenerator.java @@ -1,4 +1,4 @@ -package org.opensearch.migrations; +package org.opensearch.migrations.utils; import java.util.ArrayList; import java.util.Arrays;