Checkstyle fixes for tests
- Fixed some checkstyle errors which seemed easier to fix.
Change-Id: I9dadd2e8f98b560fadcc2b704ac52ff8f8b93913
diff --git a/src/test/java/net/onrc/onos/core/datastore/AtomicCounterTest.java b/src/test/java/net/onrc/onos/core/datastore/AtomicCounterTest.java
index 384cc03..c2d4aa3 100644
--- a/src/test/java/net/onrc/onos/core/datastore/AtomicCounterTest.java
+++ b/src/test/java/net/onrc/onos/core/datastore/AtomicCounterTest.java
@@ -1,6 +1,7 @@
package net.onrc.onos.core.datastore;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import java.util.ArrayList;
import java.util.List;
@@ -15,12 +16,6 @@
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
-import net.onrc.onos.core.datastore.DataStoreClient;
-import net.onrc.onos.core.datastore.IKVClient;
-import net.onrc.onos.core.datastore.IKVTableID;
-import net.onrc.onos.core.datastore.ObjectDoesntExistException;
-import net.onrc.onos.core.datastore.ObjectExistsException;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -84,7 +79,7 @@
.getProperty("AtomicCounterTest.NUM_THREADS", "3")));
class Incrementor implements Callable<Long> {
- private final ConcurrentMap<Long,Long> uniquenessTestSet;
+ private final ConcurrentMap<Long, Long> uniquenessTestSet;
private final ConcurrentLinkedQueue<Long> incrementTimes;
public Incrementor(ConcurrentMap<Long, Long> uniquenessTestSet, ConcurrentLinkedQueue<Long> incrementTimes) {
@@ -96,10 +91,10 @@
@Override
public Long call() throws ObjectDoesntExistException {
IKVClient client = DataStoreClient.getClient();
- for (int i = 0 ; i < NUM_INCREMENTS ; ++i) {
+ for (int i = 0; i < NUM_INCREMENTS; ++i) {
final long start = System.nanoTime();
final long incremented = client.incrementCounter(counterID, LONG_ZERO, 1);
- incrementTimes.add( System.nanoTime() - start );
+ incrementTimes.add(System.nanoTime() - start);
final Long expectNull = uniquenessTestSet.putIfAbsent(incremented, incremented);
assertNull(expectNull);
}
@@ -119,22 +114,22 @@
final int initThreads = Math.max(1, Integer.valueOf(System
.getProperty("AtomicCounterTest.initThreads",
String.valueOf(NUM_THREADS))));
- for (int num_threads = initThreads; num_threads <= NUM_THREADS; ++num_threads) {
+ for (int numThreads = initThreads; numThreads <= NUM_THREADS; ++numThreads) {
client.setCounter(counterID, LONG_ZERO, 0L);
- parallelIncrementCounter(executor, num_threads);
+ parallelIncrementCounter(executor, numThreads);
}
executor.shutdown();
}
private void parallelIncrementCounter(final ExecutorService executor,
- final int num_threads) throws InterruptedException, ExecutionException {
+ final int numThreads) throws InterruptedException, ExecutionException {
- ConcurrentNavigableMap<Long,Long> uniquenessTestSet = new ConcurrentSkipListMap<>();
+ ConcurrentNavigableMap<Long, Long> uniquenessTestSet = new ConcurrentSkipListMap<>();
ConcurrentLinkedQueue<Long> incrementTimes = new ConcurrentLinkedQueue<Long>();
- List<Callable<Long>> tasks = new ArrayList<>(num_threads);
- for (int i = 0 ; i < num_threads ; ++i) {
+ List<Callable<Long>> tasks = new ArrayList<>(numThreads);
+ for (int i = 0; i < numThreads; ++i) {
tasks.add(new Incrementor(uniquenessTestSet, incrementTimes));
}
List<Future<Long>> futures = executor.invokeAll(tasks);
@@ -144,10 +139,10 @@
future.get();
}
- assertEquals(num_threads * NUM_INCREMENTS , uniquenessTestSet.size());
+ assertEquals(numThreads * NUM_INCREMENTS , uniquenessTestSet.size());
long prevValue = 0;
- for (Long value : uniquenessTestSet.keySet() ) {
- assertEquals( (prevValue + 1), value.longValue() );
+ for (Long value : uniquenessTestSet.keySet()) {
+ assertEquals((prevValue + 1), value.longValue());
prevValue = value;
}
@@ -161,8 +156,8 @@
}
System.err.printf("incrementCounter: th, incs, N, avg(ns), min(ns), max(ns)\n");
System.err.printf("incrementCounter: %d, %d, %d, %f, %d, %d\n",
- num_threads, NUM_INCREMENTS, incrementTimes.size(),
- sum/(double)incrementTimes.size(), min, max );
+ numThreads, NUM_INCREMENTS, incrementTimes.size(),
+ sum / (double) incrementTimes.size(), min, max);
}
}
diff --git a/src/test/java/net/onrc/onos/core/datastore/KVArpCacheTest.java b/src/test/java/net/onrc/onos/core/datastore/KVArpCacheTest.java
index 9db55f2..a25df5f 100644
--- a/src/test/java/net/onrc/onos/core/datastore/KVArpCacheTest.java
+++ b/src/test/java/net/onrc/onos/core/datastore/KVArpCacheTest.java
@@ -15,17 +15,17 @@
import org.junit.Test;
public class KVArpCacheTest {
-
+
KVArpCache arpCache = null;
InetAddress ip = null;
MACAddress mac = null;
@Before
public void setUp() throws Exception {
- arpCache = new KVArpCache();
- try {
+ arpCache = new KVArpCache();
+ try {
mac = MACAddress.valueOf("00:01:02:03:04:05");
- ip = InetAddress.getLocalHost();
+ ip = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
fail();
}
@@ -90,7 +90,7 @@
public void testForceDelete() {
byte[] byteMac = mac.toBytes();
long ver = arpCache.forceCreate(ip, byteMac);
- long deletedVer= arpCache.forceDelete(ip);
+ long deletedVer = arpCache.forceDelete(ip);
assertEquals(ver, deletedVer);
}
@@ -103,7 +103,7 @@
} catch (UnknownHostException e) {
fail();
}
-
+
byte[] byteMac = mac.toBytes();
byte[] byteMac2 = MACAddress.valueOf("00:01:02:03:04:06").toBytes();
Map<InetAddress, byte[]> map = new HashMap<InetAddress, byte[]>();
@@ -112,7 +112,7 @@
map.put(ip, byteMac);
arpCache.create(ip2, byteMac2);
map.put(ip2, byteMac2);
- for(IKVEntry entry : arpCache.getAllEntries()) {
+ for (IKVEntry entry : arpCache.getAllEntries()) {
try {
assertTrue(map.containsKey(InetAddress.getByAddress(entry.getKey())));
MACAddress mac1 = MACAddress.valueOf(map.get(InetAddress.getByAddress(entry.getKey())));
diff --git a/src/test/java/net/onrc/onos/core/datastore/hazelcast/HZTableTest.java b/src/test/java/net/onrc/onos/core/datastore/hazelcast/HZTableTest.java
index 44d71d6..3be5061 100644
--- a/src/test/java/net/onrc/onos/core/datastore/hazelcast/HZTableTest.java
+++ b/src/test/java/net/onrc/onos/core/datastore/hazelcast/HZTableTest.java
@@ -98,7 +98,7 @@
}
@Test
- public void testVERSION_NONEXISTENT() {
+ public void testVersionNonexistant() {
assertEquals(HZClient.VERSION_NONEXISTENT, table.getVersionNonexistant());
}
diff --git a/src/test/java/net/onrc/onos/core/datastore/topology/KVSwitchTest.java b/src/test/java/net/onrc/onos/core/datastore/topology/KVSwitchTest.java
index e8927ae..607e0fb 100644
--- a/src/test/java/net/onrc/onos/core/datastore/topology/KVSwitchTest.java
+++ b/src/test/java/net/onrc/onos/core/datastore/topology/KVSwitchTest.java
@@ -19,22 +19,26 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class KVSwitchTest {
+ private static final Logger log = LoggerFactory.getLogger(KVSwitchTest.class);
+
static {
// configuration to quickly fall back to instance mode for faster test run
System.setProperty("net.onrc.onos.core.datastore.hazelcast.client.attemptLimit", "0");
}
IKVTable switchTable;
- static final Long dpid1 = 0x1L;
+ static final Long DPID1 = 0x1L;
KVSwitch sw1;
@Before
public void setUp() throws Exception {
switchTable = DataStoreClient.getClient().getTable(KVSwitch.GLOBAL_SWITCH_TABLE_NAME);
- sw1 = new KVSwitch(dpid1);
+ sw1 = new KVSwitch(DPID1);
}
@After
@@ -62,6 +66,7 @@
sw.read();
fail("Switch was not supposed to be there in datastore");
} catch (ObjectDoesntExistException e) {
+ log.debug("Exception thrown as expected", e);
}
}
@@ -96,19 +101,19 @@
sw1.create();
assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw1.getVersion());
- assertEquals(dpid1, sw1.getDpid());
+ assertEquals(DPID1, sw1.getDpid());
assertEquals(STATUS.ACTIVE, sw1.getStatus());
- assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
+ assertSwitchInDataStore(DPID1, STATUS.ACTIVE);
}
@Test(expected = ObjectExistsException.class)
public void testCreateFailAlreadyExist() throws ObjectExistsException {
// setup pre-existing Switch
- KVSwitch sw = new KVSwitch(dpid1);
+ KVSwitch sw = new KVSwitch(DPID1);
sw.forceCreate();
assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw.getVersion());
- assertSwitchInDataStore(dpid1, STATUS.INACTIVE);
+ assertSwitchInDataStore(DPID1, STATUS.INACTIVE);
sw1.setStatus(STATUS.ACTIVE);
sw1.create();
@@ -118,34 +123,34 @@
@Test
public void testForceCreate() {
// setup pre-existing Switch
- KVSwitch sw = new KVSwitch(dpid1);
+ KVSwitch sw = new KVSwitch(DPID1);
sw.forceCreate();
assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw.getVersion());
- assertSwitchInDataStore(dpid1, STATUS.INACTIVE);
+ assertSwitchInDataStore(DPID1, STATUS.INACTIVE);
sw1.setStatus(STATUS.ACTIVE);
sw1.forceCreate();
assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw1.getVersion());
- assertEquals(dpid1, sw1.getDpid());
+ assertEquals(DPID1, sw1.getDpid());
assertEquals(STATUS.ACTIVE, sw1.getStatus());
- assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
+ assertSwitchInDataStore(DPID1, STATUS.ACTIVE);
}
@Test
public void testRead() throws ObjectDoesntExistException {
// setup pre-existing Switch
- KVSwitch sw = new KVSwitch(dpid1);
+ KVSwitch sw = new KVSwitch(DPID1);
sw.setStatus(STATUS.ACTIVE);
sw.forceCreate();
assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw.getVersion());
- assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
+ assertSwitchInDataStore(DPID1, STATUS.ACTIVE);
sw1.read();
assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw1.getVersion());
assertEquals(sw.getVersion(), sw1.getVersion());
- assertEquals(dpid1, sw1.getDpid());
+ assertEquals(DPID1, sw1.getDpid());
assertEquals(STATUS.ACTIVE, sw1.getStatus());
}
@@ -159,11 +164,11 @@
@Test
public void testUpdate() throws ObjectDoesntExistException, WrongVersionException {
// setup pre-existing Switch
- KVSwitch sw = new KVSwitch(dpid1);
+ KVSwitch sw = new KVSwitch(DPID1);
sw.setStatus(STATUS.ACTIVE);
sw.forceCreate();
assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw.getVersion());
- assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
+ assertSwitchInDataStore(DPID1, STATUS.ACTIVE);
sw1.read();
@@ -173,18 +178,18 @@
sw1.update();
assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw1.getVersion());
assertNotEquals(sw.getVersion(), sw1.getVersion());
- assertEquals(dpid1, sw1.getDpid());
+ assertEquals(DPID1, sw1.getDpid());
assertEquals(STATUS.INACTIVE, sw1.getStatus());
}
@Test
public void testDelete() throws ObjectDoesntExistException, WrongVersionException {
// setup pre-existing Switch
- KVSwitch sw = new KVSwitch(dpid1);
+ KVSwitch sw = new KVSwitch(DPID1);
sw.setStatus(STATUS.ACTIVE);
sw.forceCreate();
assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw.getVersion());
- assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
+ assertSwitchInDataStore(DPID1, STATUS.ACTIVE);
try {
@@ -194,17 +199,17 @@
}
assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw1.getVersion());
sw1.delete();
- assertSwitchNotInDataStore(dpid1);
+ assertSwitchNotInDataStore(DPID1);
}
@Test
public void testForceDelete() {
// setup pre-existing Switch
- KVSwitch sw = new KVSwitch(dpid1);
+ KVSwitch sw = new KVSwitch(DPID1);
sw.setStatus(STATUS.ACTIVE);
sw.forceCreate();
assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw.getVersion());
- assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
+ assertSwitchInDataStore(DPID1, STATUS.ACTIVE);
sw1.forceDelete();
diff --git a/src/test/java/net/onrc/onos/core/datastore/topology/KVTopologyTest.java b/src/test/java/net/onrc/onos/core/datastore/topology/KVTopologyTest.java
index de71490..7921099 100644
--- a/src/test/java/net/onrc/onos/core/datastore/topology/KVTopologyTest.java
+++ b/src/test/java/net/onrc/onos/core/datastore/topology/KVTopologyTest.java
@@ -74,7 +74,7 @@
}
@Test
- public void basic_switch_test() {
+ public void basicSwitchTest() {
// create switch 0x1
try {
KVSwitch sw = new KVSwitch(DPID1);
@@ -145,13 +145,13 @@
}
@Test
- public void topology_setup_and_tear_down() {
- topology_setup();
- topology_walk();
- topology_delete();
+ public void topologySetupAndTeardown() {
+ topologySetup();
+ topologyWalk();
+ topologyDelete();
}
- private static void topology_setup() {
+ private static void topologySetup() {
// d1 - s1p1 - s1 - s1p2 - s2p1 - s2 - s2p2
@@ -298,7 +298,7 @@
}
- private static void topology_walk() {
+ private static void topologyWalk() {
Iterable<KVSwitch> swIt = KVSwitch.getAllSwitches();
List<Long> switchesExpected = new ArrayList<>(Arrays.asList(DPID1, DPID2));
@@ -336,10 +336,10 @@
// DPID -> [port_no]
@SuppressWarnings("serial")
- Map<Long, List<Long>> expectedPorts = new HashMap<Long, List<Long>>() {{
+ Map<Long, List<Long>> expectedPorts = new HashMap<Long, List<Long>>() { {
put(DPID1, new ArrayList<>(Arrays.asList(SW1_PORTNO1, SW1_PORTNO2)));
put(DPID2, new ArrayList<>(Arrays.asList(SW2_PORTNO1, SW2_PORTNO2)));
- }};
+ } };
for (KVPort port : KVPort.getAllPorts()) {
System.out.println(port + " @ " + port.getVersion());
@@ -355,10 +355,10 @@
// DeviceID -> PortID
@SuppressWarnings("serial")
- Map<byte[], byte[]> expectedDevice = new TreeMap<byte[], byte[]>(ByteArrayComparator.BYTEARRAY_COMPARATOR) {{
+ Map<byte[], byte[]> expectedDevice = new TreeMap<byte[], byte[]>(ByteArrayComparator.BYTEARRAY_COMPARATOR) { {
put(DEVICE1_MAC_SW1P1, KVPort.getPortID(DPID1, SW1_PORTNO1));
put(DEVICE2_MAC_SW2P2, KVPort.getPortID(DPID2, SW2_PORTNO2));
- }};
+ } };
for (KVDevice device : KVDevice.getAllDevices()) {
System.out.println(device + " @ " + device.getVersion());
@@ -383,7 +383,7 @@
}
- private static void topology_delete() {
+ private static void topologyDelete() {
for (KVSwitch sw : KVSwitch.getAllSwitches()) {
try {
@@ -426,9 +426,9 @@
public static void main(final String[] argv) {
- topology_setup();
- topology_walk();
- topology_delete();
+ topologySetup();
+ topologyWalk();
+ topologyDelete();
System.exit(0);
}
diff --git a/src/test/java/net/onrc/onos/core/datastore/utils/ByteArrayUtilTest.java b/src/test/java/net/onrc/onos/core/datastore/utils/ByteArrayUtilTest.java
index 926135f..7c69df2 100644
--- a/src/test/java/net/onrc/onos/core/datastore/utils/ByteArrayUtilTest.java
+++ b/src/test/java/net/onrc/onos/core/datastore/utils/ByteArrayUtilTest.java
@@ -34,8 +34,8 @@
MatcherAssert.assertThat(allocatedBuilder.toString(), is(equalTo("")));
final StringBuilder providedBuilder = new StringBuilder();
- final StringBuilder returnedBuilder = ByteArrayUtil.toHexStringBuilder
- (null, "", providedBuilder);
+ final StringBuilder returnedBuilder = ByteArrayUtil.toHexStringBuilder(null, "",
+ providedBuilder);
MatcherAssert.assertThat(providedBuilder, is(notNullValue()));
MatcherAssert.assertThat(returnedBuilder, is(equalTo(providedBuilder)));
MatcherAssert.assertThat(providedBuilder.toString(), is(equalTo("")));
@@ -57,7 +57,7 @@
MatcherAssert.assertThat(result, is(notNullValue()));
MatcherAssert.assertThat(result.toString(),
is(equalTo(expectedResult)));
-
+
final StringBuilder providedBuilder = new StringBuilder();
final StringBuilder returnedBuilder =
ByteArrayUtil.toHexStringBuilder(testData, ":", providedBuilder);
diff --git a/src/test/java/net/onrc/onos/core/flowprogrammer/FlowPusherTest.java b/src/test/java/net/onrc/onos/core/flowprogrammer/FlowPusherTest.java
index 1c25e75..f2cfb59 100644
--- a/src/test/java/net/onrc/onos/core/flowprogrammer/FlowPusherTest.java
+++ b/src/test/java/net/onrc/onos/core/flowprogrammer/FlowPusherTest.java
@@ -77,8 +77,8 @@
endInitMock();
initPusher(1);
- boolean add_result = pusher.add(sw, msg);
- assertTrue(add_result);
+ boolean addResult = pusher.add(sw, msg);
+ assertTrue(addResult);
try {
// wait until message is processed.
@@ -129,8 +129,8 @@
initPusher(1);
for (OFMessage msg : messages) {
- boolean add_result = pusher.add(sw, msg);
- assertTrue(add_result);
+ boolean addResult = pusher.add(sw, msg);
+ assertTrue(addResult);
}
try {
@@ -159,7 +159,7 @@
beginInitMock();
- Map<IOFSwitch, List<OFMessage>> sw_map = new HashMap<IOFSwitch, List<OFMessage>>();
+ Map<IOFSwitch, List<OFMessage>> swMap = new HashMap<IOFSwitch, List<OFMessage>>();
for (int i = 0; i < NUM_SWITCH; ++i) {
IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
EasyMock.expect(sw.getId()).andReturn((long) i).anyTimes();
@@ -183,16 +183,16 @@
fail("Failed in OFMessageDamper#write()");
}
}
- sw_map.put(sw, messages);
+ swMap.put(sw, messages);
}
endInitMock();
initPusher(1);
- for (IOFSwitch sw : sw_map.keySet()) {
- for (OFMessage msg : sw_map.get(sw)) {
- boolean add_result = pusher.add(sw, msg);
- assertTrue(add_result);
+ for (IOFSwitch sw : swMap.keySet()) {
+ for (OFMessage msg : swMap.get(sw)) {
+ boolean addResult = pusher.add(sw, msg);
+ assertTrue(addResult);
}
}
@@ -203,8 +203,8 @@
fail("Failed in Thread.sleep()");
}
- for (IOFSwitch sw : sw_map.keySet()) {
- for (OFMessage msg : sw_map.get(sw)) {
+ for (IOFSwitch sw : swMap.keySet()) {
+ for (OFMessage msg : swMap.get(sw)) {
EasyMock.verify(msg);
}
@@ -225,7 +225,7 @@
beginInitMock();
- Map<IOFSwitch, List<OFMessage>> sw_map = new HashMap<IOFSwitch, List<OFMessage>>();
+ Map<IOFSwitch, List<OFMessage>> swMap = new HashMap<IOFSwitch, List<OFMessage>>();
for (int i = 0; i < NUM_THREAD; ++i) {
IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
EasyMock.expect(sw.getId()).andReturn((long) i).anyTimes();
@@ -249,16 +249,16 @@
fail("Failed in OFMessageDamper#write()");
}
}
- sw_map.put(sw, messages);
+ swMap.put(sw, messages);
}
endInitMock();
initPusher(NUM_THREAD);
- for (IOFSwitch sw : sw_map.keySet()) {
- for (OFMessage msg : sw_map.get(sw)) {
- boolean add_result = pusher.add(sw, msg);
- assertTrue(add_result);
+ for (IOFSwitch sw : swMap.keySet()) {
+ for (OFMessage msg : swMap.get(sw)) {
+ boolean addResult = pusher.add(sw, msg);
+ assertTrue(addResult);
}
}
@@ -269,8 +269,8 @@
fail("Failed in Thread.sleep()");
}
- for (IOFSwitch sw : sw_map.keySet()) {
- for (OFMessage msg : sw_map.get(sw)) {
+ for (IOFSwitch sw : swMap.keySet()) {
+ for (OFMessage msg : swMap.get(sw)) {
EasyMock.verify(msg);
}
@@ -348,8 +348,8 @@
long beginTime = System.currentTimeMillis();
for (OFMessage msg : messages) {
- boolean add_result = pusher.add(sw, msg);
- assertTrue(add_result);
+ boolean addResult = pusher.add(sw, msg);
+ assertTrue(addResult);
}
pusher.barrierAsync(sw);
@@ -362,8 +362,8 @@
fail("Failed to sleep");
}
- double measured_rate = NUM_MSG * 100 / (barrierTime - beginTime);
- assertTrue(measured_rate < ACCEPTABLE_RATE);
+ double measuredRate = NUM_MSG * 100 / (barrierTime - beginTime);
+ assertTrue(measuredRate < ACCEPTABLE_RATE);
for (OFMessage msg : messages) {
EasyMock.verify(msg);
@@ -536,8 +536,8 @@
EasyMock.verify(context);
}
- private void initPusher(int num_thread) {
- pusher = new FlowPusher(num_thread);
+ private void initPusher(int numThread) {
+ pusher = new FlowPusher(numThread);
pusher.init(context, modContext, factory, damper);
pusher.start();
}
diff --git a/src/test/java/net/onrc/onos/core/flowprogrammer/FlowSynchronizerTest.java b/src/test/java/net/onrc/onos/core/flowprogrammer/FlowSynchronizerTest.java
index 2d97d4f..efbffb6 100644
--- a/src/test/java/net/onrc/onos/core/flowprogrammer/FlowSynchronizerTest.java
+++ b/src/test/java/net/onrc/onos/core/flowprogrammer/FlowSynchronizerTest.java
@@ -35,7 +35,7 @@
// Test should be fixed to fit RAMCloud basis
@Ignore
@RunWith(PowerMockRunner.class)
-@PrepareForTest({FlowSynchronizer.class})
+@PrepareForTest({FlowSynchronizer.class })
public class FlowSynchronizerTest {
private FlowPusher pusher;
private FlowSynchronizer sync;
@@ -262,21 +262,21 @@
*/
/*
List<IFlowEntry> flowEntryList = new ArrayList<IFlowEntry>();
-
+
for (long id : idList) {
IFlowEntry entry = EasyMock.createMock(IFlowEntry.class);
EasyMock.expect(entry.getFlowEntryId()).andReturn(String.valueOf(id)).anyTimes();
EasyMock.replay(entry);
flowEntryList.add(entry);
}
-
+
ISwitchObject swObj = EasyMock.createMock(ISwitchObject.class);
EasyMock.expect(swObj.getFlowEntries()).andReturn(flowEntryList).once();
EasyMock.replay(swObj);
-
+
DBOperation mockOp = PowerMock.createMock(DBOperation.class);
EasyMock.expect(mockOp.searchSwitch(EasyMock.anyObject(String.class))).andReturn(swObj).once();
-
+
PowerMock.mockStatic(FlowDatabaseOperation.class);
for (IFlowEntry entry : flowEntryList) {
EasyMock.expect(FlowDatabaseOperation.extractFlowEntry(EasyMock.eq(entry)))
@@ -285,20 +285,20 @@
public FlowEntry answer() throws Throwable {
IFlowEntry iflow = (IFlowEntry)EasyMock.getCurrentArguments()[0];
long flowEntryId = Long.valueOf(iflow.getFlowEntryId());
-
+
FlowEntry flow = EasyMock.createMock(FlowEntry.class);
EasyMock.expect(flow.flowEntryId()).andReturn(new FlowEntryId(flowEntryId)).anyTimes();
EasyMock.replay(flow);
return flow;
}
-
+
}).anyTimes();
EasyMock.expect(mockOp.searchFlowEntry(EasyMock.eq(new FlowEntryId(entry.getFlowEntryId()))))
.andReturn(entry);
}
PowerMock.replay(FlowDatabaseOperation.class);
EasyMock.replay(mockOp);
-
+
try {
PowerMock.expectNew(DBOperation.class).andReturn(mockOp);
} catch (Exception e) {
diff --git a/src/test/java/net/onrc/onos/core/intent/ConstrainedBFSTreeTest.java b/src/test/java/net/onrc/onos/core/intent/ConstrainedBFSTreeTest.java
index 8d5a6d6..0e4ce87 100644
--- a/src/test/java/net/onrc/onos/core/intent/ConstrainedBFSTreeTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/ConstrainedBFSTreeTest.java
@@ -14,7 +14,7 @@
* @author Toshio Koide (t-koide@onlab.us)
*/
public class ConstrainedBFSTreeTest {
- static long LOCAL_PORT = 0xFFFEL;
+ static final long LOCAL_PORT = 0xFFFEL;
@Before
public void setUp() throws Exception {
@@ -141,4 +141,4 @@
assertNull(path3);
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/net/onrc/onos/core/intent/ConstrainedShortestPathIntentTest.java b/src/test/java/net/onrc/onos/core/intent/ConstrainedShortestPathIntentTest.java
index 6b13f6d..c8a4e0d 100644
--- a/src/test/java/net/onrc/onos/core/intent/ConstrainedShortestPathIntentTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/ConstrainedShortestPathIntentTest.java
@@ -50,7 +50,7 @@
kryo.writeObject(output, intent1);
output.close();
- byte bytes[] = output.toBytes();
+ byte[] bytes = output.toBytes();
Input input = new Input(bytes);
ConstrainedShortestPathIntent intent2 = kryo.readObject(input, ConstrainedShortestPathIntent.class);
diff --git a/src/test/java/net/onrc/onos/core/intent/MockTopology.java b/src/test/java/net/onrc/onos/core/intent/MockTopology.java
index 680acc2..27fd96a 100644
--- a/src/test/java/net/onrc/onos/core/intent/MockTopology.java
+++ b/src/test/java/net/onrc/onos/core/intent/MockTopology.java
@@ -20,7 +20,7 @@
// We may well need a MockTopology, but that's not what this class is
// doing.
- public static Long LOCAL_PORT = 0xFFFEL;
+ public static final Long LOCAL_PORT = 0xFFFEL;
public SwitchImpl sw1, sw2, sw3, sw4;
public Switch addSwitch(Long switchId) {
diff --git a/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java b/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
index 2d57cfe..ff25bac 100644
--- a/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
@@ -139,7 +139,7 @@
* Intent with the specified Intent Id.
*/
public static class EntryForIntentMatcher extends TypeSafeMatcher<Collection<Intent>> {
- final private String id;
+ private final String id;
public EntryForIntentMatcher(String idValue) {
id = idValue;
@@ -179,8 +179,8 @@
* and that entry has a given state.
*/
public static class IntentsHaveIntentWithStateMatcher extends TypeSafeMatcher<IntentMap> {
- final private String id;
- final private IntentState state;
+ private final String id;
+ private final IntentState state;
private Intent intent;
public IntentsHaveIntentWithStateMatcher(String idValue,
diff --git a/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java b/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
index 8cacabc..30e2845 100644
--- a/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
@@ -67,14 +67,14 @@
private IEventChannel<Long, IntentOperationList> intentOperationChannel;
private IEventChannel<Long, IntentStateList> intentStateChannel;
- private static Long LOCAL_PORT = 0xFFFEL;
+ private static final Long LOCAL_PORT = 0xFFFEL;
@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception {
- MockTopology topology = new MockTopology();
- topology.createSampleTopology1();
- this.topology = topology;
+ MockTopology mockTopology = new MockTopology();
+ mockTopology.createSampleTopology1();
+ this.topology = mockTopology;
datagridService = createMock(IDatagridService.class);
topologyService = createMock(ITopologyService.class);
@@ -100,7 +100,7 @@
expect(modContext.getServiceImpl(IRestApiService.class))
.andReturn(restApi).once();
- expect(topologyService.getTopology()).andReturn(topology).anyTimes();
+ expect(topologyService.getTopology()).andReturn(mockTopology).anyTimes();
topologyService.registerTopologyListener(anyObject(ITopologyListener.class));
expectLastCall();
diff --git a/src/test/java/net/onrc/onos/core/linkdiscovery/internal/LinkDiscoveryManagerTest.java b/src/test/java/net/onrc/onos/core/linkdiscovery/internal/LinkDiscoveryManagerTest.java
index da9d30b..af29d76 100644
--- a/src/test/java/net/onrc/onos/core/linkdiscovery/internal/LinkDiscoveryManagerTest.java
+++ b/src/test/java/net/onrc/onos/core/linkdiscovery/internal/LinkDiscoveryManagerTest.java
@@ -52,7 +52,7 @@
public class LinkDiscoveryManagerTest extends FloodlightTestCase {
private TestLinkDiscoveryManager ldm;
- protected final static Logger log = LoggerFactory.getLogger(LinkDiscoveryManagerTest.class);
+ protected static final Logger log = LoggerFactory.getLogger(LinkDiscoveryManagerTest.class);
public class TestLinkDiscoveryManager extends LinkDiscoveryManager {
public boolean isSendLLDPsCalled = false;
@@ -80,6 +80,7 @@
return mockSwitch;
}
+ @Override
@Before
public void setUp() throws Exception {
super.setUp();
@@ -268,15 +269,15 @@
assertTrue(topology.portLinks.get(dstNpt).contains(lt));
assertTrue(topology.links.containsKey(lt));
assertTrue(topology.portBroadcastDomainLinks.get(srcNpt) == null ||
- topology.portBroadcastDomainLinks.get(srcNpt).contains(lt) == false);
+ !topology.portBroadcastDomainLinks.get(srcNpt).contains(lt));
assertTrue(topology.portBroadcastDomainLinks.get(dstNpt) == null ||
- topology.portBroadcastDomainLinks.get(dstNpt).contains(lt) == false);
+ !topology.portBroadcastDomainLinks.get(dstNpt).contains(lt));
topology.timeoutLinks();
- info = new LinkInfo(System.currentTimeMillis(),/* firstseen */
- null,/* unicast */
+ info = new LinkInfo(System.currentTimeMillis(), /* firstseen */
+ null, /* unicast */
System.currentTimeMillis(), 0, 0);
topology.addOrUpdateLink(lt, info);
assertTrue(topology.links.get(lt).getUnicastValidTime() == null);
@@ -294,9 +295,9 @@
System.currentTimeMillis() - 40000, null, 0, 0);
topology.addOrUpdateLink(lt, info);
assertTrue(topology.portBroadcastDomainLinks.get(srcNpt) == null ||
- topology.portBroadcastDomainLinks.get(srcNpt).contains(lt) == false);
+ !topology.portBroadcastDomainLinks.get(srcNpt).contains(lt));
assertTrue(topology.portBroadcastDomainLinks.get(dstNpt) == null ||
- topology.portBroadcastDomainLinks.get(dstNpt).contains(lt) == false);
+ !topology.portBroadcastDomainLinks.get(dstNpt).contains(lt));
// Expect to timeout the unicast Valid Time, but not the multicast Valid time
// So the link type should go back to non-openflow link.
@@ -313,9 +314,9 @@
topology.timeoutLinks();
assertTrue(topology.links.get(lt) == null);
assertTrue(topology.portBroadcastDomainLinks.get(srcNpt) == null ||
- topology.portBroadcastDomainLinks.get(srcNpt).contains(lt) == false);
+ !topology.portBroadcastDomainLinks.get(srcNpt).contains(lt));
assertTrue(topology.portBroadcastDomainLinks.get(dstNpt) == null ||
- topology.portBroadcastDomainLinks.get(dstNpt).contains(lt) == false);
+ !topology.portBroadcastDomainLinks.get(dstNpt).contains(lt));
// Test again only with multicast LLDP
@@ -331,9 +332,9 @@
topology.timeoutLinks();
assertTrue(topology.links.get(lt) == null);
assertTrue(topology.portBroadcastDomainLinks.get(srcNpt) == null ||
- topology.portBroadcastDomainLinks.get(srcNpt).contains(lt) == false);
+ !topology.portBroadcastDomainLinks.get(srcNpt).contains(lt));
assertTrue(topology.portBroadcastDomainLinks.get(dstNpt) == null ||
- topology.portBroadcastDomainLinks.get(dstNpt).contains(lt) == false);
+ !topology.portBroadcastDomainLinks.get(dstNpt).contains(lt));
// Start clean and see if loops are also added.
lt = new Link(1L, 1, 1L, 2);
diff --git a/src/test/java/net/onrc/onos/core/packet/PacketTest.java b/src/test/java/net/onrc/onos/core/packet/PacketTest.java
index efbf05c..3e872da 100644
--- a/src/test/java/net/onrc/onos/core/packet/PacketTest.java
+++ b/src/test/java/net/onrc/onos/core/packet/PacketTest.java
@@ -85,16 +85,18 @@
}
protected void doTestClone(IPacket pkt) {
- if (pkt.getPayload() != null)
+ if (pkt.getPayload() != null) {
doTestClone(pkt.getPayload());
+ }
IPacket newPkt = (IPacket) pkt.clone();
assertSame(pkt.getClass(), newPkt.getClass());
assertNotSame(pkt, newPkt);
assertSame(pkt.getParent(), newPkt.getParent());
assertEquals(pkt, newPkt);
assertEquals(pkt.getPayload(), newPkt.getPayload());
- if (pkt.getPayload() != null)
+ if (pkt.getPayload() != null) {
assertNotSame(pkt.getPayload(), newPkt.getPayload());
+ }
if (pkt instanceof Ethernet) {
Ethernet eth = (Ethernet) pkt;
diff --git a/src/test/java/net/onrc/onos/core/registry/StandaloneRegistryTest.java b/src/test/java/net/onrc/onos/core/registry/StandaloneRegistryTest.java
index a8ea8e1..89e26b6 100644
--- a/src/test/java/net/onrc/onos/core/registry/StandaloneRegistryTest.java
+++ b/src/test/java/net/onrc/onos/core/registry/StandaloneRegistryTest.java
@@ -24,6 +24,8 @@
import org.junit.Ignore;
import org.junit.Test;
import org.openflow.util.HexString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Unit test for {@link StandaloneRegistry}.
@@ -31,6 +33,9 @@
* @author Naoki Shiota
*/
public class StandaloneRegistryTest {
+
+ private static final Logger log = LoggerFactory.getLogger(StandaloneRegistryTest.class);
+
protected static final long TIMEOUT_MSEC = 1000;
protected StandaloneRegistry registry;
@@ -49,7 +54,7 @@
private LinkedList<Long> dpidsCalledback = new LinkedList<Long>();
private LinkedList<Boolean> controlsCalledback = new LinkedList<Boolean>();
private CountDownLatch lock = null, registerLock = null;
- ;
+
/**
* Constructor with number of times callback to be called.
@@ -129,7 +134,7 @@
}
/**
- * Get hasControl parameter given by latest call
+ * Get hasControl parameter given by latest call.
*
* @return hasControl value
*/
@@ -147,7 +152,7 @@
}
}
- ;
+
@Before
public void setUp() throws Exception {
@@ -179,6 +184,7 @@
fail("Double registration goes through without exception");
} catch (RegistryException e) {
// expected behavior
+ log.debug("Exception thrown as expected", e);
}
}
@@ -445,7 +451,7 @@
assertTrue(switches.contains(dpidToRequestStr));
int count = 0;
for (Long dpid : switches) {
- if ((long) dpid == dpidToRequest) {
+ if (dpid == dpidToRequest) {
++count;
}
}
diff --git a/src/test/java/net/onrc/onos/core/registry/ZookeeperRegistryTest.java b/src/test/java/net/onrc/onos/core/registry/ZookeeperRegistryTest.java
index 8275a84..0f9d61e 100644
--- a/src/test/java/net/onrc/onos/core/registry/ZookeeperRegistryTest.java
+++ b/src/test/java/net/onrc/onos/core/registry/ZookeeperRegistryTest.java
@@ -49,20 +49,21 @@
@RunWith(PowerMockRunner.class)
@PrepareForTest({ZookeeperRegistry.class, CuratorFramework.class, CuratorFrameworkFactory.class,
ServiceDiscoveryBuilder.class, ServiceDiscovery.class, ServiceCache.class, PathChildrenCache.class,
- ZookeeperRegistry.SwitchPathCacheListener.class})
+ ZookeeperRegistry.SwitchPathCacheListener.class })
public class ZookeeperRegistryTest extends FloodlightTestCase {
- private final static Long ID_BLOCK_SIZE = 0x100000000L;
+ private static final Long ID_BLOCK_SIZE = 0x100000000L;
protected ZookeeperRegistry registry;
protected CuratorFramework client;
protected PathChildrenCacheListener pathChildrenCacheListener;
- protected final String CONTROLLER_ID = "controller2013";
+ protected static final String CONTROLLER_ID = "controller2013";
/**
* Initialize {@link ZookeeperRegistry} Object and inject initial value with {@link ZookeeperRegistry#init(FloodlightModuleContext)} method.
* This setup code also tests {@link ZookeeperRegistry#init(FloodlightModuleContext)} method itself.
*/
+ @Override
@Before
public void setUp() throws Exception {
super.setUp();
@@ -90,6 +91,7 @@
/**
* Clean up member variables (empty for now).
*/
+ @Override
@After
public void tearDown() throws Exception {
super.tearDown();
@@ -395,7 +397,7 @@
* @return Created mock object
* @throws Exception
*/
- @SuppressWarnings({"serial", "unchecked"})
+ @SuppressWarnings({"serial", "unchecked" })
private CuratorFramework createCuratorFrameworkMock() throws Exception {
// Mock of AtomicValue
AtomicValue<Long> atomicValue = EasyMock.createMock(AtomicValue.class);
@@ -464,10 +466,10 @@
ServiceCache<ControllerService> serviceCache = EasyMock.createMock(ServiceCache.class);
serviceCache.start();
EasyMock.expectLastCall().once();
- EasyMock.expect(serviceCache.getInstances()).andReturn(new ArrayList<ServiceInstance<ControllerService>>() {{
+ EasyMock.expect(serviceCache.getInstances()).andReturn(new ArrayList<ServiceInstance<ControllerService>>() { {
add(createServiceInstanceMock("controller1"));
add(createServiceInstanceMock("controller2"));
- }}).anyTimes();
+ } }).anyTimes();
EasyMock.replay(serviceCache);
// Mock ServiceCacheBuilder
@@ -486,15 +488,15 @@
EasyMock.replay(serviceDiscovery);
// Mock CuratorFramework
- CuratorFramework client = EasyMock.createMock(CuratorFramework.class);
- client.start();
+ CuratorFramework mockClient = EasyMock.createMock(CuratorFramework.class);
+ mockClient.start();
EasyMock.expectLastCall().once();
- EasyMock.expect(client.usingNamespace(EasyMock.anyObject(String.class))).andReturn(client);
- EasyMock.replay(client);
+ EasyMock.expect(mockClient.usingNamespace(EasyMock.anyObject(String.class))).andReturn(mockClient);
+ EasyMock.replay(mockClient);
// Mock ServiceDiscoveryBuilder
ServiceDiscoveryBuilder<ControllerService> builder = EasyMock.createMock(ServiceDiscoveryBuilder.class);
- EasyMock.expect(builder.client(client)).andReturn(builder).once();
+ EasyMock.expect(builder.client(mockClient)).andReturn(builder).once();
EasyMock.expect(builder.basePath(EasyMock.anyObject(String.class))).andReturn(builder);
EasyMock.expect(builder.build()).andReturn(serviceDiscovery);
EasyMock.replay(builder);
@@ -503,7 +505,7 @@
EasyMock.expect(ServiceDiscoveryBuilder.builder(ControllerService.class)).andReturn(builder).once();
PowerMock.replay(ServiceDiscoveryBuilder.class);
- return client;
+ return mockClient;
}
/**
diff --git a/src/test/java/net/onrc/onos/core/util/FlowEntryActionTest.java b/src/test/java/net/onrc/onos/core/util/FlowEntryActionTest.java
index 4377c8c..f031f6d 100644
--- a/src/test/java/net/onrc/onos/core/util/FlowEntryActionTest.java
+++ b/src/test/java/net/onrc/onos/core/util/FlowEntryActionTest.java
@@ -27,13 +27,13 @@
assertEquals("actionOutput port should be the same", actout.port(), act.actionOutput().port());
assertEquals("actionOutput maxlen should be the same", actout.maxLen(), act.actionOutput().maxLen());
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -41,13 +41,13 @@
FlowEntryAction act = new FlowEntryAction();
act.setActionOutput(new Port((short) 42));
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -55,15 +55,15 @@
FlowEntryAction act = new FlowEntryAction();
act.setActionOutputToController((short) 0);
- FlowEntryAction act_copy = new FlowEntryAction();
- act_copy.setActionOutput(new Port(Port.PortValues.PORT_CONTROLLER));
- ;
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction();
+ actCopy.setActionOutput(new Port(Port.PortValues.PORT_CONTROLLER));
+
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -75,13 +75,13 @@
assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_VLAN_VID, act.actionType());
assertEquals("vlanid should be the same", actVlan.vlanId(), act.actionSetVlanId().vlanId());
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -89,13 +89,13 @@
FlowEntryAction act = new FlowEntryAction();
act.setActionSetVlanId((short) 42);
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -107,13 +107,13 @@
assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_VLAN_PCP, act.actionType());
assertEquals("vlan priority should be the same", actVlan.vlanPriority(), act.actionSetVlanPriority().vlanPriority());
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -121,13 +121,13 @@
FlowEntryAction act = new FlowEntryAction();
act.setActionSetVlanPriority((byte) 42);
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -139,13 +139,13 @@
assertEquals("action type", FlowEntryAction.ActionValues.ACTION_STRIP_VLAN, act.actionType());
assertEquals("vlanid should be the same", actVlan.stripVlan(), act.actionStripVlan().stripVlan());
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -153,13 +153,13 @@
FlowEntryAction act = new FlowEntryAction();
act.setActionStripVlan(true);
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -173,13 +173,13 @@
assertEquals("addr should be the same", setEth.addr(), act.actionSetEthernetSrcAddr().addr());
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -188,13 +188,13 @@
byte[] mac = {1, 2, 3, 4, 5, 6};
act.setActionSetEthernetSrcAddr(new MACAddress(mac));
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -207,13 +207,13 @@
assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_DL_DST, act.actionType());
assertEquals("addr should be the same", setEth.addr(), act.actionSetEthernetDstAddr().addr());
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -222,13 +222,13 @@
byte[] mac = {1, 2, 3, 4, 5, 6};
act.setActionSetEthernetDstAddr(new MACAddress(mac));
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -240,14 +240,14 @@
assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_NW_SRC, act.actionType());
assertEquals("addr should be the same", setIp.addr(), act.actionSetIPv4SrcAddr().addr());
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -255,13 +255,13 @@
FlowEntryAction act = new FlowEntryAction();
act.setActionSetIPv4SrcAddr(new IPv4("127.0.0.1"));
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -273,13 +273,13 @@
assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_NW_DST, act.actionType());
assertEquals("addr should be the same", setIp.addr(), act.actionSetIPv4DstAddr().addr());
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -287,13 +287,13 @@
FlowEntryAction act = new FlowEntryAction();
act.setActionSetIPv4DstAddr(new IPv4("127.0.0.1"));
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -305,13 +305,13 @@
assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_NW_TOS, act.actionType());
assertEquals("tos should be the same", setIpTos.ipToS(), act.actionSetIpToS().ipToS());
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -319,13 +319,13 @@
FlowEntryAction act = new FlowEntryAction();
act.setActionSetIpToS((byte) 1);
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -337,13 +337,13 @@
assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_TP_SRC, act.actionType());
assertEquals("port should be the same", setPorts.port(), act.actionSetTcpUdpSrcPort().port());
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -351,13 +351,13 @@
FlowEntryAction act = new FlowEntryAction();
act.setActionSetTcpUdpSrcPort((short) 1);
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -369,13 +369,13 @@
assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_TP_DST, act.actionType());
assertEquals("port should be the same", setPorts.port(), act.actionSetTcpUdpDstPort().port());
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -383,13 +383,13 @@
FlowEntryAction act = new FlowEntryAction();
act.setActionSetTcpUdpDstPort((short) 1);
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -402,13 +402,13 @@
assertEquals("port should be the same", enq.port(), act.actionEnqueue().port());
assertEquals("queue id should be the same", enq.queueId(), act.actionEnqueue().queueId());
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
@Test
@@ -416,13 +416,13 @@
FlowEntryAction act = new FlowEntryAction();
act.setActionEnqueue(new Port((short) 42), 1);
- FlowEntryAction act_copy = new FlowEntryAction(act);
- FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+ FlowEntryAction actCopy = new FlowEntryAction(act);
+ FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy.toString());
+ actCopy.toString());
assertEquals("toString must match between copies", act.toString(),
- act_copy2.toString());
+ actCopy2.toString());
}
}
diff --git a/src/test/java/net/onrc/onos/core/util/FlowEntryMatchTest.java b/src/test/java/net/onrc/onos/core/util/FlowEntryMatchTest.java
index 353b8ab..39a0f91 100644
--- a/src/test/java/net/onrc/onos/core/util/FlowEntryMatchTest.java
+++ b/src/test/java/net/onrc/onos/core/util/FlowEntryMatchTest.java
@@ -65,8 +65,8 @@
@Test
public void testFlowEntryMatchFlowEntryMatch() {
- FlowEntryMatch def_base = new FlowEntryMatch();
- FlowEntryMatch def = new FlowEntryMatch(def_base);
+ FlowEntryMatch defBase = new FlowEntryMatch();
+ FlowEntryMatch def = new FlowEntryMatch(defBase);
assertEquals("default null", null, def.inPort());
assertEquals("default null", null, def.srcMac());
diff --git a/src/test/java/net/onrc/onos/core/util/FlowEntryTest.java b/src/test/java/net/onrc/onos/core/util/FlowEntryTest.java
index 818abd5..ca94206 100644
--- a/src/test/java/net/onrc/onos/core/util/FlowEntryTest.java
+++ b/src/test/java/net/onrc/onos/core/util/FlowEntryTest.java
@@ -222,9 +222,9 @@
@Test
public void testSetFlowEntryActions() {
- FlowEntryActions actions = new FlowEntryActions();
- entry.setFlowEntryActions(actions);
- assertEquals("flowEntryActions", actions, entry.flowEntryActions());
+ FlowEntryActions acts = new FlowEntryActions();
+ entry.setFlowEntryActions(acts);
+ assertEquals("flowEntryActions", acts, entry.flowEntryActions());
}
@Test
diff --git a/src/test/java/net/onrc/onos/core/util/ImmutableClassCheckerTest.java b/src/test/java/net/onrc/onos/core/util/ImmutableClassCheckerTest.java
index 151c802..7471a07 100644
--- a/src/test/java/net/onrc/onos/core/util/ImmutableClassCheckerTest.java
+++ b/src/test/java/net/onrc/onos/core/util/ImmutableClassCheckerTest.java
@@ -12,12 +12,14 @@
* checker.
*/
public class ImmutableClassCheckerTest {
+ // CHECKSTYLE:OFF test data intentionally not final
/**
* Test class for non final class check.
*/
static class NonFinal {
- private NonFinal() {}
+ private NonFinal() { }
}
+ // CHECKSTYLE:ON
/**
* Check that a non final class correctly produces an error.
diff --git a/src/test/java/net/onrc/onos/core/util/UtilityClassCheckerTest.java b/src/test/java/net/onrc/onos/core/util/UtilityClassCheckerTest.java
index 57ae6c5..c938cad 100644
--- a/src/test/java/net/onrc/onos/core/util/UtilityClassCheckerTest.java
+++ b/src/test/java/net/onrc/onos/core/util/UtilityClassCheckerTest.java
@@ -12,12 +12,15 @@
* checker.
*/
public class UtilityClassCheckerTest {
+
+ // CHECKSTYLE:OFF test data intentionally not final
/**
* Test class for non final class check.
*/
static class NonFinal {
- private NonFinal() {}
+ private NonFinal() { }
}
+ // CHECKSTYLE:ON
/**
* Check that a non final class correctly produces an error.
@@ -66,9 +69,9 @@
/**
* Test class for class with more than one constructor check.
*/
- final static class TwoConstructors {
- private TwoConstructors() {}
- private TwoConstructors(int x) {}
+ static final class TwoConstructors {
+ private TwoConstructors() { }
+ private TwoConstructors(int x) { }
}
/**
@@ -91,8 +94,8 @@
/**
* Test class with a non private constructor.
*/
- final static class NonPrivateConstructor {
- protected NonPrivateConstructor() {}
+ static final class NonPrivateConstructor {
+ protected NonPrivateConstructor() { }
}
/**
@@ -117,9 +120,9 @@
/**
* Test class with a non static method.
*/
- final static class NonStaticMethod {
- private NonStaticMethod() {}
- public void aPublicMethod() {}
+ static final class NonStaticMethod {
+ private NonStaticMethod() { }
+ public void aPublicMethod() { }
}
/**