*/
package org.opendaylight.mdsal.binding.dom.adapter;
-import com.google.common.collect.ImmutableSet;
-import java.util.Arrays;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import org.junit.Test;
-import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractDataTreeChangeListenerTest;
import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.Root;
import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.RootBuilder;
-import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.root.Fooroot;
import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.root.FoorootBuilder;
-import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.root.fooroot.Barroot;
import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.root.fooroot.BarrootBuilder;
import org.opendaylight.yang.gen.v1.opendaylight.test.bug._2562.namespace.rev160101.root.fooroot.BarrootKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@Override
protected Set<YangModuleInfo> getModuleInfos() throws Exception {
- return ImmutableSet.of(BindingReflections.getModuleInfo(Root.class));
+ return Set.of(BindingReflections.getModuleInfo(Root.class));
}
@Test
public void writeListToList2562Root() {
- final Barroot barRoot = new BarrootBuilder().setType(2).setValue(2).withKey(new BarrootKey(2)).build();
- final Fooroot fooRoot = new FoorootBuilder().setBarroot(Map.of(barRoot.key(), barRoot)).build();
- final Root root = new RootBuilder().setFooroot(Arrays.asList(fooRoot)).build();
+ final var barRoot = new BarrootBuilder().setType(2).setValue(2).withKey(new BarrootKey(2)).build();
+ final var fooRoot = new FoorootBuilder().setBarroot(Map.of(barRoot.key(), barRoot)).build();
+ final var root = new RootBuilder().setFooroot(List.of(fooRoot)).build();
- final TestListener<Root> listenerRoot = createListener(LogicalDatastoreType.CONFIGURATION, ROOT_PATH,
- added(ROOT_PATH, root));
+ try (var collector = createCollector(LogicalDatastoreType.CONFIGURATION, ROOT_PATH)) {
+ final var readWriteTransaction = getDataBroker().newReadWriteTransaction();
+ readWriteTransaction.put(LogicalDatastoreType.CONFIGURATION, ROOT_PATH, root);
+ assertCommit(readWriteTransaction.commit());
- final ReadWriteTransaction readWriteTransaction = getDataBroker().newReadWriteTransaction();
- readWriteTransaction.put(LogicalDatastoreType.CONFIGURATION, ROOT_PATH, root);
- assertCommit(readWriteTransaction.commit());
-
- listenerRoot.verify();
+ collector.assertModifications(added(ROOT_PATH, root));
+ }
}
}