use of com.google.api.generator.gapic.model.GapicContext 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.GapicContext 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.GapicContext 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());
}
use of com.google.api.generator.gapic.model.GapicContext 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());
}
use of com.google.api.generator.gapic.model.GapicContext in project gapic-generator-java by googleapis.
the class AbstractServiceClientTestClassComposer method addDynamicTypes.
private void addDynamicTypes(GapicContext context, Service service, TypeStore typeStore) {
typeStore.putAll(service.pakkage(), Arrays.asList(ClassNames.getMockServiceClassName(service), ClassNames.getServiceClientClassName(service), ClassNames.getServiceSettingsClassName(service)));
String stubPakkage = String.format("%s.stub", service.pakkage());
typeStore.put(stubPakkage, getTransportContext().classNames().getTransportServiceStubClassName(service));
// Pagination types.
typeStore.putAll(service.pakkage(), service.methods().stream().filter(m -> m.isPaged()).map(m -> String.format(PAGED_RESPONSE_TYPE_NAME_PATTERN, m.name())).collect(Collectors.toList()), true, ClassNames.getServiceClientClassName(service));
for (Service mixinService : context.mixinServices()) {
typeStore.put(mixinService.pakkage(), ClassNames.getMockServiceClassName(mixinService));
for (Method mixinMethod : mixinService.methods()) {
if (!mixinMethod.isPaged()) {
continue;
}
typeStore.put(service.pakkage(), String.format(PAGED_RESPONSE_TYPE_NAME_PATTERN, mixinMethod.name()), true, ClassNames.getServiceClientClassName(service));
}
}
}
Aggregations