本文整理汇总了Java中org.opendaylight.yangtools.yang.model.api.GroupingDefinition类的典型用法代码示例。如果您正苦于以下问题:Java GroupingDefinition类的具体用法?Java GroupingDefinition怎么用?Java GroupingDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GroupingDefinition类属于org.opendaylight.yangtools.yang.model.api包,在下文中一共展示了GroupingDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testActionStatementInDataContainers
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition; //导入依赖的package包/类
@Test
public void testActionStatementInDataContainers() throws Exception {
final SchemaContext schemaContext = StmtTestUtils.parseYangSource("/rfc7950/action-stmt/foo.yang");
assertNotNull(schemaContext);
assertContainsActions(schemaContext, "root", "grp-action", "aug-action");
assertContainsActions(schemaContext, "top-list", "top-list-action");
assertContainsActions(schemaContext, "top", "top-action");
final Set<GroupingDefinition> groupings = schemaContext.getGroupings();
assertEquals(1, groupings.size());
assertContainsActions(groupings.iterator().next(), "grp-action");
final Set<Module> modules = schemaContext.getModules();
assertEquals(1, modules.size());
final Module foo = modules.iterator().next();
final Set<AugmentationSchemaNode> augmentations = foo.getAugmentations();
assertEquals(1, augmentations.size());
assertContainsActions(augmentations.iterator().next(), "aug-action", "grp-action");
}
示例2: notificationsInDataContainersTest
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition; //导入依赖的package包/类
@Test
public void notificationsInDataContainersTest() throws Exception {
final SchemaContext schemaContext = StmtTestUtils
.parseYangSource("/rfc7950/notifications-in-data-nodes/foo.yang");
assertNotNull(schemaContext);
assertContainsNotifications(schemaContext, "root", "grp-notification", "aug-notification");
assertContainsNotifications(schemaContext, "top-list", "top-list-notification");
assertContainsNotifications(schemaContext, "top", "top-notification");
final Set<GroupingDefinition> groupings = schemaContext.getGroupings();
assertEquals(1, groupings.size());
assertContainsNotifications(groupings.iterator().next(), "grp-notification");
final Set<Module> modules = schemaContext.getModules();
assertEquals(1, modules.size());
final Module foo = modules.iterator().next();
final Set<AugmentationSchemaNode> augmentations = foo.getAugmentations();
assertEquals(1, augmentations.size());
assertContainsNotifications(augmentations.iterator().next(), "aug-notification", "grp-notification");
}
示例3: findDataSchemaNodeTest2
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition; //导入依赖的package包/类
@Test
public void findDataSchemaNodeTest2() throws URISyntaxException, IOException, YangSyntaxErrorException,
ReactorException {
// findDataSchemaNode(final SchemaContext context, final Module module,
// final RevisionAwareXPath nonCondXPath) {
final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
final Module module = context.findModule(new URI("uri:my-module"), Revision.of("2014-10-07")).get();
final GroupingDefinition grouping = getGroupingByName(module, "my-grouping");
final SchemaNode testNode = grouping.getDataChildByName(QName.create(module.getQNameModule(),
"my-leaf-in-gouping2"));
final RevisionAwareXPath xpath = new RevisionAwareXPathImpl("my:my-grouping/my:my-leaf-in-gouping2", true);
final SchemaNode foundNode = SchemaContextUtil.findDataSchemaNode(context, module, xpath);
assertNotNull(foundNode);
assertNotNull(testNode);
assertEquals(testNode, foundNode);
}
示例4: extensionsTest
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition; //导入依赖的package包/类
@Test
public void extensionsTest() throws ReactorException {
SchemaContext result = RFC7950Reactors.defaultReactor().newBuild().addSource(YANG_EXT).buildEffective();
assertNotNull(result);
Set<GroupingDefinition> groupings = result.getGroupings();
assertEquals(1, groupings.size());
GroupingDefinition grp = groupings.iterator().next();
Collection<DataSchemaNode> childNodes = grp.getChildNodes();
assertEquals(1, childNodes.size());
DataSchemaNode child = childNodes.iterator().next();
assertTrue(child instanceof LeafSchemaNode);
LeafSchemaNode leaf = (LeafSchemaNode) child;
assertNotNull(leaf.getType());
}
示例5: testOrderingNestedChildNodes2
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition; //导入依赖的package包/类
@Test
public void testOrderingNestedChildNodes2() throws Exception {
final Set<GroupingDefinition> groupings = baz.getGroupings();
assertEquals(1, groupings.size());
final GroupingDefinition target = groupings.iterator().next();
final Collection<DataSchemaNode> childNodes = target.getChildNodes();
final String[] expectedOrder = { "data", "how", "address", "port", "addresses" };
final String[] actualOrder = new String[childNodes.size()];
int offset = 0;
for (final DataSchemaNode child : childNodes) {
actualOrder[offset] = child.getQName().getLocalName();
offset++;
}
assertArrayEquals(expectedOrder, actualOrder);
}
示例6: allGroupingsToGenTypes
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition; //导入依赖的package包/类
private List<Type> allGroupingsToGenTypes(final Module module) {
final List<Type> genTypes = new ArrayList<>();
final String basePackageName = moduleNamespaceToPackageName(module);
final Set<GroupingDefinition> groupings = module.getGroupings();
List<GroupingDefinition> groupingsSortedByDependencies;
// groupingsSortedByDependencies =
// sortGroupingDefinitionsByUses(groupings);
groupingsSortedByDependencies = GroupingDefinitionDependencySort.sort(groupings);
for (final GroupingDefinition grouping : groupingsSortedByDependencies) {
GeneratedType genType = groupingToGenType(basePackageName, grouping);
genTypes.add(genType);
SchemaPath schemaPath = grouping.getPath();
allGroupings.put(schemaPath, genType);
}
return genTypes;
}
示例7: emitDataNodeContainer
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition; //导入依赖的package包/类
private void emitDataNodeContainer(final DataNodeContainer input) {
for (final TypeDefinition<?> typedef : input.getTypeDefinitions()) {
emitTypedefNode(typedef);
}
for (final GroupingDefinition grouping : input.getGroupings()) {
emitGrouping(grouping);
}
for (final DataSchemaNode child : input.getChildNodes()) {
emitDataSchemaNode(child);
}
for (final UsesNode usesNode : input.getUses()) {
emitUsesNode(usesNode);
}
}
示例8: emitGrouping
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition; //导入依赖的package包/类
private void emitGrouping(final GroupingDefinition grouping) {
super.writer.startGroupingNode(grouping.getQName());
emitDocumentedNode(grouping);
emitDataNodeContainer(grouping);
emitUnknownStatementNodes(grouping.getUnknownSchemaNodes());
emitNotifications(grouping.getNotifications());
emitActions(grouping.getActions());
super.writer.endNode();
}
示例9: emitOperationBody
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition; //导入依赖的package包/类
private void emitOperationBody(final OperationDefinition rpc) {
// FIXME: BUG-2444: *(ifFeatureNode )
emitDocumentedNode(rpc);
for (final TypeDefinition<?> typedef : rpc.getTypeDefinitions()) {
emitTypedefNode(typedef);
}
for (final GroupingDefinition grouping : rpc.getGroupings()) {
emitGrouping(grouping);
}
emitInput(rpc.getInput());
emitOutput(rpc.getOutput());
emitUnknownStatementNodes(rpc.getUnknownSchemaNodes());
}
示例10: RpcEffectiveStatementImpl
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition; //导入依赖的package包/类
RpcEffectiveStatementImpl(final StmtContext<QName, RpcStatement,
EffectiveStatement<QName, RpcStatement>> ctx) {
super(ctx);
input = findAsContainer(this, InputEffectiveStatement.class);
output = findAsContainer(this, OutputEffectiveStatement.class);
// initSubstatements
Set<GroupingDefinition> groupingsInit = new HashSet<>();
Set<TypeDefinition<?>> mutableTypeDefinitions = new LinkedHashSet<>();
for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements()) {
if (effectiveStatement instanceof GroupingDefinition) {
GroupingDefinition groupingDefinition = (GroupingDefinition) effectiveStatement;
groupingsInit.add(groupingDefinition);
}
if (effectiveStatement instanceof TypedefEffectiveStatement) {
TypedefEffectiveStatement typeDef = (TypedefEffectiveStatement) effectiveStatement;
TypeDefinition<?> type = typeDef.getTypeDefinition();
if (!mutableTypeDefinitions.contains(type)) {
mutableTypeDefinitions.add(type);
} else {
throw EffectiveStmtUtils.createNameCollisionSourceException(ctx, effectiveStatement);
}
}
}
this.groupings = ImmutableSet.copyOf(groupingsInit);
this.typeDefinitions = ImmutableSet.copyOf(mutableTypeDefinitions);
}
示例11: ActionEffectiveStatementImpl
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition; //导入依赖的package包/类
ActionEffectiveStatementImpl(
final StmtContext<QName, ActionStatement, EffectiveStatement<QName, ActionStatement>> ctx) {
super(ctx);
input = findAsContainer(this, InputEffectiveStatement.class);
output = findAsContainer(this, OutputEffectiveStatement.class);
// initSubstatements
final Set<GroupingDefinition> groupingsInit = new HashSet<>();
final Set<TypeDefinition<?>> mutableTypeDefinitions = new LinkedHashSet<>();
for (final EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements()) {
if (effectiveStatement instanceof GroupingDefinition) {
final GroupingDefinition groupingDefinition = (GroupingDefinition) effectiveStatement;
groupingsInit.add(groupingDefinition);
}
if (effectiveStatement instanceof TypedefEffectiveStatement) {
final TypedefEffectiveStatement typeDef = (TypedefEffectiveStatement) effectiveStatement;
final TypeDefinition<?> type = typeDef.getTypeDefinition();
if (!mutableTypeDefinitions.contains(type)) {
mutableTypeDefinitions.add(type);
} else {
throw EffectiveStmtUtils.createNameCollisionSourceException(ctx, effectiveStatement);
}
}
}
this.groupings = ImmutableSet.copyOf(groupingsInit);
this.typeDefinitions = ImmutableSet.copyOf(mutableTypeDefinitions);
// initCopyType
final CopyHistory copyTypesFromOriginal = ctx.getCopyHistory();
if (copyTypesFromOriginal.contains(CopyType.ADDED_BY_USES_AUGMENTATION)) {
this.augmenting = true;
this.addedByUses = true;
} else {
this.augmenting = copyTypesFromOriginal.contains(CopyType.ADDED_BY_AUGMENTATION);
this.addedByUses = copyTypesFromOriginal.contains(CopyType.ADDED_BY_USES);
}
}
示例12: getGroupingByName
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition; //导入依赖的package包/类
private static GroupingDefinition getGroupingByName(final DataNodeContainer dataNodeContainer, final String name) {
for (final GroupingDefinition grouping : dataNodeContainer.getGroupings()) {
if (grouping.getQName().getLocalName().equals(name)) {
return grouping;
}
}
return null;
}
示例13: testGrouping
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition; //导入依赖的package包/类
@Test
public void testGrouping() throws URISyntaxException {
final Module testModule = TestUtils.findModule(context, "config").get();
assertNotNull(testModule);
final Set<GroupingDefinition> groupings = testModule.getGroupings();
assertEquals(1, groupings.size());
final Iterator<GroupingDefinition> groupingsIterator = groupings.iterator();
final GroupingDefinition grouping = groupingsIterator.next();
assertEquals("service-ref", grouping.getQName().getLocalName());
assertEquals(Optional.of("Type of references to a particular service instance. This type\n"
+ "can be used when defining module configuration to refer to a\n"
+ "particular service instance. Containers using this grouping\n"
+ "should not define anything else. The run-time implementation\n"
+ "is expected to inject a reference to the service as the value\n"
+ "of the container."), grouping.getDescription());
final Collection<DataSchemaNode> children = grouping.getChildNodes();
assertEquals(2, children.size());
final LeafSchemaNode leaf1 = (LeafSchemaNode) grouping.getDataChildByName(QName.create(
testModule.getQNameModule(), "type"));
assertNotNull(leaf1);
assertTrue(leaf1.isMandatory());
final LeafSchemaNode leaf2 = (LeafSchemaNode) grouping.getDataChildByName(QName.create(
testModule.getQNameModule(), "name"));
assertNotNull(leaf2);
assertTrue(leaf2.isMandatory());
}
示例14: testGrouping
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition; //导入依赖的package包/类
@Test
public void testGrouping() {
final Module testModule = TestUtils.findModule(ctx, "baz").get();
final Set<GroupingDefinition> groupings = testModule.getGroupings();
assertEquals(1, groupings.size());
final GroupingDefinition grouping = groupings.iterator().next();
final Collection<DataSchemaNode> children = grouping.getChildNodes();
assertEquals(5, children.size());
}
示例15: getGroupings
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition; //导入依赖的package包/类
@Override
public Set<GroupingDefinition> getGroupings() {
final Set<GroupingDefinition> result = new LinkedHashSet<>();
for (Module module : getModules()) {
result.addAll(module.getGroupings());
}
return Collections.unmodifiableSet(result);
}