use of com.google.api.codegen.ConfigProto in project toolkit by googleapis.
the class GoGapicSurfaceTransformerTest method setupClass.
@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.getDiagCollector(), locator, new String[] { "myproto_gapic.yaml" });
productConfig = GapicProductConfig.create(model, configProto);
if (model.getDiagCollector().hasErrors()) {
throw new IllegalStateException(model.getDiagCollector().getDiags().toString());
}
}
use of com.google.api.codegen.ConfigProto in project toolkit by googleapis.
the class GapicConfigProducerTest method missingConfigSchemaVersion.
@Test
public void missingConfigSchemaVersion() {
TestDataLocator locator = TestDataLocator.create(GapicConfigProducerTest.class);
locator.addTestDataSource(CodegenTestUtil.class, "testsrc");
model = CodegenTestUtil.readModel(locator, tempDir, new String[] { "myproto.proto" }, new String[] { "myproto.yaml" });
ConfigProto configProto = CodegenTestUtil.readConfig(model.getDiagCollector(), locator, new String[] { "missing_config_schema_version.yaml" });
productConfig = GapicProductConfig.create(model, configProto);
Diag expectedError = Diag.error(SimpleLocation.TOPLEVEL, "config_schema_version field is required in GAPIC yaml.");
Truth.assertThat(model.getDiagCollector().hasErrors());
Truth.assertThat(model.getDiagCollector().getDiags()).contains(expectedError);
}
Aggregations