Class AbstractServiceClientTestClassComposer
- java.lang.Object
-
- com.google.api.generator.gapic.composer.common.AbstractServiceClientTestClassComposer
-
- All Implemented Interfaces:
ClassComposer
- Direct Known Subclasses:
ServiceClientTestClassComposer,ServiceClientTestClassComposer
public abstract class AbstractServiceClientTestClassComposer extends Object implements ClassComposer
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringCLIENT_VAR_NAMEprotected static StatementEMPTY_LINE_STATEMENTprotected static TypeStoreFIXED_TYPESTOREprotected static AnnotationNodeTEST_ANNOTATION
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractServiceClientTestClassComposer(TransportContext transportContext)
-
Method Summary
-
-
-
Field Detail
-
EMPTY_LINE_STATEMENT
protected static final Statement EMPTY_LINE_STATEMENT
-
CLIENT_VAR_NAME
protected static final String CLIENT_VAR_NAME
- See Also:
- Constant Field Values
-
FIXED_TYPESTORE
protected static final TypeStore FIXED_TYPESTORE
-
TEST_ANNOTATION
protected static final AnnotationNode TEST_ANNOTATION
-
-
Constructor Detail
-
AbstractServiceClientTestClassComposer
protected AbstractServiceClientTestClassComposer(TransportContext transportContext)
-
-
Method Detail
-
getTransportContext
public TransportContext getTransportContext()
-
generate
public GapicClass generate(GapicContext context, Service service)
- Specified by:
generatein interfaceClassComposer
-
generate
protected GapicClass generate(String className, GapicContext context, Service service)
-
createClassMemberVarExprs
protected abstract Map<String,VariableExpr> createClassMemberVarExprs(Service service, GapicContext context, TypeStore typeStore)
-
createClassMemberFieldDecls
protected List<Statement> createClassMemberFieldDecls(Map<String,VariableExpr> classMemberVarExprs)
-
createStartStaticServerMethod
protected abstract MethodDefinition createStartStaticServerMethod(Service service, GapicContext context, Map<String,VariableExpr> classMemberVarExprs, TypeStore typeStore, String newBuilderMethod)
-
createStopServerMethod
protected abstract MethodDefinition createStopServerMethod(Service service, Map<String,VariableExpr> classMemberVarExprs)
-
createSetUpMethod
protected abstract MethodDefinition createSetUpMethod(Service service, Map<String,VariableExpr> classMemberVarExprs, TypeStore typeStore)
-
createTearDownMethod
protected abstract MethodDefinition createTearDownMethod(Service service, Map<String,VariableExpr> classMemberVarExprs)
-
constructRpcTestCheckerLogic
protected abstract List<Statement> constructRpcTestCheckerLogic(Method method, List<MethodArgument> methodSignature, Service service, boolean isRequestArg, Map<String,VariableExpr> classMemberVarExprs, VariableExpr requestVarExpr, Message requestMessage)
-
createStreamingRpcTestMethod
protected abstract MethodDefinition createStreamingRpcTestMethod(Service service, Method method, Map<String,VariableExpr> classMemberVarExprs, Map<String,ResourceName> resourceNames, Map<String,Message> messageTypes)
-
createRpcExceptionTestMethod
protected abstract MethodDefinition createRpcExceptionTestMethod(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. createAssetTest.- 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 abstract List<Statement> createStreamingRpcExceptionTestStatements(Method method, Map<String,VariableExpr> classMemberVarExprs, Map<String,ResourceName> resourceNames, Map<String,Message> messageTypes)
-
createUnsupportedTestMethod
protected MethodDefinition createUnsupportedTestMethod(Method method)
-
createRpcExceptionTestStatements
protected List<Statement> createRpcExceptionTestStatements(Method method, List<MethodArgument> methodSignature, Map<String,VariableExpr> classMemberVarExprs, Map<String,ResourceName> resourceNames, Map<String,Message> messageTypes)
-
createRpcLroExceptionTestCatchBody
protected abstract List<Statement> createRpcLroExceptionTestCatchBody(VariableExpr exceptionExpr, boolean isStreaming)
-
-