Examples of Outcome


Examples of org.sonatype.nexus.client.core.subsystem.routing.Status.Outcome

      if (message.getDiscovery() == null) {
        // not a proxy
        discoveryStatus = null;
      }
      else {
        final Outcome discoveryOutcome = Outcome.values()[message.getDiscovery().getDiscoveryLastStatus() + 1];
        discoveryStatus =
            new DiscoveryStatus(message.getDiscovery().isDiscoveryEnabled(),
                message.getDiscovery().getDiscoveryIntervalHours(), discoveryOutcome,
                message.getDiscovery().getDiscoveryLastStrategy(),
                message.getDiscovery().getDiscoveryLastMessage(),
                message.getDiscovery().getDiscoveryLastRunTimestamp());
      }

      final Outcome publishOutcome = Outcome.values()[message.getPublishedStatus() + 1];
      return new Status(publishOutcome, message.getPublishedMessage(), message.getPublishedTimestamp(),
          message.getPublishedUrl(), discoveryStatus);
    }
    catch (UniformInterfaceException e) {
      throw getNexusClient().convert(e);
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.discovery.DiscoveryResult.Outcome

          else {
            log.debug("{} local discovery unsuccessful", mavenProxyRepository);
          }
        }
      }
      final Outcome lastOutcome = discoveryResult.getLastResult();

      final DStatus status;
      if (lastOutcome.isSuccessful()) {
        status = DStatus.SUCCESSFUL;
      }
      else {
        if (lastOutcome.getThrowable() == null) {
          status = DStatus.UNSUCCESSFUL;
        }
        else {
          status = DStatus.ERROR;
        }
      }
      final DiscoveryStatus discoveryStatus =
          new DiscoveryStatus(status, lastOutcome.getStrategyId(), lastOutcome.getMessage(),
              System.currentTimeMillis());
      discoveryStatusSource.write(discoveryStatus);
    }
    else {
      log.info("{} remote discovery disabled",
View Full Code Here

Examples of org.tmatesoft.hg.util.Outcome

      System.err.println("Need a commit message");
      return;
    }
    HgCommitCommand cmd = repo.createCommitCommand();
    cmd.message(message);
    Outcome o = cmd.execute();
    if (!o.isOk()) {
      System.err.println(o.getMessage());
      return;
    }
    System.out.printf("New changeset: %s\n", cmd.getCommittedRevision().shortNotation());
  }
View Full Code Here

Examples of org.tmatesoft.hg.util.Outcome

      int revToExtract;
      if (cset != null) {
        // TODO HgChangesetFileSneaker is handy, but bit too much here, shall extract follow rename code into separate utility
        HgChangesetFileSneaker fsneaker = new HgChangesetFileSneaker(repo);
        fsneaker.changeset(cset).followRenames(true);
        Outcome o = fsneaker.check(file);
        if (!o.isOk()) {
          if (o.getException() instanceof HgRuntimeException) {
            throw new HgLibraryFailureException(o.getMessage(), (HgRuntimeException) o.getException());
          }
          throw new HgBadArgumentException(o.getMessage(), o.getException()).setFileName(file).setRevision(cset);
        }
        if (!fsneaker.exists()) {
          throw new HgPathNotFoundException(o.getMessage(), file).setRevision(cset);
        }
        Nodeid toExtract = fsneaker.revision();
        if (fsneaker.hasAnotherName()) {
          dataFile = repo.getFileNode(fsneaker.filename());
        }
View Full Code Here

Examples of org.tmatesoft.hg.util.Outcome

    assertTrue("[sanity]", fileB.canRead());
    RepoUtils.modifyFileAppend(fileB, " 1 \n");

    HgCommitCommand cmd = new HgCommitCommand(hgRepo);
    assertFalse(cmd.isMergeCommit());
    Outcome r = cmd.message("FIRST").execute();
    errorCollector.assertTrue(r.isOk());
    Nodeid c1 = cmd.getCommittedRevision();
   
    // check that modified files are no longer reported as such
    TestStatus.StatusCollector status = new TestStatus.StatusCollector();
    new HgStatusCommand(hgRepo).all().execute(status);
    errorCollector.assertTrue(status.getErrors().isEmpty());
    errorCollector.assertTrue(status.get(Kind.Modified).isEmpty());
    errorCollector.assertEquals(1, status.get(dfB.getPath()).size());
    errorCollector.assertTrue(status.get(dfB.getPath()).contains(Kind.Clean));
   
    HgDataFile dfD = hgRepo.getFileNode("d");
    assertTrue("[sanity]", dfD.exists());
    File fileD = new File(repoLoc, "d");
    assertTrue("[sanity]", fileD.canRead());
    //
    RepoUtils.modifyFileAppend(fileD, " 1 \n");
    cmd = new HgCommitCommand(hgRepo);
    assertFalse(cmd.isMergeCommit());
    r = cmd.message("SECOND").execute();
    errorCollector.assertTrue(r.isOk());
    Nodeid c2 = cmd.getCommittedRevision();
    //
    errorCollector.assertEquals("SECOND", hgRepo.getCommitLastMessage());
    //
    int lastRev = hgRepo.getChangelog().getLastRevision();
View Full Code Here

Examples of org.tmatesoft.hg.util.Outcome

    assertTrue("[sanity]", dfD.exists());
    assertTrue("[sanity]", fileD.canRead());

    RepoUtils.modifyFileAppend(fileD, " 1 \n");
    HgCommitCommand cmd = new HgCommitCommand(hgRepo).message("FIRST");
    Outcome r = cmd.execute();
    errorCollector.assertTrue(r.isOk());
    Nodeid c = cmd.getCommittedRevision();
   
    errorCollector.assertEquals(activeBookmark, hgRepo.getBookmarks().getActiveBookmarkName());
    errorCollector.assertEquals(c, hgRepo.getBookmarks().getRevision(activeBookmark));
    // reload repo, and repeat the check
View Full Code Here

Examples of org.tmatesoft.hg.util.Outcome

    File fileD = new File(repoLoc, "d");
    assertTrue("[sanity]", fileD.canRead());
    RepoUtils.modifyFileAppend(fileD, " 1 \n");
    HgCommitCommand cmd = new HgCommitCommand(hgRepo).message("FIRST");
    Outcome r = cmd.execute();
    errorCollector.assertTrue(r.isOk());
    Nodeid c2 = cmd.getCommittedRevision();
    errorCollector.assertEquals(c2, hgRepo.getBookmarks().getRevision(activeBookmark));
    //
    if (!Internals.runningOnWindows()) {
      // need change to happen not the same moment as the last commit (and read of bookmark file)
      Thread.sleep(1000); // XXX remove once better file change detection in place
    }
    eh.run("hg", "bookmark", activeBookmark, "--force", "--rev", initialBookmarkRevision.toString());
    //
    RepoUtils.modifyFileAppend(fileD, " 2 \n");
    cmd = new HgCommitCommand(hgRepo).message("SECOND");
    r = cmd.execute();
    errorCollector.assertTrue(r.isOk());
    //Nodeid c3 = cmd.getCommittedRevision();
    errorCollector.assertEquals(initialBookmarkRevision, hgRepo.getBookmarks().getRevision(activeBookmark));
  }
