Class LocalResourceManagerHelper
- java.lang.Object
-
- com.google.cloud.resourcemanager.testing.LocalResourceManagerHelper
-
@Deprecated public class LocalResourceManagerHelper extends Object
Deprecated.v3 GAPIC client of ResourceManager is now availableUtility to create a local Resource Manager mock for testing.The mock runs in a separate thread, listening for HTTP requests on the local machine at an ephemeral port. While this mock attempts to simulate the Cloud Resource Manager, there are some divergences in behavior. The following is a non-exhaustive list of some of those behavioral differences:
- This mock assumes you have adequate permissions for any action. Related to this, testIamPermissions always indicates that the caller has all permissions listed in the request.
- IAM policies are set to an empty policy with version 0 (only legacy roles supported) upon project creation. The actual service will not have an empty list of bindings and may also set your version to 1.
- There is no input validation for the policy provided when replacing a policy or calling testIamPermissions.
- In this mock, projects never move from the DELETE_REQUESTED lifecycle state to
DELETE_IN_PROGRESS without an explicit call to the utility method
changeLifecycleState(java.lang.String, java.lang.String)
. Similarly, a project is never completely removed without an explicit call to the utility methodremoveProject(java.lang.String)
. - The messages in the error responses given by this mock do not necessarily match the messages given by the actual service.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
changeLifecycleState(String projectId, String lifecycleState)
Deprecated.Utility method to change the lifecycle state of the specified project.static LocalResourceManagerHelper
create()
Deprecated.Creates aLocalResourceManagerHelper
object that listens to requests on the local machine.ResourceManagerOptions
getOptions()
Deprecated.Returns aResourceManagerOptions
instance that sets the host to use the mock server.boolean
removeProject(String projectId)
Deprecated.Utility method to remove the specified project.void
start()
Deprecated.Starts the thread that runs the Resource Manager server.void
stop()
Deprecated.Stops the thread that runs the mock Resource Manager server.
-
-
-
Method Detail
-
create
public static LocalResourceManagerHelper create()
Deprecated.Creates aLocalResourceManagerHelper
object that listens to requests on the local machine.
-
getOptions
public ResourceManagerOptions getOptions()
Deprecated.Returns aResourceManagerOptions
instance that sets the host to use the mock server.
-
start
public void start()
Deprecated.Starts the thread that runs the Resource Manager server.
-
stop
public void stop()
Deprecated.Stops the thread that runs the mock Resource Manager server.
-
changeLifecycleState
public boolean changeLifecycleState(String projectId, String lifecycleState)
Deprecated.Utility method to change the lifecycle state of the specified project.- Returns:
- true if the lifecycle state was successfully updated, false otherwise
-
removeProject
public boolean removeProject(String projectId)
Deprecated.Utility method to remove the specified project.This method can be used to fully remove a project (to mimic when the server completely deletes a project).
- Returns:
- true if the project was successfully deleted, false if the project didn't exist
-
-