Search in sources :

Example 6 with OptionalArrayMethodView

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

the class RubyGapicSurfaceTestTransformer method createSmokeTestCaseApiMethodView.

private OptionalArrayMethodView createSmokeTestCaseApiMethodView(GapicMethodContext context, boolean packageHasMultipleServices) {
    OptionalArrayMethodView initialApiMethodView = new DynamicLangApiMethodTransformer(new RubyApiMethodParamTransformer()).generateMethod(context, packageHasMultipleServices);
    OptionalArrayMethodView.Builder apiMethodView = initialApiMethodView.toBuilder();
    TestCaseTransformer testCaseTransformer = new TestCaseTransformer(valueProducer, packageHasMultipleServices);
    InitCodeTransformer initCodeTransformer = new InitCodeTransformer(false);
    InitCodeView initCodeView = initCodeTransformer.generateInitCode(context, testCaseTransformer.createSmokeTestInitContext(context));
    apiMethodView.initCode(initCodeView);
    return apiMethodView.build();
}
Also used : OptionalArrayMethodView(com.google.api.codegen.viewmodel.OptionalArrayMethodView) TestCaseTransformer(com.google.api.codegen.transformer.TestCaseTransformer) DynamicLangApiMethodTransformer(com.google.api.codegen.transformer.DynamicLangApiMethodTransformer) InitCodeTransformer(com.google.api.codegen.transformer.InitCodeTransformer) InitCodeView(com.google.api.codegen.viewmodel.InitCodeView)

Example 7 with OptionalArrayMethodView

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

the class RubyGapicSurfaceTestTransformer method createSmokeTestClassView.

private SmokeTestClassView createSmokeTestClassView(GapicInterfaceContext context) {
    boolean packageHasMultipleServices = context.getApiModel().hasMultipleServices();
    String outputPath = smokeTestPathMapper.getOutputPath(context.getInterfaceModel().getFullName(), context.getProductConfig());
    SurfaceNamer namer = context.getNamer();
    RubyPackageMetadataNamer metadataNamer = new RubyPackageMetadataNamer(context.getNamer().getPackageName());
    String name = namer.getSmokeTestClassName(context.getInterfaceConfig());
    MethodModel method = context.getInterfaceConfig().getSmokeTestConfig().getMethod();
    TestCaseTransformer testCaseTransformer = new TestCaseTransformer(valueProducer, packageHasMultipleServices);
    FlatteningConfig flatteningGroup = testCaseTransformer.getSmokeTestFlatteningGroup(context.getMethodConfig(method), context.getInterfaceConfig().getSmokeTestConfig());
    GapicMethodContext flattenedMethodContext = context.asFlattenedMethodContext(method, flatteningGroup);
    SmokeTestClassView.Builder testClass = SmokeTestClassView.newBuilder();
    OptionalArrayMethodView apiMethodView = createSmokeTestCaseApiMethodView(flattenedMethodContext, packageHasMultipleServices);
    testClass.apiSettingsClassName(namer.getApiSettingsClassName(context.getInterfaceConfig()));
    testClass.apiClassName(namer.getApiWrapperClassName(context.getInterfaceConfig()));
    testClass.name(name);
    testClass.outputPath(namer.getSourceFilePath(outputPath, name));
    testClass.templateFileName(SMOKE_TEST_TEMPLATE_FILE);
    testClass.apiMethod(apiMethodView);
    testClass.requireProjectId(testCaseTransformer.requireProjectIdInSmokeTest(apiMethodView.initCode(), context.getNamer()));
    testClass.projectIdVariableName(metadataNamer.getProjectVariable(true));
    testClass.apiVersion(packageConfig.apiVersion());
    FileHeaderView fileHeader = fileHeaderTransformer.generateFileHeader(context.getProductConfig(), importSectionTransformer.generateSmokeTestImportSection(context), namer);
    testClass.fileHeader(fileHeader);
    return testClass.build();
}
Also used : MethodModel(com.google.api.codegen.config.MethodModel) GapicMethodContext(com.google.api.codegen.transformer.GapicMethodContext) OptionalArrayMethodView(com.google.api.codegen.viewmodel.OptionalArrayMethodView) TestCaseTransformer(com.google.api.codegen.transformer.TestCaseTransformer) SmokeTestClassView(com.google.api.codegen.viewmodel.testing.SmokeTestClassView) FlatteningConfig(com.google.api.codegen.config.FlatteningConfig) SurfaceNamer(com.google.api.codegen.transformer.SurfaceNamer) FileHeaderView(com.google.api.codegen.viewmodel.FileHeaderView)

Example 8 with OptionalArrayMethodView

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

the class NodeJSGapicSurfaceTestTransformer method createSmokeTestCaseApiMethodView.

