diff --git a/build.xml b/build.xml index 3ef76bce1ac4da9f4a0ae443a906b44c5ad7e191..003ec3a939dfc1d9912ba7bae0f571ce62fa8d0e 100644 --- a/build.xml +++ b/build.xml @@ -44,8 +44,8 @@ <property name="floodlight-test-jar" location="${target}/floodlight-test.jar"/> <property name="thrift.dir" value="${basedir}/src/main/thrift"/> <property name="thrift.out.dir" value="lib/gen-java"/> - <property name="ant.build.javac.source" value="1.7"/> - <property name="ant.build.javac.target" value="1.7"/> + <property name="ant.build.javac.source" value="1.8"/> + <property name="ant.build.javac.target" value="1.8"/> <property name="findbugs.home" value="../build/findbugs-2.0.2"/> <property name="findbugs.results" value="findbugs-results" /> <property name="lib" location="lib"/> @@ -115,8 +115,8 @@ </path> <patternset id="lib-test"> - <include name="junit-4.8.2.jar"/> - <include name="org.easymock-3.1.jar"/> + <include name="junit-4.12.jar"/> + <include name="easymock-3.4.jar"/> <include name="objenesis-1.2.jar"/> <!-- required by easymock to mock classes --> <include name="cglib-nodep-2.2.2.jar"/> <!-- required by easymock to mock classes --> </patternset> diff --git a/lib/easymock-3.4.jar b/lib/easymock-3.4.jar new file mode 100644 index 0000000000000000000000000000000000000000..e1118b2b2c8148566c6a6c437b52d47eb0046e78 Binary files /dev/null and b/lib/easymock-3.4.jar differ diff --git a/lib/junit-4.12.jar b/lib/junit-4.12.jar new file mode 100644 index 0000000000000000000000000000000000000000..3a7fc266c3e32283a2b21fe12166ebdcc33a1da1 Binary files /dev/null and b/lib/junit-4.12.jar differ diff --git a/lib/junit-4.8.2.jar b/lib/junit-4.8.2.jar deleted file mode 100644 index 5b4bb849af9583fec1ea0a0ccc0d571ef49aa8ba..0000000000000000000000000000000000000000 Binary files a/lib/junit-4.8.2.jar and /dev/null differ diff --git a/lib/org.easymock-3.1.jar b/lib/org.easymock-3.1.jar deleted file mode 100644 index f56f07aceaa79963eee1981efaa02aefdcbccebf..0000000000000000000000000000000000000000 Binary files a/lib/org.easymock-3.1.jar and /dev/null differ diff --git a/pom.xml b/pom.xml index c371b0801514a21d623a2cd966c7e1fe7f6dadb3..778e60b7fd7cc91971570850abea580e6d128337 100644 --- a/pom.xml +++ b/pom.xml @@ -24,8 +24,8 @@ <artifactId>maven-compiler-plugin</artifactId> <version>3.0</version> <configuration> - <source>1.7</source> - <target>1.7</target> + <source>1.8</source> + <target>1.8</target> </configuration> </plugin> <plugin> @@ -69,7 +69,7 @@ build-helper-maven-plugin </artifactId> <versionRange> - [1.7,) + [1.8,) </versionRange> <goals> <goal>add-source</goal> @@ -160,13 +160,13 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.8.2</version> + <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>org.easymock</groupId> <artifactId>easymock</artifactId> - <version>3.1</version> + <version>3.4</version> <scope>test</scope> </dependency> <dependency> diff --git a/src/main/java/net/floodlightcontroller/util/MatchUtils.java b/src/main/java/net/floodlightcontroller/util/MatchUtils.java index 73f696ef0346710e1e8dba31e3646959a1cc7add..73d8db53618af52b1f7b1d4e3089e410f036e54a 100644 --- a/src/main/java/net/floodlightcontroller/util/MatchUtils.java +++ b/src/main/java/net/floodlightcontroller/util/MatchUtils.java @@ -154,7 +154,7 @@ public class MatchUtils { if (m.isExact(mf)) { mb.setExact(mf, m.get(mf)); } else if (m.isPartiallyMasked(mf)) { - mb.setMasked(mf, m.getMasked(mf)); + mb.setMasked((MatchField<?>) mf, m.getMasked(mf)); } else { // it's either exact, masked, or wildcarded // itr only contains exact and masked MatchFields @@ -202,7 +202,7 @@ public class MatchUtils { if (parent.isExact(mf)) { mb.setExact(mf, parent.get(mf)); } else if (parent.isPartiallyMasked(mf)) { - mb.setMasked(mf, parent.getMasked(mf)); + mb.setMasked((MatchField<?>) mf, parent.getMasked(mf)); } else { // it's either exact, masked, or wildcarded // itr only contains exact and masked MatchFields diff --git a/src/test/java/net/floodlightcontroller/core/internal/OFChannelHandlerVer10Test.java b/src/test/java/net/floodlightcontroller/core/internal/OFChannelHandlerVer10Test.java index 39ec2714e9aa9170a2f115f46cef7533e6593af8..538a8a9b3f6cd8ddc2db6c5a7ad927f1a1e78a92 100644 --- a/src/test/java/net/floodlightcontroller/core/internal/OFChannelHandlerVer10Test.java +++ b/src/test/java/net/floodlightcontroller/core/internal/OFChannelHandlerVer10Test.java @@ -119,16 +119,16 @@ public class OFChannelHandlerVer10Test { switchManager = createMock(IOFSwitchManager.class); connectionListener = createMock(IOFConnectionListener.class); newConnectionListener = createMock(INewOFConnectionListener.class); - newConnection = new Capture<IOFConnectionBackend>(); - newFeaturesReply = new Capture<OFFeaturesReply>(); + newConnection = EasyMock.newCapture(); + newFeaturesReply = EasyMock.newCapture(); eventLoop = new TestEventLoop(); ctx = createMock(ChannelHandlerContext.class); channel = createMock(Channel.class); timer = new HashedWheelTimer(); - exceptionEventCapture = new Capture<Throwable>(CaptureType.ALL); + exceptionEventCapture = EasyMock.newCapture(CaptureType.ALL); pipeline = createMock(ChannelPipeline.class); - writeCapture = new Capture<List<OFMessage>>(CaptureType.ALL); + writeCapture = EasyMock.newCapture(CaptureType.ALL); seenXids = null; // TODO: should mock IDebugCounterService and make sure diff --git a/src/test/java/net/floodlightcontroller/core/internal/OFChannelHandlerVer13Test.java b/src/test/java/net/floodlightcontroller/core/internal/OFChannelHandlerVer13Test.java index 643bc416ba1df288845efe8ce1debb161e96c13e..8989aeaed0ac9bc1a267ef467784efd4b039c974 100644 --- a/src/test/java/net/floodlightcontroller/core/internal/OFChannelHandlerVer13Test.java +++ b/src/test/java/net/floodlightcontroller/core/internal/OFChannelHandlerVer13Test.java @@ -122,16 +122,16 @@ public class OFChannelHandlerVer13Test { switchManager = createMock(IOFSwitchManager.class); connectionListener = createMock(IOFConnectionListener.class); newConnectionListener = createMock(INewOFConnectionListener.class); - newConnection = new Capture<IOFConnectionBackend>(); - newFeaturesReply = new Capture<OFFeaturesReply>(); + newConnection = EasyMock.newCapture(); + newFeaturesReply = EasyMock.newCapture(); eventLoop = new TestEventLoop(); ctx = createMock(ChannelHandlerContext.class); channel = createMock(Channel.class); timer = new HashedWheelTimer(); - exceptionEventCapture = new Capture<Throwable>(CaptureType.ALL); + exceptionEventCapture = EasyMock.newCapture(CaptureType.ALL); pipeline = createMock(ChannelPipeline.class); - writeCapture = new Capture<List<OFMessage>>(CaptureType.ALL); + writeCapture = EasyMock.newCapture(CaptureType.ALL); seenXids = null; diff --git a/src/test/java/net/floodlightcontroller/core/internal/OFConnectionTest.java b/src/test/java/net/floodlightcontroller/core/internal/OFConnectionTest.java index 23230074aacb2c69d45801bda2c5bdaa4bddff1c..577d5ec2c25e65fe6eec406a16aa22c59a2f2eda 100644 --- a/src/test/java/net/floodlightcontroller/core/internal/OFConnectionTest.java +++ b/src/test/java/net/floodlightcontroller/core/internal/OFConnectionTest.java @@ -164,7 +164,7 @@ public class OFConnectionTest { private Capture<List<OFMessage>> prepareChannelForWriteList() { EasyMock.expect(channel.isActive()).andReturn(Boolean.TRUE).anyTimes(); - Capture<List<OFMessage>> cMsgList = new Capture<>(); + Capture<List<OFMessage>> cMsgList = EasyMock.newCapture(); expect(channel.writeAndFlush(capture(cMsgList))).andReturn(null).once(); replay(channel); return cMsgList; diff --git a/src/test/java/net/floodlightcontroller/core/internal/OFSwitchBaseTest.java b/src/test/java/net/floodlightcontroller/core/internal/OFSwitchBaseTest.java index 5c067f060310082d3f64a9985f892111f0eb5f5e..657a424d84c35ade0959098bf8f7c085664ae901 100644 --- a/src/test/java/net/floodlightcontroller/core/internal/OFSwitchBaseTest.java +++ b/src/test/java/net/floodlightcontroller/core/internal/OFSwitchBaseTest.java @@ -146,7 +146,7 @@ public class OFSwitchBaseTest { .build(); IOFConnectionBackend conn = EasyMock.createNiceMock(IOFConnectionBackend.class); - capturedMessage = new Capture<Iterable<OFMessage>>(); + capturedMessage = EasyMock.newCapture(); expect(conn.write(EasyMock.capture(capturedMessage))).andReturn(Collections.<OFMessage>emptyList()).atLeastOnce(); expect(conn.getOFFactory()).andReturn(factory).anyTimes(); expect(conn.getAuxId()).andReturn(OFAuxId.MAIN).anyTimes(); diff --git a/src/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java b/src/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java index 7f453279c7e12ed0d9751759a62920ed98e11bb6..7ff102fa2bed58b96ab65be183e041f320676e90 100644 --- a/src/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java +++ b/src/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java @@ -438,8 +438,8 @@ public class ForwardingTest extends FloodlightTestCase { public void testForwardMultiSwitchPath() throws Exception { learnDevices(DestDeviceToLearn.DEVICE1); - Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL); - Capture<OFMessage> wc2 = new Capture<OFMessage>(CaptureType.ALL); + Capture<OFMessage> wc1 = EasyMock.newCapture(CaptureType.ALL); + Capture<OFMessage> wc2 = EasyMock.newCapture(CaptureType.ALL); Route route = new Route(DatapathId.of(1L), DatapathId.of(2L)); List<NodePortTuple> nptList = new ArrayList<NodePortTuple>(); @@ -508,8 +508,8 @@ public class ForwardingTest extends FloodlightTestCase { public void testForwardMultiSwitchPathIPv6() throws Exception { learnDevicesIPv6(DestDeviceToLearn.DEVICE1); - Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL); - Capture<OFMessage> wc2 = new Capture<OFMessage>(CaptureType.ALL); + Capture<OFMessage> wc1 = EasyMock.newCapture(CaptureType.ALL); + Capture<OFMessage> wc2 = EasyMock.newCapture(CaptureType.ALL); Route route = new Route(DatapathId.of(1L), DatapathId.of(2L)); List<NodePortTuple> nptList = new ArrayList<NodePortTuple>(); @@ -578,8 +578,8 @@ public class ForwardingTest extends FloodlightTestCase { public void testForwardSingleSwitchPath() throws Exception { learnDevices(DestDeviceToLearn.DEVICE2); - Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL); - Capture<OFMessage> wc2 = new Capture<OFMessage>(CaptureType.ALL); + Capture<OFMessage> wc1 = EasyMock.newCapture(CaptureType.ALL); + Capture<OFMessage> wc2 = EasyMock.newCapture(CaptureType.ALL); Route route = new Route(DatapathId.of(1L), DatapathId.of(1L)); route.getPath().add(new NodePortTuple(DatapathId.of(1L), OFPort.of(1))); @@ -632,8 +632,8 @@ public class ForwardingTest extends FloodlightTestCase { public void testForwardSingleSwitchPathIPv6() throws Exception { learnDevicesIPv6(DestDeviceToLearn.DEVICE2); - Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL); - Capture<OFMessage> wc2 = new Capture<OFMessage>(CaptureType.ALL); + Capture<OFMessage> wc1 = EasyMock.newCapture(CaptureType.ALL); + Capture<OFMessage> wc2 = EasyMock.newCapture(CaptureType.ALL); Route route = new Route(DatapathId.of(1L), DatapathId.of(1L)); route.getPath().add(new NodePortTuple(DatapathId.of(1L), OFPort.of(1))); @@ -747,7 +747,7 @@ public class ForwardingTest extends FloodlightTestCase { // Set no destination attachment point or route // expect no Flow-mod but expect the packet to be flooded - Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL); + Capture<OFMessage> wc1 = EasyMock.newCapture(CaptureType.ALL); Set<OFPort> bcastPorts = new HashSet<OFPort>(); bcastPorts.add(OFPort.of(10)); @@ -778,7 +778,7 @@ public class ForwardingTest extends FloodlightTestCase { // Set no destination attachment point or route // expect no Flow-mod but expect the packet to be flooded - Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL); + Capture<OFMessage> wc1 = EasyMock.newCapture(CaptureType.ALL); Set<OFPort> bcastPorts = new HashSet<OFPort>(); bcastPorts.add(OFPort.of(10)); diff --git a/src/test/java/net/floodlightcontroller/hub/HubTest.java b/src/test/java/net/floodlightcontroller/hub/HubTest.java index 6bc1c98984d123ef3342de16dac4021bfca7a263..6fcd37e81669945e853450426cb09a2fb97b8c23 100644 --- a/src/test/java/net/floodlightcontroller/hub/HubTest.java +++ b/src/test/java/net/floodlightcontroller/hub/HubTest.java @@ -121,7 +121,7 @@ public class HubTest extends FloodlightTestCase { .setInPort(OFPort.of(1)) .setData(this.testPacketSerialized).build(); - Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL); + Capture<OFMessage> wc1 = EasyMock.newCapture(CaptureType.ALL); expect(mockSwitch.write(capture(wc1))).andReturn(true).anyTimes(); @@ -163,7 +163,7 @@ public class HubTest extends FloodlightTestCase { // Mock up our expected behavior IOFSwitch mockSwitch = createMock(IOFSwitch.class); EasyMock.expect(mockSwitch.getOFFactory()).andReturn(OFFactories.getFactory(OFVersion.OF_13)).anyTimes(); - Capture<OFPacketOut> wc1 = new Capture<OFPacketOut>(CaptureType.ALL); + Capture<OFPacketOut> wc1 = EasyMock.newCapture(CaptureType.ALL); expect(mockSwitch.write(capture(wc1))).andReturn(true).anyTimes(); // Start recording the replay on the mocks diff --git a/src/test/java/net/floodlightcontroller/learningswitch/LearningSwitchTest.java b/src/test/java/net/floodlightcontroller/learningswitch/LearningSwitchTest.java index c52d6312fa17a4435f344caa40729ad7fd9de96e..eb884f4406694a574b31dd31a1a3fb33d1dd176b 100644 --- a/src/test/java/net/floodlightcontroller/learningswitch/LearningSwitchTest.java +++ b/src/test/java/net/floodlightcontroller/learningswitch/LearningSwitchTest.java @@ -184,7 +184,7 @@ public class LearningSwitchTest extends FloodlightTestCase { .setData(this.testPacketSerialized) .build(); - Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL); + Capture<OFMessage> wc1 = EasyMock.newCapture(CaptureType.ALL); // Mock up our expected behavior IOFSwitch mockSwitch = createMock(IOFSwitch.class); @@ -215,9 +215,9 @@ public class LearningSwitchTest extends FloodlightTestCase { // tweak the test packet in since we need a bufferId this.packetIn = packetIn.createBuilder().setBufferId(OFBufferId.of(50)).build(); - Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL); - Capture<OFMessage> wc2 = new Capture<OFMessage>(CaptureType.ALL); - Capture<OFMessage> wc3 = new Capture<OFMessage>(CaptureType.ALL); + Capture<OFMessage> wc1 = EasyMock.newCapture(CaptureType.ALL); + Capture<OFMessage> wc2 = EasyMock.newCapture(CaptureType.ALL); + Capture<OFMessage> wc3 = EasyMock.newCapture(CaptureType.ALL); Set<OFFlowModFlags> flags = new HashSet<OFFlowModFlags>(); flags.add(OFFlowModFlags.SEND_FLOW_REM); diff --git a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java b/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java index fce4585c7386fef8673ef5da4c942487751e15c8..6cc84cb745cb7f26c2b920c4880d5913d6df249c 100644 --- a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java +++ b/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java @@ -558,7 +558,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { } // Set the captures. - wc = new Capture<OFMessage>(CaptureType.ALL); + wc = EasyMock.newCapture(CaptureType.ALL); // Expect switch to return those ports. expect(sw1.getEnabledPortNumbers()).andReturn(ports).anyTimes(); diff --git a/src/test/java/net/floodlightcontroller/loadbalancer/LoadBalancerTest.java b/src/test/java/net/floodlightcontroller/loadbalancer/LoadBalancerTest.java index ae3adb92dab7a9ec590d8843d6b8ac8a3c5467d7..b0496135e6ceb4c3f90748454b6dd4a9944580bf 100644 --- a/src/test/java/net/floodlightcontroller/loadbalancer/LoadBalancerTest.java +++ b/src/test/java/net/floodlightcontroller/loadbalancer/LoadBalancerTest.java @@ -440,7 +440,7 @@ public class LoadBalancerTest extends FloodlightTestCase { OFPacketOut arpReplyPacketOut1; - Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL); + Capture<OFMessage> wc1 = EasyMock.newCapture(CaptureType.ALL); sw1 = EasyMock.createNiceMock(IOFSwitch.class); expect(sw1.getId()).andReturn(DatapathId.of(1L)).anyTimes(); diff --git a/src/test/java/net/floodlightcontroller/staticflowentry/StaticFlowTests.java b/src/test/java/net/floodlightcontroller/staticflowentry/StaticFlowTests.java index 25f8f4ea1ade6578f2ee1361f641f1ded33d3fdb..fc0c1b27323e40cf2293064e8f603bec60c3fcc7 100644 --- a/src/test/java/net/floodlightcontroller/staticflowentry/StaticFlowTests.java +++ b/src/test/java/net/floodlightcontroller/staticflowentry/StaticFlowTests.java @@ -27,6 +27,7 @@ import java.util.Set; import org.easymock.Capture; import org.easymock.CaptureType; +import org.easymock.EasyMock; import org.junit.Test; import org.projectfloodlight.openflow.protocol.OFFactories; import org.projectfloodlight.openflow.protocol.OFFactory; @@ -200,8 +201,8 @@ public class StaticFlowTests extends FloodlightTestCase { dpid = HexString.toLong(TestSwitch1DPID); mockSwitch = createNiceMock(IOFSwitch.class); - writeCapture = new Capture<OFMessage>(CaptureType.ALL); - writeCaptureList = new Capture<List<OFMessage>>(CaptureType.ALL); + writeCapture = EasyMock.newCapture(CaptureType.ALL); + writeCaptureList = EasyMock.newCapture(CaptureType.ALL); expect(mockSwitch.write(capture(writeCapture))).andReturn(true).anyTimes(); expect(mockSwitch.write(capture(writeCaptureList))).andReturn(Collections.<OFMessage>emptyList()).anyTimes(); @@ -264,9 +265,9 @@ public class StaticFlowTests extends FloodlightTestCase { // should be fixed because OFMessage.hashCode() is deterministic OFFlowMod firstFlowMod = (OFFlowMod) writeCapture.getValues().get(2); verifyFlowMod(firstFlowMod, FlowMod1); - OFFlowMod secondFlowMod = (OFFlowMod) writeCapture.getValues().get(1); + OFFlowMod secondFlowMod = (OFFlowMod) writeCapture.getValues().get(0); /* Java 8 stores 2-0-1 */ verifyFlowMod(secondFlowMod, FlowMod2); - OFFlowMod thirdFlowMod = (OFFlowMod) writeCapture.getValues().get(0); + OFFlowMod thirdFlowMod = (OFFlowMod) writeCapture.getValues().get(1); verifyFlowMod(thirdFlowMod, FlowMod3); writeCapture.reset();