Remove unused routedRpcRegistration
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / statistics / services / OpendaylightFlowStatisticsServiceImpl3Test.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.openflowplugin.impl.statistics.services;
10
11 import org.junit.Test;
12 import org.mockito.Mock;
13 import org.mockito.Mockito;
14 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
15 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInput;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInputBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInput;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInputBuilder;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInput;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInputBuilder;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId;
26 import org.opendaylight.yangtools.yang.common.Uint16;
27 import org.opendaylight.yangtools.yang.common.Uint8;
28
29 /**
30  * Test for {@link OpendaylightFlowStatisticsServiceImpl} - only delegated methods.
31  */
32 public class OpendaylightFlowStatisticsServiceImpl3Test extends AbstractStatsServiceTest {
33
34     @Mock
35     private OpendaylightFlowStatisticsService flowStatisticsDelegate;
36
37     private OpendaylightFlowStatisticsServiceImpl flowStatisticsService;
38
39     @Override
40     public void setUp() {
41         final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
42         flowStatisticsService =
43                 OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager);
44         flowStatisticsService.setDelegate(flowStatisticsDelegate);
45     }
46
47     @Test
48     public void testGetAggregateFlowStatisticsFromFlowTableForAllFlows() {
49         GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input =
50                 new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder()
51                 .setNode(createNodeRef("unitProt:123"))
52                 .setTableId(new TableId(Uint8.ONE))
53                 .build();
54
55         flowStatisticsService.getAggregateFlowStatisticsFromFlowTableForAllFlows(input);
56         Mockito.verify(flowStatisticsDelegate).getAggregateFlowStatisticsFromFlowTableForAllFlows(input);
57     }
58
59     @Test
60     public void testGetAllFlowStatisticsFromFlowTable() {
61         GetAllFlowStatisticsFromFlowTableInput input = new GetAllFlowStatisticsFromFlowTableInputBuilder()
62                 .setNode(createNodeRef("unitProt:123"))
63                 .setTableId(new TableId(Uint8.ONE))
64                 .build();
65
66         flowStatisticsService.getAllFlowStatisticsFromFlowTable(input);
67         Mockito.verify(flowStatisticsDelegate).getAllFlowStatisticsFromFlowTable(input);
68     }
69
70     @Test
71     public void testGetAllFlowsStatisticsFromAllFlowTables() {
72         GetAllFlowsStatisticsFromAllFlowTablesInput input = new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder()
73                 .setNode(createNodeRef("unitProt:123"))
74                 .build();
75
76         flowStatisticsService.getAllFlowsStatisticsFromAllFlowTables(input);
77         Mockito.verify(flowStatisticsDelegate).getAllFlowsStatisticsFromAllFlowTables(input);
78     }
79
80     @Test
81     public void testGetFlowStatisticsFromFlowTable() {
82         GetFlowStatisticsFromFlowTableInput input = new GetFlowStatisticsFromFlowTableInputBuilder()
83                 .setNode(createNodeRef("unitProt:123"))
84                 .setPriority(Uint16.valueOf(5))
85                 .build();
86
87         flowStatisticsService.getFlowStatisticsFromFlowTable(input);
88         Mockito.verify(flowStatisticsDelegate).getFlowStatisticsFromFlowTable(input);
89     }
90 }