X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-inmemory-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fstore%2Fimpl%2FAbstractDataChangeListenerTest.java;h=1146458171bd1dfff7bbbce51c5a8335b15aec44;hb=c5f3be93482d6b06d95ebf22b2ef2723fd813f89;hp=0e064cd50404cea82d7ae2bf63435f45a7c54b62;hpb=be88c930f435d3a5f0f012cb0588022a216237bd;p=controller.git diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/AbstractDataChangeListenerTest.java b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/AbstractDataChangeListenerTest.java index 0e064cd504..1146458171 100644 --- a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/AbstractDataChangeListenerTest.java +++ b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/AbstractDataChangeListenerTest.java @@ -7,20 +7,17 @@ */ package org.opendaylight.controller.md.sal.dom.store.impl; -import com.google.common.util.concurrent.MoreExecutors; - import java.util.Collection; import java.util.Map; - import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.opendaylight.controller.md.sal.dom.store.impl.DatastoreTestTask.WriteTransactionCustomizer; +import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TwoLevelList; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.top.level.list.NestedList; -import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext; import org.opendaylight.yangtools.util.concurrent.SpecialExecutors; import org.opendaylight.yangtools.yang.binding.YangModuleInfo; import org.opendaylight.yangtools.yang.binding.util.BindingReflections; @@ -54,24 +51,24 @@ public abstract class AbstractDataChangeListenerTest { @Before public final void setup() throws Exception { - YangModuleInfo moduleInfo = BindingReflections + final YangModuleInfo moduleInfo = BindingReflections .getModuleInfo(TwoLevelList.class); - ModuleInfoBackedContext context = ModuleInfoBackedContext.create(); + final ModuleInfoBackedContext context = ModuleInfoBackedContext.create(); context.registerModuleInfo(moduleInfo); - schemaContext = context.tryToCreateSchemaContext().get(); + this.schemaContext = context.tryToCreateSchemaContext().get(); - dclExecutorService = new TestDCLExecutorService( - SpecialExecutors.newBlockingBoundedFastThreadPool(1, 10, "DCL" )); + this.dclExecutorService = new TestDCLExecutorService( + SpecialExecutors.newBlockingBoundedFastThreadPool(1, 10, "DCL", + AbstractDataChangeListenerTest.class)); - datastore = new InMemoryDOMDataStore("TEST", - MoreExecutors.sameThreadExecutor(), dclExecutorService ); - datastore.onGlobalContextUpdated(schemaContext); + this.datastore = new InMemoryDOMDataStore("TEST", this.dclExecutorService); + this.datastore.onGlobalContextUpdated(this.schemaContext); } @After public void tearDown() { - if( dclExecutorService != null ) { - dclExecutorService.shutdownNow(); + if (this.dclExecutorService != null) { + this.dclExecutorService.shutdownNow(); } } @@ -83,7 +80,7 @@ public abstract class AbstractDataChangeListenerTest { * children. */ public final DatastoreTestTask newTestTask() { - return new DatastoreTestTask(datastore, dclExecutorService).cleanup(DatastoreTestTask + return new DatastoreTestTask(this.datastore, this.dclExecutorService).cleanup(DatastoreTestTask .simpleDelete(TOP_LEVEL)); } @@ -117,26 +114,26 @@ public abstract class AbstractDataChangeListenerTest { } protected static void assertContains(final Collection set, final K... values) { - for (K key : values) { + for (final K key : values) { Assert.assertTrue(set.contains(key)); } } - protected static void assertNotContains(final Collection set, final K... values) { - for (K key : values) { - Assert.assertFalse(set.contains(key)); + protected static void assertContains(final Map map, final K... values) { + for (final K key : values) { + Assert.assertTrue(map.containsKey(key)); } } - protected static void assertContains(final Map map, final K... values) { - for (K key : values) { - Assert.assertTrue(map.containsKey(key)); + protected static void assertNotContains(final Collection set, final K... values) { + for (final K key : values) { + Assert.assertFalse(set.contains(key)); } } protected static void assertNotContains(final Map map, final K... values) { - for (K key : values) { + for (final K key : values) { Assert.assertFalse(map.containsKey(key)); } } @@ -163,8 +160,8 @@ public abstract class AbstractDataChangeListenerTest { public static final WriteTransactionCustomizer writeOneTopMultipleNested( final String topName, final String... nestedName) { - CollectionNodeBuilder nestedMapBuilder = nestedMap(); - for (String nestedItem : nestedName) { + final CollectionNodeBuilder nestedMapBuilder = nestedMap(); + for (final String nestedItem : nestedName) { nestedMapBuilder.addChild(nestedList(nestedItem).build()); }