Package org.apache.maven.it

Examples of org.apache.maven.it.Verifier


      FileUtils.deleteDirectory(testDir);

      final File basedir = ResourceExtractor.extractResourcePath(getClass(), "/run-p2", testDir, false);

      final Verifier verifier = new Verifier(basedir.getAbsolutePath());

      verifier.setLocalRepo(new File(TestContainer.getBasedir(), "target/maven/fake-repo").getAbsolutePath());

      verifier.setSystemProperty("org.eclipse.ecf.provider.filetransfer.retrieve.readTimeout", "30000");
      verifier.setSystemProperty("p2.installIU", installIU);
      verifier.setSystemProperty("p2.destination", destination);
      verifier.setSystemProperty("p2.metadataRepository", repositoryURL);
      verifier.setSystemProperty("p2.artifactRepository", repositoryURL);
      verifier.setSystemProperty("p2.profile", getTestId());

      if (sysProps != null) {
        for (Map.Entry<String, String> entry : sysProps.entrySet()) {
          verifier.setSystemProperty(entry.getKey(), entry.getValue());
        }
      }

      verifier.setLogFileName(getTestId() + "-maven-output.log");
      verifier.addCliOption("-X");
      verifier.executeGoals(Arrays.asList("verify"));
      verifier.verifyErrorFreeLog();
      verifier.resetStreams();

      FileUtils.deleteDirectory(testDir);
    }
    finally {
      userUtil.makeAnonymousAdministrator(wasAnonymousAdministrator);
View Full Code Here


      throws Exception
  {
    final File mavenProject = getTestFile("maven-project");
    final File settings = getTestFile("repositories.xml");
    {
      final Verifier verifier = mavenVerifierHelper.createMavenVerifier(mavenProject, settings, getTestId());
      try {
        verifier.executeGoal("dependency:resolve");
        verifier.verifyErrorFreeLog();
      }
      catch (VerificationException e) {
        mavenVerifierHelper.failTest(verifier);
      }
    }

    {
      final Verifier verifier = mavenVerifierHelper.createMavenVerifier(mavenProject, settings, getTestId());
      // Disable anonymous
      disableUser("anonymous");

      try {
        verifier.executeGoal("dependency:resolve");
        verifier.verifyErrorFreeLog();
        mavenVerifierHelper.failTest(verifier);
      }
      catch (VerificationException e) {
        // Expected exception
      }
    }

    {
      // Disable anonymous
      disableUser("anonymous");

      File mavenProjectWithauth = getTestFile("maven-project");
      File settingsWithAuth = getTestFile("repositoriesWithAuthentication.xml");

      Verifier verifier = mavenVerifierHelper.createMavenVerifier(mavenProjectWithauth, settingsWithAuth, getTestId());
      verifier.executeGoal("dependency:resolve");
      verifier.verifyErrorFreeLog();
    }
  }
View Full Code Here

  {
    try {

      // DeployUtils.forkDeployWithWagon( this.getContainer(), "http", this.getRepositoryUrl( repoId ),
      // fileToDeploy, this.getRelitiveArtifactPath( gav ) );
      Verifier verifier =
          MavenDeployer.deployAndGetVerifier(gav, this.getRepositoryUrl(repoId), fileToDeploy,
              this.getOverridableFile("settings.xml"));

      Assert.assertTrue("Artifact upload should have thrown exception", shouldUpload);
    }
View Full Code Here

  {
    File mavenProject1 = getTestFile("maven-project-1");

    File settings1 = getTestFile("settings1.xml");

    Verifier verifier1 = null;

    try {
      verifier1 = mavenVerifierHelper.createMavenVerifier(mavenProject1, settings1, getTestId());

      verifier1.executeGoal("deploy");

      verifier1.verifyErrorFreeLog();
    }

    catch (VerificationException e) {
      mavenVerifierHelper.failTest(verifier1);
    }

    try {
      verifier1.executeGoal("deploy");

      verifier1.verifyErrorFreeLog();

      Assert.fail("Should return 401 error");
    }
    catch (VerificationException e) {
      // 401 error
View Full Code Here

  {
    File mavenProject = getTestFile("maven-project-snapshot");

    File settings = getTestFile("settings-snapshot.xml");

    Verifier verifier = null;

    try {
      verifier = mavenVerifierHelper.createMavenVerifier(mavenProject, settings, getTestId());

      verifier.executeGoal("deploy");

      verifier.verifyErrorFreeLog();
    }

    catch (VerificationException e) {
      mavenVerifierHelper.failTest(verifier);
    }
View Full Code Here

  {
    File mavenProject2 = getTestFile("maven-project-2");

    File settings2 = getTestFile("settings2.xml");

    Verifier verifier2 = null;

    try {
      verifier2 = mavenVerifierHelper.createMavenVerifier(mavenProject2, settings2, getTestId());

      verifier2.executeGoal("deploy");

      verifier2.verifyErrorFreeLog();
    }
    catch (VerificationException e) {
      mavenVerifierHelper.failTest(verifier2);
    }
  }
View Full Code Here

  {
    File mavenProjectAnon = getTestFile("maven-project-anon");

    File settingsAnon = getTestFile("settings-anon.xml");

    Verifier verifierAnon = null;

    try {
      verifierAnon = mavenVerifierHelper.createMavenVerifier(mavenProjectAnon, settingsAnon, getTestId());

      verifierAnon.executeGoal("deploy");

      verifierAnon.verifyErrorFreeLog();

      Assert.fail("Should return 401 error");
    }
    catch (VerificationException e) {
      // test pass
View Full Code Here

    final File localRepo = util.resolveFile("target/apache-maven-local-repository");

    tasks().chmod(file(new File(mavenHome, "bin"))).include("mvn").permissions("755").run();

    System.setProperty("maven.home", mavenHome.getAbsolutePath());
    final Verifier verifier = new Verifier(projectToBuildTarget.getAbsolutePath(), false);
    verifier.setAutoclean(true);
    verifier.setLogFileName("maven.log");

    verifier.setLocalRepo(localRepo.getAbsolutePath());
    verifier.setMavenDebug(true);
    verifier.setCliOptions(Arrays.asList("-s " + mavenSettingsTarget.getAbsolutePath()));

    verifier.resetStreams();

    verifier.executeGoal("deploy");
    verifier.verifyErrorFreeLog();

    testIndex().recordLink("maven.log", new File(projectToBuildTarget, "maven.log"));
  }
View Full Code Here

    File mavenProjectDir = new File("target");
    mavenProjectDir.mkdirs();

    System.setProperty("maven.home", TestProperties.getString("maven-basedir"));

    Verifier verifier = new Verifier(mavenProjectDir.getAbsolutePath(), false);

    String logname = "logs/maven-deploy/" + gav.getGroupId() + "/" + fileToDeploy.getName() + ".log";
    new File(verifier.getBasedir(), logname).getParentFile().mkdirs();
    verifier.setLogFileName(logname);

    verifier.setLocalRepo(TestProperties.getFile("maven.local.repo").getAbsolutePath());

    verifier.setAutoclean(false);
    verifier.resetStreams();

    List<String> options = new ArrayList<String>();
    if (settings != null) {
      options.add("-s " + settings.getAbsolutePath());
    }

    options.add("-Durl=\'" + repositoryUrl + "\'");
    options.add("-Dfile=\'" + fileToDeploy + "\'");
    options.add("-DgroupId=\'" + gav.getGroupId() + "\'");
    options.add("-DartifactId=\'" + gav.getArtifactId() + "\'");
    options.add("-Dversion=\'" + gav.getVersion() + "\'");
    options.add("-Dpackaging=\'" + gav.getExtension() + "\'");

    if (extraOptions != null) {
      options.addAll(Arrays.asList(extraOptions));
    }

    verifier.setCliOptions(options);
    return verifier;
  }
View Full Code Here

  public static Verifier deployAndGetVerifier(Gav gav, String repositoryUrl, File fileToDeploy, File settings,
                                              String... extraOptions)
      throws VerificationException, IOException
  {
    Verifier verifier = createVerifier(gav, repositoryUrl, fileToDeploy, settings, extraOptions);
    // verifier.executeGoal( "deploy:deploy-file" );

    Map<String, String> args = new HashMap<String, String>();
    args.put("url", repositoryUrl);
    args.put("file", fileToDeploy.getAbsolutePath());
    args.put("groupId", gav.getGroupId());
    args.put("artifactId", gav.getArtifactId());
    args.put("version", gav.getVersion());
    args.put("packaging", gav.getExtension());
    if (gav.getClassifier() != null) {
      args.put("classifier", gav.getClassifier());
    }

    Properties props = new Properties();
    props.putAll(args);

    verifier.setSystemProperties(props);

    verifier.executeGoal("org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy-file", args);

    return verifier;

  }
View Full Code Here

TOP

Related Classes of org.apache.maven.it.Verifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.