use of com.google.api.generator.gapic.model.Service in project gapic-generator-java by googleapis.
the class GrpcServiceCallableFactoryClassComposerTest method generateServiceClasses.
@Test
public void generateServiceClasses() {
GapicContext context = GrpcRestTestProtoLoader.instance().parseShowcaseEcho();
Service echoProtoService = context.services().get(0);
GapicClass clazz = GrpcServiceCallableFactoryClassComposer.instance().generate(context, echoProtoService);
JavaWriterVisitor visitor = new JavaWriterVisitor();
clazz.classDefinition().accept(visitor);
Utils.saveCodegenToFile(this.getClass(), "GrpcEchoCallableFactory.golden", visitor.write());
Path goldenFilePath = Paths.get(Utils.getGoldenDir(this.getClass()), "GrpcEchoCallableFactory.golden");
Assert.assertCodeEquals(goldenFilePath, visitor.write());
}
use of com.google.api.generator.gapic.model.Service in project gapic-generator-java by googleapis.
the class HttpJsonServiceStubClassComposerTest method generateServiceClasses.
@Test
public void generateServiceClasses() {
GapicContext context = GrpcRestTestProtoLoader.instance().parseShowcaseEcho();
Service echoProtoService = context.services().get(0);
GapicClass clazz = HttpJsonServiceStubClassComposer.instance().generate(context, echoProtoService);
JavaWriterVisitor visitor = new JavaWriterVisitor();
clazz.classDefinition().accept(visitor);
Utils.saveCodegenToFile(this.getClass(), "HttpJsonEchoStub.golden", visitor.write());
Path goldenFilePath = Paths.get(Utils.getGoldenDir(this.getClass()), "HttpJsonEchoStub.golden");
Assert.assertCodeEquals(goldenFilePath, visitor.write());
}
use of com.google.api.generator.gapic.model.Service in project gapic-generator-java by googleapis.
the class GrpcServiceStubClassComposerTest method generateGrpcServiceStubClass_httpBindings.
@Test
public void generateGrpcServiceStubClass_httpBindings() {
GapicContext context = GrpcTestProtoLoader.instance().parseShowcaseTesting();
Service service = context.services().get(0);
GapicClass clazz = GrpcServiceStubClassComposer.instance().generate(context, service);
Assert.assertGoldenClass(this.getClass(), clazz, "GrpcTestingStub.golden");
Assert.assertEmptySamples(clazz.samples());
}
use of com.google.api.generator.gapic.model.Service in project gapic-generator-java by googleapis.
the class GrpcServiceStubClassComposerTest method generateGrpcServiceStubClass_httpBindingsWithSubMessageFields.
@Test
public void generateGrpcServiceStubClass_httpBindingsWithSubMessageFields() {
GapicContext context = GrpcTestProtoLoader.instance().parsePubSubPublisher();
Service service = context.services().get(0);
GapicClass clazz = GrpcServiceStubClassComposer.instance().generate(context, service);
Assert.assertGoldenClass(this.getClass(), clazz, "GrpcPublisherStub.golden");
Assert.assertEmptySamples(clazz.samples());
}
use of com.google.api.generator.gapic.model.Service in project gapic-generator-java by googleapis.
the class GrpcServiceStubClassComposerTest method generateGrpcServiceStubClass_deprecated.
@Test
public void generateGrpcServiceStubClass_deprecated() {
GapicContext context = GrpcTestProtoLoader.instance().parseDeprecatedService();
Service protoService = context.services().get(0);
GapicClass clazz = GrpcServiceStubClassComposer.instance().generate(context, protoService);
Assert.assertGoldenClass(this.getClass(), clazz, "GrpcDeprecatedServiceStub.golden");
Assert.assertEmptySamples(clazz.samples());
}
Aggregations