2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.mdsal.binding.dom.adapter.test;
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.concurrent.ExecutionException;
12 import java.util.concurrent.TimeUnit;
13 import java.util.concurrent.TimeoutException;
14 import org.opendaylight.mdsal.binding.api.DataBroker;
15 import org.opendaylight.mdsal.dom.api.DOMDataBroker;
16 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
18 public class AbstractDataBrokerTest extends AbstractSchemaAwareTest {
20 private DataBrokerTestCustomizer testCustomizer;
21 private DataBroker dataBroker;
22 private DOMDataBroker domBroker;
25 protected void setupWithSchema(final SchemaContext context) {
26 testCustomizer = createDataBrokerTestCustomizer();
27 dataBroker = testCustomizer.createDataBroker();
28 domBroker = testCustomizer.createDOMDataBroker();
29 testCustomizer.updateSchema(context);
30 setupWithDataBroker(dataBroker);
33 protected void setupWithDataBroker(final DataBroker broker) {
34 // Intentionally left No-op, subclasses may customize it
37 protected DataBrokerTestCustomizer createDataBrokerTestCustomizer() {
38 return new DataBrokerTestCustomizer();
41 public DataBroker getDataBroker() {
45 public DOMDataBroker getDomBroker() {
49 protected static final void assertCommit(final ListenableFuture<Void> commit) {
51 commit.get(500, TimeUnit.MILLISECONDS);
52 } catch (InterruptedException | ExecutionException | TimeoutException e) {
53 throw new IllegalStateException(e);