Java Code Examples for org.apache.maven.it.Verifier#verifyTextInLog()

The following examples show how to use org.apache.maven.it.Verifier#verifyTextInLog() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AllInOneArchetypeIT.java    From alfresco-sdk with Apache License 2.0 6 votes vote down vote up
@Test
public void whenGenerateProjectFromArchetypeThenAProperProjectIsCreated() throws Exception {

    generateProjectFromArchetype(LOGGER);

    LOGGER.info("---------------------------------------------------------------------");
    LOGGER.info("Building the generated project {}", archetypeProperties.getProjectArtifactId());
    LOGGER.info("---------------------------------------------------------------------");

    // Since creating the archetype was successful, we now want to actually build the generated project executing the integration tests
    // Execute a purge to ensure old data don't make the test fail
    ProcessBuilder purge = getProcessBuilder("purge");
    purge.start().waitFor();
    ProcessBuilder pb = getProcessBuilder("build_test");
    pb.start().waitFor();

    // Verify the execution of the integration tests of the project were successful
    Verifier verifier = new Verifier(projectPath);
    verifier.setAutoclean(false);
    verifier.setLogFileName(LOG_FILENAME);
    printVerifierLog("PROJECT BUILD", verifier, LOGGER);
    verifier.verifyErrorFreeLog();
    verifier.verifyTextInLog("Tests run: 5, Failures: 0, Errors: 0, Skipped: 0");
}
 
Example 2
Source File: DeployAllMojoIntegrationTest.java    From app-maven-plugin with Apache License 2.0 6 votes vote down vote up
@Test
public void testDeployAllStandard()
    throws IOException, VerificationException, CloudSdkNotFoundException,
        ProcessHandlerException {

  Verifier verifier = new StandardVerifier("testDeployStandard");

  // execute with staging directory not present
  verifier.executeGoals(Arrays.asList("package", "appengine:deployAll"));

  // verify
  verifier.verifyErrorFreeLog();
  verifier.verifyTextInLog("Detected App Engine standard environment application");
  verifier.verifyTextInLog("GCLOUD: Deployed service");
  verifier.verifyTextInLog("GCLOUD: Custom routings have been updated.");
  verifier.verifyTextInLog("GCLOUD: DoS protection has been updated.");
  verifier.verifyTextInLog("GCLOUD: Indexes are being rebuilt. This may take a moment.");
  verifier.verifyTextInLog("GCLOUD: Cron jobs have been updated.");
  verifier.verifyTextInLog("GCLOUD: Task queues have been updated.");

  // cleanup
  deleteService("standard-project");
}
 
Example 3
Source File: OtherBranchIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 6 votes vote down vote up
@Test
public void attachDeployed() throws Exception {
	Verifier verifier = createVerifier("/project-stub", "origin/feature/poc/reattach", "5.0.0-SNAPSHOT");
	try {
		verifier.executeGoal("deploy");

		verifier.verifyTextInLog("Artifact versions updated with build metadata: +origin-feature-poc-reattach-SNAPSHOT");
		verifier.verifyErrorFreeLog();
	} finally {
		verifier.resetStreams();
	}

	verifier = createVerifier("/project-stub", "origin/feature/poc/reattach", "5.0.0-SNAPSHOT");
	try {
		verifier.executeGoals(Arrays.asList("validate", "gitflow-helper:attach-deployed"));
		verifier.verifyErrorFreeLog();
	} finally {
		verifier.resetStreams();
	}
}
 
Example 4
Source File: AbstractSingleYamlDeployIntegrationTest.java    From app-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void testDeployFlexible() throws IOException, VerificationException {

  Verifier verifier = new FlexibleVerifier("testDeployFlexible");

  // execute with staging directory not present
  verifier.executeGoals(Arrays.asList("package", "appengine:" + getDeployGoal()));

  // verify
  verifier.verifyErrorFreeLog();
  verifier.verifyTextInLog("Detected App Engine flexible environment application");
  verifier.verifyTextInLog("GCLOUD: " + getExpectedLogMessage());
}
 
