Code clean up
[bgpcep.git] / bgp / linkstate / src / test / java / org / opendaylight / protocol / bgp / linkstate / TableTypeActivatorTest.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
9 package org.opendaylight.protocol.bgp.linkstate;
10
11 import java.util.Optional;
12 import org.junit.Assert;
13 import org.junit.Test;
14 import org.opendaylight.protocol.bgp.linkstate.impl.TableTypeActivator;
15 import org.opendaylight.protocol.bgp.openconfig.spi.SimpleBGPTableTypeRegistryProvider;
16 import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl;
17 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.AfiSafiType;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.LinkstateAddressFamily;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.LinkstateSubsequentAddressFamily;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.BgpTableType;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.LINKSTATE;
22
23 public class TableTypeActivatorTest {
24
25     private static final BgpTableType LINKSTATE = new BgpTableTypeImpl(LinkstateAddressFamily.class,
26             LinkstateSubsequentAddressFamily.class);
27
28     @Test
29     public void testActivator() {
30         final TableTypeActivator tableTypeActivator = new TableTypeActivator();
31         final SimpleBGPTableTypeRegistryProvider registry = new SimpleBGPTableTypeRegistryProvider();
32         tableTypeActivator.startBGPTableTypeRegistryProvider(registry);
33
34         final Optional<Class<? extends AfiSafiType>> afiSafiType = registry.getAfiSafiType(LINKSTATE);
35         Assert.assertEquals(LINKSTATE.class, afiSafiType.get());
36         final Optional<BgpTableType> tableType = registry.getTableType(LINKSTATE.class);
37         Assert.assertEquals(LINKSTATE, tableType.get());
38
39         tableTypeActivator.stopBGPTableTypeRegistryProvider();
40         tableTypeActivator.close();
41     }
42
43 }