You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/12/26 16:37:08 UTC

[maven] 01/03: Remove non-usable test

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch maven.config-from-start-scripts
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 5cd2915fcd67cdbc77c921907be23f7264b4b9c2
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sun Oct 24 19:46:49 2021 +0200

    Remove non-usable test
---
 .../java/org/apache/maven/cli/MavenCliTest.java    | 155 ---------------------
 .../test/projects/config-illegal/.mvn/maven.config |   1 -
 .../src/test/projects/config/.mvn/maven.config     |   3 -
 .../mavenConfigProperties/.mvn/maven.config        |   5 -
 4 files changed, 164 deletions(-)

diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
index 1f1da2e7c..e4f320ce0 100644
--- a/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
+++ b/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
@@ -163,161 +163,6 @@ public class MavenCliTest {
         assertThrows(IllegalArgumentException.class, () -> cli.calculateDegreeOfConcurrency("0C"));
     }
 
-    @Test
-    public void testMavenConfig() throws Exception {
-        System.setProperty(
-                MavenCli.MULTIMODULE_PROJECT_DIRECTORY, new File("src/test/projects/config").getCanonicalPath());
-        CliRequest request = new CliRequest(new String[0], null);
-
-        // read .mvn/maven.config
-        cli.initialize(request);
-        cli.cli(request);
-        assertEquals("multithreaded", request.commandLine.getOptionValue(CLIManager.BUILDER));
-        assertEquals("8", request.commandLine.getOptionValue(CLIManager.THREADS));
-
-        // override from command line
-        request = new CliRequest(new String[] {"--builder", "foobar"}, null);
-        cli.cli(request);
-        assertEquals("foobar", request.commandLine.getOptionValue("builder"));
-    }
-
-    @Test
-    public void testMavenConfigInvalid() throws Exception {
-        System.setProperty(
-                MavenCli.MULTIMODULE_PROJECT_DIRECTORY,
-                new File("src/test/projects/config-illegal").getCanonicalPath());
-        CliRequest request = new CliRequest(new String[0], null);
-
-        cli.initialize(request);
-        assertThrows(ParseException.class, () -> cli.cli(request));
-    }
-
-    /**
-     * Read .mvn/maven.config with the following definitions:
-     * <pre>
-     *   -T
-     *   3
-     *   -Drevision=1.3.0
-     *   "-Dlabel=Apache Maven"
-     * </pre>
-     * and check if the {@code -T 3} option can be overwritten via command line
-     * argument.
-     *
-     * @throws Exception in case of failure.
-     */
-    @Test
-    public void testMVNConfigurationThreadCanBeOverwrittenViaCommandLine() throws Exception {
-        System.setProperty(
-                MavenCli.MULTIMODULE_PROJECT_DIRECTORY,
-                new File("src/test/projects/mavenConfigProperties").getCanonicalPath());
-        CliRequest request = new CliRequest(new String[] {"-T", "5"}, null);
-
-        cli.initialize(request);
-        // read .mvn/maven.config
-        cli.cli(request);
-
-        assertEquals("5", request.commandLine.getOptionValue(CLIManager.THREADS));
-    }
-
-    /**
-     * Read .mvn/maven.config with the following definitions:
-     * <pre>
-     *   -T
-     *   3
-     *   -Drevision=1.3.0
-     *   "-Dlabel=Apache Maven"
-     * </pre>
-     * and check if the {@code -Drevision-1.3.0} option can be overwritten via command line
-     * argument.
-     *
-     * @throws Exception
-     */
-    @Test
-    public void testMVNConfigurationDefinedPropertiesCanBeOverwrittenViaCommandLine() throws Exception {
-        System.setProperty(
-                MavenCli.MULTIMODULE_PROJECT_DIRECTORY,
-                new File("src/test/projects/mavenConfigProperties").getCanonicalPath());
-        CliRequest request = new CliRequest(new String[] {"-Drevision=8.1.0"}, null);
-
-        cli.initialize(request);
-        // read .mvn/maven.config
-        cli.cli(request);
-        cli.properties(request);
-
-        String revision = System.getProperty("revision");
-        assertEquals("8.1.0", revision);
-    }
-
-    /**
-     * Read .mvn/maven.config with the following definitions:
-     * <pre>
-     *   -T
-     *   3
-     *   -Drevision=1.3.0
-     *   "-Dlabel=Apache Maven"
-     * </pre>
-     * and check if the {@code -Drevision-1.3.0} option can be overwritten via command line
-     * argument.
-     *
-     * @throws Exception
-     */
-    @Test
-    public void testMVNConfigurationCLIRepeatedPropertiesLastWins() throws Exception {
-        System.setProperty(
-                MavenCli.MULTIMODULE_PROJECT_DIRECTORY,
-                new File("src/test/projects/mavenConfigProperties").getCanonicalPath());
-        CliRequest request = new CliRequest(new String[] {"-Drevision=8.1.0", "-Drevision=8.2.0"}, null);
-
-        cli.initialize(request);
-        // read .mvn/maven.config
-        cli.cli(request);
-        cli.properties(request);
-
-        String revision = System.getProperty("revision");
-        assertEquals("8.2.0", revision);
-    }
-
-    /**
-     * Read .mvn/maven.config with the following definitions:
-     * <pre>
-     *   -T
-     *   3
-     *   -Drevision=1.3.0
-     *   "-Dlabel=Apache Maven"
-     * </pre>
-     * and check if the {@code -Drevision-1.3.0} option can be overwritten via command line argument when there are
-     * funky arguments present.
-     *
-     * @throws Exception
-     */
-    @Test
-    public void testMVNConfigurationFunkyArguments() throws Exception {
-        System.setProperty(
-                MavenCli.MULTIMODULE_PROJECT_DIRECTORY,
-                new File("src/test/projects/mavenConfigProperties").getCanonicalPath());
-        CliRequest request = new CliRequest(
-                new String[] {
-                    "-Drevision=8.1.0", "--file=-Dpom.xml", "\"-Dfoo=bar ", "\"-Dfoo2=bar two\"", "-Drevision=8.2.0"
-                },
-                null);
-
-        cli.initialize(request);
-        // read .mvn/maven.config
-        cli.cli(request);
-        cli.properties(request);
-
-        assertEquals("3", request.commandLine.getOptionValue(CLIManager.THREADS));
-
-        String revision = System.getProperty("revision");
-        assertEquals("8.2.0", revision);
-
-        assertEquals("bar ", request.getUserProperties().getProperty("foo"));
-        assertEquals("bar two", request.getUserProperties().getProperty("foo2"));
-        assertEquals("Apache Maven", request.getUserProperties().getProperty("label"));
-
-        assertEquals("-Dpom.xml", request.getCommandLine().getOptionValue(CLIManager.ALTERNATE_POM_FILE));
-    }
-
     @Test
     public void testStyleColors() throws Exception {
         assumeTrue(MessageUtils.isColorEnabled(), "ANSI not supported");
diff --git a/maven-embedder/src/test/projects/config-illegal/.mvn/maven.config b/maven-embedder/src/test/projects/config-illegal/.mvn/maven.config
deleted file mode 100644
index 8541464a7..000000000
--- a/maven-embedder/src/test/projects/config-illegal/.mvn/maven.config
+++ /dev/null
@@ -1 +0,0 @@
-deploy
diff --git a/maven-embedder/src/test/projects/config/.mvn/maven.config b/maven-embedder/src/test/projects/config/.mvn/maven.config
deleted file mode 100644
index 280d57794..000000000
--- a/maven-embedder/src/test/projects/config/.mvn/maven.config
+++ /dev/null
@@ -1,3 +0,0 @@
--T8
---builder
-multithreaded
diff --git a/maven-embedder/src/test/projects/mavenConfigProperties/.mvn/maven.config b/maven-embedder/src/test/projects/mavenConfigProperties/.mvn/maven.config
deleted file mode 100644
index 82570230f..000000000
--- a/maven-embedder/src/test/projects/mavenConfigProperties/.mvn/maven.config
+++ /dev/null
@@ -1,5 +0,0 @@
--T
-3
--Drevision=1.3.0
-"-Dlabel=Apache Maven"
-