Package hudson.model

Examples of hudson.model.AbstractBuild


        Maps.<AbstractProject, Cause>newHashMap();
    Set<AbstractProject> completed = Sets.<AbstractProject>newHashSet();
    int maxRetries = masterBuild.getMaxRetries();
    do {
      for (AbstractProject project : projects) {
          AbstractBuild build = projectBuildMap.get(project);
          if (build != null) {
              if (build.isBuilding()) {
                  logger.printf("......... %s (%s%s%s)\n",
                      project.getDisplayName(),
                      hudson.getRootUrl(),
                      build.getUrl(),
                      "console");
              } else if (!completed.contains(project)) {
                Result result = build.getResult();
                String page = "testReport";
                if (result.isWorseThan(Result.UNSTABLE)) {
                    page = "console";
                }
                logger.printf("[%s] %s (%s%s%s)\n",
                    result,
                    project.getDisplayName(),
                    hudson.getRootUrl(),
                    build.getUrl(),
                    page);
                MasterBuildCause currentCause =
                    (MasterBuildCause) build.getCause(MasterBuildCause.class);
                int rebuildNumber = currentCause.getRebuildNumber();
                if (result.isWorseThan(Result.SUCCESS)
                    && rebuildNumber < maxRetries) {
                  Cause newCause =
                      new MasterBuildCause(masterBuild, rebuildNumber + 1);
                  this.masterBuild.rebuild(project, newCause);
                  projectBuildMap.remove(project);
                  causeMap.put(project, newCause);
                  logger.printf("!!!REBUILDING!!! %s (%s%s%s)\n",
                      project.getDisplayName(),
                      hudson.getRootUrl(),
                      build.getUrl(),
                      page);
                } else {
                  completed.add(project);
                }
              }
          } else {
              Cause cause = causeMap.containsKey(project)
                  ? causeMap.get(project) : this.cause;
              build = buildFinder.findBuild(project, cause);
              if (build != null) {
                  masterBuild.addSubBuild(
                      project.getDisplayName(),
                      build.getNumber());
                  projectBuildMap.put(project, build);
              } else {
                  logger.printf(
                      "......... %s (pending)\n",
                      project.getDisplayName());
View Full Code Here


     CLICause cause = new CLICause(user, a, sp);
     Future<? extends AbstractBuild> f =
         job.scheduleBuild2(0, cause, a, sp);

     AbstractBuild build = null;
     do {
       build = buildFinder.findBuild(job, cause);
       stdout.println(
           String.format("......... %s ( pending )", job.getDisplayName()));
       rest();
     } while(build == null);

     stdout.println(
         String.format("......... %s ( %s%s )",
          job.getDisplayName(),
          hudson.getRootUrl(),
          build.getUrl()));
     build.setDescription("<h2>" + cause.getUserName() + "</h2>");

     if (!sync) return 0;

     AbstractBuild b = f.get()// wait for completion
     stdout.println(
         String.format(
             "Completed %s : %s",
             b.getFullDisplayName(),
             b.getResult()));
     return b.getResult().ordinal;
  }
View Full Code Here

    if (results.isEmpty()) {
      // No builds have been scheduled yet.
      return true;
    }
    for (SubResult subResult : results.values()) {
      AbstractBuild latestSubBuild = subResult.getLatestBuild();
      if (latestSubBuild != null && latestSubBuild.isBuilding()) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

  @Override
  public void doDynamic(StaplerRequest req, StaplerResponse res)
      throws ServletException, IOException {
    if (("/" + getOriginalFileName()).equals(req.getRestOfPath())) {
      AbstractBuild build = (AbstractBuild) req
          .findAncestor(AbstractBuild.class)
          .getObject();
      File fileParameter = getLocationUnderBuild(build);
      if (fileParameter.isFile()) {
        res.serveFile(req, fileParameter.toURI().toURL());
View Full Code Here

                            continue;
                        }
                        for (Future<AbstractBuild> future : futures.get(p)) {
                            try {
                                listener.getLogger().println("Waiting for the completion of " + HyperlinkNote.encodeTo('/'+ p.getUrl(), p.getFullDisplayName()));
                                AbstractBuild b = future.get();
                                listener.getLogger().println(HyperlinkNote.encodeTo('/'+ b.getUrl(), b.getFullDisplayName()) + " completed. Result was "+b.getResult());
                                BuildInfoExporterAction.addBuildInfoExporterAction(build, b.getProject().getFullName(), b.getNumber(), b.getResult());

                                if(buildStepResult && config.getBlock().mapBuildStepResult(b.getResult())) {
                                    build.setResult(config.getBlock().mapBuildResult(b.getResult()));
                                } else {
                                    buildStepResult = false;
                                }
                            } catch (CancellationException x) {
                                throw new AbortException(p.getFullDisplayName() +" aborted.");
View Full Code Here

        // Nbr of builds to back track
        final int BACK_TRACK = 5;

        if (!subProjectData.getUnresolved().isEmpty()) {

            AbstractBuild currentBuild = (AbstractBuild)context.getLastBuild();

            // If we don't have any build there's no point to trying to resolved dynamic projects
            if (currentBuild == null) {
                // But we can still get statically defined project
                subProjectData.getFixed().addAll(Items.fromNameList(context.getParent(), projects, AbstractProject.class));
                // Remove them from unsolved
                for (AbstractProject staticProject : subProjectData.getFixed()) {
                    subProjectData.getUnresolved().remove(staticProject.getFullName());
                }
                return;
            }

            // check the last build
            resolveProject(currentBuild, subProjectData);
            currentBuild = (AbstractBuild)currentBuild.getPreviousBuild();

            int backTrackCount = 0;
            // as long we have more builds to examine we continue,
            while (currentBuild != null && backTrackCount < BACK_TRACK) {
                resolveProject(currentBuild, subProjectData);
                currentBuild = (AbstractBuild)currentBuild.getPreviousBuild();
                backTrackCount++;
            }

            // If oldBuild is null then we have already examined LastSuccessfulBuild as well.
            if (currentBuild != null && context.getLastSuccessfulBuild() != null) {
View Full Code Here

        when(result.getNumberOfAnnotations(Priority.NORMAL)).thenReturn(fixedWarnings);
        when(result.getNumberOfAnnotations(Priority.LOW)).thenReturn(Math.abs(newWarnings - fixedWarnings));
        when(result.getNumberOfFixedWarnings()).thenReturn(fixedWarnings);
        when(result.getNumberOfNewWarnings()).thenReturn(newWarnings);

        AbstractBuild build = mock(AbstractBuild.class);

        when(build.getTimestamp()).thenReturn(new GregorianCalendar(2010, 02, buildNumber));
        when(build.getNumber()).thenReturn(buildNumber);
        when(build.getDisplayName()).thenReturn("#" + buildNumber);

        when(result.getOwner()).thenReturn(build);

        return result;
    }
View Full Code Here

     * @throws Exception the exception
     */
    @Test
    @SuppressWarnings("rawtypes")
    public void testHasPreviousResult() throws Exception {
        AbstractBuild withResult = mockBuild();
        AbstractBuild noResult = mockBuild();
        AbstractBuild baseline = mockBuild();

        when(baseline.getPreviousBuild()).thenReturn(noResult);
        when(noResult.getPreviousBuild()).thenReturn(withResult);

        TestResultAction action = mockAction(withResult);
        when(withResult.getAction(TestResultAction.class)).thenReturn(action);
        BuildResult result = mock(BuildResult.class);
View Full Code Here

        verifyHasResult(true, Result.FAILURE);
    }

    @SuppressWarnings("rawtypes")
    private void verifyHasResult(final boolean expectedResult, final Result pluginResult) {
        AbstractBuild withResult = mockBuild(Result.ABORTED);
        AbstractBuild noResult = mockBuild();
        AbstractBuild baseline = mockBuild();

        when(baseline.getPreviousBuild()).thenReturn(noResult);
        when(noResult.getPreviousBuild()).thenReturn(withResult);

        TestResultAction action = mockAction(withResult);
        when(withResult.getAction(TestResultAction.class)).thenReturn(action);
        BuildResult result = mock(BuildResult.class);
View Full Code Here

        return mockBuild(Result.SUCCESS);
    }

    @SuppressWarnings("rawtypes")
    private AbstractBuild mockBuild(final Result result) {
        AbstractBuild build = mock(AbstractBuild.class);
        when(build.getResult()).thenReturn(result);
        return build;
    }
View Full Code Here

TOP

Related Classes of hudson.model.AbstractBuild

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.