X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-inmemory-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fstore%2Fimpl%2FSchemaUpdateForTransactionTest.java;h=0b5598098595d16056a7d88ee766faf3ca6be996;hp=9910039e2e187f012b235ea43fb3afb4e64d932a;hb=c5f3be93482d6b06d95ebf22b2ef2723fd813f89;hpb=db89afdefb3cfa4454dfdc6008e1d54d3ede66fb diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/SchemaUpdateForTransactionTest.java b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/SchemaUpdateForTransactionTest.java index 9910039e2e..0b55980985 100644 --- a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/SchemaUpdateForTransactionTest.java +++ b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/SchemaUpdateForTransactionTest.java @@ -8,9 +8,8 @@ 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; @@ -30,25 +29,20 @@ public class SchemaUpdateForTransactionTest { private InMemoryDOMDataStore domStore; @Before - public void setupStore() { + public void setupStore() throws Exception { this.domStore = new InMemoryDOMDataStore("TEST", MoreExecutors.newDirectExecutorService()); loadSchemas(RockTheHouseInput.class); } - public void loadSchemas(final Class... classes) { - YangModuleInfo moduleInfo; - try { - final ModuleInfoBackedContext context = ModuleInfoBackedContext.create(); - for (final Class clz : classes) { - moduleInfo = BindingReflections.getModuleInfo(clz); + public void loadSchemas(final Class... classes) throws Exception { + final ModuleInfoBackedContext context = ModuleInfoBackedContext.create(); + for (final Class clz : classes) { + YangModuleInfo moduleInfo = BindingReflections.getModuleInfo(clz); - context.registerModuleInfo(moduleInfo); - } - this.schemaContext = context.tryToCreateSchemaContext().get(); - this.domStore.onGlobalContextUpdated(this.schemaContext); - } catch (final Exception e) { - Throwables.propagateIfPossible(e); + context.registerModuleInfo(moduleInfo); } + this.schemaContext = context.tryToCreateSchemaContext().get(); + this.domStore.onGlobalContextUpdated(this.schemaContext); } /** @@ -57,16 +51,14 @@ public class SchemaUpdateForTransactionTest { * then triggering update of global schema context * and then performing write (according to new module). * + *

* If transaction between allocation and schema context was * unmodified, it is safe to change its schema context * to new one (e.g. it will be same as if allocated after * schema context update.) - * - * @throws InterruptedException - * @throws ExecutionException */ @Test - public void testTransactionSchemaUpdate() throws InterruptedException, ExecutionException { + public void testTransactionSchemaUpdate() throws Exception { assertNotNull(this.domStore); @@ -78,15 +70,11 @@ public class SchemaUpdateForTransactionTest { // we trigger schema context update to contain Lists model loadSchemas(RockTheHouseInput.class, Top.class); - /** - * + /* * Writes /test in writeTx, this write should not fail * with IllegalArgumentException since /test is in * schema context. - * */ writeTx.write(TOP_PATH, ImmutableNodes.containerNode(Top.QNAME)); - } - }