use of com.google.api.codegen.viewmodel.testing.MockServiceImplFileView in project toolkit by googleapis.
the class JavaSurfaceTestTransformer method createMockServiceImplFileView.
private MockServiceImplFileView createMockServiceImplFileView(InterfaceContext context) {
addMockServiceImplImports(context);
SurfaceNamer namer = context.getNamer();
String outputPath = pathMapper.getOutputPath(context.getInterfaceModel().getFullName(), context.getProductConfig());
String name = namer.getMockGrpcServiceImplName(context.getInterfaceModel());
String grpcClassName = context.getImportTypeTable().getAndSaveNicknameFor(namer.getGrpcServiceClassName(context.getInterfaceModel()));
MockServiceImplFileView.Builder mockServiceImplFile = MockServiceImplFileView.newBuilder();
mockServiceImplFile.serviceImpl(MockServiceImplView.newBuilder().name(name).mockGrpcClassName(grpcClassName).grpcMethods(mockServiceTransformer.createMockGrpcMethodViews(context)).build());
mockServiceImplFile.outputPath(namer.getSourceFilePath(outputPath, name));
mockServiceImplFile.templateFileName(MOCK_SERVICE_IMPL_FILE);
// Imports must be done as the last step to catch all imports.
FileHeaderView fileHeader = fileHeaderTransformer.generateFileHeader(context);
mockServiceImplFile.fileHeader(fileHeader);
return mockServiceImplFile.build();
}
Aggregations