Package hudson.model

Examples of hudson.model.Item


        Binding binding = new Binding();
        binding.setProperty("out",new PrintWriter(stdout,true));
        String j = getClientEnvironmentVariable("JOB_NAME");
        if (j!=null) {
            Item job = Hudson.getInstance().getItemByFullName(j);
            binding.setProperty("currentJob", job);
            String b = getClientEnvironmentVariable("BUILD_NUMBER");
            if (b!=null && job instanceof AbstractProject) {
                Run r = ((AbstractProject) job).getBuildByNumber(Integer.parseInt(b));
                binding.setProperty("currentBuild", r);
View Full Code Here


            if(!subject.hasPermission(Item.CONFIGURE))      return FormValidation.ok();

            StringTokenizer tokens = new StringTokenizer(Util.fixNull(value),",");
            while(tokens.hasMoreTokens()) {
                String projectName = tokens.nextToken().trim();
                Item item = Hudson.getInstance().getItemByFullName(projectName,Item.class);
                if(item==null)
                    return FormValidation.error(Messages.BuildTrigger_NoSuchProject(projectName,AbstractProject.findNearest(projectName).getName()));
                if(!(item instanceof AbstractProject))
                    return FormValidation.error(Messages.BuildTrigger_NotBuildable(projectName));
                if (StringUtils.equals(projectName, current.getName())) {
View Full Code Here

    /**
     * Tests that the builds from the FreeStyleProject can be loaded.
     */
    @LocalData
    public void testFreeStyleBuild() {
        Item item = Hudson.getInstance().getItem("freestyleJob");
        assertThat("Item is not a FreeStyleProject", item, instanceOf(FreeStyleProject.class));
        FreeStyleProject proj = (FreeStyleProject)item;
        RunList<FreeStyleBuild> builds = proj.getBuilds();
        assertNotNull(builds);
        assertTrue("The build list should not be empty", builds.size() > 0);
View Full Code Here

    /**
     * Tests that the builds from the MatrixProject can be loaded.
     */
    @LocalData
    public void testMatrixBuild() {
        Item item = Hudson.getInstance().getItem("matrixJob");
        assertThat("Item is not a MatrixProject", item, instanceOf(MatrixProject.class));
        MatrixProject proj = (MatrixProject)item;
        RunList<MatrixBuild> builds = proj.getBuilds();
        assertNotNull(builds);
        assertTrue("The build list should not be empty", builds.size() > 0);
View Full Code Here

    /**
     * Tests that a new build can be triggered for the old FreeStyleProject.
     */
    @LocalData
    public void testNewTriggeredBuild() {
        Item item = Hudson.getInstance().getItem("freestyleJob");
        assertThat("Item is not a FreeStyleProject", item, instanceOf(FreeStyleProject.class));
        FreeStyleProject project = (FreeStyleProject)item;
        int number = project.getLastBuild().getNumber() + 1;
        server.waitForCommand(GERRIT_STREAM_EVENTS, 2000);
        PluginImpl.getInstance().getServer(PluginImpl.DEFAULT_SERVER_NAME).triggerEvent(Setup.createPatchsetCreated());
View Full Code Here

        } else {
            StringTokenizer tokens = new StringTokenizer(Util.fixNull(projects), ",");
            while (tokens.hasMoreTokens()) {
                String projectName = tokens.nextToken().trim();
                if (!projectName.equals("")) {
                    Item item = Jenkins.getInstance().getItem(projectName, context, Item.class);
                    if ((item != null) && (item instanceof AbstractProject)) {
                        dependencyJobs.add((AbstractProject)item);
                        logger.debug("project dependency job added : {}", (AbstractProject)item);
                    }
                }
View Full Code Here

            StringTokenizer tokens = new StringTokenizer(Util.fixNull(value), ",");
            // Check that all jobs are legit, actual projects.
            while (tokens.hasMoreTokens()) {
                String projectName = tokens.nextToken().trim();
                if (!projectName.equals("")) {
                    Item item = Hudson.getInstance().getItem(projectName, project, Item.class);
                    if ((item == null) || !(item instanceof AbstractProject)) {
                        return FormValidation.error(hudson.model.Messages.AbstractItem_NoSuchJobExists(projectName,
                                    AbstractProject.findNearest(projectName,
                                        project.getParent()).getRelativeNameFrom(project)));
                    }
View Full Code Here

TOP

Related Classes of hudson.model.Item

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.