org.jvnet.hudson.test
Class MockFolder

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.model.Actionable
          extended by hudson.model.AbstractItem
              extended by org.jvnet.hudson.test.MockFolder
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.model.TopLevelItem>, hudson.model.DescriptorByNameOwner, hudson.model.Item, hudson.model.ItemGroup<hudson.model.TopLevelItem>, hudson.model.ModelObject, hudson.model.ModifiableItemGroup<hudson.model.TopLevelItem>, hudson.model.ModifiableViewGroup, hudson.model.PersistenceRoot, hudson.model.Saveable, hudson.model.TopLevelItem, hudson.model.ViewGroup, hudson.search.SearchableModelObject, hudson.search.SearchItem, hudson.security.AccessControlled, jenkins.model.DirectlyModifiableTopLevelItemGroup, jenkins.model.ModelObjectWithContextMenu, jenkins.model.ModifiableTopLevelItemGroup, org.kohsuke.stapler.HttpDeletable, org.kohsuke.stapler.StaplerFallback

public class MockFolder
extends hudson.model.AbstractItem
implements jenkins.model.DirectlyModifiableTopLevelItemGroup, hudson.model.TopLevelItem, hudson.model.ModifiableViewGroup, org.kohsuke.stapler.StaplerFallback

Minimal implementation of a modifiable item group akin to the CloudBees Folders plugin. No UI, just enough implementation to test functionality of code which should deal with item full names, etc.

If you need to work with the UI during the test, or just prefer to depend on a plugin POM earlier than this class, you can simply add a test dependency on cloudbees-folder to your plugin and use jenkinsRule.jenkins.createProject(Folder.class, "name").

Since:
1.494

Nested Class Summary
static class MockFolder.DescriptorImpl
           
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
jenkins.model.ModelObjectWithContextMenu.ContextMenu, jenkins.model.ModelObjectWithContextMenu.ContextMenuVisibility, jenkins.model.ModelObjectWithContextMenu.MenuItem
 
Field Summary
 
Fields inherited from class hudson.model.AbstractItem
description, displayName, name, PRONOUN
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Fields inherited from interface hudson.model.Item
BUILD, CANCEL, CONFIGURE, CREATE, DELETE, DISCOVER, EXTENDED_READ, PERMISSIONS, READ, WIPEOUT, WORKSPACE
 
Method Summary
<I extends hudson.model.TopLevelItem>
I
add(I item, String name)
           
 void addView(hudson.model.View view)
           
 boolean canAdd(hudson.model.TopLevelItem item)
           
 boolean canDelete(hudson.model.View view)
           
<T extends hudson.model.TopLevelItem>
T
copy(T src, String name)
           
