*/
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
+ * <a href="https://bugs.opendaylight.org/show_bug.cgi?id=7538">bug
+ * 7538</a> 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<RpcResult<TransactionStatus>> 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
}
-
}