当前位置: 首页>>代码示例>>Java>>正文


Java ItemGroup类代码示例

本文整理汇总了Java中hudson.model.ItemGroup的典型用法代码示例。如果您正苦于以下问题:Java ItemGroup类的具体用法?Java ItemGroup怎么用?Java ItemGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ItemGroup类属于hudson.model包,在下文中一共展示了ItemGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newInstance

import hudson.model.ItemGroup; //导入依赖的package包/类
@Override
public DrupalProject newInstance(ItemGroup parent, String name) {
	DrupalProject project = new DrupalProject(parent, name);
	
	// Add SCM.
	try {
		project.setScm(new DrushMakefileSCM("api=2\r\ncore=7.x\r\nprojects[drupal][version]=7.38", "drupal"));
	} catch (IOException e) {
		LOGGER.warning("[DRUPAL] Unable to instantiate Makefile SCM: "+e.toString());
	}

	// Add builders.
	project.getBuildersList().add(new DrupalInstanceBuilder("mysql://user:[email protected]/db", "drupal", "standard", false, false));
	project.getBuildersList().add(new DrupalReviewBuilder(true, true, true, true, true, "drupal", "logs_codereview", "", false));
	project.getBuildersList().add(new DrupalTestsBuilder("http://localhost/", "drupal", "logs_tests", "", ""));
	
	// Add publishers.
	// project.getPublishersList().add(new CheckStylePublisher("", "", "low", "", false, "", "", "0", "", "", "", "", "", "", "0", "", "", "", "", "", "", false, false, false, false, false, "logs_codereview/*"));
	// project.getPublishersList().add(new JUnitResultArchiver("logs_tests/*"));

	return project;
}
 
开发者ID:jenkinsci,项目名称:drupal-developer-plugin,代码行数:23,代码来源:DrupalProject.java

示例2: deleteWorkspaceRecursive

import hudson.model.ItemGroup; //导入依赖的package包/类
private void deleteWorkspaceRecursive(AbstractProject project)
    throws IOException {
  final AbstractBuild build = project.getLastBuild();
  if (build != null) {
    final FilePath workspace = build.getWorkspace();
    if (workspace != null) {
      try {
        workspace.deleteRecursive();
      } catch (InterruptedException e) {
        throw new IOException(e);
      }
    }
  }

  if (project instanceof ItemGroup) {
    deleteWorkspacesRecursive((ItemGroup) project);
  }
}
 
开发者ID:jenkinsci,项目名称:yaml-project-plugin,代码行数:19,代码来源:YamlBuild.java

示例3: getBranch

import hudson.model.ItemGroup; //导入依赖的package包/类
/** Fetch the branch of the project. */
public Branch getBranch() {
  if (isDelegate()) {
    final ItemGroup parent = getParent();
    // If we are a delegate, defer to our project context for our Branch
    // since it provides the complete version.
    // NOTE: A delegate SCM is only an option for projects contained
    // within an AbstractBranchAwareProject, so validate this invariant.
    checkState(parent instanceof AbstractBranchAwareProject);
    final AbstractBranchAwareProject parentProject =
        (AbstractBranchAwareProject) parent;
    return parentProject.getBranch();
  } else {
    // If we are not a delegate, than the branch we store is accurate.
    return checkNotNull(branch);
  }
}
 
开发者ID:jenkinsci,项目名称:yaml-project-plugin,代码行数:18,代码来源:AbstractBranchAwareProject.java

示例4: getParentProject

import hudson.model.ItemGroup; //导入依赖的package包/类
/**
 * Walk the ancestors of the current project to identify from which
 * project we inherit our {@link SCM}.
 *
 * @param project The project that is consuming this {@link DelegateSCM}
 * @return The project from which to inherit our actual {@link SCM}
 */
private T getParentProject(AbstractProject project) {
  // We expect this SCM to be shared by 1 or more layers beneath a project
  // matching our clazz, from which we inherit our source context.
  // NOTE: multiple layers are possible with a matrix job, for example.
  checkArgument(this == project.getScm());

  // Some configuration, e.g. MatrixProject/MatrixConfiguration
  // have several layers of project that we need to walk through
  // get to the real container.  Walk through all of the projects
  // that share this SCM to find the AbstractBranchAwareProject
  // that contains this and assigned this sub-project the DelegateSCM.
  AbstractProject cursor = project;
  do {
    ItemGroup parent = cursor.getParent();
    // We are searching for a project, so at any point in time our
    // container must remain a project.  Validate the cast.
    checkState(parent instanceof AbstractProject);
    cursor = (AbstractProject) parent;
  } while (this == cursor.getScm());

  // Validate that the container we ultimately find matches our
  // expected container type before casting and returning it.
  checkState(clazz.isInstance(cursor));
  return clazz.cast(cursor);
}
 
开发者ID:jenkinsci,项目名称:yaml-project-plugin,代码行数:33,代码来源:DelegateSCM.java

示例5: testGetItems

