Search in sources :

Example 6 with ProtoMethodModel

use of com.google.api.codegen.config.ProtoMethodModel in project toolkit by googleapis.

the class GoGapicSurfaceTransformerTest method testGetImportsLro.

@Test
public void testGetImportsLro() {
    MethodModel method = new ProtoMethodModel(getMethod(context.getInterface(), "LroMethod"));
    transformer.addXApiImports(context, Collections.singletonList(method));
    transformer.generateRetryConfigDefinitions(context, Collections.singletonList(method));
    Truth.assertThat(context.getImportTypeTable().getImports()).doesNotContainKey("math");
    Truth.assertThat(context.getImportTypeTable().getImports()).containsKey("cloud.google.com/go/longrunning");
}
Also used : ProtoMethodModel(com.google.api.codegen.config.ProtoMethodModel) MethodModel(com.google.api.codegen.config.MethodModel) ProtoMethodModel(com.google.api.codegen.config.ProtoMethodModel) Test(org.junit.Test)

Example 7 with ProtoMethodModel

use of com.google.api.codegen.config.ProtoMethodModel in project toolkit by googleapis.

the class GapicInterfaceContext method getInterfaceConfigMethods.

/**
 * Returns a list of methods for this interface that have method configs. Memoize the result.
 */
@Override
public List<MethodModel> getInterfaceConfigMethods() {
    if (interfaceMethods != null) {
        return interfaceMethods;
    }
    ImmutableList.Builder<MethodModel> methodBuilder = ImmutableList.builder();
    for (MethodConfig methodConfig : getInterfaceConfig().getMethodConfigs()) {
        methodBuilder.add(new ProtoMethodModel(((GapicMethodConfig) methodConfig).getMethod()));
    }
    interfaceMethods = methodBuilder.build();
    return interfaceMethods;
}
Also used : GapicMethodConfig(com.google.api.codegen.config.GapicMethodConfig) MethodConfig(com.google.api.codegen.config.MethodConfig) ProtoMethodModel(com.google.api.codegen.config.ProtoMethodModel) MethodModel(com.google.api.codegen.config.MethodModel) ProtoMethodModel(com.google.api.codegen.config.ProtoMethodModel) GapicMethodConfig(com.google.api.codegen.config.GapicMethodConfig) ImmutableList(com.google.common.collect.ImmutableList)

Example 8 with ProtoMethodModel

use of com.google.api.codegen.config.ProtoMethodModel in project toolkit by googleapis.

the class GoGapicSurfaceTransformerTest method testGetImportsPageStream.

@Test
public void testGetImportsPageStream() {
    MethodModel method = new ProtoMethodModel(getMethod(context.getInterface(), "PageStreamMethod"));
    transformer.addXApiImports(context, Collections.singletonList(method));
    transformer.generateRetryConfigDefinitions(context, Collections.singletonList(method));
    Truth.assertThat(context.getImportTypeTable().getImports()).containsKey("math");
    Truth.assertThat(context.getImportTypeTable().getImports()).doesNotContainKey("cloud.google.com/go/longrunning");
}
Also used : ProtoMethodModel(com.google.api.codegen.config.ProtoMethodModel) MethodModel(com.google.api.codegen.config.MethodModel) ProtoMethodModel(com.google.api.codegen.config.ProtoMethodModel) Test(org.junit.Test)

Example 9 with ProtoMethodModel

use of com.google.api.codegen.config.ProtoMethodModel in project toolkit by googleapis.

the class GoGapicSurfaceTransformerTest method testGetExampleImportsClientStream.

@Test
public void testGetExampleImportsClientStream() {
    MethodModel method = new ProtoMethodModel(getMethod(context.getInterface(), "ClientStreamMethod"));
    transformer.addXExampleImports(context, Collections.singletonList(method));
    Truth.assertThat(context.getImportTypeTable().getImports()).doesNotContainKey("io");
}
Also used : ProtoMethodModel(com.google.api.codegen.config.ProtoMethodModel) MethodModel(com.google.api.codegen.config.MethodModel) ProtoMethodModel(com.google.api.codegen.config.ProtoMethodModel) Test(org.junit.Test)

Aggregations

MethodModel (com.google.api.codegen.config.MethodModel)9 ProtoMethodModel (com.google.api.codegen.config.ProtoMethodModel)9 Test (org.junit.Test)8 GapicMethodConfig (com.google.api.codegen.config.GapicMethodConfig)1 MethodConfig (com.google.api.codegen.config.MethodConfig)1 ImmutableList (com.google.common.collect.ImmutableList)1