X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=olm%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Folm%2Fpower%2FPowerMgmtTest.java;h=21ffdcfba91b97e690e1147946591b92e60a1fe3;hb=48bc79b22b6350e16e6919172a8bce3b6881bc47;hp=d49588e833902c1ecc8a9d2bee0119969bd56df6;hpb=c72df380a231df4cadf26101d530b648ffc6ad85;p=transportpce.git diff --git a/olm/src/test/java/org/opendaylight/transportpce/olm/power/PowerMgmtTest.java b/olm/src/test/java/org/opendaylight/transportpce/olm/power/PowerMgmtTest.java index d49588e83..21ffdcfba 100644 --- a/olm/src/test/java/org/opendaylight/transportpce/olm/power/PowerMgmtTest.java +++ b/olm/src/test/java/org/opendaylight/transportpce/olm/power/PowerMgmtTest.java @@ -11,9 +11,9 @@ package org.opendaylight.transportpce.olm.power; import java.util.List; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.mockito.Mockito; +import org.opendaylight.mdsal.binding.api.DataBroker; import org.opendaylight.mdsal.binding.api.MountPoint; import org.opendaylight.mdsal.binding.api.MountPointService; import org.opendaylight.transportpce.common.StringConstants; @@ -42,9 +42,7 @@ import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev17 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerTurndownInput; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId; -@Ignore public class PowerMgmtTest extends AbstractTest { - private MountPoint mountPoint; private MountPointService mountPointService; private DeviceTransactionManager deviceTransactionManager; @@ -59,13 +57,15 @@ public class PowerMgmtTest extends AbstractTest { private OpenRoadmInterfacesImpl221 openRoadmInterfacesImpl22; private PortMappingVersion221 portMappingVersion22; private PortMappingVersion121 portMappingVersion121; + private DataBroker dataBroker; @Before public void setUp() { - this.mountPoint = new MountPointStub(this.getDataBroker()); + dataBroker = this.getNewDataBroker(); + this.mountPoint = new MountPointStub(dataBroker); this.mountPointService = new MountPointServiceStub(mountPoint); // this.mappingUtils = new MappingUtilsImpl(getDataBroker()); - this.mappingUtils = Mockito.spy(new MappingUtilsImpl(getDataBroker())); + this.mappingUtils = Mockito.spy(new MappingUtilsImpl(dataBroker)); Mockito.doReturn(StringConstants.OPENROADM_DEVICE_VERSION_1_2_1).when(mappingUtils) .getOpenRoadmVersion(Mockito.anyString()); this.deviceTransactionManager = new DeviceTransactionManagerImpl(mountPointService, 3000); @@ -79,13 +79,13 @@ public class PowerMgmtTest extends AbstractTest { this.mappingUtils,this.openRoadmInterfacesImpl121,this.openRoadmInterfacesImpl22); this.openRoadmInterfaces = Mockito.spy(this.openRoadmInterfaces); this.portMappingVersion22 = - new PortMappingVersion221(getDataBroker(), deviceTransactionManager, this.openRoadmInterfaces); + new PortMappingVersion221(dataBroker, deviceTransactionManager, this.openRoadmInterfaces); this.portMappingVersion121 = - new PortMappingVersion121(getDataBroker(), deviceTransactionManager, this.openRoadmInterfaces); - this.portMapping = new PortMappingImpl(getDataBroker(), + new PortMappingVersion121(dataBroker, deviceTransactionManager, this.openRoadmInterfaces); + this.portMapping = new PortMappingImpl(dataBroker, this.portMappingVersion22, this.portMappingVersion121); this.portMapping = Mockito.spy(this.portMapping); - this.powerMgmt = new PowerMgmtImpl(this.getDataBroker(), this.openRoadmInterfaces, this.crossConnect, + this.powerMgmt = new PowerMgmtImpl(this.dataBroker, this.openRoadmInterfaces, this.crossConnect, this.deviceTransactionManager); } @@ -149,7 +149,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.getDataBroker(), null); + TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.dataBroker, null); Thread.sleep(1000); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput(); @@ -161,7 +161,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes2() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction2(nodeId.getValue(), this.getDataBroker(), null); + TransactionUtils.writeNodeTransaction2(nodeId.getValue(), this.dataBroker, null); Thread.sleep(500); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput(); @@ -173,7 +173,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes3() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction3(nodeId.getValue(), this.getDataBroker(), null); + TransactionUtils.writeNodeTransaction3(nodeId.getValue(), this.dataBroker, null); Thread.sleep(500); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput(); @@ -197,7 +197,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes312() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction3(nodeId.getValue(), this.getDataBroker(), "deg"); + TransactionUtils.writeNodeTransaction3(nodeId.getValue(), this.dataBroker, "deg"); Thread.sleep(500); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput4(); @@ -209,7 +209,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes32() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction3(nodeId.getValue(), this.getDataBroker(), null); + TransactionUtils.writeNodeTransaction3(nodeId.getValue(), this.dataBroker, null); Thread.sleep(500); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput3(); @@ -221,7 +221,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes4() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.getDataBroker(), "network"); + TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.dataBroker, "network"); Thread.sleep(500); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput2(); @@ -246,7 +246,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes42() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.getDataBroker(), "deg"); + TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.dataBroker, "deg"); Thread.sleep(500); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput3(); @@ -258,7 +258,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes422() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.getDataBroker(), "deg"); + TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.dataBroker, "deg"); Thread.sleep(500); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput4(); @@ -270,7 +270,7 @@ public class PowerMgmtTest extends AbstractTest { public void testSetPowerPresentNodes43() throws InterruptedException { List nodes = TransactionUtils.getNodeIds(); for (NodeId nodeId : nodes) { - TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.getDataBroker(), null); + TransactionUtils.writeNodeTransaction(nodeId.getValue(), this.dataBroker, null); Thread.sleep(500); } ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput3();