/* * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.groupbasedpolicy.neutron.mapper.test; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import com.google.common.collect.ImmutableList; import java.util.Collection; import org.opendaylight.controller.md.sal.binding.test.AbstractDataBrokerTest; import org.opendaylight.groupbasedpolicy.neutron.mapper.EndpointRegistrator; import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.RegisterEndpointInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.UnregisterEndpointInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.forwarding.l2_l3.rev170511.SubnetAugmentForwarding; import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.forwarding.rev160427.Forwarding; import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.Mappings; import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.Tenants; import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron; /** * Loads only modules of GBP and it's dependencies for data broker. *
* Therefore this implementation is faster than {@link AbstractDataBrokerTest} */ public class NeutronMapperDataBrokerTest extends CustomDataBrokerTest { @Override public Collection> getClassesFromModules() { return ImmutableList.>of(Neutron.class, Tenants.class, Forwarding.class, SubnetAugmentForwarding.class, Mappings.class); } @SuppressWarnings("checkstyle:LineLength") // Longer lines in this method are caused by long package names, // this will be removed when deprecated classes will be cleared. protected EndpointRegistrator getEpRegistrator() { EndpointRegistrator epRegistrator = mock(EndpointRegistrator.class); when(epRegistrator.registerEndpoint(any(RegisterEndpointInput.class))).thenReturn(true); when(epRegistrator.registerEndpoint( any(org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.RegisterEndpointInput.class))) .thenReturn(true); when(epRegistrator.unregisterEndpoint(any(UnregisterEndpointInput.class))).thenReturn(true); when(epRegistrator.unregisterEndpoint( any(org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.UnregisterEndpointInput.class))) .thenReturn(true); return epRegistrator; } }