Search in sources :

Example 1 with SchemaListenerRegistration

use of org.opendaylight.yangtools.yang.model.repo.spi.SchemaListenerRegistration in project yangtools by opendaylight.

the class SimpleModuleTest method init.

@Before
public void init() {
    schemaRegistry = new SharedSchemaRepository("test");
    final TextToIRTransformer astTransformer = TextToIRTransformer.create(schemaRegistry, schemaRegistry);
    schemaRegistry.registerSchemaSourceListener(astTransformer);
    schemaContextFactory = schemaRegistry.createEffectiveModelContextFactory();
    allTestSources = new HashSet<>();
    final SchemaListenerRegistration reg = schemaRegistry.registerSchemaSourceListener(new SchemaSourceListener() {

        @Override
        public void schemaSourceUnregistered(final PotentialSchemaSource<?> source) {
        // NOOP
        }

        @Override
        public void schemaSourceRegistered(final Iterable<PotentialSchemaSource<?>> sources) {
            for (final PotentialSchemaSource<?> source : sources) {
                allTestSources.add(source.getSourceIdentifier());
            }
        }

        @Override
        public void schemaSourceEncountered(final SchemaSourceRepresentation source) {
        // NOOP
        }
    });
    reg.close();
}
Also used : SchemaSourceListener(org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceListener) SchemaListenerRegistration(org.opendaylight.yangtools.yang.model.repo.spi.SchemaListenerRegistration) PotentialSchemaSource(org.opendaylight.yangtools.yang.model.repo.spi.PotentialSchemaSource) SharedSchemaRepository(org.opendaylight.yangtools.yang.parser.repo.SharedSchemaRepository) TextToIRTransformer(org.opendaylight.yangtools.yang.parser.rfc7950.repo.TextToIRTransformer) SchemaSourceRepresentation(org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 SchemaSourceRepresentation (org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation)1 PotentialSchemaSource (org.opendaylight.yangtools.yang.model.repo.spi.PotentialSchemaSource)1 SchemaListenerRegistration (org.opendaylight.yangtools.yang.model.repo.spi.SchemaListenerRegistration)1 SchemaSourceListener (org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceListener)1 SharedSchemaRepository (org.opendaylight.yangtools.yang.parser.repo.SharedSchemaRepository)1 TextToIRTransformer (org.opendaylight.yangtools.yang.parser.rfc7950.repo.TextToIRTransformer)1