Search in sources :

Example 6 with SmokeTestClassView

use of com.google.api.codegen.viewmodel.testing.SmokeTestClassView in project toolkit by googleapis.

the class CSharpGapicSmokeTestTransformer method generateSmokeTestCsproj.

private SmokeTestClassView generateSmokeTestCsproj(GapicInterfaceContext context) {
    SmokeTestClassView.Builder builder = generateSmokeTestViewBuilder(context);
    GapicProductConfig productConfig = context.getProductConfig();
    String outputPath = pathMapper.getOutputPath(context.getInterface().getFullName(), productConfig);
    builder.outputPath(outputPath + File.separator + productConfig.getPackageName() + ".SmokeTests.csproj");
    builder.templateFileName(SMOKETEST_CSPROJ_TEMPLATE_FILENAME);
    return builder.build();
}
Also used : GapicProductConfig(com.google.api.codegen.config.GapicProductConfig) SmokeTestClassView(com.google.api.codegen.viewmodel.testing.SmokeTestClassView)

Example 7 with SmokeTestClassView

use of com.google.api.codegen.viewmodel.testing.SmokeTestClassView in project toolkit by googleapis.

the class GoGapicSurfaceTestTransformer method createSmokeTestClassView.

private SmokeTestClassView createSmokeTestClassView(InterfaceContext context) {
    SurfaceNamer namer = context.getNamer();
    MethodModel method = context.getInterfaceConfig().getSmokeTestConfig().getMethod();
    MethodContext methodContext = context.asRequestMethodContext(method);
    SmokeTestClassView.Builder testClass = SmokeTestClassView.newBuilder();
    StaticLangApiMethodView apiMethodView = createSmokeTestCaseApiMethodView(methodContext);
    testClass.apiSettingsClassName(namer.getApiSettingsClassName(context.getInterfaceConfig()));
    testClass.apiClassName(namer.getApiWrapperClassName(context.getInterfaceConfig()));
    testClass.name(namer.getSmokeTestClassName(context.getInterfaceConfig()));
    testClass.outputPath(context.getProductConfig().getPackageName() + File.separator + method.getSimpleName() + "_smoke_test.go");
    testClass.templateFileName(SMOKE_TEST_TEMPLATE_FILE);
    testClass.apiMethod(apiMethodView);
    testClass.requireProjectId(testCaseTransformer.requireProjectIdInSmokeTest(apiMethodView.initCode(), context.getNamer()));
    // The shared code above add imports both for input and output.
    // Since we use short decls, we don't need to import anything for output.
    context.getImportTypeTable().getImports().clear();
    method.getAndSaveRequestTypeName(methodContext.getTypeTable(), methodContext.getNamer());
    FileHeaderView fileHeader = fileHeaderTransformer.generateFileHeader(context);
    testClass.fileHeader(fileHeader);
    return testClass.build();
}
Also used : MethodModel(com.google.api.codegen.config.MethodModel) StaticLangApiMethodView(com.google.api.codegen.viewmodel.StaticLangApiMethodView) SmokeTestClassView(com.google.api.codegen.viewmodel.testing.SmokeTestClassView) GapicMethodContext(com.google.api.codegen.transformer.GapicMethodContext) MethodContext(com.google.api.codegen.transformer.MethodContext) SurfaceNamer(com.google.api.codegen.transformer.SurfaceNamer) FileHeaderView(com.google.api.codegen.viewmodel.FileHeaderView)

Example 8 with SmokeTestClassView

use of com.google.api.codegen.viewmodel.testing.SmokeTestClassView in project toolkit by googleapis.

the class JavaSurfaceTestTransformer method createSmokeTestClassView.

// /////////////////////////////////// Smoke Test ///////////////////////////////////////
private SmokeTestClassView createSmokeTestClassView(InterfaceContext context) {
    String outputPath = pathMapper.getOutputPath(context.getInterfaceModel().getFullName(), context.getProductConfig());
    SurfaceNamer namer = context.getNamer();
    String name = namer.getSmokeTestClassName(context.getInterfaceConfig());
    SmokeTestClassView.Builder testClass = createSmokeTestClassViewBuilder(context);
    testClass.name(name);
    testClass.outputPath(namer.getSourceFilePath(outputPath, name));
    return testClass.build();
}
Also used : SmokeTestClassView(com.google.api.codegen.viewmodel.testing.SmokeTestClassView) SurfaceNamer(com.google.api.codegen.transformer.SurfaceNamer)

Aggregations

SmokeTestClassView (com.google.api.codegen.viewmodel.testing.SmokeTestClassView)8 SurfaceNamer (com.google.api.codegen.transformer.SurfaceNamer)7 MethodModel (com.google.api.codegen.config.MethodModel)3 GapicMethodContext (com.google.api.codegen.transformer.GapicMethodContext)3 FileHeaderView (com.google.api.codegen.viewmodel.FileHeaderView)3 FlatteningConfig (com.google.api.codegen.config.FlatteningConfig)2 OptionalArrayMethodView (com.google.api.codegen.viewmodel.OptionalArrayMethodView)2 GapicProductConfig (com.google.api.codegen.config.GapicProductConfig)1 InterfaceModel (com.google.api.codegen.config.InterfaceModel)1 GapicInterfaceContext (com.google.api.codegen.transformer.GapicInterfaceContext)1 MethodContext (com.google.api.codegen.transformer.MethodContext)1 TestCaseTransformer (com.google.api.codegen.transformer.TestCaseTransformer)1 StaticLangApiMethodView (com.google.api.codegen.viewmodel.StaticLangApiMethodView)1 ViewModel (com.google.api.codegen.viewmodel.ViewModel)1 ArrayList (java.util.ArrayList)1