Class ServiceClientTestClassComposer
java.lang.Object
com.google.api.generator.gapic.composer.common.AbstractServiceClientTestClassComposer
com.google.api.generator.gapic.composer.rest.ServiceClientTestClassComposer
- All Implemented Interfaces:
ClassComposer
- Direct Known Subclasses:
HttpJsonServiceClientTestClassComposer
-
Field Summary
Fields inherited from class com.google.api.generator.gapic.composer.common.AbstractServiceClientTestClassComposer
CLIENT_VAR_NAME, EMPTY_LINE_STATEMENT, FIXED_TYPESTORE, TEST_ANNOTATION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconstructRpcTestCheckerLogic(Method method, List<MethodArgument> methodSignature, Service service, boolean isRequestArg, Map<String, VariableExpr> classMemberVarExprs, VariableExpr requestVarExpr, Message requestMessage) createClassMemberFieldDecls(Map<String, VariableExpr> classMemberVarExprs) protected Map<String,VariableExpr> createClassMemberVarExprs(Service service, GapicContext context, TypeStore typeStore) protected MethodDefinitioncreateRpcExceptionTestMethod(Method method, Service service, List<MethodArgument> methodSignature, int variantIndex, Map<String, VariableExpr> classMemberVarExprs, Map<String, ResourceName> resourceNames, Map<String, Message> messageTypes) Creates a test method to exercise exceptions for a given RPC, e.g.createRpcLroExceptionTestCatchBody(VariableExpr exceptionExpr, boolean isStreaming) protected MethodDefinitioncreateSetUpMethod(Service service, Map<String, VariableExpr> classMemberVarExprs, TypeStore typeStore) protected MethodDefinitioncreateStartStaticServerMethod(Service service, GapicContext context, Map<String, VariableExpr> classMemberVarExprs, TypeStore typeStore, String newBuilderMethod) protected MethodDefinitioncreateStopServerMethod(Service service, Map<String, VariableExpr> classMemberVarExprs) createStreamingRpcExceptionTestStatements(Method method, Map<String, VariableExpr> classMemberVarExprs, Map<String, ResourceName> resourceNames, Map<String, Message> messageTypes) protected MethodDefinitioncreateStreamingRpcTestMethod(Service service, Method method, Map<String, VariableExpr> classMemberVarExprs, Map<String, ResourceName> resourceNames, Map<String, Message> messageTypes) protected MethodDefinitioncreateTearDownMethod(Service service, Map<String, VariableExpr> classMemberVarExprs) protected StringgetMockServiceVarName(Service service) instance()Methods inherited from class com.google.api.generator.gapic.composer.common.AbstractServiceClientTestClassComposer
createRpcExceptionTestStatements, createUnsupportedTestMethod, generate, generate, getCallableMethodName, getCallableType, getTransportContext
-
Constructor Details
-
ServiceClientTestClassComposer
protected ServiceClientTestClassComposer()
-
-
Method Details
-
instance
-
createClassMemberVarExprs
protected Map<String,VariableExpr> createClassMemberVarExprs(Service service, GapicContext context, TypeStore typeStore) - Specified by:
createClassMemberVarExprsin classAbstractServiceClientTestClassComposer
-
createClassMemberFieldDecls
- Overrides:
createClassMemberFieldDeclsin classAbstractServiceClientTestClassComposer
-
createStartStaticServerMethod
protected MethodDefinition createStartStaticServerMethod(Service service, GapicContext context, Map<String, VariableExpr> classMemberVarExprs, TypeStore typeStore, String newBuilderMethod) - Specified by:
createStartStaticServerMethodin classAbstractServiceClientTestClassComposer
-
createStopServerMethod
protected MethodDefinition createStopServerMethod(Service service, Map<String, VariableExpr> classMemberVarExprs) - Specified by:
createStopServerMethodin classAbstractServiceClientTestClassComposer
-
createSetUpMethod
protected MethodDefinition createSetUpMethod(Service service, Map<String, VariableExpr> classMemberVarExprs, TypeStore typeStore) - Specified by:
createSetUpMethodin classAbstractServiceClientTestClassComposer
-
createTearDownMethod
protected MethodDefinition createTearDownMethod(Service service, Map<String, VariableExpr> classMemberVarExprs) - Specified by:
createTearDownMethodin classAbstractServiceClientTestClassComposer
-
constructRpcTestCheckerLogic
protected List<Statement> constructRpcTestCheckerLogic(Method method, List<MethodArgument> methodSignature, Service service, boolean isRequestArg, Map<String, VariableExpr> classMemberVarExprs, VariableExpr requestVarExpr, Message requestMessage) - Specified by:
constructRpcTestCheckerLogicin classAbstractServiceClientTestClassComposer
-
createStreamingRpcTestMethod
protected MethodDefinition createStreamingRpcTestMethod(Service service, Method method, Map<String, VariableExpr> classMemberVarExprs, Map<String, ResourceName> resourceNames, Map<String, Message> messageTypes) - Specified by:
createStreamingRpcTestMethodin classAbstractServiceClientTestClassComposer
-
createRpcExceptionTestMethod
protected MethodDefinition createRpcExceptionTestMethod(Method method, Service service, List<MethodArgument> methodSignature, int variantIndex, Map<String, VariableExpr> classMemberVarExprs, Map<String, ResourceName> resourceNames, Map<String, Message> messageTypes) Description copied from class:AbstractServiceClientTestClassComposerCreates a test method to exercise exceptions for a given RPC, e.g. createAssetTest.- Specified by:
createRpcExceptionTestMethodin classAbstractServiceClientTestClassComposer- Parameters:
method- the RPC for which this test method is created.service- the service thatmethodbelongs to.methodSignature- the method signature of the RPC under test.variantIndex- the nth variant of the RPC under test. This applies when we have polymorphism due to the presence of several method signature annotations in the proto.classMemberVarExprs- the class members in the generated test class.resourceNames- the resource names available for use.messageTypes- the proto message types available for use.
-
createStreamingRpcExceptionTestStatements
protected List<Statement> createStreamingRpcExceptionTestStatements(Method method, Map<String, VariableExpr> classMemberVarExprs, Map<String, ResourceName> resourceNames, Map<String, Message> messageTypes) - Specified by:
createStreamingRpcExceptionTestStatementsin classAbstractServiceClientTestClassComposer
-
createRpcLroExceptionTestCatchBody
protected List<Statement> createRpcLroExceptionTestCatchBody(VariableExpr exceptionExpr, boolean isStreaming) - Specified by:
createRpcLroExceptionTestCatchBodyin classAbstractServiceClientTestClassComposer
-
getMockServiceVarName
- Overrides:
getMockServiceVarNamein classAbstractServiceClientTestClassComposer
-