From f37883660b5e46f11946b0fe454c6d015ae56a85 Mon Sep 17 00:00:00 2001 From: mvanzalu Date: Tue, 12 Nov 2024 15:22:14 +0000 Subject: [PATCH] refactor: optimize imports --- .../datashare/tasks/TaskManagerMemory.java | 5 ++--- .../icij/datashare/web/TaskResourceTest.java | 22 +++++-------------- .../datashare/asynctasks/TaskManagerAmqp.java | 6 +---- .../asynctasks/TaskManagerMemory.java | 12 +--------- .../asynctasks/TaskManagerAmqpTest.java | 13 ++--------- .../asynctasks/TaskManagerMemoryTest.java | 14 ++++++------ 6 files changed, 18 insertions(+), 54 deletions(-) diff --git a/datashare-app/src/main/java/org/icij/datashare/tasks/TaskManagerMemory.java b/datashare-app/src/main/java/org/icij/datashare/tasks/TaskManagerMemory.java index 32e8fd8ac..bd0689d4e 100644 --- a/datashare-app/src/main/java/org/icij/datashare/tasks/TaskManagerMemory.java +++ b/datashare-app/src/main/java/org/icij/datashare/tasks/TaskManagerMemory.java @@ -2,13 +2,12 @@ import com.google.inject.Inject; import com.google.inject.Singleton; +import org.icij.datashare.PropertiesProvider; +import org.icij.datashare.asynctasks.Task; import java.util.concurrent.BlockingQueue; import java.util.concurrent.CountDownLatch; -import org.icij.datashare.PropertiesProvider; -import org.icij.datashare.asynctasks.Task; - @Singleton public class TaskManagerMemory extends org.icij.datashare.asynctasks.TaskManagerMemory { diff --git a/datashare-app/src/test/java/org/icij/datashare/web/TaskResourceTest.java b/datashare-app/src/test/java/org/icij/datashare/web/TaskResourceTest.java index 243f283d5..ee8e0ba77 100644 --- a/datashare-app/src/test/java/org/icij/datashare/web/TaskResourceTest.java +++ b/datashare-app/src/test/java/org/icij/datashare/web/TaskResourceTest.java @@ -1,23 +1,18 @@ package org.icij.datashare.web; -import java.util.Map; -import java.util.function.Function; import net.codestory.http.routes.Routes; import net.codestory.rest.Response; import net.codestory.rest.RestAssert; import net.codestory.rest.ShouldChain; import org.icij.datashare.PropertiesProvider; -import org.icij.datashare.asynctasks.Group; -import org.icij.datashare.asynctasks.Task; -import org.icij.datashare.asynctasks.TaskManager; -import org.icij.datashare.asynctasks.TaskModifier; -import org.icij.datashare.asynctasks.TaskSupplier; +import org.icij.datashare.asynctasks.*; import org.icij.datashare.asynctasks.bus.amqp.TaskCreation; import org.icij.datashare.db.JooqRepository; import org.icij.datashare.extension.PipelineRegistry; import org.icij.datashare.mode.CommonMode; import org.icij.datashare.nlp.EmailPipeline; import org.icij.datashare.session.LocalUserFilter; +import org.icij.datashare.tasks.TaskManagerMemory; import org.icij.datashare.tasks.*; import org.icij.datashare.test.DatashareTimeRule; import org.icij.datashare.text.indexing.Indexer; @@ -32,12 +27,10 @@ import org.mockito.Mock; import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Optional; +import java.util.*; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; +import java.util.function.Function; import static java.lang.String.format; import static java.util.concurrent.TimeUnit.SECONDS; @@ -48,12 +41,7 @@ import static org.icij.datashare.cli.DatashareCliOptions.REPORT_NAME_OPT; import static org.icij.datashare.json.JsonObjectMapper.MAPPER; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import static org.mockito.Mockito.*; import static org.mockito.MockitoAnnotations.initMocks; public class TaskResourceTest extends AbstractProdWebServerTest { diff --git a/datashare-tasks/src/main/java/org/icij/datashare/asynctasks/TaskManagerAmqp.java b/datashare-tasks/src/main/java/org/icij/datashare/asynctasks/TaskManagerAmqp.java index 91b5e9cd3..a8eba75c0 100644 --- a/datashare-tasks/src/main/java/org/icij/datashare/asynctasks/TaskManagerAmqp.java +++ b/datashare-tasks/src/main/java/org/icij/datashare/asynctasks/TaskManagerAmqp.java @@ -1,10 +1,6 @@ package org.icij.datashare.asynctasks; -import org.icij.datashare.asynctasks.bus.amqp.AmqpConsumer; -import org.icij.datashare.asynctasks.bus.amqp.AmqpInterlocutor; -import org.icij.datashare.asynctasks.bus.amqp.AmqpQueue; -import org.icij.datashare.asynctasks.bus.amqp.CancelEvent; -import org.icij.datashare.asynctasks.bus.amqp.TaskEvent; +import org.icij.datashare.asynctasks.bus.amqp.*; import org.icij.datashare.tasks.RoutingStrategy; import org.icij.datashare.user.User; diff --git a/datashare-tasks/src/main/java/org/icij/datashare/asynctasks/TaskManagerMemory.java b/datashare-tasks/src/main/java/org/icij/datashare/asynctasks/TaskManagerMemory.java index 9d26483da..89bdc4341 100644 --- a/datashare-tasks/src/main/java/org/icij/datashare/asynctasks/TaskManagerMemory.java +++ b/datashare-tasks/src/main/java/org/icij/datashare/asynctasks/TaskManagerMemory.java @@ -12,24 +12,14 @@ import java.io.Serializable; import java.util.LinkedList; import java.util.List; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.CancellationException; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; +import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.IntStream; -import java.util.stream.Stream; import static java.lang.Integer.parseInt; -import static java.util.concurrent.Executors.newSingleThreadExecutor; import static java.util.stream.Collectors.toList; import static org.icij.datashare.asynctasks.Task.State.RUNNING; diff --git a/datashare-tasks/src/test/java/org/icij/datashare/asynctasks/TaskManagerAmqpTest.java b/datashare-tasks/src/test/java/org/icij/datashare/asynctasks/TaskManagerAmqpTest.java index 112980987..cdf3111e8 100644 --- a/datashare-tasks/src/test/java/org/icij/datashare/asynctasks/TaskManagerAmqpTest.java +++ b/datashare-tasks/src/test/java/org/icij/datashare/asynctasks/TaskManagerAmqpTest.java @@ -9,12 +9,7 @@ import org.icij.datashare.user.User; import org.icij.extract.redis.RedissonClientFactory; import org.icij.task.Options; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.ClassRule; -import org.junit.Test; +import org.junit.*; import org.redisson.Redisson; import org.redisson.RedissonMap; import org.redisson.api.RedissonClient; @@ -25,11 +20,7 @@ import java.io.Serializable; import java.util.HashMap; import java.util.Map; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.TimeUnit; +import java.util.concurrent.*; import static org.fest.assertions.Assertions.assertThat; diff --git a/datashare-tasks/src/test/java/org/icij/datashare/asynctasks/TaskManagerMemoryTest.java b/datashare-tasks/src/test/java/org/icij/datashare/asynctasks/TaskManagerMemoryTest.java index 28eb092d7..2201c6f93 100644 --- a/datashare-tasks/src/test/java/org/icij/datashare/asynctasks/TaskManagerMemoryTest.java +++ b/datashare-tasks/src/test/java/org/icij/datashare/asynctasks/TaskManagerMemoryTest.java @@ -1,12 +1,5 @@ package org.icij.datashare.asynctasks; -import static org.fest.assertions.Assertions.assertThat; - -import java.util.Map; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.TimeUnit; - import org.icij.datashare.PropertiesProvider; import org.icij.datashare.test.LogbackCapturingRule; import org.icij.datashare.user.User; @@ -16,6 +9,13 @@ import org.junit.Test; import org.slf4j.event.Level; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; + +import static org.fest.assertions.Assertions.assertThat; + public class TaskManagerMemoryTest { @Rule