<T extends hudson.model.TopLevelItem>
T
createProject(Class<T> type, String name)
          Convenience method to create a FreeStyleProject or similar.
 hudson.model.TopLevelItem createProject(hudson.model.TopLevelItemDescriptor type, String name, boolean notify)
           
 hudson.model.TopLevelItem createProjectFromXML(String name, InputStream xml)
           
 void deleteView(hudson.model.View view)
           
 hudson.model.TopLevelItem doCreateItem(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
           
 Collection<? extends hudson.model.Job> getAllJobs()
           
 hudson.model.TopLevelItemDescriptor getDescriptor()
           
 hudson.model.TopLevelItem getItem(String name)
           
 hudson.model.ItemGroup<? extends hudson.model.TopLevelItem> getItemGroup()
           
 Collection<hudson.model.TopLevelItem> getItems()
           
 hudson.model.TopLevelItem getJob(String name)
          Same as getItem(java.lang.String) but named this way as a WebMethod.
 hudson.model.View getPrimaryView()
           
 File getRootDirFor(hudson.model.TopLevelItem child)
           
 Object getStaplerFallback()
           
 String getUrlChildPrefix()
           
 hudson.model.View getView(String name)
           
 List<hudson.model.Action> getViewActions()
           
 Collection<hudson.model.View> getViews()
           
 hudson.views.ViewsTabBar getViewsTabBar()
           
 void onCopiedFrom(hudson.model.Item src)
           
 void onDeleted(hudson.model.TopLevelItem item)
           
 void onLoad(hudson.model.ItemGroup<? extends hudson.model.Item> parent, String name)
           
 void onRenamed(hudson.model.TopLevelItem item, String oldName, String newName)
           
 void onViewRenamed(hudson.model.View view, String oldName, String newName)
           
 void remove(hudson.model.TopLevelItem item)
           
 void renameTo(String newName)
           
 
Methods inherited from class hudson.model.AbstractItem
checkPermission, delete, delete, doConfigDotXml, doDoDelete, doSetName, doSubmitDescription, getAbsoluteUrl, getACL, getApi, getConfigFile, getDescription, getDescriptorByName, getDisplayName, getDisplayNameOrNull, getFullDisplayName, getFullName, getName, getParent, getPronoun, getRelativeDisplayNameFrom, getRelativeNameFrom, getRelativeNameFrom, getRelativeNameFromGroup, getRootDir, getSearchName, getSearchUrl, getShortUrl, getUrl, hasPermission, onCreatedFromScratch, performDelete, resolveForCLI, save, setDescription, setDisplayName, setDisplayNameOrNull, toString, updateByXml, updateByXml
 
Methods inherited from class hudson.model.Actionable
addAction, doContextMenu, getAction, getAction, getActions, getActions, getAllActions, getDynamic, replaceAction
 
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface hudson.model.ItemGroup
getFullDisplayName, getFullName, getUrl
 
Methods inherited from interface hudson.model.PersistenceRoot
getRootDir
 
Methods inherited from interface hudson.model.Saveable
save
 
Methods inherited from interface hudson.model.ModelObject
getDisplayName
 
Methods inherited from interface hudson.model.Item
delete, getAbsoluteUrl, getDisplayName, getFullDisplayName, getFullName, getName, getParent, getRelativeNameFrom, getRelativeNameFrom, getShortUrl, getUrl, onCreatedFromScratch, save
 
Methods inherited from interface hudson.search.SearchableModelObject
getSearch
 
Methods inherited from interface hudson.search.SearchItem
getSearchIndex, getSearchName, getSearchUrl
 
Methods inherited from interface hudson.model.ViewGroup
getUrl
 
Methods inherited from interface hudson.security.AccessControlled
checkPermission, getACL, hasPermission
 

Method Detail

onLoad

public void onLoad(hudson.model.ItemGroup<? extends hudson.model.Item> parent,
                   String name)
            throws IOException
Specified by:
onLoad in interface hudson.model.Item
Overrides:
onLoad in class hudson.model.AbstractItem
Throws:
IOException

getItems

public Collection<hudson.model.TopLevelItem> getItems()
Specified by:
getItems in interface hudson.model.ItemGroup<hudson.model.TopLevelItem>

getItem

public hudson.model.TopLevelItem getItem(String name)
Specified by:
getItem in interface hudson.model.ItemGroup<hudson.model.TopLevelItem>

getAllJobs

public Collection<? extends hudson.model.Job> getAllJobs()
Specified by:
getAllJobs in interface hudson.model.Item
Specified by:
getAllJobs in class hudson.model.AbstractItem

copy

public <T extends hudson.model.TopLevelItem> T copy(T src,
                                                    String name)
                                         throws IOException
Specified by:
copy in interface jenkins.model.ModifiableTopLevelItemGroup
Throws:
IOException

onCopiedFrom

public void onCopiedFrom(hudson.model.Item src)
Specified by:
onCopiedFrom in interface hudson.model.Item
Overrides:
onCopiedFrom in class hudson.model.AbstractItem

createProjectFromXML

public hudson.model.TopLevelItem createProjectFromXML(String name,
                                                      InputStream xml)
                                               throws IOException
Specified by:
createProjectFromXML in interface jenkins.model.ModifiableTopLevelItemGroup
Throws:
IOException

createProject

public hudson.model.TopLevelItem createProject(hudson.model.TopLevelItemDescriptor type,
                                               String name,
                                               boolean notify)
                                        throws IOException
Specified by:
createProject in interface jenkins.model.ModifiableTopLevelItemGroup
Throws:
IOException

createProject

public <T extends hudson.model.TopLevelItem> T createProject(Class<T> type,
                                                             String name)
                                                  throws IOException
Convenience method to create a FreeStyleProject or similar.

Throws:
IOException

doCreateItem

public hudson.model.TopLevelItem doCreateItem(org.kohsuke.stapler.StaplerRequest req,
                                              org.kohsuke.stapler.StaplerResponse rsp)
                                       throws IOException,
                                              javax.servlet.ServletException
Specified by:
doCreateItem in interface hudson.model.ModifiableItemGroup<hudson.model.TopLevelItem>
Throws:
IOException
javax.servlet.ServletException

getUrlChildPrefix

public String getUrlChildPrefix()
Specified by:
getUrlChildPrefix in interface hudson.model.ItemGroup<hudson.model.TopLevelItem>

getRootDirFor

public File getRootDirFor(hudson.model.TopLevelItem child)
Specified by:
getRootDirFor in interface hudson.model.ItemGroup<hudson.model.TopLevelItem>

onRenamed

public void onRenamed(hudson.model.TopLevelItem item,
                      String oldName,
                      String newName)
               throws IOException
Specified by:
onRenamed in interface hudson.model.ItemGroup<hudson.model.TopLevelItem>
Throws:
IOException

renameTo

public void renameTo(String newName)
              throws IOException
Overrides:
renameTo in class hudson.model.AbstractItem
Throws:
IOException

onDeleted

public void onDeleted(hudson.model.TopLevelItem item)
               throws IOException
Specified by:
onDeleted in interface hudson.model.ItemGroup<hudson.model.TopLevelItem>
Throws:
IOException

canAdd

public boolean canAdd(hudson.model.TopLevelItem item)
Specified by:
canAdd in interface jenkins.model.DirectlyModifiableTopLevelItemGroup

add

public <I extends hudson.model.TopLevelItem> I add(I item,
                                                   String name)
                                        throws IOException,
                                               IllegalArgumentException
Specified by:
add in interface jenkins.model.DirectlyModifiableTopLevelItemGroup
Throws:
IOException
IllegalArgumentException

remove

public void remove(hudson.model.TopLevelItem item)
            throws IOException,
                   IllegalArgumentException
Specified by:
remove in interface jenkins.model.DirectlyModifiableTopLevelItemGroup
Throws:
IOException
IllegalArgumentException

getDescriptor

public hudson.model.TopLevelItemDescriptor getDescriptor()
Specified by:
getDescriptor in interface hudson.model.Describable<hudson.model.TopLevelItem>
Specified by:
getDescriptor in interface hudson.model.TopLevelItem

addView

public void addView(hudson.model.View view)
             throws IOException
Specified by:
addView in interface hudson.model.ModifiableViewGroup
Throws:
IOException

canDelete

public boolean canDelete(hudson.model.View view)
Specified by:
canDelete in interface hudson.model.ViewGroup

deleteView

public void deleteView(hudson.model.View view)
                throws IOException
Specified by:
deleteView in interface hudson.model.ViewGroup
Throws:
IOException

getViews

public Collection<hudson.model.View> getViews()
Specified by:
getViews in interface hudson.model.ViewGroup

getView

public hudson.model.View getView(String name)
Specified by:
getView in interface hudson.model.ViewGroup

getPrimaryView

public hudson.model.View getPrimaryView()
Specified by:
getPrimaryView in interface hudson.model.ViewGroup

onViewRenamed

public void onViewRenamed(hudson.model.View view,
                          String oldName,
                          String newName)
Specified by:
onViewRenamed in interface hudson.model.ViewGroup

getViewsTabBar

public hudson.views.ViewsTabBar getViewsTabBar()
Specified by:
getViewsTabBar in interface hudson.model.ViewGroup

getItemGroup

public hudson.model.ItemGroup<? extends hudson.model.TopLevelItem> getItemGroup()
Specified by:
getItemGroup in interface hudson.model.ViewGroup

getViewActions

public List<hudson.model.Action> getViewActions()
Specified by:
getViewActions in interface hudson.model.ViewGroup

getStaplerFallback

public Object getStaplerFallback()
Specified by:
getStaplerFallback in interface org.kohsuke.stapler.StaplerFallback

getJob

public hudson.model.TopLevelItem getJob(String name)
Same as getItem(java.lang.String) but named this way as a WebMethod.

See Also:
Hudson.getJob(java.lang.String)


Copyright © 2004-2014. All Rights Reserved.