2 * Copyright (c) 2016 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.groupbasedpolicy.neutron.mapper.test;
10 import static org.mockito.Matchers.any;
11 import static org.mockito.Mockito.mock;
12 import static org.mockito.Mockito.when;
14 import com.google.common.collect.ImmutableList;
16 import java.util.Collection;
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;
29 * Loads only modules of GBP and it's dependencies for data broker.
31 * Therefore this implementation is faster than {@link AbstractDataBrokerTest}
33 public class NeutronMapperDataBrokerTest extends CustomDataBrokerTest {
36 public Collection<Class<?>> getClassesFromModules() {
37 return ImmutableList.<Class<?>>of(Neutron.class, Tenants.class, Forwarding.class, SubnetAugmentForwarding.class,
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)))
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)))