@Nullable public static GapicProductConfig create( Model model, ConfigProto configProto, TargetLanguage language) { return create(model, configProto, null, null, language); }
new DiscoApiModel(Document.from(new DiscoveryNode(root)), defaultPackageName); GapicProductConfig productConfig = GapicProductConfig.create(model, configProto, language);
GapicProductConfig.create(model, configProto, protoPackage, clientPackage, language); if (productConfig == null) { return;
GapicProductConfig.create(model, gapicConfig, protoPackage, clientPackage, language); if (productConfig == null) { for (Diag diag : model.getDiagReporter().getDiagCollector().getDiags()) {
@BeforeClass public static void setupClass() { TestDataLocator locator = TestDataLocator.create(GoGapicSurfaceTransformerTest.class); model = CodegenTestUtil.readModel( locator, tempDir, new String[] {"myproto.proto", "singleservice.proto"}, new String[] {"myproto.yaml"}); for (Interface apiInterface : model.getSymbolTable().getInterfaces()) { if (apiInterface.getSimpleName().equals("Gopher")) { GoGapicSurfaceTransformerTest.apiInterface = apiInterface; break; } } ConfigProto configProto = CodegenTestUtil.readConfig( model.getDiagReporter().getDiagCollector(), locator, new String[] {"myproto_gapic.yaml"}); productConfig = GapicProductConfig.create(model, configProto, TargetLanguage.GO); if (model.getDiagReporter().getDiagCollector().hasErrors()) { throw new IllegalStateException( model.getDiagReporter().getDiagCollector().getDiags().toString()); } }
@Test public void missingConfigSchemaVersion() { TestDataLocator locator = TestDataLocator.create(GapicConfigProducerTest.class); locator.addTestDataSource(CodegenTestUtil.class, "testsrc/common"); locator.addTestDataSource(CodegenTestUtil.class, "testsrc/libraryproto"); model = CodegenTestUtil.readModel( locator, tempDir, new String[] {"myproto.proto"}, new String[] {"myproto.yaml"}); ConfigProto configProto = CodegenTestUtil.readConfig( model.getDiagReporter().getDiagCollector(), locator, new String[] {"missing_config_schema_version.yaml"}); productConfig = GapicProductConfig.create(model, configProto, null, null, TargetLanguage.JAVA); Diag expectedError = Diag.error( SimpleLocation.TOPLEVEL, "config_schema_version field is required in GAPIC yaml."); assertThat(model.getDiagReporter().getDiagCollector().hasErrors()).isTrue(); assertThat(model.getDiagReporter().getDiagCollector().getDiags()).contains(expectedError); } }