Skip to content

Commit

Permalink
Add cli arguments one by one for Verifier
Browse files Browse the repository at this point in the history
Prepare for Verifier 2.0 - MSHARED-1125
  • Loading branch information
slawekjaranowski committed Sep 7, 2022
1 parent 4a57270 commit bd25080
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public void testitMNG3057 ()

verifier.addCliOption( "-V" );
verifier.addCliOption( "-DtestVersion=1" );
verifier.addCliOption( "-f pom-filtered.xml" );
verifier.addCliOption( "-f" );
verifier.addCliOption( "pom-filtered.xml" );

verifier.executeGoal( "generate-sources" );
verifier.verifyErrorFreeLog();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public void testMultipleProfileParams()

verifier.addCliOption( "-Pprofile1,profile2" );
verifier.addCliOption( "-Pprofile3" );
verifier.addCliOption( "-P profile4" );
verifier.addCliOption( "-P" );
verifier.addCliOption( "profile4" );
verifier.executeGoal( "package" );

verifier.verifyErrorFreeLog();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public void testDeactivateDefaultProfilesHyphen()

// Deactivate active by default profiles
verifier.addCliOption( "-P-profile1" );
verifier.addCliOption( "-P -profile2" );
verifier.addCliOption( "-P" );
verifier.addCliOption( "-profile2" );

verifier.executeGoal( "validate" );

Expand All @@ -103,7 +104,8 @@ public void testDeactivateDefaultProfilesExclamation()

// Deactivate active by default profiles
verifier.addCliOption( "-P!profile1" );
verifier.addCliOption( "-P !profile2" );
verifier.addCliOption( "-P" );
verifier.addCliOption( "!profile2" );

verifier.executeGoal( "validate" );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public void testitMNG3641()
verifier.deleteArtifact( "org.apache.maven.its.mng3641", "parent", "1.0", "pom" );

