From 59ada6603354f766dc627a83813af8fd69bab1fd Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Mon, 4 Feb 2019 10:20:01 -0500 Subject: [PATCH] ARTEMIS-1058 Improving web temporary cleanup * Using SpawnedVMSupport (used to be on testsuite, moving it to Utils) * Building the classpath for ./lib, similar to what happens on Bootstrap * Using Path as much as possible to avoid issues encoding files --- .../artemis/utils}/SpawnedVMSupport.java | 110 ++++++++++-------- .../artemis/component/WebServerComponent.java | 58 ++++----- .../artemis/component}/WebTmpCleaner.java | 30 +++-- .../activemq/cli/test/WebServerCLITest.java | 34 ++++++ .../integration/amqp/AmqpNoHearbeatsTest.java | 2 +- .../client/IncompatibleVersionTest.java | 2 +- .../integration/client/JournalCrashTest.java | 2 +- .../integration/client/SendAckFailTest.java | 2 +- .../clientcrash/ClientCrashTest.java | 2 +- .../clientcrash/ClientExitTest.java | 2 +- .../clientcrash/PendingDeliveriesTest.java | 2 +- .../cluster/RealNodeManagerTest.java | 2 +- .../failover/LiveCrashOnBackupSyncTest.java | 2 +- .../critical/CriticalCrashTest.java | 2 +- .../journal/CrashOnCompactTest.java | 2 +- .../ValidateTransactionHealthTest.java | 2 +- .../paging/PageCountSyncServer.java | 2 +- .../paging/PagingWithFailoverBackup.java | 2 +- .../paging/PagingWithFailoverServer.java | 2 +- .../security/NettySecurityClientTest.java | 2 +- .../artemis/common/AbstractAdmin.java | 2 +- .../core/util/RandomUtilDistributionTest.java | 2 +- .../artemis/tests/util/SpawnedVMCheck.java | 1 + 23 files changed, 160 insertions(+), 109 deletions(-) rename {tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util => artemis-commons/src/main/java/org/apache/activemq/artemis/utils}/SpawnedVMSupport.java (82%) rename {artemis-boot/src/main/java/org/apache/activemq/artemis/boot => artemis-web/src/main/java/org/apache/activemq/artemis/component}/WebTmpCleaner.java (64%) diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMSupport.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/SpawnedVMSupport.java similarity index 82% rename from tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMSupport.java rename to artemis-commons/src/main/java/org/apache/activemq/artemis/utils/SpawnedVMSupport.java index b8e86e965d..6f47c8247b 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMSupport.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/SpawnedVMSupport.java @@ -14,35 +14,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.util; +package org.apache.activemq.artemis.utils; import java.io.BufferedReader; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.file.Paths; import java.util.HashSet; import java.util.List; -import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import org.apache.activemq.artemis.tests.unit.UnitTestLogger; -import org.apache.activemq.artemis.utils.ActiveMQThreadFactory; -import org.junit.Assert; +import org.jboss.logging.Logger; -import static java.util.concurrent.TimeUnit.SECONDS; - -public final class SpawnedVMSupport { +public class SpawnedVMSupport { static ConcurrentHashMap startedProcesses = null; - private static final UnitTestLogger log = UnitTestLogger.LOGGER; + private static final Logger log = Logger.getLogger(SpawnedVMSupport.class); public static Process spawnVM(final String className, final String... args) throws Exception { return SpawnedVMSupport.spawnVM(className, new String[0], true, args); @@ -53,6 +44,12 @@ public final class SpawnedVMSupport { final String... args) throws Exception { return SpawnedVMSupport.spawnVM(className, new String[0], logOutput, args); } + public static Process spawnVM(final String classPath, + final String className, + final boolean logOutput, + final String... args) throws Exception { + return SpawnedVMSupport.spawnVM(classPath, className, new String[0], logOutput, args); + } public static Process spawnVM(final String className, final String[] vmargs, final String... args) throws Exception { return SpawnedVMSupport.spawnVM(className, vmargs, true, args); @@ -65,6 +62,14 @@ public final class SpawnedVMSupport { return SpawnedVMSupport.spawnVM(className, "-Xms512m", "-Xmx512m", vmargs, logOutput, true, true, args); } + public static Process spawnVM(final String classpath, + final String className, + final String[] vmargs, + final boolean logOutput, + final String... args) throws Exception { + return SpawnedVMSupport.spawnVM(classpath, className, "-Xms512m", "-Xmx512m", vmargs, logOutput, true, true, args); + } + public static Process spawnVMWithLogMacher(String wordMatch, Runnable runnable, final String className, @@ -85,6 +90,18 @@ public final class SpawnedVMSupport { return spawnVM(null, null, className, memoryArg1, memoryArg2, vmargs, logOutput, logErrorOutput, useLogging, args); } + public static Process spawnVM(final String classPath, + final String className, + final String memoryArg1, + final String memoryArg2, + final String[] vmargs, + final boolean logOutput, + final boolean logErrorOutput, + final boolean useLogging, + final String... args) throws Exception { + return spawnVM(classPath, null, null, className, memoryArg1, memoryArg2, vmargs, logOutput, logErrorOutput, useLogging, args); + } + public static Process spawnVM(final String wordMatch, final Runnable wordRunning, final String className, @@ -95,7 +112,7 @@ public final class SpawnedVMSupport { final boolean logErrorOutput, final boolean useLogging, final String... args) throws Exception { - return spawnVM(System.getProperty("java.class.path"), wordMatch, wordRunning, className, memoryArg1, memoryArg2, vmargs, logOutput, logErrorOutput, useLogging, args); + return spawnVM(getClassPath(), wordMatch, wordRunning, className, memoryArg1, memoryArg2, vmargs, logOutput, logErrorOutput, useLogging, args); } @@ -113,6 +130,30 @@ public final class SpawnedVMSupport { return spawnVM(classPath, wordMatch, wordRunning, className, memoryArg1, memoryArg2, vmargs, logOutput, logErrorOutput, useLogging, -1, args); } + public static String getClassPath() { + return System.getProperty("java.class.path"); + } + + public static String getClassPath(File libfolder) { + if (libfolder == null) { + return getClassPath(); + } + + StringBuilder stringBuilder = new StringBuilder(); + boolean empty = true; + for (File f : libfolder.listFiles()) { + if (f.getName().endsWith(".jar") || f.getName().endsWith(".zip")) { + if (!empty) { + stringBuilder.append(File.pathSeparator); + } + empty = false; + stringBuilder.append(f.toString()); + } + } + + return stringBuilder.toString(); + } + /** * @param classPath * @param wordMatch @@ -259,7 +300,10 @@ public final class SpawnedVMSupport { startedProcesses = new ConcurrentHashMap<>(); } - public static void checkProcess() { + /** + * Check if all spawned processes are finished. + */ + public static boolean checkProcess() { HashSet aliveProcess = getAliveProcesses(); @@ -270,11 +314,13 @@ public final class SpawnedVMSupport { alive.destroyForcibly(); buffer.append(startedProcesses.get(alive) + " "); } - Assert.fail("There are " + aliveProcess.size() + " processes alive :: " + buffer.toString()); + return false; } } finally { startedProcesses = null; } + + return true; } /** @@ -300,36 +346,6 @@ public final class SpawnedVMSupport { startLogger(true, null, null, className, process); } - /** - * Assert that a process exits with the expected value (or not depending if - * the sameValue is expected or not). The method waits 5 - * seconds for the process to exit, then an Exception is thrown. In any case, - * the process is destroyed before the method returns. - */ - public static void assertProcessExits(final boolean sameValue, - final int value, - final Process p) throws InterruptedException, ExecutionException, TimeoutException { - ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(ActiveMQThreadFactory.defaultThreadFactory()); - Future future = executor.submit(new Callable() { - - @Override - public Integer call() throws Exception { - p.waitFor(); - return p.exitValue(); - } - }); - try { - int exitValue = future.get(10, SECONDS); - if (sameValue) { - Assert.assertSame(value, exitValue); - } else { - Assert.assertNotSame(value, exitValue); - } - } finally { - p.destroy(); - } - } - /** * Redirect the input stream to a logger (as debug logs) */ diff --git a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java index 7c1a6ac7a8..64f89d2da0 100644 --- a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java +++ b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java @@ -30,7 +30,6 @@ import org.apache.activemq.artemis.components.ExternalComponent; import org.apache.activemq.artemis.dto.AppDTO; import org.apache.activemq.artemis.dto.ComponentDTO; import org.apache.activemq.artemis.dto.WebServerDTO; -import org.apache.activemq.artemis.utils.FileUtil; import org.eclipse.jetty.server.ConnectionFactory; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.HttpConfiguration; @@ -60,12 +59,11 @@ public class WebServerComponent implements ExternalComponent { private String consoleUrl; private List webContexts; private ServerConnector connector; - private String artemisHome; + private Path artemisHomePath; @Override public void configure(ComponentDTO config, String artemisInstance, String artemisHome) throws Exception { webServerConfig = (WebServerDTO) config; - this.artemisHome = artemisHome; uri = new URI(webServerConfig.bind); server = new Server(); String scheme = uri.getScheme(); @@ -104,7 +102,8 @@ public class WebServerComponent implements ExternalComponent { handlers = new HandlerList(); - Path homeWarDir = Paths.get(artemisHome != null ? artemisHome : ".").resolve(webServerConfig.path).toAbsolutePath(); + this.artemisHomePath = Paths.get(artemisHome != null ? artemisHome : "."); + Path homeWarDir = artemisHomePath.resolve(webServerConfig.path).toAbsolutePath(); Path instanceWarDir = Paths.get(artemisInstance != null ? artemisInstance : ".").resolve(webServerConfig.path).toAbsolutePath(); if (webServerConfig.apps != null && webServerConfig.apps.size() > 0) { @@ -236,44 +235,33 @@ public class WebServerComponent implements ExternalComponent { } public void internalStop() throws Exception { + System.out.println("Stopping"); server.stop(); if (webContexts != null) { - - File tmpdir = null; - StringBuilder strBuilder = new StringBuilder(); - boolean found = false; - for (WebAppContext context : webContexts) { - tmpdir = context.getTempDirectory(); - - if (tmpdir != null && tmpdir.exists() && !context.isPersistTempDirectory()) { - //tmpdir will be removed by deleteOnExit() - //However because the URLClassLoader never release/close its opened - //jars the jar file won't be able to get deleted on Windows platform - //until after the process fully terminated. To fix this here arranges - //a separate process to try clean up the temp dir - FileUtil.deleteDirectory(tmpdir); - if (tmpdir.exists()) { - ActiveMQWebLogger.LOGGER.tmpFileNotDeleted(tmpdir); - strBuilder.append(tmpdir); - strBuilder.append(","); - found = true; - } - } - } - - if (found) { - String bootJar = artemisHome + File.separator + "lib" + File.separator + "artemis-boot.jar"; - - String[] command = {"java", "-cp", bootJar, "org.apache.activemq.artemis.boot.WebTmpCleaner", strBuilder.toString()}; - ProcessBuilder pb = new ProcessBuilder(command); - - pb.start(); - } + cleanupWebTemporaryFiles(webContexts); webContexts.clear(); } } + private File getLibFolder() { + Path lib = artemisHomePath.resolve("lib"); + File libFolder = new File(lib.toUri()); + return libFolder; + } + + public void cleanupWebTemporaryFiles(List webContexts) throws Exception { + List temporaryFiles = new ArrayList<>(); + for (WebAppContext context : webContexts) { + File tmpdir = context.getTempDirectory(); + temporaryFiles.add(tmpdir); + } + + if (!temporaryFiles.isEmpty()) { + WebTmpCleaner.cleanupTmpFiles(getLibFolder(), temporaryFiles); + } + } + @Override public boolean isStarted() { return server != null && server.isStarted(); diff --git a/artemis-boot/src/main/java/org/apache/activemq/artemis/boot/WebTmpCleaner.java b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebTmpCleaner.java similarity index 64% rename from artemis-boot/src/main/java/org/apache/activemq/artemis/boot/WebTmpCleaner.java rename to artemis-web/src/main/java/org/apache/activemq/artemis/component/WebTmpCleaner.java index 42ba22070e..0bc0b67456 100644 --- a/artemis-boot/src/main/java/org/apache/activemq/artemis/boot/WebTmpCleaner.java +++ b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebTmpCleaner.java @@ -14,9 +14,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.boot; +package org.apache.activemq.artemis.component; import java.io.File; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + +import org.apache.activemq.artemis.utils.SpawnedVMSupport; /** * This class is used to remove the jar files @@ -26,10 +31,7 @@ import java.io.File; */ public class WebTmpCleaner { - public static void main(String[] args) throws Exception { - - String[] filesToClean = args[0].split(","); - + public static void main(String[] filesToClean) throws Exception { //It needs to retry a bit as we are not sure //when the main VM exists. boolean allCleaned = false; @@ -38,9 +40,10 @@ public class WebTmpCleaner { allCleaned = true; for (String f : filesToClean) { if (!f.trim().isEmpty()) { - File file = new File(f); + URI url = new URI(f); + File file = new File(url); if (file.exists()) { - deleteFile(file); + deleteFolder(file); allCleaned = false; } } @@ -49,13 +52,22 @@ public class WebTmpCleaner { } } + public static Process cleanupTmpFiles(File libFolder, List temporaryFiles) throws Exception { + ArrayList files = new ArrayList<>(temporaryFiles.size()); + for (File f : temporaryFiles) { + files.add(f.toURI().toString()); + } - public static final void deleteFile(final File file) { + String classPath = SpawnedVMSupport.getClassPath(libFolder); + return SpawnedVMSupport.spawnVM(classPath, WebTmpCleaner.class.getName(), false, (String[]) files.toArray(new String[files.size()])); + } + + public static final void deleteFolder(final File file) { if (file.isDirectory()) { String[] files = file.list(); for (String path : files) { File f = new File(file, path); - deleteFile(f); + deleteFolder(f); } } file.delete(); diff --git a/artemis-web/src/test/java/org/apache/activemq/cli/test/WebServerCLITest.java b/artemis-web/src/test/java/org/apache/activemq/cli/test/WebServerCLITest.java index e624e6f14f..6665e802fd 100644 --- a/artemis-web/src/test/java/org/apache/activemq/cli/test/WebServerCLITest.java +++ b/artemis-web/src/test/java/org/apache/activemq/cli/test/WebServerCLITest.java @@ -17,6 +17,10 @@ package org.apache.activemq.cli.test; import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.io.PrintStream; +import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; @@ -25,6 +29,7 @@ import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.cli.Artemis; import org.apache.activemq.artemis.cli.commands.Run; import org.apache.activemq.artemis.cli.commands.tools.LockAbstract; +import org.apache.activemq.artemis.component.WebTmpCleaner; import org.apache.activemq.artemis.core.server.ActiveMQComponent; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; @@ -34,6 +39,7 @@ import org.apache.activemq.artemis.junit.Wait; import org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoader; import org.apache.activemq.artemis.utils.ThreadLeakCheckRule; import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -104,6 +110,34 @@ public class WebServerCLITest { stopServer(); } + + @Test + public void testCleanupFolder() throws Exception { + System.out.println("temporary folder = " + temporaryFolder.getRoot()); + List fileList = new ArrayList<>(); + for (int i = 0; i < 10; i++) { + File directory = temporaryFolder.newFolder("test & output " + i); + fillup(directory); + } + Process process = WebTmpCleaner.cleanupTmpFiles(null, fileList); + Assert.assertEquals(0, process.waitFor()); + for (File f : fileList) { + Assert.assertFalse(f.exists()); + } + + } + + private void fillup(File file) throws Exception { + System.out.println("Creating file " + file); + file.mkdirs(); + for (int i = 0; i < 10; i++) { + File fi = new File(file, "file" + i + ".txt"); + PrintStream str = new PrintStream(new FileOutputStream(fi)); + str.println("hello"); + str.close(); + } + } + private void stopServer() throws Exception { Artemis.internalExecute("stop"); assertTrue(Run.latchRunning.await(5, TimeUnit.SECONDS)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpNoHearbeatsTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpNoHearbeatsTest.java index a7e82d0482..9f155cbd31 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpNoHearbeatsTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpNoHearbeatsTest.java @@ -23,7 +23,7 @@ import java.util.Map; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.apache.activemq.transport.amqp.client.AmqpClient; import org.apache.activemq.transport.amqp.client.AmqpConnection; import org.apache.activemq.transport.amqp.client.AmqpMessage; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/IncompatibleVersionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/IncompatibleVersionTest.java index 20f98ec71f..ec641bd3d6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/IncompatibleVersionTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/IncompatibleVersionTest.java @@ -42,7 +42,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.version.impl.VersionImpl; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.util.SpawnedTestBase; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.apache.activemq.artemis.utils.VersionLoader; import org.junit.After; import org.junit.Assert; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JournalCrashTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JournalCrashTest.java index 944660ac67..c10f2baa26 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JournalCrashTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JournalCrashTest.java @@ -35,7 +35,7 @@ import org.apache.activemq.artemis.core.journal.RecordInfo; import org.apache.activemq.artemis.core.journal.impl.JournalImpl; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.tests.util.SpawnedTestBase; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.junit.Assert; import org.junit.Test; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SendAckFailTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SendAckFailTest.java index 210a9d1529..b9b686c405 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SendAckFailTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SendAckFailTest.java @@ -79,7 +79,7 @@ import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager; import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule; import org.apache.activemq.artemis.tests.util.SpawnedTestBase; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.apache.activemq.artemis.tests.util.Wait; import org.junit.After; import org.junit.Assert; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientCrashTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientCrashTest.java index 04377b1349..01df8b7f3c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientCrashTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientCrashTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.util.SpawnedVMCheck; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.junit.After; import org.junit.Assert; import org.junit.Before; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientExitTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientExitTest.java index 23fa0a6b0c..0c0f27e2f1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientExitTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientExitTest.java @@ -23,7 +23,7 @@ import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.apache.activemq.artemis.utils.RandomUtil; import org.junit.Before; import org.junit.Test; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/PendingDeliveriesTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/PendingDeliveriesTest.java index 9180532585..8af9290ee2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/PendingDeliveriesTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/PendingDeliveriesTest.java @@ -30,7 +30,7 @@ import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.artemis.logs.AssertionLoggerHandler; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.apache.qpid.jms.JmsConnectionFactory; import org.junit.After; import org.junit.Assert; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/RealNodeManagerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/RealNodeManagerTest.java index 1a49f94fcf..1dfe48bb71 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/RealNodeManagerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/RealNodeManagerTest.java @@ -23,7 +23,7 @@ import java.util.List; import org.apache.activemq.artemis.core.server.NodeManager; import org.apache.activemq.artemis.core.server.impl.FileLockNodeManager; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.apache.activemq.artemis.utils.UUID; import org.junit.Assert; import org.junit.Test; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/LiveCrashOnBackupSyncTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/LiveCrashOnBackupSyncTest.java index db414b8bb0..c5536e7cfe 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/LiveCrashOnBackupSyncTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/LiveCrashOnBackupSyncTest.java @@ -48,7 +48,7 @@ import org.apache.activemq.artemis.junit.Wait; import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager; import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.apache.activemq.artemis.utils.actors.ArtemisExecutor; import org.junit.Assert; import org.junit.Before; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/critical/CriticalCrashTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/critical/CriticalCrashTest.java index df69af90a8..548b99eaa8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/critical/CriticalCrashTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/critical/CriticalCrashTest.java @@ -36,7 +36,7 @@ import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager; import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule; import org.apache.activemq.artemis.tests.util.SpawnedTestBase; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.junit.Assert; import org.junit.Test; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/CrashOnCompactTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/CrashOnCompactTest.java index 3badf29153..e8b0e4be9f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/CrashOnCompactTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/CrashOnCompactTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.artemis.core.journal.impl.JournalCompactor; import org.apache.activemq.artemis.core.journal.impl.JournalFile; import org.apache.activemq.artemis.core.journal.impl.JournalImpl; import org.apache.activemq.artemis.tests.util.SpawnedTestBase; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/ValidateTransactionHealthTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/ValidateTransactionHealthTest.java index 5de80f38c3..1a72b98def 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/ValidateTransactionHealthTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/ValidateTransactionHealthTest.java @@ -32,7 +32,7 @@ import org.apache.activemq.artemis.core.journal.RecordInfo; import org.apache.activemq.artemis.core.journal.impl.JournalImpl; import org.apache.activemq.artemis.jlibaio.LibaioContext; import org.apache.activemq.artemis.tests.util.SpawnedTestBase; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.junit.Assert; import org.junit.Test; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncServer.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncServer.java index 3711965280..2bc72c9534 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncServer.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncServer.java @@ -17,7 +17,7 @@ package org.apache.activemq.artemis.tests.integration.paging; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; /** * This is a sub process of the test {@link PageCountSyncOnNonTXTest} diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverBackup.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverBackup.java index 928f8a87c3..b02224cf3f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverBackup.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverBackup.java @@ -16,7 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.paging; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; /** * There is no difference between this class and {@link PagingWithFailoverServer} diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverServer.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverServer.java index 99e0aacfcd..c2fb8bd964 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverServer.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverServer.java @@ -17,7 +17,7 @@ package org.apache.activemq.artemis.tests.integration.paging; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; public class PagingWithFailoverServer extends SpawnedServerSupport { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/NettySecurityClientTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/NettySecurityClientTest.java index 15e287bb52..7e6b035259 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/NettySecurityClientTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/NettySecurityClientTest.java @@ -25,7 +25,7 @@ import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.util.SpawnedTestBase; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java index 70ce6be9b2..b400613995 100644 --- a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java +++ b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java @@ -35,7 +35,7 @@ import org.apache.activemq.artemis.api.core.management.ManagementHelper; import org.apache.activemq.artemis.api.core.management.ResourceNames; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory; import org.apache.activemq.artemis.api.core.RoutingType; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.objectweb.jtests.jms.admin.Admin; /** diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/util/RandomUtilDistributionTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/util/RandomUtilDistributionTest.java index caa0fc919e..e324545f49 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/util/RandomUtilDistributionTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/util/RandomUtilDistributionTest.java @@ -20,8 +20,8 @@ package org.apache.activemq.artemis.tests.unit.core.util; import java.util.HashSet; import org.apache.activemq.artemis.tests.util.SpawnedVMCheck; -import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; import org.apache.activemq.artemis.utils.RandomUtil; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMCheck.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMCheck.java index c4832ab36f..0cfe20fdfb 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMCheck.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMCheck.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.util; +import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.junit.rules.ExternalResource; public class SpawnedVMCheck extends ExternalResource {