Remove use of commons-io in tests 80/29680/2
authorRobert Varga <robert.varga@pantheon.sk>
Fri, 13 Nov 2015 19:24:43 +0000 (20:24 +0100)
committerRobert Varga <robert.varga@pantheon.sk>
Sat, 14 Nov 2015 13:46:52 +0000 (14:46 +0100)
Guava provides equivalent utilities, so use those.

Change-Id: Ieb8a86d4a9081413e6b75e7e84c323c6e8e36f51
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
opendaylight/restconf/sal-rest-connector/pom.xml
opendaylight/restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/JSONRestconfServiceImplTest.java

index dd1cd94369c74788877b44c7c45a134c8cbb7f82..1b1f5b5c6a2dbdd8051cf5bdceef0ce8a853008b 100644 (file)
     </dependency>
 
     <!-- Testing Dependencies -->
-     <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
index 41d06df0ce0f516983eb8ba223be1ae9fc4e08a1..89608e06aceb222619cfc6eb20ede8afc27bd614 100644 (file)
@@ -22,13 +22,13 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.verify;
 import com.google.common.base.Optional;
+import com.google.common.io.Resources;
 import com.google.common.util.concurrent.Futures;
 import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 import java.util.Map;
-import org.apache.commons.io.IOUtils;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -111,9 +111,8 @@ public class JSONRestconfServiceImplTest {
         reset(brokerFacade);
     }
 
-    private String loadData(String path) throws IOException {
-        InputStream stream = JSONRestconfServiceImplTest.class.getResourceAsStream(path);
-        return IOUtils.toString(stream, "UTF-8");
+    private static String loadData(final String path) throws IOException {
+        return Resources.asCharSource(JSONRestconfServiceImplTest.class.getResource(path), StandardCharsets.UTF_8).read();
     }
 
     @SuppressWarnings("rawtypes")
@@ -398,7 +397,7 @@ public class JSONRestconfServiceImplTest {
         service.invokeRpc(uriPath, Optional.<String>absent());
     }
 
-    void testGet(LogicalDatastoreType datastoreType) throws OperationFailedException {
+    void testGet(final LogicalDatastoreType datastoreType) throws OperationFailedException {
         MapEntryNode entryNode = ImmutableNodes.mapEntryBuilder(INTERFACE_QNAME, NAME_QNAME, "eth0")
                 .withChild(ImmutableNodes.leafNode(NAME_QNAME, "eth0"))
                 .withChild(ImmutableNodes.leafNode(TYPE_QNAME, "ethernetCsmacd"))
@@ -447,13 +446,13 @@ public class JSONRestconfServiceImplTest {
         return mockMountPoint;
     }
 
-    void verifyLeafNode(DataContainerNode<?> parent, QName leafType, Object leafValue) {
+    void verifyLeafNode(final DataContainerNode<?> parent, final QName leafType, final Object leafValue) {
         Optional<DataContainerChild<?, ?>> leafChild = parent.getChild(new NodeIdentifier(leafType));
         assertEquals(leafType.toString() + " present", true, leafChild.isPresent());
         assertEquals(leafType.toString() + " value", leafValue, leafChild.get().getValue());
     }
 
-    void verifyPath(YangInstanceIdentifier path, Object... expArgs) {
+    void verifyPath(final YangInstanceIdentifier path, final Object... expArgs) {
         List<PathArgument> pathArgs = path.getPathArguments();
         assertEquals("Arg count for actual path " + path, expArgs.length, pathArgs.size());
         int i = 0;