Example 5
Source File: OtherBranchIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void automagicVersionDependenciesResolve() throws Exception {
	// Create a -SNAPSHOT of the project-stub.
	Verifier verifier = createVerifier("/project-stub", "origin/feature/poc/long-running", "2.0.0");
	try {
		verifier.executeGoal("deploy");

		verifier.verifyTextInLog("Artifact versions updated with build metadata: +origin-feature-poc-long-running-SNAPSHOT");
		verifier.verifyErrorFreeLog();
	} finally {
		verifier.resetStreams();
	}

	// Create a -SNAPSHOT of the project-alt1-stub that depends upon the other project's automagic version.
	// The alt project defines a `-` as the otherBranchVersionDelimiter.
	verifier = createVerifier("/project-alt1-stub", "origin/feature/poc/long-running", "2.0.0");
	try {
		verifier.getCliOptions().add("-Ddependency.stub.version=2.0.0+origin-feature-poc-long-running-SNAPSHOT");
		verifier.getCliOptions().add("-Dplugin.stub.version=2.0.0+origin-feature-poc-long-running-SNAPSHOT");

		verifier.executeGoal("deploy");
		verifier.verifyTextInLog("Artifact versions updated with build metadata: -origin-feature-poc-long-running-SNAPSHOT");
		verifier.verifyErrorFreeLog();
	} finally {
		verifier.resetStreams();
	}
}
 
Example 6
Source File: MasterSupportBranchIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void releaseVersionSuccess() throws Exception {
	Verifier verifier = createVerifier("/project-stub", "origin/master", "1.0.0");

	try {
		verifier.executeGoal("gitflow-helper:enforce-versions");

		verifier.verifyErrorFreeLog();
		verifier.verifyTextInLog("GitBranchInfo:");
	} finally {
		verifier.resetStreams();
	}
}
 
Example 7
Source File: XtendCompilerMojoIT.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void continueOnXtendWarnings() throws Exception {
	Verifier verifier = MavenVerifierUtil.newVerifier(ROOT + "/xtendwarnings");
	verifier.executeGoal("verify");
	verifier.verifyTextInLog("3: The import 'java.util.Collections' is never used.");
	verifier.verifyTextInLog("[INFO] BUILD SUCCESS");
}
 
Example 8
Source File: MasterSupportBranchIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void dontPruneExplicitlyInvokedPlugins() throws Exception {
	// Create a release version and get it deployed.
	Verifier verifier = createVerifier("/project-stub", "origin/release/1.1.0", "1.1.0");

	try {
		verifier.executeGoal("deploy");

		verifier.verifyErrorFreeLog();
	} finally {
		verifier.resetStreams();
	}

	// Promote (deploy) from /origin/master
	verifier = createVerifier("/project-stub", "origin/master", "1.1.0");

	try {
		verifier.executeGoals(Arrays.asList("jar:jar", "deploy"));
		try {
			verifier.verifyTextInLog("Compiling");
			throw new VerificationException(PROMOTION_FAILED_MESSAGE);
		} catch (VerificationException ve) {
			if (ve.getMessage().equals(PROMOTION_FAILED_MESSAGE)) {
				throw ve;
			}
			// Otherwise, it's the VerificationException from looking for "Compiling", and that's expected to fail.
		}

		verifier.verifyTextInLog("Building jar:"); // This should still be there.
		verifier.verifyTextInLog(
			"gitflow-helper-maven-plugin: Enabling MasterPromoteExtension. GIT_BRANCH: [origin/master] matches masterBranchPattern");
		verifier.verifyTextInLog("[INFO] Setting release artifact repository to: [releases]");
		verifier.verifyTextInLog(
			"[INFO] Resolving & Reattaching existing artifacts from stageDeploymentRepository [test-releases");
		verifier.verifyErrorFreeLog();
	} finally {
		verifier.resetStreams();
	}
}
 
Example 9
Source File: XtendCompilerMojoIT.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void emptyDirWarningTrue() throws Exception {
	Verifier verifier = MavenVerifierUtil.newVerifier(ROOT + "/emptydir-warning-true");
	verifier.setDebug(true);
	verifier.executeGoal("test");
	verifier.verifyErrorFreeLog();
	verifier.verifyTextInLog("is empty. Can't process.");
}
 
