Favor Guava version of Resource utility

Change-Id: I3590d6addc88aa1bc162e5d7b79734445fefaf15
diff --git a/utils/misc/src/test/java/org/onlab/packet/dhcp/Dhcp6RelayTest.java b/utils/misc/src/test/java/org/onlab/packet/dhcp/Dhcp6RelayTest.java
index f8a0425..6f8c518 100644
--- a/utils/misc/src/test/java/org/onlab/packet/dhcp/Dhcp6RelayTest.java
+++ b/utils/misc/src/test/java/org/onlab/packet/dhcp/Dhcp6RelayTest.java
@@ -19,7 +19,8 @@
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
-import org.apache.commons.io.IOUtils;
+import com.google.common.io.Resources;
+
 import org.junit.Test;
 import org.onlab.packet.DHCP6;
 import org.onlab.packet.Ip6Address;
@@ -64,7 +65,7 @@
      */
     @Test
     public void deserializeSolicit() throws Exception {
-        byte[] data = IOUtils.toByteArray(Dhcp6RelayTest.class.getResource(SOLICIT));
+        byte[] data = Resources.toByteArray(Dhcp6RelayTest.class.getResource(SOLICIT));
         DHCP6 relayMsg = DHCP6.deserializer().deserialize(data, 0, data.length);
         assertEquals(relayMsg.getMsgType(), DHCP6.MsgType.RELAY_FORW.value());
         assertEquals(relayMsg.getHopCount(), HOP_COUNT);
@@ -177,7 +178,7 @@
         relayOption.setPayload(relaiedDhcp6);
 
         relayMsg.setOptions(ImmutableList.of(relayOption));
-        assertArrayEquals(IOUtils.toByteArray(Dhcp6RelayTest.class.getResource(SOLICIT)),
+        assertArrayEquals(Resources.toByteArray(Dhcp6RelayTest.class.getResource(SOLICIT)),
                           relayMsg.serialize());
     }
 
@@ -188,7 +189,7 @@
      */
     @Test
     public void deserializeAdvertise() throws Exception {
-        byte[] data = IOUtils.toByteArray(getClass().getResource(ADVERTISE));
+        byte[] data = Resources.toByteArray(getClass().getResource(ADVERTISE));
         DHCP6 relayMsg = DHCP6.deserializer().deserialize(data, 0, data.length);
 
         assertEquals(relayMsg.getMsgType(), DHCP6.MsgType.RELAY_REPL.value());
@@ -304,7 +305,7 @@
 
         relayMsg.setOptions(ImmutableList.of(relayOption));
 
-        assertArrayEquals(IOUtils.toByteArray(Dhcp6RelayTest.class.getResource(ADVERTISE)),
+        assertArrayEquals(Resources.toByteArray(Dhcp6RelayTest.class.getResource(ADVERTISE)),
                           relayMsg.serialize());
     }
 
@@ -315,7 +316,7 @@
      */
     @Test
     public void deserializeRequest() throws Exception {
-        byte[] data = IOUtils.toByteArray(getClass().getResource(REQUEST));
+        byte[] data = Resources.toByteArray(getClass().getResource(REQUEST));
         DHCP6 relayMsg = DHCP6.deserializer().deserialize(data, 0, data.length);
 
         assertEquals(relayMsg.getMsgType(), DHCP6.MsgType.RELAY_FORW.value());
@@ -458,7 +459,7 @@
 
         relayMsg.setOptions(ImmutableList.of(relayOption));
 
-        assertArrayEquals(IOUtils.toByteArray(Dhcp6RelayTest.class.getResource(REQUEST)),
+        assertArrayEquals(Resources.toByteArray(Dhcp6RelayTest.class.getResource(REQUEST)),
                           relayMsg.serialize());
     }
 
@@ -469,7 +470,7 @@
      */
     @Test
     public void deserializeReply() throws Exception {
-        byte[] data = IOUtils.toByteArray(getClass().getResource(REPLY));
+        byte[] data = Resources.toByteArray(getClass().getResource(REPLY));
         DHCP6 relayMsg = DHCP6.deserializer().deserialize(data, 0, data.length);
 
         assertEquals(relayMsg.getMsgType(), DHCP6.MsgType.RELAY_REPL.value());
@@ -580,7 +581,7 @@
 
         relayMsg.setOptions(ImmutableList.of(relayOption));
 
-        assertArrayEquals(IOUtils.toByteArray(Dhcp6RelayTest.class.getResource(REPLY)),
+        assertArrayEquals(Resources.toByteArray(Dhcp6RelayTest.class.getResource(REPLY)),
                           relayMsg.serialize());
     }
 }
diff --git a/utils/misc/src/test/java/org/onlab/packet/dhcp/Dhcp6Test.java b/utils/misc/src/test/java/org/onlab/packet/dhcp/Dhcp6Test.java
index 4996ae6..896242a 100644
--- a/utils/misc/src/test/java/org/onlab/packet/dhcp/Dhcp6Test.java
+++ b/utils/misc/src/test/java/org/onlab/packet/dhcp/Dhcp6Test.java
@@ -18,7 +18,8 @@
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
-import org.apache.commons.io.IOUtils;
+import com.google.common.io.Resources;
+
 import org.junit.Test;
 import org.onlab.packet.DHCP6;
 import org.onlab.packet.Deserializer;
@@ -81,7 +82,7 @@
      */
     @Test
     public void testDeserializeSolicit() throws Exception {
-        byte[] data = IOUtils.toByteArray(Dhcp6RelayTest.class.getResource(SOLICIT));
+        byte[] data = Resources.toByteArray(Dhcp6RelayTest.class.getResource(SOLICIT));
         DHCP6 dhcp6 = DHCP6.deserializer().deserialize(data, 0, data.length);
         assertEquals(dhcp6.getMsgType(), DHCP6.MsgType.SOLICIT.value());
         assertEquals(dhcp6.getTransactionId(), XID_1);
@@ -175,7 +176,7 @@
         Dhcp6RelayOption relayOption = new Dhcp6RelayOption();
         relayOption.setPayload(dhcp6);
 
-        assertArrayEquals(IOUtils.toByteArray(Dhcp6RelayTest.class.getResource(SOLICIT)),
+        assertArrayEquals(Resources.toByteArray(Dhcp6RelayTest.class.getResource(SOLICIT)),
                           dhcp6.serialize());
     }
 
@@ -186,7 +187,7 @@
      */
     @Test
     public void deserializeAdvertise() throws Exception {
-        byte[] data = IOUtils.toByteArray(getClass().getResource(ADVERTISE));
+        byte[] data = Resources.toByteArray(getClass().getResource(ADVERTISE));
 
 
         DHCP6 dhcp6 = DHCP6.deserializer().deserialize(data, 0, data.length);
@@ -283,7 +284,7 @@
         Dhcp6RelayOption relayOption = new Dhcp6RelayOption();
         relayOption.setPayload(dhcp6);
 
-        assertArrayEquals(IOUtils.toByteArray(Dhcp6RelayTest.class.getResource(ADVERTISE)),
+        assertArrayEquals(Resources.toByteArray(Dhcp6RelayTest.class.getResource(ADVERTISE)),
                           dhcp6.serialize());
     }
 
@@ -294,7 +295,7 @@
      */
     @Test
     public void deserializeRequest() throws Exception {
-        byte[] data = IOUtils.toByteArray(getClass().getResource(REQUEST));
+        byte[] data = Resources.toByteArray(getClass().getResource(REQUEST));
         DHCP6 dhcp6 = DHCP6.deserializer().deserialize(data, 0, data.length);
         assertEquals(dhcp6.getMsgType(), DHCP6.MsgType.REQUEST.value());
         assertEquals(dhcp6.getTransactionId(), XID_2);
@@ -416,7 +417,7 @@
         Dhcp6RelayOption relayOption = new Dhcp6RelayOption();
         relayOption.setPayload(dhcp6);
 
-        assertArrayEquals(IOUtils.toByteArray(Dhcp6RelayTest.class.getResource(REQUEST)),
+        assertArrayEquals(Resources.toByteArray(Dhcp6RelayTest.class.getResource(REQUEST)),
                           dhcp6.serialize());
     }
 
@@ -427,7 +428,7 @@
      */
     @Test
     public void deserializeReply() throws Exception {
-        byte[] data = IOUtils.toByteArray(getClass().getResource(REPLY));
+        byte[] data = Resources.toByteArray(getClass().getResource(REPLY));
 
         DHCP6 dhcp6 = DHCP6.deserializer().deserialize(data, 0, data.length);
         assertEquals(dhcp6.getMsgType(), DHCP6.MsgType.REPLY.value());
@@ -518,7 +519,7 @@
         Dhcp6RelayOption relayOption = new Dhcp6RelayOption();
         relayOption.setPayload(dhcp6);
 
-        assertArrayEquals(IOUtils.toByteArray(Dhcp6RelayTest.class.getResource(REPLY)),
+        assertArrayEquals(Resources.toByteArray(Dhcp6RelayTest.class.getResource(REPLY)),
                           dhcp6.serialize());
     }
 }