Sho SHIMIZU
Committed by Gerrit Code Review

Use long literal to shorten codes

Change-Id: I7a6c4e32b98aa37ce862ab94cab246889aea986a
......@@ -41,36 +41,36 @@ public class AsPathTest {
pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_CONFED_SEQUENCE;
segmentAsNumbers = new ArrayList<>();
segmentAsNumbers.add((long) 1);
segmentAsNumbers.add((long) 2);
segmentAsNumbers.add((long) 3);
segmentAsNumbers.add(1L);
segmentAsNumbers.add(2L);
segmentAsNumbers.add(3L);
pathSegment =
new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
pathSegments.add(pathSegment);
//
pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_CONFED_SET;
segmentAsNumbers = new ArrayList<>();
segmentAsNumbers.add((long) 4);
segmentAsNumbers.add((long) 5);
segmentAsNumbers.add((long) 6);
segmentAsNumbers.add(4L);
segmentAsNumbers.add(5L);
segmentAsNumbers.add(6L);
pathSegment =
new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
pathSegments.add(pathSegment);
//
pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
segmentAsNumbers = new ArrayList<>();
segmentAsNumbers.add((long) 7);
segmentAsNumbers.add((long) 8);
segmentAsNumbers.add((long) 9);
segmentAsNumbers.add(7L);
segmentAsNumbers.add(8L);
segmentAsNumbers.add(9L);
pathSegment =
new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
pathSegments.add(pathSegment);
//
pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_SET;
segmentAsNumbers = new ArrayList<>();
segmentAsNumbers.add((long) 10);
segmentAsNumbers.add((long) 11);
segmentAsNumbers.add((long) 12);
segmentAsNumbers.add(10L);
segmentAsNumbers.add(11L);
segmentAsNumbers.add(12L);
pathSegment =
new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
pathSegments.add(pathSegment);
......@@ -176,36 +176,36 @@ public class AsPathTest {
pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_CONFED_SEQUENCE;
segmentAsNumbers = new ArrayList<>();
segmentAsNumbers.add((long) 1);
segmentAsNumbers.add((long) 2);
segmentAsNumbers.add((long) 3);
segmentAsNumbers.add(1L);
segmentAsNumbers.add(2L);
segmentAsNumbers.add(3L);
pathSegment =
new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
pathSegments.add(pathSegment);
//
pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_CONFED_SET;
segmentAsNumbers = new ArrayList<>();
segmentAsNumbers.add((long) 4);
segmentAsNumbers.add((long) 5);
segmentAsNumbers.add((long) 6);
segmentAsNumbers.add(4L);
segmentAsNumbers.add(5L);
segmentAsNumbers.add(6L);
pathSegment =
new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
pathSegments.add(pathSegment);
//
pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
segmentAsNumbers = new ArrayList<>();
segmentAsNumbers.add((long) 7);
segmentAsNumbers.add((long) 8);
segmentAsNumbers.add((long) 9);
segmentAsNumbers.add(7L);
segmentAsNumbers.add(8L);
segmentAsNumbers.add(9L);
pathSegment =
new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
pathSegments.add(pathSegment);
//
pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_SET;
segmentAsNumbers = new ArrayList<>();
segmentAsNumbers.add((long) 10);
segmentAsNumbers.add((long) 111); // Different
segmentAsNumbers.add((long) 12);
segmentAsNumbers.add(10L);
segmentAsNumbers.add(111L); // Different
segmentAsNumbers.add(12L);
pathSegment =
new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
pathSegments.add(pathSegment);
......
......@@ -99,18 +99,18 @@ public class BgpRouteEntryTest {
ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
byte pathSegmentType1 = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
ArrayList<Long> segmentAsNumbers1 = new ArrayList<>();
segmentAsNumbers1.add((long) 1);
segmentAsNumbers1.add((long) 2);
segmentAsNumbers1.add((long) 3);
segmentAsNumbers1.add(1L);
segmentAsNumbers1.add(2L);
segmentAsNumbers1.add(3L);
BgpRouteEntry.PathSegment pathSegment1 =
new BgpRouteEntry.PathSegment(pathSegmentType1, segmentAsNumbers1);
pathSegments.add(pathSegment1);
//
byte pathSegmentType2 = (byte) BgpConstants.Update.AsPath.AS_SET;
ArrayList<Long> segmentAsNumbers2 = new ArrayList<>();
segmentAsNumbers2.add((long) 4);
segmentAsNumbers2.add((long) 5);
segmentAsNumbers2.add((long) 6);
segmentAsNumbers2.add(4L);
segmentAsNumbers2.add(5L);
segmentAsNumbers2.add(6L);
BgpRouteEntry.PathSegment pathSegment2 =
new BgpRouteEntry.PathSegment(pathSegmentType2, segmentAsNumbers2);
pathSegments.add(pathSegment2);
......@@ -191,18 +191,18 @@ public class BgpRouteEntryTest {
ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
byte pathSegmentType1 = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
ArrayList<Long> segmentAsNumbers1 = new ArrayList<>();
segmentAsNumbers1.add((long) 1);
segmentAsNumbers1.add((long) 2);
segmentAsNumbers1.add((long) 3);
segmentAsNumbers1.add(1L);
segmentAsNumbers1.add(2L);
segmentAsNumbers1.add(3L);
BgpRouteEntry.PathSegment pathSegment1 =
new BgpRouteEntry.PathSegment(pathSegmentType1, segmentAsNumbers1);
pathSegments.add(pathSegment1);
//
byte pathSegmentType2 = (byte) BgpConstants.Update.AsPath.AS_SET;
ArrayList<Long> segmentAsNumbers2 = new ArrayList<>();
segmentAsNumbers2.add((long) 4);
segmentAsNumbers2.add((long) 5);
segmentAsNumbers2.add((long) 6);
segmentAsNumbers2.add(4L);
segmentAsNumbers2.add(5L);
segmentAsNumbers2.add(6L);
BgpRouteEntry.PathSegment pathSegment2 =
new BgpRouteEntry.PathSegment(pathSegmentType2, segmentAsNumbers2);
pathSegments.add(pathSegment2);
......@@ -245,18 +245,18 @@ public class BgpRouteEntryTest {
ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
byte pathSegmentType1 = (byte) BgpConstants.Update.AsPath.AS_SET;
ArrayList<Long> segmentAsNumbers1 = new ArrayList<>();
segmentAsNumbers1.add((long) 1);
segmentAsNumbers1.add((long) 2);
segmentAsNumbers1.add((long) 3);
segmentAsNumbers1.add(1L);
segmentAsNumbers1.add(2L);
segmentAsNumbers1.add(3L);
BgpRouteEntry.PathSegment pathSegment1 =
new BgpRouteEntry.PathSegment(pathSegmentType1, segmentAsNumbers1);
pathSegments.add(pathSegment1);
//
byte pathSegmentType2 = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
ArrayList<Long> segmentAsNumbers2 = new ArrayList<>();
segmentAsNumbers2.add((long) 4);
segmentAsNumbers2.add((long) 5);
segmentAsNumbers2.add((long) 6);
segmentAsNumbers2.add(4L);
segmentAsNumbers2.add(5L);
segmentAsNumbers2.add(6L);
BgpRouteEntry.PathSegment pathSegment2 =
new BgpRouteEntry.PathSegment(pathSegmentType2, segmentAsNumbers2);
pathSegments.add(pathSegment2);
......@@ -293,7 +293,7 @@ public class BgpRouteEntryTest {
// Get neighbor AS for non-local route
//
BgpRouteEntry bgpRouteEntry = generateBgpRouteEntry();
assertThat(bgpRouteEntry.getNeighborAs(), is((long) 1));
assertThat(bgpRouteEntry.getNeighborAs(), is(1L));
//
// Get neighbor AS for a local route
......@@ -355,18 +355,18 @@ public class BgpRouteEntryTest {
ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
byte pathSegmentType1 = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
ArrayList<Long> segmentAsNumbers1 = new ArrayList<>();
segmentAsNumbers1.add((long) 1);
segmentAsNumbers1.add((long) 2);
segmentAsNumbers1.add((long) 3);
segmentAsNumbers1.add(1L);
segmentAsNumbers1.add(2L);
segmentAsNumbers1.add(3L);
BgpRouteEntry.PathSegment pathSegment1 =
new BgpRouteEntry.PathSegment(pathSegmentType1, segmentAsNumbers1);
pathSegments.add(pathSegment1);
//
byte pathSegmentType2 = (byte) BgpConstants.Update.AsPath.AS_SET;
ArrayList<Long> segmentAsNumbers2 = new ArrayList<>();
segmentAsNumbers2.add((long) 4);
segmentAsNumbers2.add((long) 5);
segmentAsNumbers2.add((long) 6);
segmentAsNumbers2.add(4L);
segmentAsNumbers2.add(5L);
segmentAsNumbers2.add(6L);
BgpRouteEntry.PathSegment pathSegment2 =
new BgpRouteEntry.PathSegment(pathSegmentType2, segmentAsNumbers2);
pathSegments.add(pathSegment2);
......@@ -474,18 +474,18 @@ public class BgpRouteEntryTest {
ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
byte pathSegmentType1 = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
ArrayList<Long> segmentAsNumbers1 = new ArrayList<>();
segmentAsNumbers1.add((long) 1);
segmentAsNumbers1.add((long) 2);
segmentAsNumbers1.add((long) 3);
segmentAsNumbers1.add(1L);
segmentAsNumbers1.add(2L);
segmentAsNumbers1.add(3L);
BgpRouteEntry.PathSegment pathSegment1 =
new BgpRouteEntry.PathSegment(pathSegmentType1, segmentAsNumbers1);
pathSegments.add(pathSegment1);
//
byte pathSegmentType2 = (byte) BgpConstants.Update.AsPath.AS_SET;
ArrayList<Long> segmentAsNumbers2 = new ArrayList<>();
segmentAsNumbers2.add((long) 4);
segmentAsNumbers2.add((long) 5);
segmentAsNumbers2.add((long) 6);
segmentAsNumbers2.add(4L);
segmentAsNumbers2.add(5L);
segmentAsNumbers2.add(6L);
BgpRouteEntry.PathSegment pathSegment2 =
new BgpRouteEntry.PathSegment(pathSegmentType2, segmentAsNumbers2);
pathSegments.add(pathSegment2);
......
......@@ -289,9 +289,9 @@ public class BgpSessionManagerTest {
ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
byte pathSegmentType1 = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
ArrayList<Long> segmentAsNumbers1 = new ArrayList<>();
segmentAsNumbers1.add((long) 65010);
segmentAsNumbers1.add((long) 65020);
segmentAsNumbers1.add((long) 65030);
segmentAsNumbers1.add(65010L);
segmentAsNumbers1.add(65020L);
segmentAsNumbers1.add(65030L);
BgpRouteEntry.PathSegment pathSegment1 =
new BgpRouteEntry.PathSegment(pathSegmentType1, segmentAsNumbers1);
pathSegments.add(pathSegment1);
......@@ -299,9 +299,9 @@ public class BgpSessionManagerTest {
//
byte pathSegmentType2 = (byte) BgpConstants.Update.AsPath.AS_SET;
ArrayList<Long> segmentAsNumbers2 = new ArrayList<>();
segmentAsNumbers2.add((long) 65041);
segmentAsNumbers2.add((long) 65042);
segmentAsNumbers2.add((long) 65043);
segmentAsNumbers2.add(65041L);
segmentAsNumbers2.add(65042L);
segmentAsNumbers2.add(65043L);
BgpRouteEntry.PathSegment pathSegment2 =
new BgpRouteEntry.PathSegment(pathSegmentType2, segmentAsNumbers2);
pathSegments.add(pathSegment2);
......
......@@ -36,9 +36,9 @@ public class PathSegmentTest {
private BgpRouteEntry.PathSegment generatePathSegment() {
byte pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
ArrayList<Long> segmentAsNumbers = new ArrayList<>();
segmentAsNumbers.add((long) 1);
segmentAsNumbers.add((long) 2);
segmentAsNumbers.add((long) 3);
segmentAsNumbers.add(1L);
segmentAsNumbers.add(2L);
segmentAsNumbers.add(3L);
BgpRouteEntry.PathSegment pathSegment =
new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
......@@ -75,9 +75,9 @@ public class PathSegmentTest {
// Create the fields to compare against
byte pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
ArrayList<Long> segmentAsNumbers = new ArrayList<>();
segmentAsNumbers.add((long) 1);
segmentAsNumbers.add((long) 2);
segmentAsNumbers.add((long) 3);
segmentAsNumbers.add(1L);
segmentAsNumbers.add(2L);
segmentAsNumbers.add(3L);
// Generate the entry to test
BgpRouteEntry.PathSegment pathSegment = generatePathSegment();
......@@ -107,9 +107,9 @@ public class PathSegmentTest {
// Setup Path Segment 2
byte pathSegmentType = (byte) BgpConstants.Update.AsPath.AS_SEQUENCE;
ArrayList<Long> segmentAsNumbers = new ArrayList<>();
segmentAsNumbers.add((long) 1);
segmentAsNumbers.add((long) 22); // Different
segmentAsNumbers.add((long) 3);
segmentAsNumbers.add(1L);
segmentAsNumbers.add(22L); // Different
segmentAsNumbers.add(3L);
//
BgpRouteEntry.PathSegment pathSegment2 =
new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
......
......@@ -150,7 +150,7 @@ public class LLDPLinkProviderTest {
deviceListener.event(portEvent(DeviceEvent.Type.PORT_ADDED, DID1, port(DID1, 3, true)));
assertTrue("Port not added to discoverer",
provider.discoverers.get(DID1).containsPort((long) 3));
provider.discoverers.get(DID1).containsPort(3L));
}
@Test
......@@ -162,8 +162,8 @@ public class LLDPLinkProviderTest {
assertFalse("Port added to discoverer",
provider.discoverers.get(DID1).containsPort((long) 1));
assertTrue("Port is not gone.", vanishedPort((long) 1));
provider.discoverers.get(DID1).containsPort(1L));
assertTrue("Port is not gone.", vanishedPort(1L));
}
@Test
......
......@@ -125,7 +125,7 @@ public abstract class FlowModBuilder {
this.factory = factory;
this.flowRule = flowRule;
this.selector = flowRule.selector();
this.xid = xid.orElse((long) 0);
this.xid = xid.orElse(0L);
}
......