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.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlow;
import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
import org.opendaylight.yangtools.yang.common.Uint8;
public class FlowDirectStatisticsServiceTest extends AbstractDirectStatisticsServiceTest {
static final Uint8 TABLE_NO = Uint8.ONE;
- private FlowDirectStatisticsService service;
+ private MultiGetFlowStatistics service;
@Override
public void setUp() {
- service = new FlowDirectStatisticsService(requestContextStack,
+ service = new MultiGetFlowStatistics(requestContextStack,
deviceContext,
convertorManager,
multipartWriterProvider);
final MultipartReplyFlowCase flowCase = mock(MultipartReplyFlowCase.class);
final MultipartReplyFlow flow = mock(MultipartReplyFlow.class);
final FlowStats flowStat = new FlowStatsBuilder()
- .setDurationSec(1L)
- .setDurationNsec(1L)
+ .setDurationSec(Uint32.ONE)
+ .setDurationNsec(Uint32.ONE)
.setTableId(TABLE_NO)
- .setByteCount(BigInteger.ONE)
- .setPacketCount(BigInteger.ONE)
+ .setByteCount(Uint64.ONE)
+ .setPacketCount(Uint64.ONE)
.setFlags(mock(FlowModFlags.class))
.setMatch(new org.opendaylight.yang.gen.v1.urn
.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder()
- .setMatchEntry(Collections.emptyList())
+ .setMatchEntry(List.of())
.build())
.build();
- final List<FlowStats> flowStats = Collections.singletonList(flowStat);
- final List<MultipartReply> input = Collections.singletonList(reply);
+ final List<FlowStats> flowStats = List.of(flowStat);
+ final List<MultipartReply> input = List.of(reply);
when(flow.getFlowStats()).thenReturn(flowStats);
when(flowCase.getMultipartReplyFlow()).thenReturn(flow);
when(stat.getTableId()).thenReturn(TABLE_NO);
when(stat.getMatch()).thenReturn(new MatchBuilder().build());
- final List<FlowAndStatisticsMapList> stats = Collections.singletonList(stat);
+ final List<FlowAndStatisticsMapList> stats = List.of(stat);
final GetFlowStatisticsOutput output = mock(GetFlowStatisticsOutput.class);
when(output.nonnullFlowAndStatisticsMapList()).thenReturn(stats);
- multipartWriterProvider.lookup(MultipartType.OFPMPFLOW).get().write(output, true);
+ multipartWriterProvider.lookup(MultipartType.OFPMPFLOW).orElseThrow().write(output, true);
verify(deviceContext).writeToTransactionWithParentsSlow(eq(LogicalDatastoreType.OPERATIONAL), any(), any());
}
}