Enable checkstyle rule to verify method names
Enabled checkstyle rule "MethodName" which checks
if method names adhere to a naming convention and
fixed the violations it found.
Change-Id: I87448a1fa857e78f33c42090d485bf21a8986ba7
diff --git a/src/main/java/net/onrc/onos/apps/bgproute/BgpRoute.java b/src/main/java/net/onrc/onos/apps/bgproute/BgpRoute.java
index 6969480..bb4c7d5 100644
--- a/src/main/java/net/onrc/onos/apps/bgproute/BgpRoute.java
+++ b/src/main/java/net/onrc/onos/apps/bgproute/BgpRoute.java
@@ -414,7 +414,7 @@
if (rib != null && !rib.equals(update.getRibEntry())) {
// There was an existing nexthop for this prefix. This update supersedes that,
// so we need to remove the old flows for this prefix from the switches
- _processDeletePrefix(prefix, rib);
+ executeDeletePrefix(prefix, rib);
}
if (update.getRibEntry().getNextHop().equals(
@@ -426,11 +426,11 @@
return;
}
- _processRibAdd(update);
+ executeRibAdd(update);
}
}
- private void _processRibAdd(RibUpdate update) {
+ private void executeRibAdd(RibUpdate update) {
Prefix prefix = update.getPrefix();
RibEntry rib = update.getRibEntry();
@@ -598,12 +598,12 @@
* If no entry was removed, the <prefix, nexthop> wasn't there so
* it's probably already been removed and we don't need to do anything
*/
- _processDeletePrefix(prefix, update.getRibEntry());
+ executeDeletePrefix(prefix, update.getRibEntry());
}
}
}
- private void _processDeletePrefix(Prefix prefix, RibEntry ribEntry) {
+ private void executeDeletePrefix(Prefix prefix, RibEntry ribEntry) {
deletePrefixFlows(prefix);
log.debug("Deleting {} to {}", prefix, ribEntry.getNextHop());
@@ -1046,7 +1046,7 @@
// and the next hop is the same as our update. The prefix could
// have been removed while we were waiting for the ARP, or the
// next hop could have changed.
- _processRibAdd(update);
+ executeRibAdd(update);
} else {
log.debug("Received ARP response, but {},{} is no longer in ptree",
update.getPrefix(), update.getRibEntry());
diff --git a/src/main/java/net/onrc/onos/apps/bgproute/Ptree.java b/src/main/java/net/onrc/onos/apps/bgproute/Ptree.java
index 3c51c90..0f7d4a0 100644
--- a/src/main/java/net/onrc/onos/apps/bgproute/Ptree.java
+++ b/src/main/java/net/onrc/onos/apps/bgproute/Ptree.java
@@ -19,7 +19,7 @@
public Ptree(int maxKeyBits) {
this.maxKeyBits = maxKeyBits;
- maxKeyOctets = bit_to_octet(maxKeyBits);
+ maxKeyOctets = bitToOctet(maxKeyBits);
//refCount = 0;
}
@@ -37,14 +37,14 @@
while (node != null
&& node.keyBits <= keyBits
- && key_match(node.key, node.keyBits, key, keyBits)) {
+ && keyMatch(node.key, node.keyBits, key, keyBits)) {
if (node.keyBits == keyBits) {
return addReference(node);
}
match = node;
- if (bit_check(key, node.keyBits)) {
+ if (bitCheck(key, node.keyBits)) {
node = node.right;
} else {
node = node.left;
@@ -57,25 +57,25 @@
add = new PtreeNode(key, keyBits, maxKeyOctets);
if (match != null) {
- node_link(match, add);
+ nodeLink(match, add);
} else {
top = add;
}
} else {
- add = node_common(node, key, keyBits);
+ add = nodeCommon(node, key, keyBits);
if (match != null) {
- node_link(match, add);
+ nodeLink(match, add);
} else {
top = add;
}
- node_link(add, node);
+ nodeLink(add, node);
if (add.keyBits != keyBits) {
match = add;
add = new PtreeNode(key, keyBits, maxKeyOctets);
- node_link(match, add);
+ nodeLink(match, add);
}
}
@@ -91,12 +91,12 @@
while (node != null
&& node.keyBits <= keyBits
- && key_match(node.key, node.keyBits, key, keyBits)) {
+ && keyMatch(node.key, node.keyBits, key, keyBits)) {
if (node.keyBits == keyBits) {
return addReference(node);
}
- if (bit_check(key, node.keyBits)) {
+ if (bitCheck(key, node.keyBits)) {
node = node.right;
} else {
node = node.left;
@@ -116,10 +116,10 @@
while (node != null
&& node.keyBits <= keyBits
- && key_match(node.key, node.keyBits, key, keyBits)) {
+ && keyMatch(node.key, node.keyBits, key, keyBits)) {
matched = node;
- if (bit_check(key, node.keyBits)) {
+ if (bitCheck(key, node.keyBits)) {
node = node.right;
} else {
node = node.left;
@@ -173,7 +173,7 @@
return null;
}
- public static int bit_to_octet(int keyBits) {
+ public static int bitToOctet(int keyBits) {
return Math.max((keyBits + 7) / 8, 1);
}
@@ -187,11 +187,11 @@
node.refCount--;
}
if (node.refCount == 0) {
- node_remove(node);
+ nodeRemove(node);
}
}
- private boolean key_match(byte[] key1, int key1Len, byte[] key2, int key2Len) {
+ private boolean keyMatch(byte[] key1, int key1Len, byte[] key2, int key2Len) {
int offset;
int shift;
@@ -217,7 +217,7 @@
return true;
}
- private boolean bit_check(byte[] key, int keyBits) {
+ private boolean bitCheck(byte[] key, int keyBits) {
int offset = keyBits / 8;
int shift = 7 - (keyBits % 8);
int bit = key[offset] & 0xff;
@@ -227,8 +227,8 @@
return ((bit & 1) == 1);
}
- private void node_link(PtreeNode node, PtreeNode add) {
- boolean bit = bit_check(add.key, node.keyBits);
+ private void nodeLink(PtreeNode node, PtreeNode add) {
+ boolean bit = bitCheck(add.key, node.keyBits);
if (bit) {
node.right = add;
@@ -238,7 +238,7 @@
add.parent = node;
}
- private PtreeNode node_common(PtreeNode node, byte[] key, int keyBits) {
+ private PtreeNode nodeCommon(PtreeNode node, byte[] key, int keyBits) {
int i;
int limit = Math.min(node.keyBits, keyBits) / 8;
@@ -281,7 +281,7 @@
return add;
}
- private void node_remove(PtreeNode node) {
+ private void nodeRemove(PtreeNode node) {
PtreeNode child;
PtreeNode parent;
@@ -312,7 +312,7 @@
}
if (parent != null && parent.refCount == 0) {
- node_remove(parent);
+ nodeRemove(parent);
}
}
}
diff --git a/src/main/java/net/onrc/onos/apps/bgproute/PtreeNode.java b/src/main/java/net/onrc/onos/apps/bgproute/PtreeNode.java
index 4d0b470..76c37d9 100644
--- a/src/main/java/net/onrc/onos/apps/bgproute/PtreeNode.java
+++ b/src/main/java/net/onrc/onos/apps/bgproute/PtreeNode.java
@@ -26,7 +26,7 @@
this.keyBits = keyBits;
log.debug("inside Ptreenode constructor key {} bits {}", key, keyBits);
- int octet = Ptree.bit_to_octet(keyBits);
+ int octet = Ptree.bitToOctet(keyBits);
for (int i = 0; i < maxKeyOctet; i++) {
if (i < octet) {
if (key != null) {
diff --git a/src/main/java/net/onrc/onos/core/datastore/IKVClient.java b/src/main/java/net/onrc/onos/core/datastore/IKVClient.java
index 0fa1cbd..c2d9e35 100644
--- a/src/main/java/net/onrc/onos/core/datastore/IKVClient.java
+++ b/src/main/java/net/onrc/onos/core/datastore/IKVClient.java
@@ -161,6 +161,6 @@
* Version number which represents that the object does not exist, or has
* never been read the DB before.
*/
- public long VERSION_NONEXISTENT();
+ public long getVersionNonexistant();
}
diff --git a/src/main/java/net/onrc/onos/core/datastore/IKVTable.java b/src/main/java/net/onrc/onos/core/datastore/IKVTable.java
index 87fee25..9d0c8ee 100644
--- a/src/main/java/net/onrc/onos/core/datastore/IKVTable.java
+++ b/src/main/java/net/onrc/onos/core/datastore/IKVTable.java
@@ -10,7 +10,7 @@
* Version number which represents that the object does not exist, or has
* never been read the DB before.
*/
- public long VERSION_NONEXISTENT();
+ public long getVersionNonexistant();
/**
* Interface for a class to represent an entry in Table.
@@ -98,7 +98,7 @@
* Remove a Key-Value entry in table.
*
* @param key
- * @return version of removed object or VERSION_NONEXISTENT, if it did not exist.
+ * @return version of removed object or non existant version if it did not exist.
*/
public long forceDelete(byte[] key);
diff --git a/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZClient.java b/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZClient.java
index 32ff15b..3bfe157 100644
--- a/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZClient.java
+++ b/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZClient.java
@@ -335,7 +335,7 @@
}
@Override
- public long VERSION_NONEXISTENT() {
+ public long getVersionNonexistant() {
return VERSION_NONEXISTENT;
}
diff --git a/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZTable.java b/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZTable.java
index 7b97ec0..20501bb 100644
--- a/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZTable.java
+++ b/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZTable.java
@@ -43,7 +43,7 @@
}
/**
- * increment version, avoiding VERSION_NONEXISTENT.
+ * increment version, avoiding versionNonexistant.
*
* @param version
* @return
@@ -320,7 +320,7 @@
}
@Override
- public long VERSION_NONEXISTENT() {
+ public long getVersionNonexistant() {
return HZClient.VERSION_NONEXISTENT;
}
}
diff --git a/src/main/java/net/onrc/onos/core/datastore/ramcloud/RCClient.java b/src/main/java/net/onrc/onos/core/datastore/ramcloud/RCClient.java
index d2e1670..3644cfa 100644
--- a/src/main/java/net/onrc/onos/core/datastore/ramcloud/RCClient.java
+++ b/src/main/java/net/onrc/onos/core/datastore/ramcloud/RCClient.java
@@ -566,7 +566,7 @@
static final long VERSION_NONEXISTENT = JRamCloud.VERSION_NONEXISTENT;
@Override
- public long VERSION_NONEXISTENT() {
+ public long getVersionNonexistant() {
return VERSION_NONEXISTENT;
}
}
diff --git a/src/main/java/net/onrc/onos/core/datastore/ramcloud/RCTable.java b/src/main/java/net/onrc/onos/core/datastore/ramcloud/RCTable.java
index f7bafd5..3c78cf1 100644
--- a/src/main/java/net/onrc/onos/core/datastore/ramcloud/RCTable.java
+++ b/src/main/java/net/onrc/onos/core/datastore/ramcloud/RCTable.java
@@ -127,7 +127,7 @@
}
@Override
- public long VERSION_NONEXISTENT() {
+ public long getVersionNonexistant() {
return RCClient.VERSION_NONEXISTENT;
}
diff --git a/src/main/java/net/onrc/onos/core/datastore/utils/KVObject.java b/src/main/java/net/onrc/onos/core/datastore/utils/KVObject.java
index 568cfc7..618c31e 100644
--- a/src/main/java/net/onrc/onos/core/datastore/utils/KVObject.java
+++ b/src/main/java/net/onrc/onos/core/datastore/utils/KVObject.java
@@ -49,7 +49,7 @@
/**
* serialized value version stored on data store or
- * {@link IKVTable.VERSION_NONEXISTENT()} if is a new object.
+ * {@link IKVTable.getVersionNonexistant()} if is a new object.
*/
private long version;
@@ -59,7 +59,7 @@
private Map<Object, Object> propertyMap;
public KVObject(final IKVTable table, final byte[] key) {
- this(table, key, null, table.VERSION_NONEXISTENT());
+ this(table, key, null, table.getVersionNonexistant());
}
public KVObject(final IKVTable table, final byte[] key, final byte[] value, final long version) {
@@ -324,7 +324,7 @@
}
} else {
log.error("MultiRead error, skipping {}, {}", obj.getTable(), obj);
- obj.version = obj.getTable().VERSION_NONEXISTENT();
+ obj.version = obj.getTable().getVersionNonexistant();
failExists = true;
}
}
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 39e7e9f..913012d 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
@@ -93,7 +93,7 @@
@Test
public void testVERSION_NONEXISTENT() {
- assertEquals(HZClient.VERSION_NONEXISTENT, table.VERSION_NONEXISTENT());
+ assertEquals(HZClient.VERSION_NONEXISTENT, table.getVersionNonexistant());
}
@Test
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 ba25903..a789f1c 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
@@ -40,7 +40,7 @@
try {
final KVSwitch sw = new KVSwitch(dpid);
sw.read();
- assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
+ assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw.getVersion());
assertEquals(dpid, sw.getDpid());
assertEquals(status, sw.getStatus());
return sw;
@@ -67,7 +67,7 @@
KVSwitch sw = new KVSwitch(dpid);
sw.setStatus(STATUS.ACTIVE);
sw.create();
- assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
+ assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw.getVersion());
expected.put(sw.getDpid(), sw);
}
@@ -88,7 +88,7 @@
public void testCreate() throws ObjectExistsException {
sw1.setStatus(STATUS.ACTIVE);
sw1.create();
- assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
+ assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw1.getVersion());
assertEquals(dpid1, sw1.getDpid());
assertEquals(STATUS.ACTIVE, sw1.getStatus());
@@ -101,7 +101,7 @@
// setup pre-existing Switch
KVSwitch sw = new KVSwitch(dpid1);
sw.forceCreate();
- assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
+ assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw.getVersion());
assertSwitchInDataStore(dpid1, STATUS.INACTIVE);
sw1.setStatus(STATUS.ACTIVE);
@@ -114,13 +114,13 @@
// setup pre-existing Switch
KVSwitch sw = new KVSwitch(dpid1);
sw.forceCreate();
- assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
+ assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw.getVersion());
assertSwitchInDataStore(dpid1, STATUS.INACTIVE);
sw1.setStatus(STATUS.ACTIVE);
sw1.forceCreate();
- assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
+ assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw1.getVersion());
assertEquals(dpid1, sw1.getDpid());
assertEquals(STATUS.ACTIVE, sw1.getStatus());
@@ -133,11 +133,11 @@
KVSwitch sw = new KVSwitch(dpid1);
sw.setStatus(STATUS.ACTIVE);
sw.forceCreate();
- assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
+ assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw.getVersion());
assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
sw1.read();
- assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
+ assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw1.getVersion());
assertEquals(sw.getVersion(), sw1.getVersion());
assertEquals(dpid1, sw1.getDpid());
assertEquals(STATUS.ACTIVE, sw1.getStatus());
@@ -156,16 +156,16 @@
KVSwitch sw = new KVSwitch(dpid1);
sw.setStatus(STATUS.ACTIVE);
sw.forceCreate();
- assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
+ assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw.getVersion());
assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
sw1.read();
- assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
+ assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw1.getVersion());
sw1.setStatus(STATUS.INACTIVE);
sw1.update();
- assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
+ assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw1.getVersion());
assertNotEquals(sw.getVersion(), sw1.getVersion());
assertEquals(dpid1, sw1.getDpid());
assertEquals(STATUS.INACTIVE, sw1.getStatus());
@@ -177,7 +177,7 @@
KVSwitch sw = new KVSwitch(dpid1);
sw.setStatus(STATUS.ACTIVE);
sw.forceCreate();
- assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
+ assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw.getVersion());
assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
@@ -186,7 +186,7 @@
} catch (ObjectDoesntExistException e) {
fail("Failed reading switch to delete");
}
- assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
+ assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw1.getVersion());
sw1.delete();
assertSwitchNotInDataStore(dpid1);
}
@@ -197,12 +197,12 @@
KVSwitch sw = new KVSwitch(dpid1);
sw.setStatus(STATUS.ACTIVE);
sw.forceCreate();
- assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
+ assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw.getVersion());
assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
sw1.forceDelete();
- assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
+ assertNotEquals(DataStoreClient.getClient().getVersionNonexistant(), sw1.getVersion());
}
}
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 d9c2478..ce647a4 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
@@ -34,7 +34,7 @@
public class KVTopologyTest {
- static final long VERSION_NONEXISTENT = DataStoreClient.getClient().VERSION_NONEXISTENT();
+ static final long VERSION_NONEXISTENT = DataStoreClient.getClient().getVersionNonexistant();
private static final byte[] DEVICE2_MAC_SW2P2 = new byte[]{6, 5, 4, 3, 2, 1, 0};