<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<dependenciesToScan>
- <dependency>org.opendaylight.yangtools:features-test</dependency>
+ <dependency>org.opendaylight.odlparent:features-test</dependency>
</dependenciesToScan>
</configuration>
</plugin>
<dependencies>
<!-- test the features.xml -->
<dependency>
- <groupId>org.opendaylight.yangtools</groupId>
+ <groupId>org.opendaylight.odlparent</groupId>
<artifactId>features-test</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
</reporting>
-
-
- <!-- Note: we can not use variables for these URLs because we need to
- be able to download the parent pom from the repository the first
- time we go to use it (since it is in a different project).
- To override the settings, use the "mirror" section of the
- settings.xml. See http://maven.apache.org/settings.html -->
- <repositories>
- <!-- OpenDayLight Repo Mirror -->
- <repository>
- <id>opendaylight-mirror</id>
- <name>opendaylight-mirror</name>
- <url>http://nexus.opendaylight.org/content/groups/public/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <releases>
- <enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
- </releases>
- </repository>
-
- <!-- OpenDayLight Snapshot artifact -->
- <repository>
- <id>opendaylight-snapshot</id>
- <name>opendaylight-snapshot</name>
- <url>http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- </repositories>
</project>
import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
import org.opendaylight.yangtools.yang.data.impl.codec.SchemaTracker;
import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public void startContainerNode(final NodeIdentifier name, final int childSizeHint) throws IOException {
final SchemaNode schema = tracker.startContainerNode(name);
- final boolean isPresence = schema instanceof ContainerSchemaNode ?
- ((ContainerSchemaNode) schema).isPresenceContainer() : DEFAULT_EMIT_EMPTY_CONTAINERS;
-
- context = new JSONStreamWriterNamedObjectContext(context, name, isPresence);
+ // FIXME this code ignores presence for containers
+ // but datastore does as well and it needs be fixed first (2399)
+ context = new JSONStreamWriterNamedObjectContext(context, name, DEFAULT_EMIT_EMPTY_CONTAINERS);
}
@Override
}
if (old.getType() == null) {
- copy.setTypedef(copy(old.getTypedef(), copy, updateQName));
+ copy.setTypedef(old.getTypedef());
} else {
copy.setType(old.getType());
}
}
if (old.getType() == null) {
- copy.setTypedef(copy(old.getTypedef(), copy, updateQName));
+ copy.setTypedef(old.getTypedef());
} else {
copy.setType(old.getType());
}
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+
import java.io.File;
import java.io.IOException;
import java.net.URI;
assertEquals(gy.getDataChildByName("leaf-grouping-Y"),SchemaNodeUtils.getRootOriginalIfPossible( gx.getDataChildByName("leaf-grouping-Y")));
}
+ @Test
+ public void testAddedByUsesLeafTypeQName() throws IOException,
+ URISyntaxException {
+
+ Set<Module> loadModules = TestUtils.loadModules(getClass().getResource(
+ "/added-by-uses-leaf-test").toURI());
+
+ assertEquals(2, loadModules.size());
+
+ Module foo = null;
+ Module imp = null;
+ for (Module module : loadModules) {
+ if (module.getName().equals("foo")) {
+ foo = module;
+ }
+ if (module.getName().equals("import-module")) {
+ imp = module;
+ }
+ }
+
+ LeafSchemaNode leaf = (LeafSchemaNode) ((ContainerSchemaNode) foo
+ .getDataChildByName("my-container"))
+ .getDataChildByName("my-leaf");
+
+ TypeDefinition impType = null;
+ Set<TypeDefinition<?>> typeDefinitions = imp.getTypeDefinitions();
+ for (TypeDefinition<?> typeDefinition : typeDefinitions) {
+ if (typeDefinition.getQName().getLocalName().equals("imp-type")) {
+ impType = typeDefinition;
+ break;
+ }
+ }
+
+ assertEquals(leaf.getType().getQName(), impType.getQName());
+
+ }
+
}
--- /dev/null
+module foo {
+ prefix foo;
+ namespace "namespace-foo";
+
+ import import-module { prefix imp; revision-date 1970-01-02; }
+
+ grouping grp {
+ leaf my-leaf {
+ type imp:imp-type;
+ }
+
+ }
+
+ container my-container {
+ uses grp;
+ uses imp:imp_grp;
+ }
+
+}
+
--- /dev/null
+module import-module {
+ prefix imp;
+ namespace "import-module";
+
+ revision 1970-01-02 {
+ description "Initial revision.";
+ }
+
+ typedef imp-type {
+ type string {
+ length "0..100";
+ }
+ }
+
+ grouping imp_grp {
+
+ typedef grp-type {
+ type string {
+ length "20..30";
+ }
+ }
+
+ leaf my-leaf2 {
+ type grp-type;
+ }
+
+ leaf union-leaf {
+ type union {
+ type int16;
+ type string;
+ }
+ }
+ }
+}
+