import hudson.model.ItemGroup; //导入依赖的package包/类
@Test
public void testGetItems() throws Exception {
  List<TopLevelItem> list = ImmutableList.of(mockItem, mockItem);
  when(mockItemGroup.getItems()).thenReturn(list);
  JobHistoryView underTest = new JobHistoryView() {
      @Override
      public ItemGroup getOwnerItemGroup() {
        return mockItemGroup;
      }
    };

  assertEquals(list, underTest.getItems());

  verify(mockItemGroup, times(1)).getItems();
  verifyNoMoreInteractions(mockItemGroup);
  verifyNoMoreInteractions(mockItem);
}
 
开发者ID:jenkinsci,项目名称:yaml-project-plugin,代码行数:18,代码来源:JobHistoryViewTest.java

示例6: testGetItems

import hudson.model.ItemGroup; //导入依赖的package包/类
@Test
public void testGetItems() throws Exception {
  List<TopLevelItem> list = ImmutableList.of(mockItem, mockItem);
  when(mockItemGroup.getItems()).thenReturn(list);
  LastProjectView underTest = new LastProjectView() {
      @Override
      public ItemGroup getOwnerItemGroup() {
        return mockItemGroup;
      }
    };

  assertEquals(0, underTest.getItems().size());

  verifyNoMoreInteractions(mockItemGroup);
  verifyNoMoreInteractions(mockItem);
}
 
开发者ID:jenkinsci,项目名称:yaml-project-plugin,代码行数:17,代码来源:LastProjectViewTest.java

示例7: resolveProject

import hudson.model.ItemGroup; //导入依赖的package包/类
private Item resolveProject(final String projectName, final Iterator<String> restOfPathParts) {
    return ACLUtil.impersonate(ACL.SYSTEM, new ACLUtil.Function<Item>() {
        public Item invoke() {
            final Jenkins jenkins = Jenkins.getInstance();
            if (jenkins != null) {
                Item item = jenkins.getItemByFullName(projectName);
                while (item instanceof ItemGroup<?> && !(item instanceof Job<?, ?> || item instanceof SCMSourceOwner) && restOfPathParts.hasNext()) {
                    item = jenkins.getItem(restOfPathParts.next(), (ItemGroup<?>) item);
                }
                if (item instanceof Job<?, ?> || item instanceof SCMSourceOwner) {
                    return item;
                }
            }
            LOGGER.log(Level.FINE, "No project found: {0}, {1}", toArray(projectName, Joiner.on('/').join(restOfPathParts)));
            return null;
        }
    });
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:19,代码来源:ActionResolver.java

示例8: doFillCredentialsIdItems

import hudson.model.ItemGroup; //导入依赖的package包/类
public static ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context) {

            AccessControlled ac = (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance());
            if (!ac.hasPermission(Jenkins.ADMINISTER)) {
                return new ListBoxModel();
            }

            return new SSHUserListBoxModel().withMatching(
                    SSHAuthenticator.matcher(Connection.class),
                    CredentialsProvider.lookupCredentials(
                            StandardUsernameCredentials.class,
                            context,
                            ACL.SYSTEM,
                            SSHLauncher.SSH_SCHEME)
            );
        }
 
开发者ID:jenkinsci,项目名称:docker-plugin,代码行数:17,代码来源:DockerTemplateBase.java

示例9: onLoad

import hudson.model.ItemGroup; //导入依赖的package包/类
@Override
public void onLoad(final ItemGroup<? extends Item> parent, final String name) throws IOException {
    try {
        final Field parentField = AbstractItem.class.getDeclaredField("parent");
        parentField.setAccessible(true);
        ReflectionUtils.setField(parentField, this, parent);
    } catch (final Exception e) {
        throw new RuntimeException(e);
    }

    doSetName(name);
    if (this.transientActions == null) {
        this.transientActions = new Vector<>();
    }
    updateTransientActions();
    getBuildersList().setOwner(this);
    getPublishersList().setOwner(this);
    getBuildWrappersList().setOwner(this);

    initRepos();
}
 
开发者ID:groupon,项目名称:DotCi,代码行数:22,代码来源:DynamicSubProject.java

示例10: doCreateItem

import hudson.model.ItemGroup; //导入依赖的package包/类
@Override
public Item doCreateItem(StaplerRequest req, StaplerResponse rsp)
		throws IOException, ServletException {
	//First, we just create this item
	Item item = null;
	ItemGroup<? extends TopLevelItem> ig = getOwnerItemGroup();
       if (ig instanceof ModifiableItemGroup)
           item = ((ModifiableItemGroup<? extends TopLevelItem>)ig).doCreateItem(req, rsp);
       
       //Checking if we deal with an inheritable job
       if (item == null || !(item instanceof InheritanceProject)) {
       	return item;
       }
       //If we deal with an inheritable project, we assign it to the currently
       //viewed creation class, if any
       InheritanceProject ip = (InheritanceProject) item;
       //Checking if we define a CC
       if (!this.creationClassFilter.isEmpty()) {
       	ip.setCreationClass(this.creationClassFilter);
       }
       return item;
}
 
开发者ID:i-m-c,项目名称:jenkins-inheritance-plugin,代码行数:23,代码来源:RelatedProjectView.java

示例11: onLoad

