Package hudson.model

Examples of hudson.model.Item


   
    File jobDirectory = new File(getCurrentHudsonRootDirectory() + "/jobs/fakeJob/" );
    File configFile = new File(jobDirectory.getAbsolutePath() + File.separator + "config.xml");
   
    // Creating fake new job
    Item mockedItem = Mockito.mock(TopLevelItem.class);
    when(mockedItem.getRootDir()).thenReturn(jobDirectory);
   
    sscItemListener.onCreated(mockedItem);

    sscConfigurationSaveableListener.onChange(mockedItem, new XmlFile(configFile));
   
View Full Code Here


    sscBusiness.synchronizeAllConfigs(ScmSyncConfigurationPlugin.AVAILABLE_STRATEGIES);

    File configFile = new File(getCurrentHudsonRootDirectory() + "/hudson.tasks.Shell.xml" );

    // Creating fake new job
    Item mockedItem = Mockito.mock(Item.class);
    when(mockedItem.getRootDir()).thenReturn(configFile);

    sscItemListener.onCreated(mockedItem);
    sscConfigurationSaveableListener.onChange(mockedItem, new XmlFile(configFile));

    verifyCurrentScmContentMatchesHierarchy("expected-scm-hierarchies/InitRepositoryTest.shouldSynchronizeHudsonFiles/");
View Full Code Here

    scmManipulator.addFile(checkoutDirectoryForVerifications, "jobs/hello.txt");
    scmManipulator.addFile(checkoutDirectoryForVerifications, "hello2.txt");
    scmManipulator.checkinFiles(checkoutDirectoryForVerifications, "external commit");
   
    // Renaming fakeJob to newFakeJob
    Item mockedItem = Mockito.mock(Item.class);
    File mockedItemRootDir = new File(getCurrentHudsonRootDirectory() + "/jobs/newFakeJob/" );
    when(mockedItem.getRootDir()).thenReturn(mockedItemRootDir);
   
    sscItemListener.onRenamed(mockedItem, "fakeJob", "newFakeJob");
   
    // Assert no hello file is present in current hudson root
    assertThat(new File(this.getCurrentScmSyncConfigurationCheckoutDirectory()+"/jobs/hello.txt").exists(), is(false));
View Full Code Here

   
    // Synchronizing hudson config files
    sscBusiness.synchronizeAllConfigs(ScmSyncConfigurationPlugin.AVAILABLE_STRATEGIES);
   
    // Deleting fakeJob
    Item mockedItem = Mockito.mock(TopLevelItem.class);
    File mockedItemRootDir = new File(getCurrentHudsonRootDirectory() + "/jobs/fakeJob/" );
    when(mockedItem.getRootDir()).thenReturn(mockedItemRootDir);
   
    sscItemListener.onDeleted(mockedItem);
   
    verifyCurrentScmContentMatchesHierarchy("expected-scm-hierarchies/HudsonExtensionsTest.shouldJobDeleteBeCorrectlyImpactedOnSCM" + getSuffixForTestFiles() + "/");
   
View Full Code Here

   
    // Synchronizing hudson config files
    sscBusiness.synchronizeAllConfigs(ScmSyncConfigurationPlugin.AVAILABLE_STRATEGIES);
   
    // Deleting fakeJob
    Item mockedItem = Mockito.mock(TopLevelItem.class);
    File mockedItemRootDir = new File(getCurrentHudsonRootDirectory() + "/jobs/fakeJob/" );
    when(mockedItem.getRootDir()).thenReturn(mockedItemRootDir);
   
    sscItemListener.onDeleted(mockedItem);
   
    verifyCurrentScmContentMatchesHierarchy("expected-scm-hierarchies/HudsonExtensionsTest.shouldJobDeleteWithTwoJobsBeCorrectlyImpactedOnSCM/");
   
View Full Code Here

    scmManipulator.addFile(checkoutDirectoryForVerifications, "jobs/hello.txt");
    scmManipulator.addFile(checkoutDirectoryForVerifications, "hello2.txt");
    scmManipulator.checkinFiles(checkoutDirectoryForVerifications, "external commit");
   
    // Deleting fakeJob
    Item mockedItem = Mockito.mock(Item.class);
    File mockedItemRootDir = new File(getCurrentHudsonRootDirectory() + "/jobs/fakeJob/" );
    when(mockedItem.getRootDir()).thenReturn(mockedItemRootDir);
   
    sscItemListener.onDeleted(mockedItem);
   
    // Assert no hello file is present in current hudson root
    assertThat(new File(this.getCurrentScmSyncConfigurationCheckoutDirectory()+"/jobs/hello.txt").exists(), is(false));
View Full Code Here

        }

        String credentialsId = parser.get("credentialsId");
        StandardCredentials upc = null;
        if (credentialsId != null) {
            Item context = req.findAncestorObject(Item.class);
            final List<Authentication> authentications = new ArrayList<Authentication>(2);
            authentications.add(Jenkins.getAuthentication());
            if (context.hasPermission(Item.CONFIGURE)) {
                authentications.add(ACL.SYSTEM);
            }
            for (Authentication a : authentications) {
                upc = CredentialsMatchers.firstOrNull(CredentialsProvider.lookupCredentials(StandardCredentials.class,
                        context,
View Full Code Here

    if (!subject.hasPermission(Item.CONFIGURE)) return FormValidation.ok();
    StringTokenizer tokenizer = new StringTokenizer(value);
    while (tokenizer.hasMoreTokens()) {
      String projectName = tokenizer.nextToken().trim();
      if (StringUtils.isNotBlank(projectName)) {
        Item item = hudson.getItemByFullName(projectName, Item.class);
        if (item == null) {
          return FormValidation.error(
              Messages.BuildTrigger_NoSuchProject(
                  projectName,
                  AbstractProject.findNearest(projectName).getName()));
View Full Code Here

            StringTokenizer tokens = new StringTokenizer(Util.fixNull(value),",");
            boolean hasProjects = false;
            while(tokens.hasMoreTokens()) {
                String projectName = tokens.nextToken().trim();
                if (StringUtils.isNotBlank(projectName)) {
                  Item item = Jenkins.getInstance().getItem(projectName,project,Item.class); // only works after version 1.410
                    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));
View Full Code Here

        }

        String path = ancestors.get(p);
        if(path!=nullreturn path;

        Item i=p;
        String url = "";
        while(true) {
            ItemGroup ig = i.getParent();
            url = i.getShortUrl()+url;

            if(ig==Hudson.getInstance()) {
                assert i instanceof TopLevelItem;
                if(view!=null && view.contains((TopLevelItem)i)) {
                    // if p and the current page belongs to the same view, then return a relative path
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.