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

The following examples show how to use org.apache.maven.it.Verifier#setSystemProperty() . 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: 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 2
Source File: RunAsyncMojoIntegrationTest.java    From app-maven-plugin with Apache License 2.0 5 votes vote down vote up
@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 3
Source File: MavenVerifierUtil.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
public static Verifier newVerifier(String pathToTestProject) throws IOException, VerificationException {
	File testDir = ResourceExtractor.simpleExtractResources(MavenVerifierUtil.class, pathToTestProject);
	Verifier verifier = new Verifier(testDir.getAbsolutePath());
	System.out.println("gradle: " + System.getProperty("gradleMavenRepo"));
	for (Object iterable_element : System.getProperties().keySet()) {
		System.out.println(iterable_element + "=" + System.getProperty(iterable_element.toString()));
	}
	
	String gradleMavenRepo = System.getProperty("gradleMavenRepo");
	Assert.assertNotNull("gradleMavenRepo is null", gradleMavenRepo);
	verifier.setSystemProperty("gradleMavenRepo", gradleMavenRepo);
	
	verifier.setSystemProperty("nonTestMavenRepo", System.getProperty("maven.repo.local"));
	verifier.setSystemProperty("WORKSPACE", System.getProperty("WORKSPACE"));
	
	String testMavenRepo = System.getProperty("testMavenRepo");
	Assert.assertNotNull("testMavenRepo is null", testMavenRepo);
	verifier.setLocalRepo(testMavenRepo);
	
	verifier.setDebug(true);
	String testSettingsXML = System.getProperty("testSettingsXML");
	if (testSettingsXML != null) {
		verifier.addCliOption("-s");
		verifier.addCliOption(testSettingsXML);
	}
	verifier.addCliOption("-U");
	verifier.setMavenDebug(true);
	// verifier.setDebugJvm(true);
	// verifier.setForkJvm(false);
	return verifier;
}
 
Example 4
Source File: AbstractRunMojoIntegrationTest.java    From app-maven-plugin with Apache License 2.0 4 votes vote down vote up
private Verifier createVerifier(String name) throws IOException, VerificationException {
  Verifier verifier = new StandardVerifier(name);
  verifier.setSystemProperty("app.devserver.port", Integer.toString(serverPort));
  return verifier;
}
 
Example 5
Source File: RunAsyncMojoIntegrationTest.java    From app-maven-plugin with Apache License 2.0 4 votes vote down vote up
private Verifier createVerifier(String name) throws IOException, VerificationException {
  Verifier verifier = new StandardVerifier(name);
  verifier.setSystemProperty("app.devserver.port", Integer.toString(serverPort));
  return verifier;
}