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
9 package org.opendaylight.protocol.bgp.openconfig.spi;
11 import static org.junit.Assert.assertTrue;
13 import java.util.Collections;
14 import java.util.List;
15 import org.junit.Assert;
16 import org.junit.Test;
17 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4UNICAST;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.UnicastSubsequentAddressFamily;
20 import org.opendaylight.yangtools.concepts.AbstractRegistration;
22 public class BGPTableTypeRegistryProviderActivatorTest {
25 public void testBGPTableTypeRegistryProviderActivator() {
26 final AbstractBGPTableTypeRegistryProviderActivator activator =
27 new AbstractBGPTableTypeRegistryProviderActivator() {
29 protected List<AbstractRegistration> startBGPTableTypeRegistryProviderImpl(
30 final BGPTableTypeRegistryProvider provider) {
31 return Collections.singletonList(provider.registerBGPTableType(Ipv4AddressFamily.class,
32 UnicastSubsequentAddressFamily.class, IPV4UNICAST.class));
36 final SimpleBGPTableTypeRegistryProvider provider = new SimpleBGPTableTypeRegistryProvider();
37 activator.startBGPTableTypeRegistryProvider(provider);
38 assertTrue(provider.getTableType(IPV4UNICAST.class).isPresent());
39 activator.stopBGPTableTypeRegistryProvider();
40 Assert.assertFalse(provider.getTableType(IPV4UNICAST.class).isPresent());