use of org.revapi.Revapi in project revapi by revapi.
the class RevapiTask method execute.
@Override
public void execute() throws BuildException {
Revapi revapi = initRevapi();
AnalysisContext context = initAnalysisContext(revapi);
log("Running API analysis");
log("Old API: " + context.getOldApi().toString());
log("New API: " + context.getNewApi().toString());
try (AnalysisResult res = revapi.analyze(context)) {
res.throwIfFailed();
} catch (Exception e) {
throw new BuildException("API analysis failed.", e);
}
}
use of org.revapi.Revapi in project revapi by revapi.
the class ConfigurationValidatorTest method testRevapiValidation_mergeWithIds.
@Test
public void testRevapiValidation_mergeWithIds() throws Exception {
String config1 = "[" + "{\"extension\": \"my-config\", \"id\": \"c1\", \"configuration\": {\"id\": 3, \"kachna\": \"duck\"}}" + "]";
String config2 = "[" + "{\"extension\": \"my-config\", \"id\": \"c2\", \"configuration\": {\"id\": 4, \"kachna\": \"no duck\"}}," + "{\"extension\": \"other-config\", \"configuration\": 1}" + "]";
Revapi revapi = Revapi.builder().withFilters(TestFilter.class).withReporters(TestReporter.class).withAnalyzers(DummyApiAnalyzer.class).build();
AnalysisContext ctx = AnalysisContext.builder(revapi).withConfigurationFromJSON(config1).mergeConfigurationFromJSON(config2).build();
ValidationResult res = revapi.validateConfiguration(ctx);
Assert.assertFalse(res.isSuccessful());
Assert.assertNotNull(res.getErrors());
Assert.assertEquals(1, res.getErrors().length);
Assert.assertEquals("/[2]/configuration", res.getErrors()[0].dataPath);
}
Aggregations