Class RemoteLoggingHelper

java.lang.Object
com.google.cloud.logging.testing.RemoteLoggingHelper

public class RemoteLoggingHelper extends Object
Utility to create a remote logging configuration for testing. Logging options can be obtained via the getOptions() method. Returned options have custom ServiceOptions.getRetrySettings(): RetrySettings.getMaxRetryDelay() is 30000, RetrySettings.getTotalTimeout() is 120000 and RetrySettings.getInitialRetryDelay() is 250.
  • Method Details

    • getOptions

      public LoggingOptions getOptions()
      Returns a LoggingOptions object to be used for testing.
    • create

      public static RemoteLoggingHelper create(String projectId, InputStream keyStream)
      Creates a RemoteLoggingHelper object for the given project id and JSON key input stream.
      Parameters:
      projectId - id of the project to be used for running the tests
      keyStream - input stream for a JSON key
      Returns:
      A RemoteLoggingHelper object for the provided options
      Throws:
      RemoteLoggingHelper.LoggingHelperException - if keyStream is not a valid JSON key stream
    • create

      public static RemoteLoggingHelper create()
      Creates a RemoteLoggingHelper object using default project id and authentication credentials.
    • formatForTest

      public static String formatForTest(String name)
      Formats a resource name for testing purpose. This method appends a random UUID to the provided name.