Java Code Examples for org.apache.maven.it.Verifier#executeGoals()
The following examples show how to use
org.apache.maven.it.Verifier#executeGoals() .
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: OtherBranchIT.java From gitflow-helper-maven-plugin with Apache License 2.0 | 6 votes |
@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 2
Source File: DeployAllMojoIntegrationTest.java From app-maven-plugin with Apache License 2.0 | 6 votes |
@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: StopMojoIntegrationTest.java From app-maven-plugin with Apache License 2.0 | 6 votes |
@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 4
Source File: SetupIT.java From vertx-maven-plugin with Apache License 2.0 | 5 votes |
private void setup(Verifier verifier, String... params) throws VerificationException { verifier.setLogFileName("build-setup.log"); ImmutableList.Builder<String> builder = ImmutableList.builder(); builder.add("io.reactiverse:vertx-maven-plugin:" + VertxMojoTestBase.VERSION + ":setup"); for (String p : params) { builder.add(p); } verifier.executeGoals(builder.build(), getEnv()); }
Example 5
Source File: AbstractSingleYamlDeployIntegrationTest.java From app-maven-plugin with Apache License 2.0 | 5 votes |
@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 6
Source File: AbstractSingleYamlDeployIntegrationTest.java From app-maven-plugin with Apache License 2.0 | 5 votes |
@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 7
Source File: AbstractStageMojoIntegrationTest.java From app-maven-plugin with Apache License 2.0 | 5 votes |
@Test public void testStageFlexible() throws IOException, VerificationException { Verifier verifier = new FlexibleVerifier("testStageFlexible"); // execute stage verifier.executeGoals(Arrays.asList("package", "appengine:stage")); // verify verifier.verifyErrorFreeLog(); verifier.verifyTextInLog("Detected App Engine flexible environment application"); verifier.assertFilePresent("target/appengine-staging"); verifier.assertFilePresent("target/appengine-staging/flexible-project-1.0-SNAPSHOT.war"); verifier.assertFilePresent("target/appengine-staging/app.yaml"); }
Example 8
Source File: AbstractStageMojoIntegrationTest.java From app-maven-plugin with Apache License 2.0 | 5 votes |
@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 9
Source File: RunAsyncMojoIntegrationTest.java From app-maven-plugin with Apache License 2.0 | 5 votes |
@Test public void testRunAsync() throws IOException, VerificationException, InterruptedException { String testName = "testRunAsync"; try { Verifier verifier = createVerifier(testName); verifier.setSystemProperty("app.devserver.startSuccessTimeout", "60"); verifier.executeGoals(Arrays.asList("package", "appengine:start")); String urlContent = UrlUtils.getUrlContentWithRetries(getServerUrl(), 60000, 1000); assertThat(urlContent, containsString("Hello from the App Engine Standard project.")); assertThat(urlContent, containsString("TEST_VAR=testVariableValue")); Path expectedLog = Paths.get( "target", "test-classes", "projects", "standard-project", "target", "dev-appserver-out", "dev_appserver.out"); assertTrue(Files.exists(expectedLog)); String devAppServerOutput = new String(Files.readAllBytes(expectedLog), StandardCharsets.UTF_8); assertTrue(devAppServerOutput.contains(DEV_APP_SERVER_STARTED)); verifier.verifyErrorFreeLog(); verifier.verifyTextInLog(DEV_APP_SERVER_STARTED); } finally { Verifier stopVerifier = createVerifier(testName + "_stop"); stopVerifier.executeGoal("appengine:stop"); // wait up to 5 seconds for the server to stop assertTrue(UrlUtils.isUrlDownWithRetries(getServerUrl(), 5000, 100)); } }
Example 10
Source File: AbstractRunMojoIntegrationTest.java From app-maven-plugin with Apache License 2.0 | 5 votes |
@Test @Parameters public void testRun(String[] profiles, String expectedModuleName) throws IOException, VerificationException, InterruptedException, ExecutionException { String name = "testRun" + Arrays.toString(profiles); Verifier verifier = createVerifier(name); Arrays.stream(profiles) .filter(profile -> !profile.isEmpty()) .map("-P"::concat) .forEach(verifier::addCliOption); ExecutorService executor = Executors.newSingleThreadExecutor(); // sequential execution Future<String> urlContent = // wait up to 8 minutes for the server to start (retry every second) // it may take a long time when installing Cloud SDK components for the first time executor.submit(() -> UrlUtils.getUrlContentWithRetries(getServerUrl(), 480000, 1000)); Future<Boolean> isUrlDown = executor.submit( () -> { // stop server createVerifier(name + "_stop").executeGoal("appengine:stop"); // wait up to 5 seconds for the server to stop return UrlUtils.isUrlDownWithRetries(getServerUrl(), 5000, 100); }); executor.shutdown(); // execute verifier.executeGoals(Arrays.asList("package", "appengine:run")); assertThat(urlContent.get(), containsString("Hello from the App Engine Standard project.")); assertThat(urlContent.get(), containsString("TEST_VAR=testVariableValue")); assertTrue(isUrlDown.get()); verifier.verifyErrorFreeLog(); verifier.verifyTextInLog("Dev App Server is now running"); verifier.verifyTextInLog("Module instance " + expectedModuleName + " is running"); }
Example 11
Source File: DeployAllMojoIntegrationTest.java From app-maven-plugin with Apache License 2.0 | 5 votes |
@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"); }
Example 12
Source File: RunIT.java From vertx-maven-plugin with Apache License 2.0 | 5 votes |
private void run(Verifier verifier, String ... previous) throws VerificationException { verifier.setLogFileName("build-run.log"); ImmutableList.Builder<String> builder = ImmutableList.builder(); builder.add(previous); builder.add("vertx:run"); verifier.executeGoals(builder.build(), getEnv()); }
Example 13
Source File: RedeployIT.java From vertx-maven-plugin with Apache License 2.0 | 5 votes |
private void run(Verifier verifier, String... previous) throws VerificationException { verifier.setLogFileName("build-run.log"); ImmutableList.Builder<String> builder = ImmutableList.builder(); builder.add(previous); builder.add("vertx:run"); verifier.executeGoals(builder.build(), getEnv()); }
Example 14
Source File: AbstractMojoTest.java From sarl with Apache License 2.0 | 5 votes |
/** Execute a Mojo. * * @param projectName the name of the project to test for the unit test. * @param goalName the goal to run. * @return the verifier. * @throws Exception any exception. */ protected Verifier executeMojo(String projectName, String goalName) throws Exception { String tempDirPath = System.getProperty("maven.test.tmpdir", //$NON-NLS-1$ System.getProperty("java.io.tmpdir")); //$NON-NLS-1$ File tempDir = new File(tempDirPath); File baseDir = new File(tempDir, projectName); assertNotNull(baseDir); FileUtils.deleteDirectory(baseDir); URL url = getClass().getResource("/projects/" + projectName); //$NON-NLS-1$ if (url == null) { throw new IllegalArgumentException("Resource not found: " + projectName); //$NON-NLS-1$ } File resourceFile = new File(new URI(url.toExternalForm())); assertTrue(resourceFile.isDirectory()); FileUtils.copyDirectoryStructure(resourceFile, baseDir); assertTrue(baseDir.exists()); assertTrue(baseDir.isDirectory()); recursiveDeleteOnShutdownHook(baseDir); Verifier verifier = new Verifier(baseDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.setDebug(false); final String m2home = findDefaultMavenHome(); if (m2home != null && !m2home.isEmpty()) { verifier.setForkJvm(false); verifier.getSystemProperties().put("maven.multiModuleProjectDirectory", m2home); //$NON-NLS-1$ verifier.getVerifierProperties().put("use.mavenRepoLocal", Boolean.FALSE.toString()); //$NON-NLS-1$ } verifier.executeGoals(Arrays.asList("clean", goalName)); //$NON-NLS-1$ return verifier; }
Example 15
Source File: RunIT.java From vertx-maven-plugin with Apache License 2.0 | 5 votes |
private void run(Verifier verifier, String ... previous) throws VerificationException { verifier.setLogFileName("build-run.log"); ImmutableList.Builder<String> builder = ImmutableList.builder(); builder.add(previous); builder.add("vertx:run"); verifier.executeGoals(builder.build(), getEnv()); }
Example 16
Source File: MasterSupportBranchIT.java From gitflow-helper-maven-plugin with Apache License 2.0 | 5 votes |
@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 17
Source File: RedeployIT.java From vertx-maven-plugin with Apache License 2.0 | 4 votes |
private void run(Verifier verifier) throws VerificationException { verifier.setLogFileName("build-run.log"); verifier.executeGoals(ImmutableList.of("compile", "vertx:run"), getEnv()); }
Example 18
Source File: DebugIT.java From vertx-maven-plugin with Apache License 2.0 | 4 votes |
private void debug(Verifier verifier) throws VerificationException { verifier.setLogFileName("build-run.log"); verifier.executeGoals(ImmutableList.of("compile", "vertx:debug"), getEnv()); }
Example 19
Source File: RedeployIT.java From vertx-maven-plugin with Apache License 2.0 | 4 votes |
private void run(Verifier verifier) throws VerificationException { verifier.setLogFileName("build-run.log"); verifier.executeGoals(ImmutableList.of("compile", "vertx:run"), getEnv()); }
Example 20
Source File: DebugIT.java From vertx-maven-plugin with Apache License 2.0 | 4 votes |
private void debug(Verifier verifier) throws VerificationException { verifier.setLogFileName("build-run.log"); verifier.executeGoals(ImmutableList.of("compile", "vertx:debug"), getEnv()); }