Class KubernetesCrudDispatcher
- java.lang.Object
-
- io.fabric8.mockwebserver.http.Dispatcher
-
- io.fabric8.mockwebserver.crud.CrudDispatcher
-
- io.fabric8.kubernetes.client.server.mock.KubernetesCrudDispatcher
-
- All Implemented Interfaces:
KubernetesCrudPersistence,CustomResourceAware,Resetable
public class KubernetesCrudDispatcher extends CrudDispatcher implements KubernetesCrudPersistence, CustomResourceAware
-
-
Field Summary
-
Fields inherited from class io.fabric8.mockwebserver.crud.CrudDispatcher
attributeExtractor, context, map, responseComposer
-
Fields inherited from interface io.fabric8.kubernetes.client.server.mock.crud.KubernetesCrudPersistence
CREATION_TIMESTAMP, GENERATION, METADATA, RESOURCE_VERSION, UID
-
-
Constructor Summary
Constructors Constructor Description KubernetesCrudDispatcher()KubernetesCrudDispatcher(List<io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext> crdContexts)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexpectCustomResource(io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext rdc)Map.Entry<AttributeSet,String>findResource(AttributeSet attributes)AttributeSetgetKey(String path)MockResponsehandleCreate(RecordedRequest request)Adds the specified object to the in-memory db.MockResponsehandleDelete(String path)Performs a delete for the corresponding object from the in-memory db.MockResponsehandleGet(String path)Performs a get for the corresponding object from the in-memory db.MockResponsehandlePatch(RecordedRequest request)Patches the specified object to the in-memory db.MockResponsehandleUpdate(RecordedRequest request)Updates the specified object to the in-memory db.MockResponsehandleWatch(String path)Watch the resource list on `path` endpointbooleanisStatusSubresourceEnabledForResource(String path)protected voidlocked(Lock lock)voidprocessEvent(String path, AttributeSet pathAttributes, AttributeSet oldAttributes, io.fabric8.kubernetes.api.model.GenericKubernetesResource resource, String newState)longrequestResourceVersion()voidreset()return the resource to its initial state-
Methods inherited from class io.fabric8.mockwebserver.crud.CrudDispatcher
dispatch, getAttributeExtractor, getMap, getResponseComposer, handleCreate, handlePatch, handleUpdate
-
Methods inherited from class io.fabric8.mockwebserver.http.Dispatcher
shutdown
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.fabric8.kubernetes.client.server.mock.crud.KubernetesCrudPersistence
asNode, asNode, merge, preserveMetadata, touchGeneration, touchResourceVersion
-
-
-
-
Constructor Detail
-
KubernetesCrudDispatcher
public KubernetesCrudDispatcher()
-
KubernetesCrudDispatcher
public KubernetesCrudDispatcher(List<io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext> crdContexts)
-
-
Method Detail
-
handleCreate
public MockResponse handleCreate(RecordedRequest request)
Adds the specified object to the in-memory db.- Overrides:
handleCreatein classCrudDispatcher- Parameters:
request- RecordedRequest information.- Returns:
- a MockResponse to be dispatched.
-
handleUpdate
public MockResponse handleUpdate(RecordedRequest request)
Updates the specified object to the in-memory db.- Overrides:
handleUpdatein classCrudDispatcher- Parameters:
request- RecordedRequest information.- Returns:
- a MockResponse to be dispatched.
-
handleGet
public MockResponse handleGet(String path)
Performs a get for the corresponding object from the in-memory db.- Overrides:
handleGetin classCrudDispatcher- Parameters:
path- The path.- Returns:
- The
MockResponse
-
handlePatch
public MockResponse handlePatch(RecordedRequest request)
Patches the specified object to the in-memory db.- Overrides:
handlePatchin classCrudDispatcher- Returns:
- The
MockResponse
-
handleDelete
public MockResponse handleDelete(String path)
Performs a delete for the corresponding object from the in-memory db.- Overrides:
handleDeletein classCrudDispatcher- Parameters:
path- String- Returns:
- The
MockResponse
-
requestResourceVersion
public long requestResourceVersion()
- Specified by:
requestResourceVersionin interfaceKubernetesCrudPersistence
-
getKey
public AttributeSet getKey(String path)
- Specified by:
getKeyin interfaceKubernetesCrudPersistence
-
findResource
public Map.Entry<AttributeSet,String> findResource(AttributeSet attributes)
- Specified by:
findResourcein interfaceKubernetesCrudPersistence
-
isStatusSubresourceEnabledForResource
public boolean isStatusSubresourceEnabledForResource(String path)
- Specified by:
isStatusSubresourceEnabledForResourcein interfaceKubernetesCrudPersistence
-
processEvent
public void processEvent(String path, AttributeSet pathAttributes, AttributeSet oldAttributes, io.fabric8.kubernetes.api.model.GenericKubernetesResource resource, String newState)
- Specified by:
processEventin interfaceKubernetesCrudPersistence
-
handleWatch
public MockResponse handleWatch(String path)
Watch the resource list on `path` endpoint- Parameters:
path- String- Returns:
- The
MockResponse
-
reset
public void reset()
Description copied from interface:Resetablereturn the resource to its initial state
-
expectCustomResource
public void expectCustomResource(io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext rdc)
- Specified by:
expectCustomResourcein interfaceCustomResourceAware
-
locked
protected void locked(Lock lock)
-
-