// (1) make sure the profile is found. Must not contain a warning.
verifier.addCliOption( "-P mng-3641-it-provided-profile" );
verifier.addCliOption( "-P" );
verifier.addCliOption( "mng-3641-it-provided-profile" );
verifier.setLogFileName( "log-1.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
Expand All @@ -62,7 +63,8 @@ public void testitMNG3641()

// (2) make sure the profile was not found and a warning was printed.
verifier = newVerifier( testDir.getAbsolutePath() );
verifier.addCliOption( "-P mng-3641-TWlzdGVyIFQgd2FzIGhlcmUuICheX14p" );
verifier.addCliOption( "-P" );
verifier.addCliOption( "mng-3641-TWlzdGVyIFQgd2FzIGhlcmUuICheX14p" );
verifier.setLogFileName( "log-2.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
Expand All @@ -74,7 +76,8 @@ public void testitMNG3641()
// (3) make sure the first profile is found while the other is not and a warning was printed
// accordingly.
verifier = newVerifier( testDir.getAbsolutePath() );
verifier.addCliOption( "-P mng-3641-it-provided-profile,mng-3641-TWlzdGVyIFQgd2FzIGhlcmUuICheX14p" );
verifier.addCliOption( "-P" );
verifier.addCliOption( "mng-3641-it-provided-profile,mng-3641-TWlzdGVyIFQgd2FzIGhlcmUuICheX14p" );
verifier.setLogFileName( "log-3.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
Expand All @@ -86,7 +89,8 @@ public void testitMNG3641()

// (4) make sure the warning is only printed when the profile is missing in all projects
verifier = newVerifier( testDir.getAbsolutePath() );
verifier.addCliOption( "-P mng-3641-it-provided-profile-child" );
verifier.addCliOption( "-P" );
verifier.addCliOption( "mng-3641-it-provided-profile-child" );
verifier.setLogFileName( "log-4.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
Expand All @@ -97,7 +101,8 @@ public void testitMNG3641()

// (5) make sure the profile is found in subproject. Must not contain a warning.
verifier = newVerifier( new File( testDir, "child1" ).getAbsolutePath() );
verifier.addCliOption( "-P mng-3641-it-provided-profile-child" );
verifier.addCliOption( "-P" );
verifier.addCliOption( "mng-3641-it-provided-profile-child" );
verifier.setLogFileName( "log-5.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
Expand All @@ -108,7 +113,8 @@ public void testitMNG3641()

// (6) make sure the profile is found from parent in subproject. Must not contain a warning.
verifier = newVerifier( new File( testDir, "child1" ).getAbsolutePath() );
verifier.addCliOption( "-P mng-3641-it-provided-profile" );
verifier.addCliOption( "-P" );
verifier.addCliOption( "mng-3641-it-provided-profile" );
verifier.setLogFileName( "log-6.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public void testitMNG3714()

verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.addCliOption( "--toolchains toolchains.xml" );
verifier.addCliOption( "--toolchains" );
verifier.addCliOption( "toolchains.xml" );
verifier.executeGoal( "initialize" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ private void testit( boolean fromHttp, boolean toHttp, boolean relativeLocation
filterProps.setProperty( "@protocol@", fromHttp ? "http" : "https" );
filterProps.setProperty( "@port@", Integer.toString( ( (NetworkConnector) from ).getLocalPort() ) );
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps );
verifier.addCliOption( "-X --settings" );
verifier.addCliOption( "-X" );
verifier.addCliOption( "--settings" );
verifier.addCliOption( "settings.xml" );
verifier.setSystemProperty( "javax.net.ssl.trustStore", storePath );
verifier.setSystemProperty( "javax.net.ssl.trustStorePassword", storePwd );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public void testCorrectModuleFails()
verifier.deleteDirectory( "target" );
verifier.setSystemProperty( "maven.ext.class.path", "../spy/target/event-spy-0.0.1-SNAPSHOT.jar" );
verifier.addCliOption( "-X" );
verifier.addCliOption( "-T 2" );
verifier.addCliOption( "-T" );
verifier.addCliOption( "2" );
verifier.addCliOption( "-fn" );
verifier.executeGoal( "compile" );
verifier.verifyTextInLog( "ProjectFailed/org.apache.maven.its.mng5208:sub-2" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public void testFileOptionToADirectory()
verifier.deleteDirectory( "target" );
verifier.deleteArtifacts( "org.apache.maven.its.mng5338" );

verifier.addCliOption( "-f project" );
verifier.addCliOption( "-f" );
verifier.addCliOption( "project" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public void testRunningRestrictedReactor()
// from the reactor.
//
verifier.deleteArtifacts( "org.apache.maven.its.mng5557" );
verifier.addCliOption( "--projects project-0,project-1" );
verifier.addCliOption( "--projects" );
verifier.addCliOption( "project-0,project-1" );
try
{
verifier.executeGoal( "package" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ public void testBasic_multithreaded()
// build the test project
verifier = newVerifier( projectDir.getAbsolutePath(), "remote" );
verifier.addCliOption( "-Dit-build-extensions=false" );
verifier.addCliOption( "--builder multithreaded -T 1" );
verifier.addCliOption( "--builder" );
verifier.addCliOption( "multithreaded" );
verifier.addCliOption( "-T" );
verifier.addCliOption( "1" );
verifier.executeGoal( "package" );
verifier.resetStreams();
verifier.verifyErrorFreeLog();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public void testitMNG5716()

verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.addCliOption( "--toolchains toolchains.xml" );
verifier.addCliOption( "--toolchains" );
verifier.addCliOption( "toolchains.xml" );
verifier.executeGoal( "initialize" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public void testitShouldResolveTheDependenciesWithoutBuildConsumer()
verifier.setAutoclean( false );

verifier.addCliOption( "-Drevision=1.2" );
verifier.addCliOption( "-pl module-3" );
verifier.addCliOption( "-pl" );
verifier.addCliOption( "module-3" );
verifier.executeGoal( "package" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
Expand Down Expand Up @@ -101,7 +102,8 @@ public void testitShouldResolveTheDependenciesWithBuildConsumer()
verifier.setForkJvm(true);

verifier.addCliOption( "-Drevision=1.2" );
verifier.addCliOption( "-pl module-3" );
verifier.addCliOption( "-pl" );
verifier.addCliOption( "module-3" );
verifier.executeGoal( "package" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
* under the License.
*/

import org.apache.maven.it.util.ResourceExtractor;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.apache.maven.it.util.ResourceExtractor;

/**
* This is a collection of test cases for <a href="https://issues.apache.org/jira/browse/MNG-6118">MNG-6118</a>,
Expand All @@ -43,7 +41,6 @@ public class MavenITmng6118SubmoduleInvocation extends AbstractMavenIntegrationT
{
private static final String RESOURCE_PATH = "/mng-6118-submodule-invocation-full-reactor";
private final File testDir;
private final Map<String, String> envVars = new HashMap<>();

public MavenITmng6118SubmoduleInvocation() throws IOException
{
Expand All @@ -60,13 +57,13 @@ public void testInSubModule() throws Exception
{
// Compile the whole project first.
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.executeGoal( "compile", envVars );
verifier.executeGoal( "compile" );

final File submoduleDirectory = new File( testDir, "app" );
verifier = newVerifier( submoduleDirectory.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.setLogFileName( "log-insubmodule.txt" );
verifier.executeGoal( "compile", envVars );
verifier.executeGoal( "compile" );
}

/**
Expand All @@ -83,8 +80,9 @@ public void testWithFile() throws Exception
verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.setLogFileName( "log-withfile.txt" );
verifier.addCliOption( "-f app/pom.xml" );
verifier.executeGoal( "compile", envVars );
verifier.addCliOption( "-f" );
verifier.addCliOption( "app/pom.xml" );
verifier.executeGoal( "compile" );
}

/**
Expand All @@ -96,9 +94,10 @@ public void testWithFileAndAlsoMake() throws Exception
{
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.addCliOption( "-am" );
verifier.addCliOption( "-f app/pom.xml" );
verifier.addCliOption( "-f" );
verifier.addCliOption( "app/pom.xml" );
verifier.setLogFileName( "log-withfilealsomake.txt" );
verifier.executeGoal( "compile", envVars );
verifier.executeGoal( "compile" );
verifier.verifyTextInLog( "Building Maven Integration Test :: MNG-6118 :: Library 1.0" );
}

Expand All @@ -113,7 +112,7 @@ public void testInSubModuleWithAlsoMake() throws Exception
Verifier verifier = newVerifier( submoduleDirectory.getAbsolutePath() );
verifier.addCliOption( "-am" );
verifier.setLogFileName( "log-insubmodulealsomake.txt" );
verifier.executeGoal( "compile", envVars );
verifier.executeGoal( "compile" );
verifier.verifyTextInLog( "Building Maven Integration Test :: MNG-6118 :: Library 1.0" );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public void testSelectExistingOptionalProfile() throws VerificationException

Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setLogFileName( "log-select-existing.txt" );
verifier.addCliOption( "-pl ?existing-module" );
verifier.addCliOption( "-pl" );
verifier.addCliOption( "?existing-module" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.verifyFilePresent( "existing-module/target/touch.txt" ); // existing-module should have been built.
Expand All @@ -60,7 +61,8 @@ public void testSelectExistingOptionalProfileByArtifactId() throws VerificationE

Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setLogFileName( "log-select-existing-artifact-id.txt" );
verifier.addCliOption( "-pl ?:existing-module" );
verifier.addCliOption( "-pl" );
verifier.addCliOption( "?:existing-module" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.verifyFilePresent( "existing-module/target/touch.txt" ); // existing-module should have been built.
Expand All @@ -72,7 +74,8 @@ public void testSelectNonExistingOptionalProfile() throws VerificationException

Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setLogFileName( "log-select-non-existing.txt" );
verifier.addCliOption( "-pl ?non-existing-module" );
verifier.addCliOption( "-pl" );
verifier.addCliOption( "?non-existing-module" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.verifyFilePresent( "existing-module/target/touch.txt" ); // existing-module should have been built.
Expand All @@ -84,7 +87,8 @@ public void testDeselectExistingOptionalProfile() throws VerificationException

Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setLogFileName( "log-deselect-existing.txt" );
verifier.addCliOption( "-pl !?existing-module" );
verifier.addCliOption( "-pl" );
verifier.addCliOption( "!?existing-module" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.verifyFileNotPresent( "existing-module/target/touch.txt" ); // existing-module should not have been built.
Expand All @@ -96,7 +100,8 @@ public void testDeselectNonExistingOptionalProfile() throws VerificationExceptio

Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setLogFileName( "log-deselect-non-existing.txt" );
verifier.addCliOption( "-pl !?non-existing-module" );
verifier.addCliOption( "-pl" );
verifier.addCliOption( "!?non-existing-module" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.verifyFilePresent( "existing-module/target/touch.txt" ); // existing-module should have been built.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public void testBlockedHttpRepositoryInPom() throws Exception
{
final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH );
final Verifier verifier = newVerifier( projectDir.getAbsolutePath() );
verifier.addCliOption( "-s settings.xml" ); // ITs override global settings that provide blocked mirror: need to define the mirror in dedicated settings
// ITs override global settings that provide blocked mirror: need to define the mirror in dedicated settings
verifier.addCliOption( "-s" );
verifier.addCliOption( "settings.xml" );

try
{
Expand Down

0 comments on commit bd25080

Please sign in to comment.