Class RemoteTranslateHelper
- java.lang.Object
-
- com.google.cloud.translate.testing.RemoteTranslateHelper
-
public class RemoteTranslateHelper extends Object
Utility to create a remote translate configuration for testing. Translate options can be obtained via thegetOptions()()} method. Returned options have customServiceOptions.getRetrySettings():RetrySettings.getMaxAttempts()is10,RetrySettings.getMaxRetryDelay()is30000,RetrySettings.getTotalTimeout()is120000andRetrySettings.getInitialRetryDelay()is250.HttpTransportOptions.getConnectTimeout()andHttpTransportOptions.getReadTimeout()are both both set to60000.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRemoteTranslateHelper.TranslateHelperException
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static RemoteTranslateHelpercreate()Creates aRemoteTranslateHelperobject using default project id and authentication credentials.static RemoteTranslateHelpercreate(String apiKey)Deprecated.static RemoteTranslateHelpercreate(String projectId, InputStream keyStream)Creates aRemoteTranslateHelperobject for the given project id and JSON key input stream.TranslateOptionsgetOptions()Returns aTranslateOptionsobject to be used for testing.
-
-
-
Method Detail
-
getOptions
public TranslateOptions getOptions()
Returns aTranslateOptionsobject to be used for testing.
-
create
public static RemoteTranslateHelper create(String projectId, InputStream keyStream) throws RemoteTranslateHelper.TranslateHelperException
Creates aRemoteTranslateHelperobject for the given project id and JSON key input stream.- Parameters:
projectId- id of the project to be used for running the testskeyStream- input stream for a JSON key- Returns:
- A
RemoteTranslateHelperobject for the provided options - Throws:
RemoteTranslateHelper.TranslateHelperException- ifkeyStreamis not a valid JSON key stream
-
create
@Deprecated public static RemoteTranslateHelper create(String apiKey)
Deprecated.Creates aRemoteTranslateHelperobject for the given API key.- Parameters:
apiKey- API key used to issue requests to Google Translation.
-
create
public static RemoteTranslateHelper create()
Creates aRemoteTranslateHelperobject using default project id and authentication credentials.
-
-