Enforce checkstyle for unit test codes
- First time contributer is likely to start with unit-test code,
so it is probably better to enforce the ONOS code style for
unit test codes also.
Change-Id: Id665e55b0f0bee7232dfb18ce6a7f9ea8cc3b164
diff --git a/src/test/java/net/onrc/onos/apps/proxyarp/ProxyArpManagerTest.java b/src/test/java/net/onrc/onos/apps/proxyarp/ProxyArpManagerTest.java
index f0ebc7a..a38a90b 100644
--- a/src/test/java/net/onrc/onos/apps/proxyarp/ProxyArpManagerTest.java
+++ b/src/test/java/net/onrc/onos/apps/proxyarp/ProxyArpManagerTest.java
@@ -259,7 +259,8 @@
packetService.registerPacketListener(arpManager);
EasyMock.expectLastCall();
EasyMock.expect(topologyService.getTopology()).andReturn(topology);
- EasyMock.expect(datagridService.addListener((String) EasyMock.anyObject(), EasyMock.isA(IEventChannelListener.class),
+ EasyMock.expect(datagridService.addListener(EasyMock.<String>anyObject(),
+ EasyMock.isA(IEventChannelListener.class),
(Class) EasyMock.anyObject(), (Class) EasyMock.anyObject())).andReturn(eg).anyTimes();
List<ArpCacheNotification> list = new ArrayList<ArpCacheNotification>();
EasyMock.expect(eg.getAllEntries()).andReturn(list);
@@ -280,8 +281,10 @@
Map<String, String> config = new HashMap<String, String>();
EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
- EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
+ EasyMock.replay(context, floodligthProviderService, configInfoService,
+ restApiService, datagridService, flowPusherService,
+ topologyService, onosDeviceService, packetService, topology, eg,
+ el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
assertEquals(defaultStrAgingMsec, String.valueOf(arpManager.getArpEntryTimeout()));
@@ -297,8 +300,10 @@
config.put("cleanupmsec", strCleanupMsec);
EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
- EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
+ EasyMock.replay(context, floodligthProviderService, configInfoService,
+ restApiService, datagridService, flowPusherService,
+ topologyService, onosDeviceService, packetService, topology,
+ eg, el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
assertEquals(defaultStrAgingMsec, String.valueOf(arpManager.getArpEntryTimeout()));
@@ -313,8 +318,10 @@
configMap.put("cleanupmsec", strCleanupMsec);
EasyMock.expect(context.getConfigParams(arpManager)).andReturn(configMap);
- EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
+ EasyMock.replay(context, floodligthProviderService, configInfoService,
+ restApiService, datagridService, flowPusherService,
+ topologyService, onosDeviceService, packetService, topology,
+ eg, el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
assertEquals(strAgingMsec, String.valueOf(arpManager.getArpEntryTimeout()));
@@ -326,8 +333,10 @@
Map<String, String> config = new HashMap<String, String>();
EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
- EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
+ EasyMock.replay(context, floodligthProviderService, configInfoService,
+ restApiService, datagridService, flowPusherService,
+ topologyService, onosDeviceService, packetService, topology,
+ eg, el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
MACAddress mac = arpManager.getMacAddress(cachedIp1);
@@ -339,8 +348,10 @@
Map<String, String> config = new HashMap<String, String>();
EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
- EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
+ EasyMock.replay(context, floodligthProviderService, configInfoService,
+ restApiService, datagridService, flowPusherService,
+ topologyService, onosDeviceService, packetService, topology,
+ eg, el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
List<String> list = arpManager.getMappings();
@@ -354,8 +365,10 @@
Map<String, String> config = new HashMap<String, String>();
EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
- EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
+ EasyMock.replay(context, floodligthProviderService, configInfoService,
+ restApiService, datagridService, flowPusherService,
+ topologyService, onosDeviceService, packetService, topology,
+ eg, el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
arpManager.receive(sw1, inPort1, ethRarpRequest);
@@ -368,8 +381,10 @@
prepareExpectForLearnArp();
- EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
+ EasyMock.replay(context, floodligthProviderService, configInfoService,
+ restApiService, datagridService, flowPusherService,
+ topologyService, onosDeviceService, packetService, topology,
+ eg, el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
arpManager.receive(sw1, inPort1, ethArpOtherOp);
@@ -388,8 +403,10 @@
EasyMock.expectLastCall();
EasyMock.expect(context.getServiceImpl(IDatagridService.class)).andReturn(datagridService);
- EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
+ EasyMock.replay(context, floodligthProviderService, configInfoService,
+ restApiService, datagridService, flowPusherService,
+ topologyService, onosDeviceService, packetService, topology,
+ eg, el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
arpManager.receive(sw1, inPort1, ethArpReply);
@@ -405,8 +422,10 @@
EasyMock.expect(configInfoService.fromExternalNetwork(EasyMock.anyLong(), EasyMock.anyShort())).andReturn(true);
EasyMock.expect(configInfoService.isInterfaceAddress(dstIp)).andReturn(false);
- EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
+ EasyMock.replay(context, floodligthProviderService, configInfoService,
+ restApiService, datagridService, flowPusherService,
+ topologyService, onosDeviceService, packetService, topology,
+ eg, el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
arpManager.receive(sw1, inPort1, ethArpRequest);
@@ -422,7 +441,8 @@
prepareExpectForLearnArp();
- EasyMock.expect(configInfoService.fromExternalNetwork(EasyMock.anyLong(), EasyMock.anyShort())).andReturn(false);
+ EasyMock.expect(configInfoService.fromExternalNetwork(
+ EasyMock.anyLong(), EasyMock.anyShort())).andReturn(false);
topology.acquireReadLock();
EasyMock.expectLastCall();
EasyMock.expect(topology.getDeviceByMac(dstMac)).andReturn(dev1);
diff --git a/src/test/java/net/onrc/onos/apps/sdnip/PrefixTest.java b/src/test/java/net/onrc/onos/apps/sdnip/PrefixTest.java
index a000564..cee6898 100644
--- a/src/test/java/net/onrc/onos/apps/sdnip/PrefixTest.java
+++ b/src/test/java/net/onrc/onos/apps/sdnip/PrefixTest.java
@@ -65,11 +65,12 @@
assertEquals(p1.hashCode(), p3.hashCode());
}
+ private static final int MAX_PREFIX_LENGTH = 32;
+
@Test
public void testPrefixReturnsSame() {
//Create a prefix of all 1s for each prefix length.
//Check that Prefix doesn't mangle it
- final int MAX_PREFIX_LENGTH = 32;
for (int prefixLength = 1; prefixLength <= MAX_PREFIX_LENGTH; prefixLength++) {
byte[] address = new byte[MAX_PREFIX_LENGTH / Byte.SIZE];