import hudson.model.ItemGroup; //导入依赖的package包/类
/**
 * This method restores transient fields that could not be deserialized.
 * Do note that there is no guaranteed order of deserialization, so
 * don't expect other objects to be present, when this method is called.
 */
@Override
public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException {
	//Creating & clearing buffers, if necessary
	createBuffers();
	clearBuffers(null);
	
	/* We need to create a dummy version store first, as we can't get the
	 * project root directory before super() is executed (as no name is
	 * set yet); but that one needs a version store available to load
	 * certain values reliably without a null pointer access.
	 */
	this.versionStore = new VersionedObjectStore();
	
	//Then loading the elements defined in the parent
	//TODO: What to do if a transient job is attempted to be loaded?
	super.onLoad(parent, name);
	
	//Loading the correct version store
	this.versionStore = this.loadVersionedObjectStore();
	
	//And clearing the buffers again, as a new job with new props is available
	clearBuffers(null);
}
 
开发者ID:i-m-c,项目名称:jenkins-inheritance-plugin,代码行数:29,代码来源:InheritanceProject.java

示例12: getProjectList

import hudson.model.ItemGroup; //导入依赖的package包/类
public static List<AbstractProject> getProjectList(String projects, ItemGroup context, EnvVars env) {
    List<AbstractProject> projectList = new ArrayList<>();

    // expand variables if applicable
    StringBuilder projectNames = new StringBuilder();
    StringTokenizer tokens = new StringTokenizer(projects, ",");
    while (tokens.hasMoreTokens()) {
        if (projectNames.length() > 0) {
            projectNames.append(',');
        }
        projectNames.append(env != null ? env.expand(tokens.nextToken().trim()) : tokens.nextToken().trim());
    }

    projectList.addAll(Items.fromNameList(context, projectNames.toString(), AbstractProject.class));
    return projectList;
}
 
开发者ID:Diabol,项目名称:delivery-pipeline-plugin,代码行数:17,代码来源:ProjectUtil.java

示例13: triggerManual

import hudson.model.ItemGroup; //导入依赖的package包/类
@Override
public void triggerManual(AbstractProject<?, ?> project, AbstractProject<?, ?> upstream, String buildId,
                          ItemGroup<? extends TopLevelItem> itemGroup) throws TriggerException {
    StandardBuildCard buildCard = new StandardBuildCard();

    if (upstream != null && upstream.getBuild(buildId) != null) {

        try {
            buildCard.triggerManualBuild(itemGroup, Integer.parseInt(buildId),
                    project.getRelativeNameFrom(itemGroup),
                    upstream.getRelativeNameFrom(itemGroup));
        } catch (Exception e) {
            throw new TriggerException("Could not trigger", e);
        }
    } else {
        throw new TriggerException("Could not find build: " + buildId + " for project: " + upstream);
    }
}
 
开发者ID:Diabol,项目名称:delivery-pipeline-plugin,代码行数:19,代码来源:BPPManualTrigger.java

示例14: createPipelineLatest

import hudson.model.ItemGroup; //导入依赖的package包/类
@Override
public List<Pipeline> createPipelineLatest(int noOfPipelines,
                                           ItemGroup context,
                                           boolean pagingEnabled,
                                           boolean showChanges,
                                           Component component) throws PipelineException {
    List<AbstractProject> firstProjects = ProjectUtil.getStartUpstreams(getFirstProject());
    List<AbstractBuild> builds = resolveBuilds(firstProjects);

    //TODO check if in queue

    int totalNoOfPipelines = builds.size();
    component.setTotalNoOfPipelines(totalNoOfPipelines);
    int startIndex = getStartIndex(component, pagingEnabled, noOfPipelines);
    int retrieveSize = calculateRetreiveSize(component, pagingEnabled, noOfPipelines, totalNoOfPipelines);

    return getPipelines(builds.listIterator(startIndex), context, startIndex, retrieveSize, showChanges);
}
 
开发者ID:Diabol,项目名称:delivery-pipeline-plugin,代码行数:19,代码来源:DownstreamPipeline.java

示例15: setAggregatedChanges

import hudson.model.ItemGroup; //导入依赖的package包/类
void setAggregatedChanges(ItemGroup context, List<Stage> pipelineStages) {
    // We use size() - 1 because last stage's changelog can't be calculated against next stage (no such)
    for (int i = 0; i < pipelineStages.size() - 1; i++) {
        Stage stage = pipelineStages.get(i);
        Stage nextStage = pipelineStages.get(i + 1);

        final AbstractBuild nextBuild = nextStage.getHighestBuild(firstProject, context, Result.SUCCESS);

        Set<Change> changes = new LinkedHashSet<>();

        AbstractBuild build = stage.getHighestBuild(firstProject, context, Result.SUCCESS);
        for (; build != null && build != nextBuild; build = build.getPreviousBuild()) {
            changes.addAll(Change.getChanges(build));
        }

        stage.setChanges(changes);
    }
}
 
开发者ID:Diabol,项目名称:delivery-pipeline-plugin,代码行数:19,代码来源:Pipeline.java


注:本文中的hudson.model.ItemGroup类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。