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");
}
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;
}
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");
}
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");
}
Aggregations