use of org.opendaylight.yangtools.yang.model.api.EffectiveModelContext in project yangtools by opendaylight.
the class MoreRevisionsTest method multipleRevisionsSimpleTest.
@Test
public void multipleRevisionsSimpleTest() throws Exception {
for (int i = 0; i < 1000; i++) {
EffectiveModelContext context = StmtTestUtils.parseYangSources("/semantic-statement-parser/multiple-revisions/simple");
assertEquals(5, context.getModules().size());
checkContentSimpleTest(context);
}
}
use of org.opendaylight.yangtools.yang.model.api.EffectiveModelContext in project yangtools by opendaylight.
the class MoreRevisionsTest method readAndParseYangFileTest.
@Test
public void readAndParseYangFileTest() throws ReactorException {
EffectiveModelContext result = RFC7950Reactors.defaultReactor().newBuild().addSource(REVFILE).buildEffective();
final Module moduleByName = result.getModules().iterator().next();
assertEquals("2015-06-07", moduleByName.getQNameModule().getRevision().get().toString());
}
use of org.opendaylight.yangtools.yang.model.api.EffectiveModelContext in project yangtools by opendaylight.
the class YT1133Test method testAugmentKeys.
@Test
@SuppressWarnings("checkstyle:regexpSinglelineJava")
public void testAugmentKeys() throws Exception {
final PrintStream stdout = System.out;
final ByteArrayOutputStream output = new ByteArrayOutputStream();
final EffectiveModelContext ctx;
try (PrintStream out = new PrintStream(output, true, StandardCharsets.UTF_8)) {
System.setOut(out);
ctx = StmtTestUtils.parseYangSources("/bugs/YT1133");
} finally {
System.setOut(stdout);
}
assertEquals(2, ctx.getModules().size());
final String log = output.toString();
assertThat(log, not(containsString("Configuration list (bar)values")));
}
use of org.opendaylight.yangtools.yang.model.api.EffectiveModelContext in project yangtools by opendaylight.
the class Main method runSystemTest.
@SuppressFBWarnings({ "DM_EXIT", "DM_GC" })
@SuppressWarnings("checkstyle:illegalCatch")
private static void runSystemTest(final List<String> yangLibDirs, final List<String> yangFiles, final Set<QName> supportedFeatures, final boolean recursiveSearch) {
LOG.info("Yang model dirs: {} ", yangLibDirs);
LOG.info("Yang model files: {} ", yangFiles);
LOG.info("Supported features: {} ", supportedFeatures);
EffectiveModelContext context = null;
printMemoryInfo("start");
final Stopwatch stopWatch = Stopwatch.createStarted();
try {
context = SystemTestUtils.parseYangSources(yangLibDirs, yangFiles, supportedFeatures, recursiveSearch);
} catch (final Exception e) {
LOG.error("Failed to create SchemaContext.", e);
System.exit(1);
}
stopWatch.stop();
LOG.info("Elapsed time: {}", stopWatch);
printMemoryInfo("end");
LOG.info("SchemaContext resolved Successfully. {}", context);
Runtime.getRuntime().gc();
printMemoryInfo("after gc");
}
use of org.opendaylight.yangtools.yang.model.api.EffectiveModelContext in project lighty-netconf-simulator by PANTHEONtech.
the class RpcOutputRequestProcessor method init.
@Override
public void init(NetconfDeviceServices netconfDeviceServices) {
super.init(netconfDeviceServices);
EffectiveModelContext schemaContext = getNetconfDeviceServices().getAdapterContext().currentSerializer().getRuntimeContext().getEffectiveModelContext();
Optional<? extends RpcDefinition> rpcDefinitionOptional = ConverterUtils.loadRpc(schemaContext, getIdentifier());
if (rpcDefinitionOptional.isPresent()) {
this.rpcDefinition = rpcDefinitionOptional.get();
} else {
throw new IllegalStateException("RpcDefinition for " + getIdentifier() + " was not found!");
}
}
Aggregations