* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.statistics.services.direct.singlelayer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.math.BigInteger;
import java.util.Collections;
import java.util.List;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.impl.statistics.services.direct.AbstractDirectStatisticsServiceTest;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReplyBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartRequest;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class MeterDirectStatisticsServiceTest extends AbstractDirectStatisticsServiceTest {
- static final Long METER_NO = 1L;
+ static final Uint32 METER_NO = Uint32.ONE;
private MeterDirectStatisticsService service;
@Override
- public void setUp() throws Exception {
+ public void setUp() {
service = new MeterDirectStatisticsService(requestContextStack,
deviceContext,
convertorManager,
}
@Override
- public void testBuildRequestBody() throws Exception {
+ public void testBuildRequestBody() {
final GetMeterStatisticsInput input = mock(GetMeterStatisticsInput.class);
- when(input.getNode()).thenReturn(createNodeRef(NODE_ID));
+ lenient().when(input.getNode()).thenReturn(createNodeRef(NODE_ID));
when(input.getMeterId()).thenReturn(new MeterId(METER_NO));
final MultipartRequestMeterStats body = (MultipartRequestMeterStats) ((MultipartRequest) service
- .buildRequest(new Xid(42L), input))
+ .buildRequest(new Xid(Uint32.valueOf(42L)), input))
.getMultipartRequestBody();
- assertEquals(METER_NO, body.getMeterId().getValue());
+ assertEquals(METER_NO, body.getStatMeterId().getValue());
}
@Override
- public void testBuildReply() throws Exception {
+ public void testBuildReply() {
final MeterStats meterStat = new MeterStatsBuilder()
.setMeterId(new MeterId(METER_NO))
.setByteInCount(new Counter64(BigInteger.ONE))
}
@Override
- public void testStoreStatistics() throws Exception {
+ public void testStoreStatistics() {
final org.opendaylight.yang.gen.v1.urn
.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats stat =
mock(org.opendaylight.yang.gen.v1.urn
when(stat.getMeterId()).thenReturn(new MeterId(METER_NO));
final List<org.opendaylight.yang.gen.v1.urn
- .opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats> stats = Collections.singletonList(stat);
+ .opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats>
+ stats = Collections.singletonList(stat);
final GetMeterStatisticsOutput output = mock(GetMeterStatisticsOutput.class);
when(output.getMeterStats()).thenReturn(stats);