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()
is120000
andRetrySettings.getInitialRetryDelay()
is250
.HttpTransportOptions.getConnectTimeout()
andHttpTransportOptions.getReadTimeout()
are both both set to60000
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RemoteTranslateHelper.TranslateHelperException
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static RemoteTranslateHelper
create()
Creates aRemoteTranslateHelper
object using default project id and authentication credentials.static RemoteTranslateHelper
create(String apiKey)
Deprecated.static RemoteTranslateHelper
create(String projectId, InputStream keyStream)
Creates aRemoteTranslateHelper
object for the given project id and JSON key input stream.TranslateOptions
getOptions()
Returns aTranslateOptions
object to be used for testing.
-
-
-
Method Detail
-
getOptions
public TranslateOptions getOptions()
Returns aTranslateOptions
object to be used for testing.
-
create
public static RemoteTranslateHelper create(String projectId, InputStream keyStream) throws RemoteTranslateHelper.TranslateHelperException
Creates aRemoteTranslateHelper
object 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
RemoteTranslateHelper
object for the provided options - Throws:
RemoteTranslateHelper.TranslateHelperException
- ifkeyStream
is not a valid JSON key stream
-
create
@Deprecated public static RemoteTranslateHelper create(String apiKey)
Deprecated.Creates aRemoteTranslateHelper
object for the given API key.- Parameters:
apiKey
- API key used to issue requests to Google Translation.
-
create
public static RemoteTranslateHelper create()
Creates aRemoteTranslateHelper
object using default project id and authentication credentials.
-
-