Search in sources :

Example 1 with ProtoMethodModel

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

the class GoGapicSurfaceTransformerTest method testGetImportsRetry.

@Test
public void testGetImportsRetry() {
    MethodModel method = new ProtoMethodModel(getMethod(context.getInterface(), "RetryMethod"));
    transformer.addXApiImports(context, Collections.singletonList(method));
    transformer.generateRetryConfigDefinitions(context, Collections.singletonList(method));
    Truth.assertThat(context.getImportTypeTable().getImports()).containsKey("time");
    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 2 with ProtoMethodModel

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

the class GoGapicSurfaceTransformerTest method testGetExampleImportsBidiStream.

@Test
public void testGetExampleImportsBidiStream() {
    MethodModel method = new ProtoMethodModel(getMethod(context.getInterface(), "BidiStreamMethod"));
    transformer.addXExampleImports(context, Collections.singletonList(method));
    Truth.assertThat(context.getImportTypeTable().getImports()).containsKey("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)

Example 3 with ProtoMethodModel

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

the class GoGapicSurfaceTransformerTest method testGetExampleImportsServerStream.

@Test
public void testGetExampleImportsServerStream() {
    MethodModel method = new ProtoMethodModel(getMethod(context.getInterface(), "ServerStreamMethod"));
    transformer.addXExampleImports(context, Collections.singletonList(method));
    Truth.assertThat(context.getImportTypeTable().getImports()).containsKey("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)

Example 4 with ProtoMethodModel

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

the class GoGapicSurfaceTransformerTest method testGetImportsNotLro.

@Test
public void testGetImportsNotLro() {
    MethodModel method = new ProtoMethodModel(getMethod(context.getInterface(), "NotLroMethod"));
    transformer.addXApiImports(context, Collections.singletonList(method));
    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 5 with ProtoMethodModel

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

the class GoGapicSurfaceTransformerTest method testGetImportsPlain.

@Test
public void testGetImportsPlain() {
    MethodModel method = new ProtoMethodModel(getMethod(context.getInterface(), "SimpleMethod"));
    transformer.addXApiImports(context, Collections.singletonList(method));
    transformer.generateRetryConfigDefinitions(context, Collections.singletonList(method));
    Truth.assertThat(context.getImportTypeTable().getImports()).doesNotContainKey("time");
    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)

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