private OptionalArrayMethodView createSmokeTestCaseApiMethodView(GapicMethodContext context, boolean packageHasMultipleServices) {
    OptionalArrayMethodView initialApiMethodView = new DynamicLangApiMethodTransformer(new NodeJSApiMethodParamTransformer()).generateMethod(context, packageHasMultipleServices);
    OptionalArrayMethodView.Builder apiMethodView = initialApiMethodView.toBuilder();
    InitCodeTransformer initCodeTransformer = new InitCodeTransformer();
    InitCodeView initCodeView = initCodeTransformer.generateInitCode(context, testCaseTransformer.createSmokeTestInitContext(context));
    apiMethodView.initCode(initCodeView);
    apiMethodView.packageName("../src");
    return apiMethodView.build();
}
Also used : OptionalArrayMethodView(com.google.api.codegen.viewmodel.OptionalArrayMethodView) DynamicLangApiMethodTransformer(com.google.api.codegen.transformer.DynamicLangApiMethodTransformer) InitCodeTransformer(com.google.api.codegen.transformer.InitCodeTransformer) InitCodeView(com.google.api.codegen.viewmodel.InitCodeView)

Example 9 with OptionalArrayMethodView

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

the class NodeJSPackageMetadataTransformer method createExampleApiMethodView.

private OptionalArrayMethodView createExampleApiMethodView(GapicMethodContext context, boolean packageHasMultipleServices) {
    OptionalArrayMethodView initialApiMethodView = new DynamicLangApiMethodTransformer(new NodeJSApiMethodParamTransformer()).generateMethod(context, packageHasMultipleServices);
    OptionalArrayMethodView.Builder apiMethodView = initialApiMethodView.toBuilder();
    InitCodeTransformer initCodeTransformer = new InitCodeTransformer();
    InitCodeView initCodeView = initCodeTransformer.generateInitCode(context, testCaseTransformer.createSmokeTestInitContext(context));
    apiMethodView.initCode(initCodeView);
    return apiMethodView.build();
}
Also used : OptionalArrayMethodView(com.google.api.codegen.viewmodel.OptionalArrayMethodView) DynamicLangApiMethodTransformer(com.google.api.codegen.transformer.DynamicLangApiMethodTransformer) InitCodeTransformer(com.google.api.codegen.transformer.InitCodeTransformer) InitCodeView(com.google.api.codegen.viewmodel.InitCodeView)

Example 10 with OptionalArrayMethodView

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

the class PhpGapicSurfaceTestTransformer method createSmokeTestCaseApiMethodView.

private OptionalArrayMethodView createSmokeTestCaseApiMethodView(GapicMethodContext context) {
    OptionalArrayMethodView initialApiMethodView = new DynamicLangApiMethodTransformer(new PhpApiMethodParamTransformer()).generateMethod(context);
    OptionalArrayMethodView.Builder apiMethodView = initialApiMethodView.toBuilder();
    InitCodeTransformer initCodeTransformer = new InitCodeTransformer();
    InitCodeView initCodeView = initCodeTransformer.generateInitCode(context, testCaseTransformer.createSmokeTestInitContext(context));
    apiMethodView.initCode(initCodeView);
    return apiMethodView.build();
}
Also used : OptionalArrayMethodView(com.google.api.codegen.viewmodel.OptionalArrayMethodView) DynamicLangApiMethodTransformer(com.google.api.codegen.transformer.DynamicLangApiMethodTransformer) InitCodeTransformer(com.google.api.codegen.transformer.InitCodeTransformer) InitCodeView(com.google.api.codegen.viewmodel.InitCodeView)

Aggregations

OptionalArrayMethodView (com.google.api.codegen.viewmodel.OptionalArrayMethodView)11 InitCodeView (com.google.api.codegen.viewmodel.InitCodeView)7 DynamicLangApiMethodTransformer (com.google.api.codegen.transformer.DynamicLangApiMethodTransformer)6 InitCodeTransformer (com.google.api.codegen.transformer.InitCodeTransformer)6 MethodModel (com.google.api.codegen.config.MethodModel)5 FlatteningConfig (com.google.api.codegen.config.FlatteningConfig)4 GapicMethodContext (com.google.api.codegen.transformer.GapicMethodContext)4 SurfaceNamer (com.google.api.codegen.transformer.SurfaceNamer)4 FileHeaderView (com.google.api.codegen.viewmodel.FileHeaderView)3 SmokeTestClassView (com.google.api.codegen.viewmodel.testing.SmokeTestClassView)3 TestCaseTransformer (com.google.api.codegen.transformer.TestCaseTransformer)2 ImportSectionView (com.google.api.codegen.viewmodel.ImportSectionView)2 FieldConfig (com.google.api.codegen.config.FieldConfig)1 GrpcStreamingType (com.google.api.codegen.config.GrpcStreamingConfig.GrpcStreamingType)1 InitCodeOutputType (com.google.api.codegen.metacode.InitCodeContext.InitCodeOutputType)1 SymbolTable (com.google.api.codegen.util.SymbolTable)1 RequestObjectParamView (com.google.api.codegen.viewmodel.RequestObjectParamView)1