Bug 6859 - Binding generator v1 refactoring
[controller.git] / opendaylight / md-sal / sal-inmemory-datastore / src / test / java / org / opendaylight / controller / md / sal / dom / store / impl / SchemaUpdateForTransactionTest.java
index 364712c7b393ba87ee1d4900e9b3fab9fed41185..9910039e2e187f012b235ea43fb3afb4e64d932a 100644 (file)
@@ -8,24 +8,21 @@
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
 import static org.junit.Assert.assertNotNull;
-
+import com.google.common.base.Throwables;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.concurrent.ExecutionException;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
+import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.bi.ba.rpcservice.rev140701.RockTheHouseInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top;
-import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
-import com.google.common.base.Throwables;
-import com.google.common.util.concurrent.MoreExecutors;
-
 public class SchemaUpdateForTransactionTest {
 
     private static final YangInstanceIdentifier TOP_PATH = YangInstanceIdentifier.of(Top.QNAME);
@@ -34,23 +31,22 @@ public class SchemaUpdateForTransactionTest {
 
     @Before
     public void setupStore() {
-        domStore = new InMemoryDOMDataStore("TEST", MoreExecutors.sameThreadExecutor(),
-                MoreExecutors.sameThreadExecutor());
+        this.domStore = new InMemoryDOMDataStore("TEST", MoreExecutors.newDirectExecutorService());
         loadSchemas(RockTheHouseInput.class);
     }
 
     public void loadSchemas(final Class<?>... classes) {
         YangModuleInfo moduleInfo;
         try {
-            ModuleInfoBackedContext context = ModuleInfoBackedContext.create();
-            for (Class<?> clz : classes) {
+            final ModuleInfoBackedContext context = ModuleInfoBackedContext.create();
+            for (final Class<?> clz : classes) {
                 moduleInfo = BindingReflections.getModuleInfo(clz);
 
                 context.registerModuleInfo(moduleInfo);
             }
-            schemaContext = context.tryToCreateSchemaContext().get();
-            domStore.onGlobalContextUpdated(schemaContext);
-        } catch (Exception e) {
+            this.schemaContext = context.tryToCreateSchemaContext().get();
+            this.domStore.onGlobalContextUpdated(this.schemaContext);
+        } catch (final Exception e) {
             Throwables.propagateIfPossible(e);
         }
     }
@@ -72,11 +68,11 @@ public class SchemaUpdateForTransactionTest {
     @Test
     public void testTransactionSchemaUpdate() throws InterruptedException, ExecutionException {
 
-        assertNotNull(domStore);
+        assertNotNull(this.domStore);
 
         // We allocate transaction, initial schema context does not
         // contain Lists model
-        DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
+        final DOMStoreReadWriteTransaction writeTx = this.domStore.newReadWriteTransaction();
         assertNotNull(writeTx);
 
         // we trigger schema context update to contain Lists model