Package hudson.model

Examples of hudson.model.AbstractProject


                    for (AbstractProject key : deps.keySet()) {
                        if (key == owner) {
                            continue;   // Avoid self references
                        }

                        AbstractProject p = key;
                        if (key instanceof MatrixConfiguration) {
                            p = key.getRootProject();
                        }

                        if (seenUpstreamProjects.contains(p.getName())) {
                            continue;
                        }

                        seenUpstreamProjects.add(p.getName());
                        graph.addDependency(new Dependency(p, owner) {
                            @Override
                            public boolean shouldTriggerBuild(AbstractBuild build,
                                                              TaskListener listener,
                                                              List<Action> actions) {
View Full Code Here


            for (Fingerprint fp : getFingerprints().values()) {
                BuildPtr bp = fp.getOriginal();
                if(bp==null)    continue;       // outside Hudson
                if(bp.is(build))    continue;   // we are the owner
                AbstractProject job = bp.getJob();
                if (job==nullcontinue;   // project no longer exists
                if (job.getParent()==build.getParent())
                    continue;   // we are the parent of the build owner, that is almost like we are the owner
                if(job.getBuildByNumber(bp.getNumber())==null && !includeMissing)
                    continue;               // build no longer exists

                Integer existing = r.get(job);
                if(existing!=null && existing>bp.getNumber())
                    continue;   // the record in the map is already up to date
View Full Code Here

        Jenkins h = Jenkins.getInstance();
        String src = params.getParameter(0);

        TopLevelItem s = h.getItem(src);
        if (s==null) {
            AbstractProject nearest = AbstractProject.findNearest(src);
            if (nearest!=null)
                throw new CmdLineException(owner, "No such job '"+src+"' perhaps you meant '"+ nearest.getFullName() +"'?");
            else
                throw new CmdLineException(owner, "No such job '"+src+"'");
        }
           
        setter.addValue(s);
View Full Code Here

    @Override
    public int parseArguments(Parameters params) throws CmdLineException {
        Jenkins h = Jenkins.getInstance();
        String src = params.getParameter(0);

        AbstractProject s = h.getItemByFullName(src,AbstractProject.class);
        if (s==null) {
            AbstractProject nearest = AbstractProject.findNearest(src);
            if (nearest!=null)
                throw new CmdLineException(owner, "No such job '"+src+"' perhaps you meant '"+ nearest.getFullName() +"'?");
            else
                throw new CmdLineException(owner, "No such job '"+src+"'");
        }
        setter.addValue(s);
        return 1;
View Full Code Here

            String threadName = Thread.currentThread().getName();
            Thread.currentThread().setName("SCM polling for "+job);
            try {
                startTime = System.currentTimeMillis();
                if(runPolling()) {
                    AbstractProject p = job.asProject();
                    String name = " #"+p.getNextBuildNumber();
                    SCMTriggerCause cause;
                    try {
                        cause = new SCMTriggerCause(getLogFile());
                    } catch (IOException e) {
                        LOGGER.log(WARNING, "Failed to parse the polling log",e);
                        cause = new SCMTriggerCause();
                    }
                    if(p.scheduleBuild(p.getQuietPeriod(), cause, additionalActions)) {
                        LOGGER.info("SCM changes detected in "+ job.getName()+". Triggering "+name);
                    } else {
                        LOGGER.info("SCM changes detected in "+ job.getName()+". Job is already in the queue");
                    }
                }
View Full Code Here

        BuildIDs id = checkChannel().call(new BuildIDs());

        if (!id.isComplete())
            throw new AbortException("This command can be only invoked from a build executing inside Hudson");

        AbstractProject p = Jenkins.getInstance().getItemByFullName(id.job, AbstractProject.class);
        if (p==null)
            throw new AbortException("No such job found: "+id.job);
        p.checkPermission(Item.CONFIGURE);

        List<String> toolTypes = new ArrayList<String>();
        for (ToolDescriptor<?> d : ToolInstallation.all()) {
            toolTypes.add(d.getDisplayName());
            if (d.getDisplayName().equals(toolType)) {
View Full Code Here

public class ProjectSonarActionTest extends SonarTestCase {
  private ProjectSonarAction action;

  @Before
  public void setUp() throws Exception {
    AbstractProject project = mock(AbstractProject.class);
    action = new ProjectSonarAction(project);
    when(project.getBuilds()).thenReturn(new RunList());
  }
View Full Code Here

    @LocalData
    public void testBackwadrCompatibility1(){
        j.jenkins.getPlugin(DiskUsagePlugin.class).getConfiguration().disableBuildsDiskUsageCalculation();
        j.jenkins.getPlugin(DiskUsagePlugin.class).getConfiguration().disableJobsDiskUsageCalculation();
        j.jenkins.getPlugin(DiskUsagePlugin.class).getConfiguration().disableWorkspacesDiskUsageCalculation();
        AbstractProject project = (AbstractProject) j.jenkins.getItem("project1");
        DiskUsageProperty property = (DiskUsageProperty) project.getProperty(DiskUsageProperty.class);
        assertEquals("Size of project1 should be loaded from previous configuration.", 188357L, property.getAllDiskUsageWithoutBuilds(), 0);
        assertEquals("Size of build 3 should be loaded from previous configuration.", 23932L, property.getDiskUsageOfBuild(3), 0);
    }
View Full Code Here

    @LocalData
    public void testBackwadrCompatibility2(){
        j.jenkins.getPlugin(DiskUsagePlugin.class).getConfiguration().disableBuildsDiskUsageCalculation();
        j.jenkins.getPlugin(DiskUsagePlugin.class).getConfiguration().disableJobsDiskUsageCalculation();
        j.jenkins.getPlugin(DiskUsagePlugin.class).getConfiguration().disableWorkspacesDiskUsageCalculation();
        AbstractProject project = (AbstractProject) j.jenkins.getItem("project1");
        DiskUsageProperty property = (DiskUsageProperty) project.getProperty(DiskUsageProperty.class);
        assertEquals("Size of project1 should be loaded from previous configuration.", 188357L, property.getAllDiskUsageWithoutBuilds(), 0);
        assertEquals("Size of workspaces should be loaded from previous configuration.", 4096L, property.getAllWorkspaceSize(), 0);
        assertTrue("Path of workspace shoudl be loaded form previous configuration.", property.getSlaveWorkspaceUsage().get("").containsKey(j.jenkins.getRootDir().getAbsolutePath() + "/workspace"));
    }
View Full Code Here

    }
   
    @Test
    @LocalData
    public void testGetDiskUsageOfBuilds(){
        AbstractProject project = (AbstractProject) j.jenkins.getItem("project1");
        int loadedBuildsSize = project._getRuns().getLoadedBuilds().size();
        DiskUsageProperty property = (DiskUsageProperty) project.getProperty(DiskUsageProperty.class);
        for(DiskUsageBuildInformation information : property.getDiskUsageOfBuilds()){
            assertEquals("Disk usage of build has loaded wrong size.", information.getNumber()*1000, information.getSize(), 0);
        }
        assertEquals("No build should be loaded.", loadedBuildsSize, project._getRuns().getLoadedBuilds().size(), 0);
     }
View Full Code Here

TOP

Related Classes of hudson.model.AbstractProject

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.