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

The following examples show how to use org.apache.maven.it.Verifier#verifyErrorFreeLog() . 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: AsciidocConfluencePublisherMojoIntegrationTest.java    From confluence-publisher with Apache License 2.0 6 votes vote down vote up
private static void publishAndVerify(File projectDir, Map<String, String> pomProperties, Map<String, String> commandLineArguments, Runnable runnable) throws IOException, VerificationException {
    Files.write(projectDir.toPath().resolve("pom.xml"), generatePom(pomProperties).getBytes(UTF_8));

    Verifier verifier = new Verifier(projectDir.getAbsolutePath());

    commandLineArguments.forEach((key, value) -> {
        if (value.contains("//")) {
            // maven verifier cli options parsing replaces // with /
            value = value.replaceAll("//", "////");
        }

        if (value.contains(" ")) {
            value = "'" + value + "'";
        }

        verifier.addCliOption("-Dasciidoc-confluence-publisher." + key + "=" + value);
    });

    verifier.executeGoal("org.sahli.asciidoc.confluence.publisher:asciidoc-confluence-publisher-maven-plugin:publish");

    verifier.verifyErrorFreeLog();
    verifier.displayStreamBuffers();

    runnable.run();
}
 
Example 2
Source File: StopMojoIntegrationTest.java    From app-maven-plugin with Apache License 2.0 6 votes vote down vote up
@Test
public void testStopStandard() throws IOException, VerificationException, InterruptedException {

  Verifier verifier = new StandardVerifier("testStopStandard_start");

  verifier.setSystemProperty("app.devserver.port", Integer.toString(serverPort));

  // start dev app server
  verifier.executeGoals(Arrays.asList("package", "appengine:start"));

  // verify dev app server is up
  verifier.verifyErrorFreeLog();
  assertNotNull(UrlUtils.getUrlContentWithRetries(getServerUrl(), 60000, 100));

  // stop dev app server
  verifier.setLogFileName("testStopStandard.txt");
  verifier.setAutoclean(false);
  verifier.executeGoal("appengine:stop");

  // verify dev app server is down
  verifier.verifyErrorFreeLog();
  // wait up to 5 seconds for the server to stop
  assertTrue(UrlUtils.isUrlDownWithRetries(getServerUrl(), 5000, 100));
}
 
