use of com.google.api.generator.gapic.model.Service in project gapic-generator-java by googleapis.
the class TestProtoLoader method parseDeprecatedService.
public GapicContext parseDeprecatedService() {
FileDescriptor fileDescriptor = DeprecatedServiceOuterClass.getDescriptor();
ServiceDescriptor serviceDescriptor = fileDescriptor.getServices().get(0);
assertEquals(serviceDescriptor.getName(), "DeprecatedService");
Map<String, Message> messageTypes = Parser.parseMessages(fileDescriptor);
Map<String, ResourceName> resourceNames = new HashMap<>();
Set<ResourceName> outputResourceNames = new HashSet<>();
List<Service> services = Parser.parseService(fileDescriptor, messageTypes, resourceNames, Optional.empty(), outputResourceNames);
String jsonFilename = "deprecated_service_grpc_service_config.json";
Path jsonPath = Paths.get(testFilesDirectory, jsonFilename);
Optional<GapicServiceConfig> configOpt = ServiceConfigParser.parse(jsonPath.toString());
assertTrue(configOpt.isPresent());
GapicServiceConfig config = configOpt.get();
return GapicContext.builder().setMessages(messageTypes).setResourceNames(resourceNames).setServices(services).setServiceConfig(config).setHelperResourceNames(outputResourceNames).setTransport(transport).build();
}
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 = GrpcTestProtoLoader.instance().parseShowcaseEcho();
Service echoProtoService = context.services().get(0);
GapicClass clazz = GrpcServiceCallableFactoryClassComposer.instance().generate(context, echoProtoService);
Assert.assertGoldenClass(this.getClass(), clazz, "GrpcEchoCallableFactory.golden");
Assert.assertEmptySamples(clazz.samples());
}
use of com.google.api.generator.gapic.model.Service in project gapic-generator-java by googleapis.
the class GrpcServiceCallableFactoryClassComposerTest method generateServiceClasses_deprecated.
@Test
public void generateServiceClasses_deprecated() {
GapicContext context = GrpcTestProtoLoader.instance().parseDeprecatedService();
Service protoService = context.services().get(0);
GapicClass clazz = GrpcServiceCallableFactoryClassComposer.instance().generate(context, protoService);
Assert.assertGoldenClass(this.getClass(), clazz, "GrpcDeprecatedServiceCallableFactory.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_routingHeaders.
@Test
public void generateGrpcServiceStubClass_routingHeaders() {
GapicContext context = GrpcTestProtoLoader.instance().parseExplicitDynamicRoutingHeaderTesting();
Service service = context.services().get(0);
GapicClass clazz = GrpcServiceStubClassComposer.instance().generate(context, service);
Assert.assertGoldenClass(this.getClass(), clazz, "GrpcRoutingHeadersStub.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_simple.
@Test
public void generateGrpcServiceStubClass_simple() {
GapicContext context = GrpcTestProtoLoader.instance().parseShowcaseEcho();
Service echoProtoService = context.services().get(0);
GapicClass clazz = GrpcServiceStubClassComposer.instance().generate(context, echoProtoService);
Assert.assertGoldenClass(this.getClass(), clazz, "GrpcEchoStub.golden");
Assert.assertEmptySamples(clazz.samples());
}
Aggregations