Example 10
Source File: XtendCompilerMojoIT.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void emptyDirWarningDefault() throws Exception {
	Verifier verifier = MavenVerifierUtil.newVerifier(ROOT + "/emptydir-warning-default");
	verifier.setDebug(true);
	verifier.executeGoal("test");
	verifier.verifyErrorFreeLog();
	verifier.verifyTextInLog("is empty. Can't process.");
}
 
Example 11
Source File: YangToSourcesPluginTestIT.java    From yangtools with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testUnknownGenerator() throws Exception {
    Verifier vrf = setUp("test-parent/UnknownGenerator/", true);
    vrf.verifyTextInLog("[INFO] yang-to-sources: Code generator instantiated from "
            + "org.opendaylight.yangtools.yang2sources.spi.CodeGeneratorTestImpl");
    vrf.verifyTextInLog("Failed to instantiate code generator unknown");
    vrf.verifyTextInLog("java.lang.ClassNotFoundException: unknown");
}
 
Example 12
Source File: RetargetDeployIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void othersUnsetRepos() throws Exception {
	// Deploy a hotfix to the test-releases.
	Verifier verifier = createVerifier("/project-stub", "feature/undeployable", "3.5.0-SNAPSHOT");
	try {
		verifier.executeGoal("deploy");
		verifier.verifyTextInLog("[INFO] Skipping artifact deployment");
	} finally {
		verifier.resetStreams();
	}
}
 
Example 13
Source File: AbstractSingleYamlDeployIntegrationTest.java    From app-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void testDeployStandard() throws IOException, VerificationException {

  Verifier verifier = new StandardVerifier("testDeployStandard");

  // execute with staging directory not present
  verifier.executeGoals(Arrays.asList("package", "appengine:" + getDeployGoal()));

  // verify
  verifier.verifyErrorFreeLog();
  verifier.verifyTextInLog("Detected App Engine standard environment application");
  verifier.verifyTextInLog("GCLOUD: " + getExpectedLogMessage());
}
 
Example 14
Source File: AbstractStageMojoIntegrationTest.java    From app-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void testStageStandard() throws IOException, VerificationException {

  String projectDir =
      ResourceExtractor.simpleExtractResources(getClass(), "/projects/standard-project")
          .getAbsolutePath();

  Verifier verifier = new StandardVerifier("testStageStandard");

  // execute with staging directory not present
  verifier.executeGoals(Arrays.asList("package", "appengine:stage"));

  // verify
  verifier.verifyErrorFreeLog();
  verifier.verifyTextInLog("Detected App Engine standard environment application");
  verifier.verifyTextInLog("GCLOUD: ");
  verifier.assertFilePresent("target/appengine-staging");
  verifier.assertFilePresent("target/appengine-staging/WEB-INF");
  verifier.assertFilePresent("target/appengine-staging/WEB-INF/web.xml");
  verifier.assertFilePresent("target/appengine-staging/app.yaml");
  verifier.assertFileMatches(
      projectDir + "/target/appengine-staging/app.yaml", "(?s).*service: 'standard-project'.*");

  // repeat with staging directory present
  verifier.setLogFileName("testStageStandard_repeat.txt");
  verifier.setAutoclean(false);
  verifier.executeGoal("appengine:stage");
  verifier.verifyTextInLog("Deleting the staging directory");
}
 
Example 15
Source File: MasterSupportBranchIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test(expected = VerificationException.class)
public void snapshotVersionFailure() throws Exception {
	Verifier verifier = createVerifier("/project-stub", "origin/master", "1.0.0-SNAPSHOT");

	try {
		verifier.executeGoal("gitflow-helper:enforce-versions");
	} finally {
	    try {
			verifier.verifyTextInLog("GitBranchInfo:");
			verifier.verifyTextInLog("The maven project or one of its parents is currently a snapshot version.");
		} finally {
			verifier.resetStreams();
		}
	}
}
 
Example 16
Source File: OtherBranchIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void noOtherDeployMatch() throws Exception {
	Verifier verifier = createVerifier("/project-stub", "origin/feature/my-feature-branch", "5.0.1-SNAPSHOT");
	try {
		verifier.executeGoal("deploy");

		verifier.verifyTextInLog("Un-Setting artifact repositories.");
		verifier.verifyErrorFreeLog();
	} finally {
		verifier.resetStreams();
	}
}
 
