Fix checkstyle in mdsal-binding-dom-adapter
[mdsal.git] / binding / mdsal-binding-dom-adapter / src / test / java / org / opendaylight / mdsal / binding / dom / adapter / test / AbstractDataBrokerTest.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mdsal.binding.dom.adapter.test;
9
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;
17
18 public class AbstractDataBrokerTest extends AbstractSchemaAwareTest {
19
20     private DataBrokerTestCustomizer testCustomizer;
21     private DataBroker dataBroker;
22     private DOMDataBroker domBroker;
23
24
25     @Override
26     protected void setupWithSchema(final SchemaContext context) {
27         testCustomizer = createDataBrokerTestCustomizer();
28         dataBroker = testCustomizer.createDataBroker();
29         domBroker = testCustomizer.createDOMDataBroker();
30         testCustomizer.updateSchema(context);
31         setupWithDataBroker(dataBroker);
32     }
33
34     protected void setupWithDataBroker(final DataBroker dataBroker) {
35         // Intentionally left No-op, subclasses may customize it
36     }
37
38     protected DataBrokerTestCustomizer createDataBrokerTestCustomizer() {
39         return new DataBrokerTestCustomizer();
40     }
41
42     public DataBroker getDataBroker() {
43         return dataBroker;
44     }
45
46     public DOMDataBroker getDomBroker() {
47         return domBroker;
48     }
49
50     protected static final void assertCommit(final ListenableFuture<Void> commit) {
51         try {
52             commit.get(500, TimeUnit.MILLISECONDS);
53         } catch (InterruptedException | ExecutionException | TimeoutException e) {
54             throw new IllegalStateException(e);
55         }
56     }
57
58
59 }