Skip to content

Commit

Permalink
Revert some cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
chanseokoh committed Oct 25, 2021
1 parent cbe8ab5 commit 77727a8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ public static List<GapicClass> generateMockClasses(GapicContext context, List<Se
s -> {
if (context.transport() == Transport.REST) {
// REST transport tests do not use mock services.
} else if (context.transport() == Transport.GRPC
|| context.transport() == Transport.GRPC_REST) {
} else if (context.transport() == Transport.GRPC) {
clazzes.add(MockServiceClassComposer.instance().generate(context, s));
clazzes.add(MockServiceImplClassComposer.instance().generate(context, s));
} else if (context.transport() == Transport.GRPC_REST) {
clazzes.add(MockServiceClassComposer.instance().generate(context, s));
clazzes.add(MockServiceImplClassComposer.instance().generate(context, s));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ public GapicClass generate(GapicContext context, Service service) {
.setAnnotations(createClassAnnotations(service))
.setScope(ScopeNode.PUBLIC)
.setName(className)
.setExtendsType(typeStore.get(ClassNames.getServiceStubClassName(service)))
.setExtendsType(
typeStore.get(getTransportContext().classNames().getServiceStubClassName(service)))
.setStatements(classStatements)
.setMethods(
createClassMethods(
Expand Down Expand Up @@ -477,7 +478,8 @@ protected List<MethodDefinition> createStaticCreatorMethods(
argList ->
NewObjectExpr.builder().setType(creatorMethodReturnType).setArguments(argList).build();

TypeNode stubSettingsType = typeStore.get(ClassNames.getServiceStubSettingsClassName(service));
TypeNode stubSettingsType =
typeStore.get(getTransportContext().classNames().getServiceStubSettingsClassName(service));
VariableExpr settingsVarExpr =
VariableExpr.withVariable(
Variable.builder().setName("settings").setType(stubSettingsType).build());
Expand Down Expand Up @@ -540,7 +542,8 @@ protected List<MethodDefinition> createConstructorMethods(
Map<String, VariableExpr> classMemberVarExprs,
Map<String, VariableExpr> callableClassMemberVarExprs,
Map<String, VariableExpr> protoMethodNameToDescriptorVarExprs) {
TypeNode stubSettingsType = typeStore.get(ClassNames.getServiceStubSettingsClassName(service));
TypeNode stubSettingsType =
typeStore.get(getTransportContext().classNames().getServiceStubSettingsClassName(service));
VariableExpr settingsVarExpr =
VariableExpr.withVariable(
Variable.builder().setName("settings").setType(stubSettingsType).build());
Expand Down Expand Up @@ -1054,8 +1057,8 @@ private TypeStore createDynamicTypes(Service service, String stubPakkage) {
stubPakkage,
Arrays.asList(
getTransportContext().classNames().getTransportServiceStubClassName(service),
ClassNames.getServiceStubSettingsClassName(service),
ClassNames.getServiceStubClassName(service),
getTransportContext().classNames().getServiceStubSettingsClassName(service),
getTransportContext().classNames().getServiceStubClassName(service),
getTransportContext()
.classNames()
.getTransportServiceCallableFactoryClassName(service)));
Expand All @@ -1067,7 +1070,7 @@ private TypeStore createDynamicTypes(Service service, String stubPakkage) {
.map(m -> String.format(PAGED_RESPONSE_TYPE_NAME_PATTERN, m.name()))
.collect(Collectors.toList()),
true,
ClassNames.getServiceClientClassName(service));
getTransportContext().classNames().getServiceClientClassName(service));
return typeStore;
}

Expand Down

0 comments on commit 77727a8

Please sign in to comment.