apply checkstyle check during build for neutron-mapper
[groupbasedpolicy.git] / neutron-mapper / src / test / java / org / opendaylight / groupbasedpolicy / neutron / mapper / test / NeutronMapperDataBrokerTest.java
1 /*
2  * Copyright (c) 2016 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.groupbasedpolicy.neutron.mapper.test;
9
10 import static org.mockito.Matchers.any;
11 import static org.mockito.Mockito.mock;
12 import static org.mockito.Mockito.when;
13
14 import com.google.common.collect.ImmutableList;
15
16 import java.util.Collection;
17
18 import org.opendaylight.controller.md.sal.binding.test.AbstractDataBrokerTest;
19 import org.opendaylight.groupbasedpolicy.neutron.mapper.EndpointRegistrator;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.RegisterEndpointInput;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.UnregisterEndpointInput;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.forwarding.l2_l3.rev170511.SubnetAugmentForwarding;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.forwarding.rev160427.Forwarding;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.Mappings;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.Tenants;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;
27
28 /**
29  * Loads only modules of GBP and it's dependencies for data broker.
30  * <br>
31  * Therefore this implementation is faster than {@link AbstractDataBrokerTest}
32  */
33 public class NeutronMapperDataBrokerTest extends CustomDataBrokerTest {
34
35     @Override
36     public Collection<Class<?>> getClassesFromModules() {
37         return ImmutableList.<Class<?>>of(Neutron.class, Tenants.class, Forwarding.class, SubnetAugmentForwarding.class,
38                 Mappings.class);
39     }
40
41     @SuppressWarnings("checkstyle:LineLength") // Longer lines in this method are caused by long package names,
42                                                // this will be removed when deprecated classes will be cleared.
43     protected EndpointRegistrator getEpRegistrator() {
44         EndpointRegistrator epRegistrator = mock(EndpointRegistrator.class);
45         when(epRegistrator.registerEndpoint(any(RegisterEndpointInput.class))).thenReturn(true);
46         when(epRegistrator.registerEndpoint(
47             any(org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.RegisterEndpointInput.class)))
48             .thenReturn(true);
49         when(epRegistrator.unregisterEndpoint(any(UnregisterEndpointInput.class))).thenReturn(true);
50         when(epRegistrator.unregisterEndpoint(
51             any(org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.UnregisterEndpointInput.class)))
52             .thenReturn(true);
53         return epRegistrator;
54     }
55 }