* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.yangtools.yang.stmt;
import static org.junit.Assert.assertEquals;
import java.net.URISyntaxException;
import java.text.ParseException;
import java.util.Collection;
+import java.util.Optional;
import java.util.Set;
import org.junit.Test;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.Status;
import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
import org.opendaylight.yangtools.yang.model.util.SimpleSchemaContext;
import org.opendaylight.yangtools.yang.parser.rfc7950.reactor.RFC7950Reactors;
-import org.opendaylight.yangtools.yang.parser.rfc7950.repo.YangStatementStreamSource;
import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
import org.opendaylight.yangtools.yang.parser.stmt.reactor.EffectiveSchemaContext;
public class EffectiveSchemaContextTest {
-
@Test
public void testEffectiveSchemaContext() throws ReactorException, ParseException, URISyntaxException, IOException,
YangSyntaxErrorException {
final EffectiveSchemaContext schemaContext = RFC7950Reactors.defaultReactor().newBuild()
- .addSource(YangStatementStreamSource.create(YangTextSchemaSource.forResource(
- "/effective-schema-context-test/foo.yang")))
- .addSource(YangStatementStreamSource.create(YangTextSchemaSource.forResource(
- "/effective-schema-context-test/bar.yang")))
- .addSource(YangStatementStreamSource.create(YangTextSchemaSource.forResource(
- "/effective-schema-context-test/baz.yang")))
- .buildEffective();
+ .addSource(StmtTestUtils.sourceForResource("/effective-schema-context-test/foo.yang"))
+ .addSource(StmtTestUtils.sourceForResource("/effective-schema-context-test/bar.yang"))
+ .addSource(StmtTestUtils.sourceForResource("/effective-schema-context-test/baz.yang"))
+ .buildEffective();
assertNotNull(schemaContext);
final Collection<? extends DataSchemaNode> dataDefinitions = schemaContext.getDataDefinitions();
assertFalse(schemaContext.isAugmenting());
assertFalse(schemaContext.isAddedByUses());
- assertFalse(schemaContext.isConfiguration());
- assertFalse(schemaContext.isPresenceContainer());
+ assertEquals(Optional.empty(), schemaContext.effectiveConfig());
assertFalse(schemaContext.getWhenCondition().isPresent());
assertEquals(0, schemaContext.getMustConstraints().size());
assertFalse(schemaContext.getDescription().isPresent());