View Full Code Here

Examples of org.tmatesoft.hg.util.Outcome

    // save the reference to HgDataFile without valid RevlogStream (entry in the dirstate
    // doesn't make it valid)
    final HgDataFile newFileNode = hgRepo.getFileNode("xx");
    assertFalse(newFileNode.exists());
    HgCommitCommand cmd = new HgCommitCommand(hgRepo).message("FIRST");
    Outcome r = cmd.execute();
    errorCollector.assertTrue(r.isOk());
    TestStatus.StatusCollector status = new TestStatus.StatusCollector();
    new HgStatusCommand(hgRepo).all().execute(status);
    errorCollector.assertTrue(status.getErrors().isEmpty());
    errorCollector.assertTrue(status.get(Kind.Added).isEmpty());
    errorCollector.assertTrue(status.get(newFileNode.getPath()).contains(Kind.Clean));
View Full Code Here

Examples of org.tmatesoft.hg.util.Outcome

  }

  public Outcome updateBookmark(String name, Nodeid oldRev, Nodeid newRev) throws HgRemoteConnectionException, HgRuntimeException {
    initCapabilities();
    if (!remoteCapabilities.contains(CMD_PUSHKEY)) {
      return new Outcome(Failure, "Server doesn't support pushkey protocol");
    }
    if (pushkey("Update remote bookmark", NS_BOOKMARKS, name, oldRev.toString(), newRev.toString())) {
      return new Outcome(Success, String.format("Bookmark %s updated to %s", name, newRev.shortNotation()));
    }
    return new Outcome(Failure, String.format("Bookmark update (%s: %s -> %s) failed", name, oldRev.shortNotation(), newRev.shortNotation()));
  }
View Full Code Here

Examples of org.tmatesoft.hg.util.Outcome

  }
 
  public Outcome updatePhase(HgPhase from, HgPhase to, Nodeid n) throws HgRemoteConnectionException, HgRuntimeException {
    initCapabilities();
    if (!remoteCapabilities.contains(CMD_PUSHKEY)) {
      return new Outcome(Failure, "Server doesn't support pushkey protocol");
    }
    if (pushkey("Update remote phases", NS_PHASES, n.toString(), String.valueOf(from.mercurialOrdinal()), String.valueOf(to.mercurialOrdinal()))) {
      return new Outcome(Success, String.format("Phase of %s updated to %s", n.shortNotation(), to.name()));
    }
    return new Outcome(Failure, String.format("Phase update (%s: %s -> %s) failed", n.shortNotation(), from.name(), to.name()));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.