Package org.jvnet.hudson.test
Class MockFolder
java.lang.Object
hudson.model.AbstractModelObject
hudson.model.Actionable
hudson.model.AbstractItem
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.Loadable,jenkins.model.ModelObjectWithContextMenu,jenkins.model.ModifiableTopLevelItemGroup,jenkins.util.io.OnMaster,org.kohsuke.stapler.HttpDeletable,org.kohsuke.stapler.StaplerFallback,org.kohsuke.stapler.StaplerProxy
- Direct Known Subclasses:
SecuredMockFolder
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
Nested ClassesNested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudsonNested classes/interfaces inherited from interface org.kohsuke.stapler.HttpDeletable
org.kohsuke.stapler.HttpDeletable.HttpDeletableDispatcherNested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
jenkins.model.ModelObjectWithContextMenu.ContextMenu, jenkins.model.ModelObjectWithContextMenu.ContextMenuVisibility, jenkins.model.ModelObjectWithContextMenu.MenuItem, jenkins.model.ModelObjectWithContextMenu.MenuItemType -
Field Summary
Fields inherited from class hudson.model.AbstractItem
description, displayName, name, PRONOUN, SKIP_PERMISSION_CHECK, TASK_NOUNFields inherited from interface hudson.model.Item
BUILD, CANCEL, CONFIGURE, CREATE, DELETE, DISCOVER, EXTENDED_READ, PERMISSIONS, READ, WIPEOUT, WORKSPACEFields inherited from interface hudson.model.Saveable
NOOP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<I extends hudson.model.TopLevelItem>
IvoidaddView(hudson.model.View view) booleancanAdd(hudson.model.TopLevelItem item) booleancanDelete(hudson.model.View view) <T extends hudson.model.TopLevelItem>
Thudson.model.TopLevelItemcreateProject(hudson.model.TopLevelItemDescriptor type, String name, boolean notify) <T extends hudson.model.TopLevelItem>
TcreateProject(Class<T> type, String name) Convenience method to create aFreeStyleProjector similar.hudson.model.TopLevelItemcreateProjectFromXML(String name, InputStream xml) voiddeleteView(hudson.model.View view) hudson.model.TopLevelItemdoCreateItem(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Collection<? extends hudson.model.Job>hudson.model.TopLevelItemDescriptorhudson.model.TopLevelItemhudson.model.ItemGroup<? extends hudson.model.TopLevelItem>Collection<hudson.model.TopLevelItem>getItems()hudson.model.TopLevelItemSame asgetItem(java.lang.String)but named this way as aWebMethod.hudson.model.ViewgetRootDirFor(hudson.model.TopLevelItem child) hudson.model.ViewList<hudson.model.Action>Collection<hudson.model.View>getViews()hudson.views.ViewsTabBarbooleanvoidonCopiedFrom(hudson.model.Item src) voidonDeleted(hudson.model.TopLevelItem item) voidvoidvoidonViewRenamed(hudson.model.View view, String oldName, String newName) voidremove(hudson.model.TopLevelItem item) voidMethods inherited from class hudson.model.AbstractItem
checkRename, delete, delete, delete, doCheckNewName, doConfigDotXml, doConfigDotXml, doConfirmRename, doDoDelete, doDoDelete, doReload, doSetName, doSubmitDescription, doSubmitDescription, getAbsoluteUrl, getACL, getApi, getConfigFile, getDescription, getDisplayName, getDisplayNameOrNull, getFullDisplayName, getFullName, getName, getParent, getPronoun, getRelativeDisplayNameFrom, getRelativeNameFromGroup, getRootDir, getSearchName, getSearchUrl, getShortUrl, getTarget, getTaskNoun, getUrl, load, movedTo, performDelete, resolveForCLI, save, setDescription, setDisplayName, setDisplayNameOrNull, toString, updateByXml, updateByXml, writeConfigDotXml, writeReplaceMethods inherited from class hudson.model.Actionable
addAction, addOrReplaceAction, doContextMenu, doContextMenu, getAction, getAction, getActions, getActions, getAllActions, getDynamic, getDynamic, removeAction, removeActions, replaceAction, replaceActionsMethods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError, sendError, sendError, sendErrorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface hudson.security.AccessControlled
checkAnyPermission, checkPermission, getACL, hasAnyPermission, hasPermission, hasPermission, hasPermission2Methods inherited from interface hudson.model.DescriptorByNameOwner
getDescriptorByNameMethods inherited from interface hudson.model.Item
delete, getAbsoluteUrl, getDisplayName, getFullDisplayName, getFullName, getName, getParent, getRelativeNameFrom, getRelativeNameFrom, getShortUrl, getUrl, onCreatedFromScratch, saveMethods inherited from interface hudson.model.ItemGroup
allItems, allItems, allItems, getAllItems, getAllItems, getAllItems, getFullDisplayName, getFullName, getItemName, getItems, getItemsStream, getItemsStream, getUrlMethods inherited from interface hudson.model.ModifiableItemGroup
doCreateItemMethods inherited from interface hudson.model.PersistenceRoot
getRootDirMethods inherited from interface hudson.search.SearchableModelObject
getSearchMethods inherited from interface hudson.search.SearchItem
getSearchIndex, getSearchName, getSearchUrlMethods inherited from interface hudson.model.ViewGroup
getAllViews, getUrl
-
Constructor Details
-
MockFolder
-
-
Method Details
-
onLoad
public void onLoad(hudson.model.ItemGroup<? extends hudson.model.Item> parent, String name) throws IOException - Specified by:
onLoadin interfacehudson.model.Item- Overrides:
onLoadin classhudson.model.AbstractItem- Throws:
IOException
-
getItems
- Specified by:
getItemsin interfacehudson.model.ItemGroup<hudson.model.TopLevelItem>
-
getItem
- Specified by:
getItemin interfacehudson.model.ItemGroup<hudson.model.TopLevelItem>
-
getAllJobs
- Specified by:
getAllJobsin interfacehudson.model.Item- Specified by:
getAllJobsin classhudson.model.AbstractItem
-
copy
- Specified by:
copyin interfacejenkins.model.ModifiableTopLevelItemGroup- Throws:
IOException
-
onCopiedFrom
public void onCopiedFrom(hudson.model.Item src) - Specified by:
onCopiedFromin interfacehudson.model.Item- Overrides:
onCopiedFromin classhudson.model.AbstractItem
-
createProjectFromXML
public hudson.model.TopLevelItem createProjectFromXML(String name, InputStream xml) throws IOException - Specified by:
createProjectFromXMLin interfacejenkins.model.ModifiableTopLevelItemGroup- Throws:
IOException
-
createProject
public hudson.model.TopLevelItem createProject(@NonNull hudson.model.TopLevelItemDescriptor type, @NonNull String name, boolean notify) throws IOException - Specified by:
createProjectin interfacejenkins.model.ModifiableTopLevelItemGroup- Throws:
IOException
-
createProject
public <T extends hudson.model.TopLevelItem> T createProject(@NonNull Class<T> type, @NonNull String name) throws IOException Convenience method to create aFreeStyleProjector similar.- Throws:
IOException
-
doCreateItem
public hudson.model.TopLevelItem doCreateItem(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException - Specified by:
doCreateItemin interfacehudson.model.ModifiableItemGroup<hudson.model.TopLevelItem>- Throws:
IOExceptionjakarta.servlet.ServletException
-
getUrlChildPrefix
- Specified by:
getUrlChildPrefixin interfacehudson.model.ItemGroup<hudson.model.TopLevelItem>
-
getRootDirFor
- Specified by:
getRootDirForin interfacehudson.model.ItemGroup<hudson.model.TopLevelItem>
-
onRenamed
public void onRenamed(hudson.model.TopLevelItem item, String oldName, String newName) throws IOException - Specified by:
onRenamedin interfacehudson.model.ItemGroup<hudson.model.TopLevelItem>- Throws:
IOException
-
renameTo
- Overrides:
renameToin classhudson.model.AbstractItem- Throws:
IOException
-
onDeleted
- Specified by:
onDeletedin interfacehudson.model.ItemGroup<hudson.model.TopLevelItem>- Throws:
IOException
-
canAdd
public boolean canAdd(hudson.model.TopLevelItem item) - Specified by:
canAddin interfacejenkins.model.DirectlyModifiableTopLevelItemGroup
-
add
public <I extends hudson.model.TopLevelItem> I add(I item, String name) throws IOException, IllegalArgumentException - Specified by:
addin interfacejenkins.model.DirectlyModifiableTopLevelItemGroup- Throws:
IOExceptionIllegalArgumentException
-
remove
- Specified by:
removein interfacejenkins.model.DirectlyModifiableTopLevelItemGroup- Throws:
IOExceptionIllegalArgumentException
-
getDescriptor
public hudson.model.TopLevelItemDescriptor getDescriptor()- Specified by:
getDescriptorin interfacehudson.model.Describable<hudson.model.TopLevelItem>- Specified by:
getDescriptorin interfacehudson.model.TopLevelItem
-
addView
- Specified by:
addViewin interfacehudson.model.ModifiableViewGroup- Throws:
IOException
-
canDelete
public boolean canDelete(hudson.model.View view) - Specified by:
canDeletein interfacehudson.model.ViewGroup
-
deleteView
- Specified by:
deleteViewin interfacehudson.model.ViewGroup- Throws:
IOException
-
getViews
- Specified by:
getViewsin interfacehudson.model.ViewGroup
-
getView
- Specified by:
getViewin interfacehudson.model.ViewGroup
-
getPrimaryView
public hudson.model.View getPrimaryView()- Specified by:
getPrimaryViewin interfacehudson.model.ViewGroup
-
onViewRenamed
- Specified by:
onViewRenamedin interfacehudson.model.ViewGroup
-
getViewsTabBar
public hudson.views.ViewsTabBar getViewsTabBar()- Specified by:
getViewsTabBarin interfacehudson.model.ViewGroup
-
getItemGroup
public hudson.model.ItemGroup<? extends hudson.model.TopLevelItem> getItemGroup()- Specified by:
getItemGroupin interfacehudson.model.ViewGroup
-
getViewActions
- Specified by:
getViewActionsin interfacehudson.model.ViewGroup
-
getStaplerFallback
- Specified by:
getStaplerFallbackin interfaceorg.kohsuke.stapler.StaplerFallback
-
getJob
Same asgetItem(java.lang.String)but named this way as aWebMethod.- See Also:
-
Hudson.getJob(java.lang.String)
-
isNameEditable
public boolean isNameEditable()- Overrides:
isNameEditablein classhudson.model.AbstractItem
-