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

The following examples show how to use org.apache.maven.it.Verifier#resetStreams() . 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: 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 2
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 3
Source File: RetargetDeployIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 6 votes vote down vote up
@Test
public void hotfixTargetsTest() throws Exception {
	Verifier verifier = createVerifier("/project-stub", "origin/hotfix/3.1.5", "3.1.5");

	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.5");
	Assert.assertTrue(artifactDir.exists() && artifactDir.isDirectory() && artifactDir.list().length > 0);
}
 
Example 4
Source File: OtherBranchIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void featureSemVer() throws Exception {
	Verifier verifier = createVerifier("/project-stub", "origin/feature/poc/my-feature-branch.with.other.identifiers", "5.0.1");
	try {
		verifier.executeGoal("deploy");

		verifier.verifyTextInLog("Artifact versions updated with build metadata: +origin-feature-poc-my-feature-branch.with.other.identifiers-SNAPSHOT");
		verifier.verifyErrorFreeLog();
	} finally {
		verifier.resetStreams();
	}
}
 
Example 5
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 supportsStartswithMismatch() throws Exception {
	Verifier verifier = createVerifier("/project-stub", "origin/support/1.2", "1.3.2");

	try {
		verifier.executeGoal("gitflow-helper:enforce-versions");
	} finally {
		verifier.resetStreams();
	}
}
 
Example 6
Source File: ReleaseBranchIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Non-snapshot versions on the develop branch should fail.
 */
@Test
public void snapshotDeployFails() throws Exception {
	Verifier verifier = createVerifier("/project-stub", "origin/release/1.0.0", "1.0.0-SNAPSHOT");

	try {
		verifier.executeGoal("deploy");
	} catch (Exception ex) {
		verifier.verifyTextInLog("The current git branch: [origin/release/1.0.0] is defined as a release branch. The maven project or one of its parents is currently a snapshot version.");
	} finally {
		verifier.resetStreams();
	}
}
 
Example 7
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 8
Source File: DevelopBranchIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 5 votes vote down vote up
/**.
 * Snapshot versions on the develop branch should pass
 * @throws Exception
 */
@Test
public void snapshotDeploySuccess() throws Exception {
	Verifier verifier = createVerifier("/project-stub", "origin/develop", "1.0.0-SNAPSHOT");

	try {
		verifier.executeGoal("deploy");

		verifier.verifyErrorFreeLog();
	} finally {
		verifier.resetStreams();
	}
}
 
Example 9
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 pluginSnapshotFail() 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-SNAPSHOT");

	try {
		verifier.executeGoal("deploy");
	} finally {
		verifier.resetStreams();
	}
}
 
Example 10
Source File: EnforceVersionsIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void versionStartswithMatch() throws Exception {
	Verifier verifier = createVerifier("/project-stub", "origin/release/1.2", "1.2.4");
	verifier.getCliOptions().add("-DreleaseBranchMatchType=startsWith");

	try {
		verifier.executeGoal("gitflow-helper:enforce-versions");
	} finally {
		verifier.resetStreams();
	}
}
 
Example 11
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 12
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 13
Source File: VertxMojoTestBase.java    From vertx-maven-plugin with Apache License 2.0 5 votes vote down vote up
void runPackage(Verifier verifier) throws VerificationException {
    verifier.setLogFileName("build-package.log");
    verifier.executeGoal("package", getEnv());

    verifier.assertFilePresent("target/vertx-demo-start-0.0.1.BUILD-SNAPSHOT.jar");
    verifier.resetStreams();
}
 
Example 14
Source File: OtherBranchIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void featureSnapshotSemVer() throws Exception {
	Verifier verifier = createVerifier("/project-stub", "origin/feature/poc/my-feature-branch", "5.0.0-SNAPSHOT");
	try {
		verifier.executeGoal("deploy");

		verifier.verifyTextInLog("Artifact versions updated with build metadata: +origin-feature-poc-my-feature-branch-SNAPSHOT");
		verifier.verifyErrorFreeLog();
	} finally {
		verifier.resetStreams();
	}
}
 
Example 15
Source File: MasterSupportBranchIT.java    From gitflow-helper-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void promotionOfRelease() throws Exception {
	// 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");

		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(
			"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 16
Source File: VertxMojoTestBase.java    From vertx-maven-plugin with Apache License 2.0 5 votes vote down vote up
void runPackage(Verifier verifier) throws VerificationException {
    verifier.setLogFileName("build-package.log");
    verifier.executeGoal("package", getEnv());

    verifier.assertFilePresent("target/vertx-demo-start-0.0.1.BUILD-SNAPSHOT.jar");
    verifier.resetStreams();
}
 
Example 17
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 versionStartswithMismatch() throws Exception {
	Verifier verifier = createVerifier("/project-stub", "origin/release/1.2", "1.3.0");
	verifier.getCliOptions().add("-DreleaseBranchMatchType=startsWith");

	try {
		verifier.executeGoal("gitflow-helper:enforce-versions");
	} finally {
		verifier.resetStreams();
	}
}
 
Example 18
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 19
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();
	}
}
 
Example 20
Source File: StartStopMojoIT.java    From vertx-maven-plugin with Apache License 2.0 4 votes vote down vote up
private void runStop(Verifier verifier) throws VerificationException, IOException {
    verifier.setLogFileName("build-stop.log");
    verifier.executeGoal("vertx:stop", getEnv());
    assertInLog(verifier, "BUILD SUCCESS", "terminated with status 0");
    verifier.resetStreams();
}