Class TestProjectResolvers
java.lang.Object
org.elasticsearch.cluster.project.TestProjectResolvers
An implementation of
ProjectResolver that handles multiple projects for testing purposes. Not usable in production-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ProjectResolverstatic ProjectResolverThis method returns a ProjectResolver that always throw for all methods.static ProjectResolverThis method returns a ProjectResolver that is unable to provide the project-id unless explicitly specified with the executeOnProject method.static ProjectResolversingleProject(ProjectId projectId) This method returns a ProjectResolver that gives back the specified project-id when its getProjectId method is called.static ProjectResolversingleProjectOnly(ProjectId projectId) This method returns a ProjectResolver that returns the given ProjectId.static ProjectResolverusingRequestHeader(ThreadContext threadContext)
-
Field Details
-
DEFAULT_PROJECT_ONLY
-
-
Constructor Details
-
TestProjectResolvers
public TestProjectResolvers()
-
-
Method Details
-
allProjects
- Returns:
- a ProjectResolver that must only be used in a cluster context. It throws in single project related methods.
-
mustExecuteFirst
This method returns a ProjectResolver that is unable to provide the project-id unless explicitly specified with the executeOnProject method. -
alwaysThrow
This method returns a ProjectResolver that always throw for all methods. This is mostly useful in places where we just need a placeholder to satisfy the constructor signature. -
singleProject
This method returns a ProjectResolver that gives back the specified project-id when its getProjectId method is called. The ProjectResolver can work with cluster state containing multiple projects and its supportsMultipleProjects returns true. -
singleProjectOnly
This method returns a ProjectResolver that returns the given ProjectId. It also assumes it is the only project in the cluster state and throws if that is not the case. In addition, the ProjectResolvers returns false for supportsMultipleProjects. -
usingRequestHeader
-