use of org.opendaylight.yang.gen.v1.urn.yang.foo.rev160101.BooleanContainer in project mdsal by opendaylight.
the class Bug5845booleanKeyTest method testBug5845.
@Test
public void testBug5845() throws Exception {
final BooleanListKey blk = new BooleanListKey(true, true);
final BooleanContainer booleanContainer = new BooleanContainerBuilder().setBooleanList(Collections.singletonMap(blk, new BooleanListBuilder().withKey(blk).setBooleanLeaf1(true).setBooleanLeaf2(true).build())).build();
final BooleanListIntKey blik = new BooleanListIntKey((byte) 1);
final BooleanContainer booleanContainerInt = new BooleanContainerBuilder().setBooleanListInt(Collections.singletonMap(blik, new BooleanListIntBuilder().withKey(blik).setBooleanLeafInt((byte) 1).build())).build();
final BindingDataObjectCodecTreeNode<BooleanContainer> subtreeCodec = codecContext.getSubtreeCodec(InstanceIdentifier.create(BooleanContainer.class));
final NormalizedNode serializedInt = subtreeCodec.serialize(booleanContainerInt);
assertNotNull(serializedInt);
final NormalizedNode serialized = subtreeCodec.serialize(booleanContainer);
assertNotNull(serialized);
}
use of org.opendaylight.yang.gen.v1.urn.yang.foo.rev160101.BooleanContainer in project mdsal by opendaylight.
the class LeafDefaultValueTest method testBooleanDefaultValue.
@Test
public void testBooleanDefaultValue() throws ExecutionException, InterruptedException {
final WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.OPERATIONAL, BOOLEAN_NODE_PATH, new BooleanContainerBuilder().build());
writeTx.commit().get();
final ReadTransaction readTx = getDataBroker().newReadOnlyTransaction();
final Optional<BooleanContainer> booleanContainerNode = readTx.read(LogicalDatastoreType.OPERATIONAL, BOOLEAN_NODE_PATH).get();
assertTrue(booleanContainerNode.isPresent());
BooleanContainer boolCont = booleanContainerNode.get();
assertTrue(boolCont.getBooleanLeaf());
assertNull(boolCont.getBooleanLeaf2());
}
Aggregations