use of com.google.api.generator.gapic.model.Service in project gapic-generator-java by googleapis.
the class TestProtoLoader method parseShowcaseEcho.
public GapicContext parseShowcaseEcho() {
FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
ServiceDescriptor echoServiceDescriptor = echoFileDescriptor.getServices().get(0);
assertEquals(echoServiceDescriptor.getName(), "Echo");
Map<String, Message> messageTypes = Parser.parseMessages(echoFileDescriptor);
Map<String, ResourceName> resourceNames = Parser.parseResourceNames(echoFileDescriptor);
Set<ResourceName> outputResourceNames = new HashSet<>();
List<Service> services = Parser.parseService(echoFileDescriptor, messageTypes, resourceNames, Optional.empty(), outputResourceNames);
String jsonFilename = "showcase_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 TestProtoLoader method parseShowcaseMessaging.
public GapicContext parseShowcaseMessaging() {
FileDescriptor fileDescriptor = MessagingOuterClass.getDescriptor();
ServiceDescriptor messagingService = fileDescriptor.getServices().get(0);
assertEquals(messagingService.getName(), "Messaging");
Map<String, Message> messageTypes = Parser.parseMessages(fileDescriptor);
Map<String, ResourceName> resourceNames = Parser.parseResourceNames(fileDescriptor);
Set<ResourceName> outputResourceNames = new HashSet<>();
List<Service> services = Parser.parseService(fileDescriptor, messageTypes, resourceNames, Optional.empty(), outputResourceNames);
return GapicContext.builder().setMessages(messageTypes).setResourceNames(resourceNames).setServices(services).setHelperResourceNames(outputResourceNames).setTransport(transport).build();
}
use of com.google.api.generator.gapic.model.Service in project gapic-generator-java by googleapis.
the class TestProtoLoader method parseExplicitDynamicRoutingHeaderTesting.
public GapicContext parseExplicitDynamicRoutingHeaderTesting() {
FileDescriptor testingFileDescriptor = ExplicitDynamicRoutingHeaderTestingOuterClass.getDescriptor();
ServiceDescriptor testingService = testingFileDescriptor.getServices().get(0);
assertEquals(testingService.getName(), "ExplicitDynamicRoutingHeaderTesting");
Map<String, Message> messageTypes = Parser.parseMessages(testingFileDescriptor);
Map<String, ResourceName> resourceNames = Parser.parseResourceNames(testingFileDescriptor);
Set<ResourceName> outputResourceNames = new HashSet<>();
List<Service> services = Parser.parseService(testingFileDescriptor, messageTypes, resourceNames, Optional.empty(), outputResourceNames);
return GapicContext.builder().setMessages(messageTypes).setResourceNames(resourceNames).setServices(services).setHelperResourceNames(outputResourceNames).setTransport(transport).build();
}
use of com.google.api.generator.gapic.model.Service in project gapic-generator-java by googleapis.
the class TestProtoLoader method parseShowcaseIdentity.
public GapicContext parseShowcaseIdentity() {
FileDescriptor fileDescriptor = IdentityOuterClass.getDescriptor();
ServiceDescriptor identityService = fileDescriptor.getServices().get(0);
assertEquals(identityService.getName(), "Identity");
Map<String, Message> messageTypes = Parser.parseMessages(fileDescriptor);
Map<String, ResourceName> resourceNames = Parser.parseResourceNames(fileDescriptor);
Set<ResourceName> outputResourceNames = new HashSet<>();
List<Service> services = Parser.parseService(fileDescriptor, messageTypes, resourceNames, Optional.empty(), outputResourceNames);
return GapicContext.builder().setMessages(messageTypes).setResourceNames(resourceNames).setServices(services).setHelperResourceNames(outputResourceNames).setTransport(transport).build();
}
use of com.google.api.generator.gapic.model.Service in project gapic-generator-java by googleapis.
the class TestProtoLoader method parsePubSubPublisher.
public GapicContext parsePubSubPublisher() {
FileDescriptor serviceFileDescriptor = PubsubProto.getDescriptor();
FileDescriptor commonResourcesFileDescriptor = CommonResources.getDescriptor();
ServiceDescriptor serviceDescriptor = serviceFileDescriptor.getServices().get(0);
assertEquals("Publisher", serviceDescriptor.getName());
Map<String, ResourceName> resourceNames = new HashMap<>();
resourceNames.putAll(Parser.parseResourceNames(serviceFileDescriptor));
resourceNames.putAll(Parser.parseResourceNames(commonResourcesFileDescriptor));
Map<String, Message> messageTypes = Parser.parseMessages(serviceFileDescriptor);
Set<ResourceName> outputResourceNames = new HashSet<>();
List<Service> services = Parser.parseService(serviceFileDescriptor, messageTypes, resourceNames, Optional.empty(), outputResourceNames);
String filename = "pubsub_gapic.yaml";
Path path = Paths.get(getTestFilesDirectory(), filename);
Optional<List<GapicBatchingSettings>> batchingSettingsOpt = BatchingSettingsConfigParser.parse(Optional.of(path.toString()));
assertTrue(batchingSettingsOpt.isPresent());
String jsonFilename = "pubsub_grpc_service_config.json";
Path jsonPath = Paths.get(getTestFilesDirectory(), jsonFilename);
Optional<GapicServiceConfig> configOpt = ServiceConfigParser.parse(jsonPath.toString());
assertTrue(configOpt.isPresent());
GapicServiceConfig config = configOpt.get();
config.setBatchingSettings(batchingSettingsOpt);
return GapicContext.builder().setMessages(messageTypes).setResourceNames(resourceNames).setServices(services).setServiceConfig(config).setHelperResourceNames(outputResourceNames).setTransport(transport).build();
}
Aggregations