Search in sources :

Example 16 with GapicClass

use of com.google.api.generator.gapic.model.GapicClass 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());
}
Also used : GapicClass(com.google.api.generator.gapic.model.GapicClass) Service(com.google.api.generator.gapic.model.Service) GapicContext(com.google.api.generator.gapic.model.GapicContext) Test(org.junit.Test)

Example 17 with GapicClass

use of com.google.api.generator.gapic.model.GapicClass 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());
}
Also used : GapicClass(com.google.api.generator.gapic.model.GapicClass) Service(com.google.api.generator.gapic.model.Service) GapicContext(com.google.api.generator.gapic.model.GapicContext) Test(org.junit.Test)

Example 18 with GapicClass

use of com.google.api.generator.gapic.model.GapicClass in project gapic-generator-java by googleapis.

the class GrpcServiceStubClassComposerTest method generateGrpcServiceStubClass_createBatchingCallable.

@Test
public void generateGrpcServiceStubClass_createBatchingCallable() {
    GapicContext context = GrpcTestProtoLoader.instance().parseLogging();
    Service service = context.services().get(0);
    GapicClass clazz = GrpcServiceStubClassComposer.instance().generate(context, service);
    Assert.assertGoldenClass(this.getClass(), clazz, "GrpcLoggingStub.golden");
    Assert.assertEmptySamples(clazz.samples());
}
Also used : GapicClass(com.google.api.generator.gapic.model.GapicClass) Service(com.google.api.generator.gapic.model.Service) GapicContext(com.google.api.generator.gapic.model.GapicContext) Test(org.junit.Test)

Example 19 with GapicClass

use of com.google.api.generator.gapic.model.GapicClass in project gapic-generator-java by googleapis.

the class MockServiceImplClassComposerTest method generateMockServiceImplClasses.

@Test
public void generateMockServiceImplClasses() {
    Service service = context.services().get(0);
    GapicClass clazz = MockServiceImplClassComposer.instance().generate(context, service);
    Assert.assertGoldenClass(this.getClass(), clazz, name + ".golden");
    Assert.assertEmptySamples(clazz.samples());
}
Also used : GapicClass(com.google.api.generator.gapic.model.GapicClass) Service(com.google.api.generator.gapic.model.Service) Test(org.junit.Test)

Example 20 with GapicClass

use of com.google.api.generator.gapic.model.GapicClass in project gapic-generator-java by googleapis.

the class ServiceClientTestClassComposerTest method generateServiceClientTestClasses.

@Test
public void generateServiceClientTestClasses() {
    Service echoProtoService = context.services().get(serviceIndex);
    GapicClass clazz = ServiceClientTestClassComposer.instance().generate(context, echoProtoService);
    Assert.assertGoldenClass(this.getClass(), clazz, name + ".golden");
    Assert.assertEmptySamples(clazz.samples());
}
Also used : GapicClass(com.google.api.generator.gapic.model.GapicClass) Service(com.google.api.generator.gapic.model.Service) Test(org.junit.Test)

Aggregations

GapicClass (com.google.api.generator.gapic.model.GapicClass)45 Test (org.junit.Test)35 Service (com.google.api.generator.gapic.model.Service)29 GapicContext (com.google.api.generator.gapic.model.GapicContext)24 JavaWriterVisitor (com.google.api.generator.engine.writer.JavaWriterVisitor)21 Path (java.nio.file.Path)20 ClassDefinition (com.google.api.generator.engine.ast.ClassDefinition)9 TypeStore (com.google.api.generator.gapic.composer.store.TypeStore)8 Kind (com.google.api.generator.gapic.model.GapicClass.Kind)8 Message (com.google.api.generator.gapic.model.Message)7 ResourceName (com.google.api.generator.gapic.model.ResourceName)7 HashSet (java.util.HashSet)4 FileDescriptor (com.google.protobuf.Descriptors.FileDescriptor)3 ServiceDescriptor (com.google.protobuf.Descriptors.ServiceDescriptor)3 CommentStatement (com.google.api.generator.engine.ast.CommentStatement)2 VariableExpr (com.google.api.generator.engine.ast.VariableExpr)2 StubCommentComposer (com.google.api.generator.gapic.composer.comment.StubCommentComposer)2 Sample (com.google.api.generator.gapic.model.Sample)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2