From 8678bad88de828cef621561efe37b8a30c59e73f Mon Sep 17 00:00:00 2001 From: josecoll Date: Wed, 5 Jun 2019 10:17:02 +0100 Subject: [PATCH] CORDA-2970 Revert usage of Gradle JUnit 5 Platform Runner (#5173) * Revert usage of Gradle 5 useJUnitPlatform() which causes significant test execution performance degradation. * Remove completely top-level Java CordaCaplet unit tests causing consistent TC failure on Azure VMs: java.security.NoSuchAlgorithmException: no such algorithm: NONEwithEdDSA for provider BC --- build.gradle | 2 - ...CapletBaseDirectoryParsingFailureTest.java | 39 ------------------ .../CordaCapletBaseDirectoryParsingTest.java | 39 ------------------ ...rdaCapletConfigFileParsingFailureTest.java | 40 ------------------- .../CordaCapletConfigFileParsingTest.java | 40 ------------------- node/src/test/java/CordaCapletTestUtils.java | 16 -------- 6 files changed, 176 deletions(-) delete mode 100644 node/src/test/java/CordaCapletBaseDirectoryParsingFailureTest.java delete mode 100644 node/src/test/java/CordaCapletBaseDirectoryParsingTest.java delete mode 100644 node/src/test/java/CordaCapletConfigFileParsingFailureTest.java delete mode 100644 node/src/test/java/CordaCapletConfigFileParsingTest.java delete mode 100644 node/src/test/java/CordaCapletTestUtils.java diff --git a/build.gradle b/build.gradle index b2226cce85..320ffb5b84 100644 --- a/build.gradle +++ b/build.gradle @@ -229,8 +229,6 @@ allprojects { } tasks.withType(Test) { - useJUnitPlatform() - failFast = project.hasProperty('tests.failFast') ? project.property('tests.failFast').toBoolean() : false // Prevent the project from creating temporary files outside of the build directory. diff --git a/node/src/test/java/CordaCapletBaseDirectoryParsingFailureTest.java b/node/src/test/java/CordaCapletBaseDirectoryParsingFailureTest.java deleted file mode 100644 index 21c672d2e2..0000000000 --- a/node/src/test/java/CordaCapletBaseDirectoryParsingFailureTest.java +++ /dev/null @@ -1,39 +0,0 @@ -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.Collection; - -import static org.junit.Assert.assertEquals; - -@RunWith(Parameterized.class) -public class CordaCapletBaseDirectoryParsingFailureTest { - @Parameterized.Parameters - public static Collection CombinationsToTest() { - return Arrays.asList( - new Object[][]{ - {new String[]{"--base-directory", "--another-option"}}, - {new String[]{"--base-directory=", "-a"}}, - {new String[]{"-b", "--another-option"}}, - {new String[]{"-b=", "-a"}} - } - ); - } - - private String[] cmdLineArguments; - - public CordaCapletBaseDirectoryParsingFailureTest(String[] baseOption) { - this.cmdLineArguments = baseOption; - } - - @Test - public void testThatBaseDirectoryFallsBackToCurrentWhenBaseDirectoryIsNotSupplied() { - final CordaCaplet caplet = CordaCapletTestUtils.getCaplet(); - final String returnPath = caplet.getBaseDirectory(Arrays.asList(cmdLineArguments)); - final String expected = Paths.get(".").toAbsolutePath().normalize().toString(); - assertEquals(expected, returnPath); - } -} - diff --git a/node/src/test/java/CordaCapletBaseDirectoryParsingTest.java b/node/src/test/java/CordaCapletBaseDirectoryParsingTest.java deleted file mode 100644 index 489e59f3e5..0000000000 --- a/node/src/test/java/CordaCapletBaseDirectoryParsingTest.java +++ /dev/null @@ -1,39 +0,0 @@ - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.Collection; - -import static org.junit.Assert.assertEquals; - -@RunWith(Parameterized.class) -public class CordaCapletBaseDirectoryParsingTest { - @Parameterized.Parameters - public static Collection CombinationsToTest() { - return Arrays.asList( - new Object[][]{ - {new String[]{"--base-directory", "blah"}}, - {new String[]{"--base-directory=blah"}}, - {new String[]{"-b", "blah"}}, - {new String[]{"-b=blah"}} - }); - } - - private String[] cmdLineArguments; - - public CordaCapletBaseDirectoryParsingTest(String[] arr) { - this.cmdLineArguments = arr; - } - - @Test - public void testThatBaseDirectoryParameterIsRecognised() { - final CordaCaplet caplet = CordaCapletTestUtils.getCaplet(); - final String returnPath = caplet.getBaseDirectory(Arrays.asList(cmdLineArguments)); - final String expected = Paths.get(".").resolve("blah").toAbsolutePath().normalize().toString(); - assertEquals(expected, returnPath); - } -} - diff --git a/node/src/test/java/CordaCapletConfigFileParsingFailureTest.java b/node/src/test/java/CordaCapletConfigFileParsingFailureTest.java deleted file mode 100644 index b94e137eb5..0000000000 --- a/node/src/test/java/CordaCapletConfigFileParsingFailureTest.java +++ /dev/null @@ -1,40 +0,0 @@ -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -import java.io.File; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.Collection; - -import static org.junit.Assert.assertEquals; - -@RunWith(Parameterized.class) -public class CordaCapletConfigFileParsingFailureTest { - @Parameterized.Parameters - public static Collection CombinationsToTest() { - return Arrays.asList( - new Object[][]{ - {new String[]{"--config-file", "--another-option"}}, - {new String[]{"--config-file=", "-a"}}, - {new String[]{"-f", "--another-option"}}, - {new String[]{"-f=", "-a"}} - } - ); - } - - private String[] cmdLineArguments; - - public CordaCapletConfigFileParsingFailureTest(String[] baseOption) { - this.cmdLineArguments = baseOption; - } - - @Test - public void testThatBaseDirectoryFallsBackToDefaultWhenConfigFileIsNotSupplied() { - final CordaCaplet caplet = CordaCapletTestUtils.getCaplet(); - final File returnPath = caplet.getConfigFile(Arrays.asList(cmdLineArguments), CordaCapletTestUtils.getBaseDir()); - final File expected = Paths.get(".").resolve("node.conf").toAbsolutePath().normalize().toFile(); - assertEquals(expected, returnPath); - } -} - diff --git a/node/src/test/java/CordaCapletConfigFileParsingTest.java b/node/src/test/java/CordaCapletConfigFileParsingTest.java deleted file mode 100644 index 48ddf1766d..0000000000 --- a/node/src/test/java/CordaCapletConfigFileParsingTest.java +++ /dev/null @@ -1,40 +0,0 @@ - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -import java.io.File; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.Collection; - -import static org.junit.Assert.assertEquals; - -@RunWith(Parameterized.class) -public class CordaCapletConfigFileParsingTest { - @Parameterized.Parameters - public static Collection CombinationsToTest() { - return Arrays.asList( - new Object[][]{ - {new String[]{"--config-file", "blah.conf"}}, - {new String[]{"--config-file=blah.conf"}}, - {new String[]{"-f", "blah.conf"}}, - {new String[]{"-f=blah.conf"}} - }); - } - - private String[] cmdLineArguments; - - public CordaCapletConfigFileParsingTest(String[] arr) { - this.cmdLineArguments = arr; - } - - @Test - public void testThatConfigFileParameterIsRecognised() { - final CordaCaplet caplet = CordaCapletTestUtils.getCaplet(); - final File returnPath = caplet.getConfigFile(Arrays.asList(cmdLineArguments), CordaCapletTestUtils.getBaseDir()); - final File expected = Paths.get(".").resolve("blah.conf").toAbsolutePath().normalize().toFile(); - assertEquals(expected, returnPath.getAbsoluteFile()); - } -} - diff --git a/node/src/test/java/CordaCapletTestUtils.java b/node/src/test/java/CordaCapletTestUtils.java deleted file mode 100644 index cb282365dd..0000000000 --- a/node/src/test/java/CordaCapletTestUtils.java +++ /dev/null @@ -1,16 +0,0 @@ -import java.io.File; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.Objects; - -class CordaCapletTestUtils { - static CordaCaplet getCaplet() { - final String path = System.getProperty("user.dir") + File.separator + "build" + File.separator + "libs" + File.separator; - final File jar = Arrays.stream(Objects.requireNonNull(new File(path).listFiles())).filter(x -> x.getName().startsWith("corda-node") && x.getName().endsWith(".jar")).findFirst().get(); - return new CordaCaplet(new Capsule(jar.toPath())); - } - - static String getBaseDir() { - return Paths.get(".").toAbsolutePath().normalize().toString(); - } -}