Class LocalResourceManagerHelper (1.9.0)

public class LocalResourceManagerHelper

Deprecated. v3 GAPIC client of ResourceManager is now available

Utility 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. Similarly, a project is never completely removed without an explicit call to the utility method #removeProject.
  • The messages in the error responses given by this mock do not necessarily match the messages given by the actual service.

Inheritance

java.lang.Object > LocalResourceManagerHelper

Static Methods

create() (deprecated)

public static LocalResourceManagerHelper create()

Creates a LocalResourceManagerHelper object that listens to requests on the local machine.

Returns
TypeDescription
LocalResourceManagerHelper

Methods

changeLifecycleState(String projectId, String lifecycleState) (deprecated)

public synchronized boolean changeLifecycleState(String projectId, String lifecycleState)

Utility method to change the lifecycle state of the specified project.

Parameters
NameDescription
projectIdString
lifecycleStateString
Returns
TypeDescription
boolean

true if the lifecycle state was successfully updated, false otherwise

getOptions() (deprecated)

public ResourceManagerOptions getOptions()

Returns a ResourceManagerOptions instance that sets the host to use the mock server.

Returns
TypeDescription
ResourceManagerOptions

removeProject(String projectId) (deprecated)

public synchronized boolean removeProject(String projectId)

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).

Parameter
NameDescription
projectIdString
Returns
TypeDescription
boolean

true if the project was successfully deleted, false if the project didn't exist

start() (deprecated)

public void start()

Starts the thread that runs the Resource Manager server.

stop() (deprecated)

public void stop()

Stops the thread that runs the mock Resource Manager server.