Example 3
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 4
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 5
Source File: RetargetDeployIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 6 votes vote down vote up
@Test
public void releaseTargetsTest() throws Exception {
	Verifier verifier = createVerifier("/project-stub", "origin/release/3.1.0", "3.1.0");

	try {
		verifier.executeGoal("deploy");

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

	// Ensure the file exists in the repo.
	File artifactDir = new File(System.getProperty("basedir"), "target/it-repositories/test-releases/com/e-gineering/gitflow-helper-maven-plugin-test-stub/3.1.0");
	Assert.assertTrue(artifactDir.exists() && artifactDir.isDirectory() && artifactDir.list().length > 0);
}
 
Example 6
Source File: RetargetDeployIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 6 votes vote down vote up
@Test
public void devTargetsSnapshot() throws Exception {
	Verifier verifier = createVerifier("/project-stub", "origin/develop", "3.0.0-SNAPSHOT");

	try {
		verifier.executeGoal("deploy");

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

	// Ensure the file exists in the repo.
	File artifactDir = new File(System.getProperty("basedir"), "target/it-repositories/snapshots/com/e-gineering/gitflow-helper-maven-plugin-test-stub/3.0.0-SNAPSHOT");
	Assert.assertTrue(artifactDir.exists() && artifactDir.isDirectory() && artifactDir.list().length > 0);
}
 
Example 7
Source File: PlatformJarArchetypeIT.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 8
Source File: EnforceVersionsIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test(expected= VerificationException.class)
public void dependencySnapshotFail() 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-SNAPSHOT");
	verifier.getCliOptions().add("-Dplugin.stub.version=1.0.0");

	try {
		verifier.executeGoal("deploy");
	} 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: ShareJarArchetypeIT.java    From alfresco-sdk with Apache License 2.0 5 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
    Verifier verifier = new Verifier(projectPath);
    verifier.setAutoclean(false);
    verifier.executeGoal("install");
    printVerifierLog("PROJECT BUILD", verifier, LOGGER);
    verifier.verifyErrorFreeLog();
}
 
Example 11
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 12
Source File: CompileMojoIT.java    From jspc-maven-plugin with Apache License 2.0 5 votes vote down vote up
protected void testJspc(File testDir) throws VerificationException {
        Verifier verifier  = new Verifier(testDir.getAbsolutePath() );
        verifier.setLogFileName("verifier.log");
        
//        verifier.setDebug(true);
//        verifier.setMavenDebug(true);
        
        verifier.executeGoal("clean");
        verifier.executeGoal("package");
        
        verifier.verifyErrorFreeLog();
        
        verifier.assertFilePresent("target/jspweb.xml");
        verifier.assertFilePresent("target/classes/jsp/index_jsp.class");
    }
 
Example 13
Source File: XtendCompilerMojoTraceIT.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
private Verifier verifyErrorFreeLog(String pathToTestProject, String goal) throws IOException,
		VerificationException {
	Verifier verifier = newVerifier(pathToTestProject, debug);
	verifier.setMavenDebug(debug);
	verifier.executeGoal(goal);
	verifier.verifyErrorFreeLog();
	verifier.setDebug(true);
	verifier.resetStreams();
	return verifier;
}
 
Example 14
Source File: XtendCompilerMojoIT.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void fileSystemAccess() throws Exception {
	deleteFileIfExist("myusercode/UserCode.css");
	deleteFileIfExist("com/itemis/myusercode/UserCode2.css");

	Verifier annotationVerifier = MavenVerifierUtil.newVerifier(ROOT + "/filesystemaccess");
	annotationVerifier.setDebug(true);
	annotationVerifier.executeGoal("install");
	annotationVerifier.verifyErrorFreeLog();

	Verifier clientVerifier = MavenVerifierUtil.newVerifier(ROOT + "/filesystemaccess-client");
	clientVerifier.setDebug(true);
	clientVerifier.executeGoal("compile");
	clientVerifier.verifyErrorFreeLog();
}
 
Example 15
Source File: DownstreamParentTest.java    From brooklyn-library with Apache License 2.0 5 votes vote down vote up
/**
 * Asserts that a trivial project using brooklyn-downstream-parent can be
 * loaded into Brooklyn's catalogue and its entities deployed.
 */
@Test(groups = "Integration")
public void testDownstreamProjectsCanBeLoadedIntoBrooklynCatalogByDefault() throws Exception {
    int port = Networking.nextAvailablePort(57000);
    File dir = getBasedir("downstream-parent-test");
    Verifier verifier = new Verifier(dir.getAbsolutePath());
    verifier.setMavenDebug(true);
    verifier.executeGoal("post-integration-test", ImmutableMap.of(
            "bindPort", String.valueOf(port)));
    verifier.verifyErrorFreeLog();
    verifier.verifyTextInLog("Hello from the init method of the HelloEntity");
}
 
Example 16
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 17
Source File: EnforceVersionsIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void featureAllowsNonSnapshot() throws Exception {
	Verifier verifier = createVerifier("/project-stub", "origin/feature/aFeatureBranch", "1.0.0");

	try {
		verifier.executeGoal("gitflow-helper:enforce-versions");
		verifier.verifyErrorFreeLog();
	} finally {
		verifier.resetStreams();
	}
}
 
Example 18
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 19
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 20
Source File: DeployAllMojoIntegrationTest.java    From app-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void testDeployAllFlexible()
    throws IOException, VerificationException, CloudSdkNotFoundException,
        ProcessHandlerException {

  Verifier verifier = new FlexibleVerifier("testDeployFlexible");

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

  // verify
  verifier.verifyErrorFreeLog();
  verifier.verifyTextInLog("Detected App Engine flexible 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.");

  // verify debugger required file generation
  verifier.assertFilePresent(
      "target/flexible-project-1.0-SNAPSHOT/WEB-INF/classes/source-context.json");

  // cleanup
  deleteService("flexible-project");
}