Search in sources :

Example 1 with MessageRegistry

use of org.opendaylight.protocol.pcep.spi.MessageRegistry in project bgpcep by opendaylight.

the class PCEPDispatcherImplTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    final List<PCEPCapability> capList = new ArrayList<>();
    final PCEPSessionProposalFactory sessionProposal = new BasePCEPSessionProposalFactory(DEAD_TIMER, KEEP_ALIVE, capList);
    final EventLoopGroup eventLoopGroup;
    if (Epoll.isAvailable()) {
        eventLoopGroup = new EpollEventLoopGroup();
    } else {
        eventLoopGroup = new NioEventLoopGroup();
    }
    final MessageRegistry msgReg = ServiceLoaderPCEPExtensionProviderContext.getSingletonInstance().getMessageHandlerRegistry();
    this.dispatcher = new PCEPDispatcherImpl(msgReg, new DefaultPCEPSessionNegotiatorFactory(sessionProposal, 0), eventLoopGroup, eventLoopGroup);
    doReturn(KeyMapping.getKeyMapping()).when(this.dispatcherDependencies).getKeys();
    doReturn(null).when(this.dispatcherDependencies).getPeerProposal();
    doReturn("mockChannel").when(this.mockChannel).toString();
    final PCEPDispatcherImpl dispatcher2 = new PCEPDispatcherImpl(msgReg, new DefaultPCEPSessionNegotiatorFactory(sessionProposal, 0), eventLoopGroup, eventLoopGroup);
    this.disp2Spy = Mockito.spy(dispatcher2);
    this.pccMock = new PCCMock(new DefaultPCEPSessionNegotiatorFactory(sessionProposal, 0), new PCEPHandlerFactory(msgReg));
}
Also used : ArrayList(java.util.ArrayList) PCEPSessionProposalFactory(org.opendaylight.protocol.pcep.PCEPSessionProposalFactory) EpollEventLoopGroup(io.netty.channel.epoll.EpollEventLoopGroup) EventLoopGroup(io.netty.channel.EventLoopGroup) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) EpollEventLoopGroup(io.netty.channel.epoll.EpollEventLoopGroup) MessageRegistry(org.opendaylight.protocol.pcep.spi.MessageRegistry) PCEPCapability(org.opendaylight.protocol.pcep.PCEPCapability) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) Before(org.junit.Before)

Aggregations

EventLoopGroup (io.netty.channel.EventLoopGroup)1 EpollEventLoopGroup (io.netty.channel.epoll.EpollEventLoopGroup)1 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)1 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1 PCEPCapability (org.opendaylight.protocol.pcep.PCEPCapability)1 PCEPSessionProposalFactory (org.opendaylight.protocol.pcep.PCEPSessionProposalFactory)1 MessageRegistry (org.opendaylight.protocol.pcep.spi.MessageRegistry)1