Example 17
Source File: VulasMavenPluginTests.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void mixedConfigurationTest() throws Exception {
    String pomFileName = "mixedpom.xml";
    Path pomFilePath = Paths.get("target", "test-classes", "testproject", pomFileName);
    // Since environment variables and system properties are not passed to the forked vm
    // write the backendURL directly into the pom file
    String content = new String(Files.readAllBytes(pomFilePath), Charset.defaultCharset());
    content = content.replaceAll("REPLACE_WITH_BACKENDURL", stubServer.getBackendURL());
    Files.write(pomFilePath, content.getBytes(Charset.defaultCharset()));

    Verifier verifier = testPlugin(pomFileName);
    // in the mixed setting: the manual javaagent is always executed
    // all argLine arguments set by any maven plugin are ignored see https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html
    verifier.verifyTextInLog("/vulas/lib/vulas-core-latest-jar-with-dependencies.jar");
}
 
Example 18
Source File: VulasMavenPluginTests.java    From steady with Apache License 2.0 5 votes vote down vote up
@Test
public void backwardsCompabilityTest() throws Exception {
    String pomFileName = "backwardComppom.xml";
    Path pomFilePath = Paths.get("target", "test-classes", "testproject", pomFileName);
    // Since environment variables and system properties are not passed to the forked vm
    // write the backendURL directly into the pom file
    String content = new String(Files.readAllBytes(pomFilePath), Charset.defaultCharset());
    content = content.replaceAll("REPLACE_WITH_BACKENDURL", stubServer.getBackendURL());
    Files.write(pomFilePath, content.getBytes(Charset.defaultCharset()));

    Verifier verifier = testPlugin(pomFileName);
    verifier.verifyTextInLog("/vulas/lib/vulas-core-latest-jar-with-dependencies.jar");
}
 
Example 19
Source File: YangToSourcesPluginTestIT.java    From yangtools with Eclipse Public License 1.0 4 votes vote down vote up
@Test
public void testInvalidVersion() throws Exception {
    Verifier vrf = setUp("test-parent/InvalidVersion/", false);
    vrf.verifyErrorFreeLog();
    vrf.verifyTextInLog("[WARNING] yang-to-sources: Dependency resolution conflict:");
}
 
Example 20
Source File: EnforceVersionsIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 4 votes vote down vote up
@Test
public void dependencySuccesses() throws Exception {
	// Stage the repository with version 1.0.0 of the stub.

	// Create a release version and get it deployed.
	Verifier verifier = createVerifier("/project-stub", "origin/release/1.0.0", "1.0.0");

	try {
		verifier.executeGoal("deploy");

		verifier.verifyErrorFreeLog();
	} finally {
		verifier.resetStreams();
	}

	// Promote (deploy) from /origin/master
	verifier = createVerifier("/project-stub", "origin/master", "1.0.0");
	try {
		verifier.executeGoal("deploy");

		verifier.verifyErrorFreeLog();
	} finally {
		verifier.resetStreams();
	}

	// Build a project that depends upon the upstream project.
	verifier = createVerifier("/project-alt1-stub", "origin/release/1.0.0", "1.0.0");
	verifier.getCliOptions().add("-Ddependency.stub.version=1.0.0");
	verifier.getCliOptions().add("-Dplugin.stub.version=1.0.0");

	try {
		verifier.executeGoal("deploy");

		verifier.verifyErrorFreeLog();
	} finally {
		verifier.resetStreams();
	}

	verifier = createVerifier("/project-alt1-stub", "origin/master", "1.0.0");
	try {
		verifier.getCliOptions().add("-Ddependency.stub.version=1.0.0");
		verifier.getCliOptions().add("-Dplugin.stub.version=1.0.0");

		verifier.executeGoal("deploy");

		verifier.verifyTextInLog(
			"gitflow-helper-maven-plugin: Enabling MasterPromoteExtension. GIT_BRANCH: [origin/master] matches masterBranchPattern");
		verifier.verifyTextInLog("[INFO] Setting release artifact repository to: [releases]");
		verifier.verifyTextInLog(
			"[INFO] Resolving & Reattaching existing artifacts from stageDeploymentRepository [test-releases]");
		verifier.verifyErrorFreeLog();
	} finally {
		verifier.resetStreams();
	}
}