X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=pcep%2Ftunnel-provider%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fpcep%2Ftunnel%2Fprovider%2FPCEPTunnelTopologyProviderModuleTest.java;h=453bd7b5b61c7e72d6c36588bdfd459ee18eb7df;hb=790ecddbf2b65678496b894721bc986f7eda1ac1;hp=5fa6903dc98cb5388665b0a62292539b385c79e2;hpb=21af5ef1c1cf1bb15f2751dcd5952671d5954be9;p=bgpcep.git diff --git a/pcep/tunnel-provider/src/test/java/org/opendaylight/controller/config/yang/pcep/tunnel/provider/PCEPTunnelTopologyProviderModuleTest.java b/pcep/tunnel-provider/src/test/java/org/opendaylight/controller/config/yang/pcep/tunnel/provider/PCEPTunnelTopologyProviderModuleTest.java index 5fa6903dc9..453bd7b5b6 100644 --- a/pcep/tunnel-provider/src/test/java/org/opendaylight/controller/config/yang/pcep/tunnel/provider/PCEPTunnelTopologyProviderModuleTest.java +++ b/pcep/tunnel-provider/src/test/java/org/opendaylight/controller/config/yang/pcep/tunnel/provider/PCEPTunnelTopologyProviderModuleTest.java @@ -9,8 +9,12 @@ package org.opendaylight.controller.config.yang.pcep.tunnel.provider; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; + +import io.netty.channel.nio.NioEventLoopGroup; +import java.util.Collections; import java.util.List; import javax.management.ObjectName; +import org.junit.Before; import org.junit.Test; import org.opendaylight.controller.config.api.ValidationException; import org.opendaylight.controller.config.api.jmx.CommitStatus; @@ -18,14 +22,19 @@ import org.opendaylight.controller.config.spi.ModuleFactory; import org.opendaylight.controller.config.util.ConfigTransactionJMXClient; import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleFactory; import org.opendaylight.controller.config.yang.pcep.impl.PCEPDispatcherImplModuleFactory; -import org.opendaylight.controller.config.yang.pcep.impl.PCEPSessionProposalFactoryImplModuleFactory; -import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory; -import org.opendaylight.controller.config.yang.pcep.stateful07.cfg.PCEPStatefulCapabilityModuleFactory; import org.opendaylight.controller.config.yang.pcep.topology.provider.PCEPTopologyProviderModuleFactory; import org.opendaylight.controller.config.yang.pcep.topology.provider.PCEPTopologyProviderModuleMXBean; import org.opendaylight.controller.config.yang.pcep.topology.provider.PCEPTopologyProviderModuleTest; import org.opendaylight.controller.config.yang.pcep.topology.provider.Stateful07TopologySessionListenerModuleFactory; import org.opendaylight.controller.config.yang.programming.impl.AbstractInstructionSchedulerTest; +import org.opendaylight.protocol.pcep.PCEPDispatcher; +import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory; +import org.opendaylight.protocol.pcep.ietf.stateful07.PCEPStatefulCapability; +import org.opendaylight.protocol.pcep.impl.BasePCEPSessionProposalFactory; +import org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory; +import org.opendaylight.protocol.pcep.impl.PCEPDispatcherImpl; +import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext; +import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId; public class PCEPTunnelTopologyProviderModuleTest extends AbstractInstructionSchedulerTest { @@ -35,6 +44,21 @@ public class PCEPTunnelTopologyProviderModuleTest extends AbstractInstructionSch private static final TopologyId TOPOLOGY_ID = new TopologyId("pcep-topology"); + @Override + @Before + public void setUp() throws Exception { + super.setUp(); + + SimplePCEPExtensionProviderContext extContext = new SimplePCEPExtensionProviderContext(); + setupMockService(PCEPExtensionProviderContext.class, extContext); + BasePCEPSessionProposalFactory proposalFactory = new BasePCEPSessionProposalFactory(120, 30, + Collections.singletonList(new PCEPStatefulCapability(true, true, true, true, true, true, true))); + setupMockService(PCEPSessionProposalFactory.class, proposalFactory); + NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup(); + setupMockService(PCEPDispatcher.class, new PCEPDispatcherImpl(extContext.getMessageHandlerRegistry(), + new DefaultPCEPSessionNegotiatorFactory(proposalFactory, 5), eventLoopGroup, eventLoopGroup)); + } + @Test public void testValidationExceptionTopologyIdNotSet() throws Exception { try { @@ -49,7 +73,7 @@ public class PCEPTunnelTopologyProviderModuleTest extends AbstractInstructionSch public void testCreateBean() throws Exception { final CommitStatus status = createInstance(); assertBeanCount(1, FACTORY_NAME); - assertStatus(status, 18, 0, 0); + assertStatus(status, 14, 0, 0); } @Test @@ -59,7 +83,7 @@ public class PCEPTunnelTopologyProviderModuleTest extends AbstractInstructionSch assertBeanCount(1, FACTORY_NAME); final CommitStatus status = transaction.commit(); assertBeanCount(1, FACTORY_NAME); - assertStatus(status, 0, 0, 18); + assertStatus(status, 0, 0, 14); } @Test @@ -72,7 +96,7 @@ public class PCEPTunnelTopologyProviderModuleTest extends AbstractInstructionSch mxBean.setTopologyId(new TopologyId("new-pcep-topology")); final CommitStatus status = transaction.commit(); assertBeanCount(1, FACTORY_NAME); - assertStatus(status, 0, 1, 17); + assertStatus(status, 0, 1, 13); } private CommitStatus createInstance(final TopologyId topologyId) throws Exception { @@ -113,11 +137,8 @@ public class PCEPTunnelTopologyProviderModuleTest extends AbstractInstructionSch moduleFactories.add(new PCEPTunnelTopologyProviderModuleFactory()); moduleFactories.add(new PCEPTopologyProviderModuleFactory()); moduleFactories.add(new PCEPDispatcherImplModuleFactory()); - moduleFactories.add(new PCEPSessionProposalFactoryImplModuleFactory()); moduleFactories.add(new NettyThreadgroupModuleFactory()); - moduleFactories.add(new SimplePCEPExtensionProviderContextModuleFactory()); moduleFactories.add(new Stateful07TopologySessionListenerModuleFactory()); - moduleFactories.add(new PCEPStatefulCapabilityModuleFactory()); return moduleFactories; }