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/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) {