Refactor AbstractDataBrokerTestCustomizer
[mdsal.git] / binding / mdsal-binding-dom-adapter / src / test / java / org / opendaylight / mdsal / binding / dom / adapter / test / AbstractNotificationBrokerTest.java
1 /*
2  * Copyright (c) 2015 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 org.opendaylight.mdsal.binding.api.NotificationPublishService;
11 import org.opendaylight.mdsal.binding.api.NotificationService;
12 import org.opendaylight.mdsal.binding.dom.adapter.AdapterContext;
13 import org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeContext;
14 import org.opendaylight.mdsal.dom.broker.DOMNotificationRouter;
15
16 public class AbstractNotificationBrokerTest extends AbstractSchemaAwareTest {
17     private AdapterContext bindingToNormalizedNodeCodec;
18     private DOMNotificationRouter domNotificationRouter;
19     private NotificationService notificationService;
20     private NotificationPublishService notificationPublishService;
21
22
23     @Override
24     protected void setupWithRuntimeContext(final BindingRuntimeContext runtimeContext) {
25         final DataBrokerTestCustomizer testCustomizer = createDataBrokerTestCustomizer();
26         domNotificationRouter = testCustomizer.getDomNotificationRouter();
27         notificationService = testCustomizer.createNotificationService();
28         notificationPublishService = testCustomizer.createNotificationPublishService();
29         bindingToNormalizedNodeCodec = testCustomizer.getAdapterContext();
30         testCustomizer.updateSchema(runtimeContext);
31         super.setupWithRuntimeContext(runtimeContext);
32     }
33
34     protected DataBrokerTestCustomizer createDataBrokerTestCustomizer() {
35         return new DataBrokerTestCustomizer();
36     }
37
38     public NotificationService getNotificationService() {
39         return notificationService;
40     }
41
42     public NotificationPublishService getNotificationPublishService() {
43         return notificationPublishService;
44     }
45
46     public DOMNotificationRouter getDomNotificationRouter() {
47         return domNotificationRouter;
48     }
49
50     public AdapterContext getBindingToNormalizedNodeCodec() {
51         return bindingToNormalizedNodeCodec;
52     }
53 }