use of com.google.api.generator.gapic.model.Service 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.Service 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());
}
use of com.google.api.generator.gapic.model.Service 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());
}
use of com.google.api.generator.gapic.model.Service in project gapic-generator-java by googleapis.
the class AbstractServiceClientClassComposer method createVaporTypes.
private static void createVaporTypes(Service service, TypeStore typeStore) {
// Client stub typeStore.
typeStore.putAll(String.format("%s.stub", service.pakkage()), Arrays.asList(ClassNames.getServiceStubClassName(service), ClassNames.getServiceStubSettingsClassName(service)));
// Client ServiceClient and ServiceSettings typeStore.
typeStore.putAll(service.pakkage(), Arrays.asList(ClassNames.getServiceClientClassName(service), ClassNames.getServiceSettingsClassName(service)));
// Nested class typeStore.
for (Method method : service.methods()) {
if (!method.isPaged()) {
continue;
}
typeStore.putAll(service.pakkage(), Arrays.asList("%sPagedResponse", "%sPage", "%sFixedSizeCollection").stream().map(p -> String.format(p, JavaStyle.toUpperCamelCase(method.name()))).collect(Collectors.toList()), true, ClassNames.getServiceClientClassName(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));
}
use of com.google.api.generator.gapic.model.Service 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