Search in sources :

Example 6 with InitCodeView

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

the class JavaSurfaceTestTransformer method createSmokeTestCaseApiMethodView.

private StaticLangApiMethodView createSmokeTestCaseApiMethodView(MethodContext methodContext) {
    MethodConfig methodConfig = methodContext.getMethodConfig();
    StaticLangApiMethodView initialApiMethodView;
    if (methodConfig.isPageStreaming()) {
        if (methodContext.isFlattenedMethodContext()) {
            initialApiMethodView = apiMethodTransformer.generatePagedFlattenedMethod(methodContext);
        } else {
            throw new UnsupportedOperationException("Unsupported smoke test type: page-streaming + request-object");
        }
    } else if (methodConfig.isGrpcStreaming()) {
        throw new UnsupportedOperationException("Unsupported smoke test type: grpc-streaming");
    } else if (methodConfig.isLongRunningOperation()) {
        if (methodContext.isFlattenedMethodContext()) {
            initialApiMethodView = apiMethodTransformer.generateAsyncOperationFlattenedMethod(methodContext);
        } else {
            throw new UnsupportedOperationException("Unsupported smoke test type: long-running + request-object");
        }
    } else {
        if (methodContext.isFlattenedMethodContext()) {
            initialApiMethodView = apiMethodTransformer.generateFlattenedMethod(methodContext);
        } else {
            throw new UnsupportedOperationException("Unsupported smoke test type: simple-call + request-object");
        }
    }
    StaticLangApiMethodView.Builder apiMethodView = initialApiMethodView.toBuilder();
    InitCodeView initCodeView = initCodeTransformer.generateInitCode(methodContext, testCaseTransformer.createSmokeTestInitContext(methodContext));
    apiMethodView.initCode(initCodeView);
    return apiMethodView.build();
}
Also used : MethodConfig(com.google.api.codegen.config.MethodConfig) StaticLangApiMethodView(com.google.api.codegen.viewmodel.StaticLangApiMethodView) InitCodeView(com.google.api.codegen.viewmodel.InitCodeView)

Example 7 with InitCodeView

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

the class PythonGapicSurfaceTestTransformer method createSmokeTestCaseApiMethodView.

private OptionalArrayMethodView createSmokeTestCaseApiMethodView(GapicMethodContext context) {
    OptionalArrayMethodView initialApiMethodView = new DynamicLangApiMethodTransformer(new PythonApiMethodParamTransformer()).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)

Example 8 with InitCodeView

use of com.google.api.codegen.viewmodel.InitCodeView 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 9 with InitCodeView

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

the class GoGapicSurfaceTestTransformer method createSmokeTestCaseApiMethodView.

private StaticLangApiMethodView createSmokeTestCaseApiMethodView(MethodContext methodContext) {
    StaticLangApiMethodView initialApiMethodView;
    if (methodContext.getMethodConfig().isPageStreaming()) {
        initialApiMethodView = apiMethodTransformer.generatePagedRequestObjectMethod(methodContext);
    } else {
        initialApiMethodView = apiMethodTransformer.generateRequestObjectMethod(methodContext);
    }
    StaticLangApiMethodView.Builder apiMethodView = initialApiMethodView.toBuilder();
    InitCodeView initCodeView = initCodeTransformer.generateInitCode(methodContext, testCaseTransformer.createSmokeTestInitContext(methodContext));
    apiMethodView.initCode(initCodeView);
    return apiMethodView.build();
}
Also used : StaticLangApiMethodView(com.google.api.codegen.viewmodel.StaticLangApiMethodView) InitCodeView(com.google.api.codegen.viewmodel.InitCodeView)

Example 10 with InitCodeView

use of com.google.api.codegen.viewmodel.InitCodeView 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)

Aggregations

InitCodeView (com.google.api.codegen.viewmodel.InitCodeView)13 InitCodeTransformer (com.google.api.codegen.transformer.InitCodeTransformer)7 OptionalArrayMethodView (com.google.api.codegen.viewmodel.OptionalArrayMethodView)7 DynamicLangApiMethodTransformer (com.google.api.codegen.transformer.DynamicLangApiMethodTransformer)6 MethodConfig (com.google.api.codegen.config.MethodConfig)3 MethodModel (com.google.api.codegen.config.MethodModel)3 StaticLangApiMethodView (com.google.api.codegen.viewmodel.StaticLangApiMethodView)3 FieldConfig (com.google.api.codegen.config.FieldConfig)2 RequestObjectParamView (com.google.api.codegen.viewmodel.RequestObjectParamView)2 ArrayList (java.util.ArrayList)2 FieldModel (com.google.api.codegen.config.FieldModel)1 GrpcStreamingType (com.google.api.codegen.config.GrpcStreamingConfig.GrpcStreamingType)1 InitCodeContext (com.google.api.codegen.metacode.InitCodeContext)1 InitCodeOutputType (com.google.api.codegen.metacode.InitCodeContext.InitCodeOutputType)1 ParamWithSimpleDoc (com.google.api.codegen.transformer.ParamWithSimpleDoc)1 SurfaceNamer (com.google.api.codegen.transformer.SurfaceNamer)1 TestCaseTransformer (com.google.api.codegen.transformer.TestCaseTransformer)1 ParamDocView (com.google.api.codegen.viewmodel.ParamDocView)1 PathTemplateCheckView (com.google.api.codegen.viewmodel.PathTemplateCheckView)1 RequestObjectMethodDetailView (com.google.api.codegen.viewmodel.RequestObjectMethodDetailView)1