Fix codestyle
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / statistics / services / OpendaylightFlowStatisticsServiceImpl1Test.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 java.util.concurrent.Future;
12 import org.junit.Test;
13 import org.mockito.ArgumentCaptor;
14 import org.mockito.Captor;
15 import org.mockito.Mockito;
16 import org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext;
17 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
18 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInputBuilder;
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.GetFlowStatisticsFromFlowTableInputBuilder;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutput;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId;
26 import org.opendaylight.yangtools.yang.common.RpcResult;
27
28 /**
29  * Test for {@link OpendaylightFlowStatisticsServiceImpl} - only delegated methods (failing).
30  */
31 public class OpendaylightFlowStatisticsServiceImpl1Test extends AbstractStatsServiceTest {
32
33     @Captor
34     private ArgumentCaptor<MultipartRequestInput> requestInput;
35
36     private OpendaylightFlowStatisticsServiceImpl flowStatisticsService;
37
38     public void setUp() {
39         final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
40         flowStatisticsService =
41                 OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager);
42
43         AbstractRequestContext<Object> rqContext = new AbstractRequestContext<Object>(42L) {
44             @Override
45             public void close() {
46                 //NOOP
47             }
48         };
49         Mockito.when(rqContextStack.<Object>createRequestContext()).thenReturn(rqContext);
50     }
51
52     @Test(expected = IllegalAccessError.class)
53     public void testGetAggregateFlowStatisticsFromFlowTableForAllFlows() throws Exception {
54         GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder input =
55                 new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder()
56                 .setNode(createNodeRef("unitProt:123"))
57                 .setTableId(new TableId((short) 1));
58
59         flowStatisticsService.getAggregateFlowStatisticsFromFlowTableForAllFlows(input.build());
60     }
61
62     @Test(expected = IllegalAccessError.class)
63     public void testGetAllFlowStatisticsFromFlowTable() throws Exception {
64         GetAllFlowStatisticsFromFlowTableInputBuilder input = new GetAllFlowStatisticsFromFlowTableInputBuilder()
65                 .setNode(createNodeRef("unitProt:123"))
66                 .setTableId(new TableId((short) 1));
67
68         flowStatisticsService.getAllFlowStatisticsFromFlowTable(input.build());
69     }
70
71     @Test(expected = IllegalAccessError.class)
72     public void testGetAllFlowsStatisticsFromAllFlowTables() throws Exception {
73         GetAllFlowsStatisticsFromAllFlowTablesInputBuilder input =
74                 new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder()
75                 .setNode(createNodeRef("unitProt:123"));
76
77         flowStatisticsService.getAllFlowsStatisticsFromAllFlowTables(input.build());
78     }
79
80     @Test(expected = IllegalAccessError.class)
81     public void testGetFlowStatisticsFromFlowTable() throws Exception {
82         GetFlowStatisticsFromFlowTableInputBuilder input = new GetFlowStatisticsFromFlowTableInputBuilder()
83                 .setNode(createNodeRef("unitProt:123"))
84                 .setPriority(5);
85
86         final Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> resultFuture
87                 = flowStatisticsService.getFlowStatisticsFromFlowTable(input.build());
88     }
89 }