Java 类hudson.model.ModifiableItemGroup 实例源码

项目:jenkins-inheritance-plugin    文件:RelatedProjectView.java   
@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;
}
项目:DotCi    文件:AuthenticatedView.java   
@Override
public TopLevelItem doCreateItem(final StaplerRequest req, final StaplerResponse rsp) throws IOException, ServletException {
    final ItemGroup<? extends TopLevelItem> ig = getOwnerItemGroup();
    if (ig instanceof ModifiableItemGroup) {
        return ((ModifiableItemGroup<? extends TopLevelItem>) ig).doCreateItem(req, rsp);
    }
    return null;
}
项目:DotCi    文件:MyBuildsView.java   
@Override
public TopLevelItem doCreateItem(final StaplerRequest req, final StaplerResponse rsp) throws IOException, ServletException {
    final ItemGroup<? extends TopLevelItem> ig = getOwnerItemGroup();
    if (ig instanceof ModifiableItemGroup) {
        return ((ModifiableItemGroup<? extends TopLevelItem>) ig).doCreateItem(req, rsp);
    }
    return null;
}
项目:DotCi    文件:AuthenticatedViewTest.java   
@Test
public void should_create_item_iff_owner_is_modifiable() throws IOException, ServletException {
    ModifiableItemGroup<?> parentView = mock(ModifiableItemGroup.class);
    doReturn(parentView).when(myBuildsView).getOwnerItemGroup();
    myBuildsView.doCreateItem(null, null);
    verify(parentView).doCreateItem(null, null);
}