From 62e7364552cc671134c06821e6f9dbe3579ea0dc Mon Sep 17 00:00:00 2001 From: Alissa Bonas Date: Sun, 3 Nov 2013 15:21:31 +0200 Subject: [PATCH] Add checkstyle rule UpperEll and fix all code accordingly. UpperEll rule ensures that numbers of type long are defined with a capital "L" in the end instead of "l" for a better readability - per java language specification recommendation. Change-Id: I068c32d4aaed0980bee1d93cfeec511e72bad2f1 Signed-off-by: Alissa Bonas --- .../main/resources/controller/checkstyle.xml | 1 + .../internal/FlowProgrammerServiceTest.java | 8 ++-- .../sal/flowprogrammer/FlowTest.java | 6 +-- .../controller/sal/match/MatchTest.java | 16 +++---- .../internal/HostSwitchTest.java | 44 +++++++++---------- 5 files changed, 38 insertions(+), 37 deletions(-) diff --git a/opendaylight/commons/checkstyle/src/main/resources/controller/checkstyle.xml b/opendaylight/commons/checkstyle/src/main/resources/controller/checkstyle.xml index 86c654cb58..c810d6523a 100644 --- a/opendaylight/commons/checkstyle/src/main/resources/controller/checkstyle.xml +++ b/opendaylight/commons/checkstyle/src/main/resources/controller/checkstyle.xml @@ -17,6 +17,7 @@ + diff --git a/opendaylight/protocol_plugins/openflow/src/test/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerServiceTest.java b/opendaylight/protocol_plugins/openflow/src/test/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerServiceTest.java index aa1f6c0bd2..a751948de7 100644 --- a/opendaylight/protocol_plugins/openflow/src/test/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerServiceTest.java +++ b/opendaylight/protocol_plugins/openflow/src/test/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerServiceTest.java @@ -51,7 +51,7 @@ public class FlowProgrammerServiceTest { @Test public void testSALtoOFFlowConverter() throws UnknownHostException { - Node node = NodeCreator.createOFNode(1000l); + Node node = NodeCreator.createOFNode(1000L); NodeConnector port = NodeConnectorCreator.createNodeConnector( (short) 24, node); NodeConnector oport = NodeConnectorCreator.createNodeConnector( @@ -180,7 +180,7 @@ public class FlowProgrammerServiceTest { @Test public void testVlanNoneIdFlowConversion() throws Exception { - Node node = NodeCreator.createOFNode(1000l); + Node node = NodeCreator.createOFNode(1000L); /* * The value 0 is used to indicate that no VLAN ID is set @@ -229,7 +229,7 @@ public class FlowProgrammerServiceTest { @Test public void testV6toSALFlowConversion() throws Exception { - Node node = NodeCreator.createOFNode(12l); + Node node = NodeCreator.createOFNode(12L); NodeConnector port = NodeConnectorCreator.createNodeConnector( (short) 34, node); NodeConnector oport = NodeConnectorCreator.createNodeConnector( @@ -365,7 +365,7 @@ public class FlowProgrammerServiceTest { public void testV6MatchToSALMatchToV6MatchConversion() throws UnknownHostException { NodeConnector port = NodeConnectorCreator.createNodeConnector( - (short) 24, NodeCreator.createOFNode(6l)); + (short) 24, NodeCreator.createOFNode(6L)); byte srcMac[] = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a, (byte) 0xbc }; byte dstMac[] = { (byte) 0x1a, (byte) 0x2b, (byte) 0x3c, (byte) 0x4d, diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/flowprogrammer/FlowTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/flowprogrammer/FlowTest.java index 8f09de9aef..e644b0d834 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/flowprogrammer/FlowTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/flowprogrammer/FlowTest.java @@ -39,7 +39,7 @@ public class FlowTest { @Test public void testFlowEquality() throws Exception { - Node node = NodeCreator.createOFNode(1055l); + Node node = NodeCreator.createOFNode(1055L); Flow flow1 = getSampleFlowV6(node); Flow flow2 = getSampleFlowV6(node); Flow flow3 = getSampleFlow(node); @@ -69,7 +69,7 @@ public class FlowTest { @Test public void testFlowCloning() throws UnknownHostException { - Node node = NodeCreator.createOFNode(55l); + Node node = NodeCreator.createOFNode(55L); Flow flow1 = getSampleFlowV6(node); Flow flow2 = flow1.clone(); @@ -81,7 +81,7 @@ public class FlowTest { @Test public void testFlowActions() throws UnknownHostException { - Node node = NodeCreator.createOFNode(55l); + Node node = NodeCreator.createOFNode(55L); Flow flow = getSampleFlowV6(node); List actions = flow.getActions(); diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java index 14eedea9f8..30d49cfd9d 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java @@ -24,7 +24,7 @@ import org.opendaylight.controller.sal.utils.NodeCreator; public class MatchTest { @Test public void testMatchCreation() { - Node node = NodeCreator.createOFNode(7l); + Node node = NodeCreator.createOFNode(7L); NodeConnector port = NodeConnectorCreator.createOFNodeConnector((short) 6, node); MatchField field = new MatchField(MatchType.IN_PORT, port); @@ -60,7 +60,7 @@ public class MatchTest { public void testMatchSetGet() { Match x = new Match(); short val = 2346; - NodeConnector inPort = NodeConnectorCreator.createOFNodeConnector(val, NodeCreator.createOFNode(1l)); + NodeConnector inPort = NodeConnectorCreator.createOFNodeConnector(val, NodeCreator.createOFNode(1L)); x.setField(MatchType.IN_PORT, inPort); Assert.assertTrue(((NodeConnector) x.getField(MatchType.IN_PORT).getValue()).equals(inPort)); Assert.assertTrue((Short) ((NodeConnector) x.getField(MatchType.IN_PORT).getValue()).getID() == val); @@ -175,7 +175,7 @@ public class MatchTest { @Test public void testMatchMask() { Match x = new Match(); - NodeConnector inPort = NodeConnectorCreator.createOFNodeConnector((short) 6, NodeCreator.createOFNode(3l)); + NodeConnector inPort = NodeConnectorCreator.createOFNodeConnector((short) 6, NodeCreator.createOFNode(3L)); x.setField(MatchType.IN_PORT, inPort); x.setField(MatchType.DL_VLAN, (short) 28, (short) 0xfff); Assert.assertFalse(x.getMatches() == 0); @@ -186,7 +186,7 @@ public class MatchTest { public void testMatchBitMask() { byte mac[] = { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 22, (byte) 12 }; byte mask[] = { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0 }; - NodeConnector inPort = NodeConnectorCreator.createOFNodeConnector((short) 4095, NodeCreator.createOFNode(7l)); + NodeConnector inPort = NodeConnectorCreator.createOFNodeConnector((short) 4095, NodeCreator.createOFNode(7L)); MatchField x = new MatchField(MatchType.IN_PORT, inPort); Assert.assertTrue((x.getMask()) == null); @@ -202,7 +202,7 @@ public class MatchTest { @Test public void testNullMask() { byte mac[] = { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 22, (byte) 12 }; - NodeConnector inPort = NodeConnectorCreator.createOFNodeConnector((short) 2000, NodeCreator.createOFNode(7l)); + NodeConnector inPort = NodeConnectorCreator.createOFNodeConnector((short) 2000, NodeCreator.createOFNode(7L)); MatchField x = new MatchField(MatchType.IN_PORT, inPort); Assert.assertTrue(x.getBitMask() == 0); @@ -219,7 +219,7 @@ public class MatchTest { @Test public void testEquality() throws Exception { - Node node = NodeCreator.createOFNode(7l); + Node node = NodeCreator.createOFNode(7L); NodeConnector port = NodeConnectorCreator.createOFNodeConnector((short) 24, node); NodeConnector port2 = NodeConnectorCreator.createOFNodeConnector((short) 24, node); byte srcMac[] = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a, (byte) 0xbc }; @@ -389,7 +389,7 @@ public class MatchTest { @Test public void testCloning() throws Exception { - Node node = NodeCreator.createOFNode(7l); + Node node = NodeCreator.createOFNode(7L); NodeConnector port = NodeConnectorCreator.createOFNodeConnector((short) 24, node); byte srcMac[] = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a, (byte) 0xbc }; byte dstMac[] = { (byte) 0x1a, (byte) 0x2b, (byte) 0x3c, (byte) 0x4d, (byte) 0x5e, (byte) 0x6f }; @@ -455,7 +455,7 @@ public class MatchTest { @Test public void testFlip() throws Exception { - Node node = NodeCreator.createOFNode(7l); + Node node = NodeCreator.createOFNode(7L); NodeConnector port = NodeConnectorCreator.createOFNodeConnector((short) 24, node); byte srcMac[] = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a, (byte) 0xbc }; byte dstMac[] = { (byte) 0x1a, (byte) 0x2b, (byte) 0x3c, (byte) 0x4d, (byte) 0x5e, (byte) 0x6f }; diff --git a/opendaylight/samples/simpleforwarding/src/test/java/org/opendaylight/controller/samples/simpleforwarding/internal/HostSwitchTest.java b/opendaylight/samples/simpleforwarding/src/test/java/org/opendaylight/controller/samples/simpleforwarding/internal/HostSwitchTest.java index 7897c39890..6627029ef0 100644 --- a/opendaylight/samples/simpleforwarding/src/test/java/org/opendaylight/controller/samples/simpleforwarding/internal/HostSwitchTest.java +++ b/opendaylight/samples/simpleforwarding/src/test/java/org/opendaylight/controller/samples/simpleforwarding/internal/HostSwitchTest.java @@ -49,8 +49,8 @@ public class HostSwitchTest { } catch (ConstructionException e) { return; } - HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1l)); - HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(1l)); + HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1L)); + HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(1L)); Assert.assertTrue(hsw1.equals(hsw2)); } @@ -81,8 +81,8 @@ public class HostSwitchTest { return; } - HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1l)); - HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(1l)); + HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1L)); + HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(1L)); Assert.assertTrue(!hsw1.equals(hsw2)); } @@ -113,8 +113,8 @@ public class HostSwitchTest { return; } - HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1l)); - HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(2l)); + HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1L)); + HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(2L)); Assert.assertTrue(!hsw1.equals(hsw2)); } @@ -145,8 +145,8 @@ public class HostSwitchTest { return; } - HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1l)); - HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(2l)); + HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1L)); + HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(2L)); Assert.assertTrue(!hsw1.equals(hsw2)); } @@ -176,8 +176,8 @@ public class HostSwitchTest { } catch (ConstructionException e) { return; } - HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1l)); - HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(1l)); + HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1L)); + HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(1L)); Assert.assertTrue(hsw1.hashCode() == hsw2.hashCode()); } @@ -208,8 +208,8 @@ public class HostSwitchTest { return; } - HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1l)); - HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(1l)); + HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1L)); + HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(1L)); Assert.assertTrue(hsw1.hashCode() == hsw2.hashCode()); } @@ -239,8 +239,8 @@ public class HostSwitchTest { } catch (ConstructionException e) { return; } - HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1l)); - HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(1l)); + HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1L)); + HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(1L)); Assert.assertTrue(hsw1.hashCode() != hsw2.hashCode()); } @@ -271,8 +271,8 @@ public class HostSwitchTest { return; } - HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1l)); - HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(2l)); + HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1L)); + HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(2L)); Assert.assertTrue(hsw1.hashCode() != hsw2.hashCode()); } @@ -303,8 +303,8 @@ public class HostSwitchTest { return; } - HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1l)); - HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(2l)); + HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1L)); + HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(2L)); Assert.assertTrue(hsw1.hashCode() != hsw2.hashCode()); } @@ -335,8 +335,8 @@ public class HostSwitchTest { return; } - HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1l)); - HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(1l)); + HostNodePair hsw1 = new HostNodePair(h1, NodeCreator.createOFNode(1L)); + HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(1L)); HashMap hm = new HashMap(); hm.put(hsw1, new Long(10)); Assert.assertTrue(hm.get(hsw2) != null); @@ -370,8 +370,8 @@ public class HostSwitchTest { return; } HostNodePair hsw1 = new HostNodePair(h1, null); - HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(1l)); - hsw1.setNode(NodeCreator.createOFNode(1l)); + HostNodePair hsw2 = new HostNodePair(h2, NodeCreator.createOFNode(1L)); + hsw1.setNode(NodeCreator.createOFNode(1L)); HashMap hm = new HashMap(); hm.put(hsw1, new Long(10)); Assert.assertTrue(hm.get(hsw2) != null); -- 2.36.6