Search in sources :

Example 1 with MockServiceView

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();
}
Also used : SurfaceNamer(com.google.api.codegen.transformer.SurfaceNamer) MockServiceView(com.google.api.codegen.viewmodel.testing.MockServiceView) FileHeaderView(com.google.api.codegen.viewmodel.FileHeaderView)

Aggregations

SurfaceNamer (com.google.api.codegen.transformer.SurfaceNamer)1 FileHeaderView (com.google.api.codegen.viewmodel.FileHeaderView)1 MockServiceView (com.google.api.codegen.viewmodel.testing.MockServiceView)1