X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fbinding%2Ftest%2FAbstractDataBrokerTest.java;h=35f0650985f4b2f41ab599407e52e07a7b6a7b22;hp=7f23ac26b6edc521557a412e25c2bca1a500ff71;hb=8a8de0bffed5b6c9b4ac821dfafa7e944c70ef9d;hpb=05565ac29ed2e05fef72379c2d84ca43c01799b2 diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/AbstractDataBrokerTest.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/AbstractDataBrokerTest.java index 7f23ac26b6..35f0650985 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/AbstractDataBrokerTest.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/AbstractDataBrokerTest.java @@ -7,59 +7,41 @@ */ package org.opendaylight.controller.md.sal.binding.test; -import static org.junit.Assert.assertEquals; - -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.common.api.TransactionStatus; -import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; -import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import com.google.common.util.concurrent.ListenableFuture; - -public class AbstractDataBrokerTest extends AbstractSchemaAwareTest { - - private DataBrokerTestCustomizer testCustomizer; - private DataBroker dataBroker; - private DOMDataBroker domBroker; - +/** + * AbstractDataBrokerTest. + * + * @deprecated Please now use the AbstractConcurrentDataBrokerTest instead of + * this. Normally in a well written test this should be a drop-in + * replacement. Instead of {@literal @}Override + * setupWithDataBroker(DataBroker dataBroker), please just use + * JUnit's {@literal @}Before before() { ... getDataBroker() }. Some + * tests which relied on the Test DataBroker being synchronous, + * contrary to its specification as well as the production + * implementation, may require changes to e.g. use get() on + * submit()'ed transaction to make the test wait before asserts. See + * also + * bug + * 7538 for more details. + */ +@Deprecated +public class AbstractDataBrokerTest extends AbstractBaseDataBrokerTest { @Override - protected void setupWithSchema(final SchemaContext context) { - testCustomizer = createDataBrokerTestCustomizer(); - dataBroker = testCustomizer.createDataBroker(); - domBroker = testCustomizer.createDOMDataBroker(); - testCustomizer.updateSchema(context); - setupWithDataBroker(dataBroker); - } - - protected void setupWithDataBroker(final DataBroker dataBroker) { - // Intentionally left No-op, subclasses may customize it - } - - protected DataBrokerTestCustomizer createDataBrokerTestCustomizer() { + protected AbstractDataBrokerTestCustomizer createDataBrokerTestCustomizer() { return new DataBrokerTestCustomizer(); } - public DataBroker getDataBroker() { - return dataBroker; - } - - public DOMDataBroker getDomBroker() { - return domBroker; + @Override + protected void setupWithSchema(SchemaContext context) { + super.setupWithSchema(context); + setupWithDataBroker(getDataBroker()); } - protected static final void assertCommit(final ListenableFuture> commit) { - try { - assertEquals(TransactionStatus.COMMITED,commit.get(500, TimeUnit.MILLISECONDS).getResult()); - } catch (InterruptedException | ExecutionException | TimeoutException e) { - throw new IllegalStateException(e); - } + protected void setupWithDataBroker(final DataBroker dataBroker) { + // Intentionally left No-op, subclasses may customize it } - }