use of com.google.api.codegen.viewmodel.testing.MockServiceView in project toolkit by googleapis.
the class JavaSurfaceTestTransformer method createMockServiceView.
// /////////////////////////////////// Mock Service /////////////////////////////////////////
private MockServiceView createMockServiceView(InterfaceContext context) {
addMockServiceImports(context);
SurfaceNamer namer = context.getNamer();
String outputPath = pathMapper.getOutputPath(context.getInterfaceModel().getFullName(), context.getProductConfig());
String name = namer.getMockServiceClassName(context.getInterfaceModel());
MockServiceView.Builder mockService = MockServiceView.newBuilder();
mockService.name(name);
mockService.serviceImplClassName(namer.getMockGrpcServiceImplName(context.getInterfaceModel()));
mockService.outputPath(namer.getSourceFilePath(outputPath, name));
mockService.templateFileName(MOCK_SERVICE_FILE);
// Imports must be done as the last step to catch all imports.
FileHeaderView fileHeader = fileHeaderTransformer.generateFileHeader(context);
mockService.fileHeader(fileHeader);
return mockService.build();
}
Aggregations