Replaces uses of IOUtils methods with guava/JDK equivalents.
Change-Id: I16ece0feec2f4dc84c3be91ec675a0294cffcffb
Signed-off-by: Robert Varga <rovarga@cisco.com>
<type>test-jar</type>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>config-persister-directory-xml-adapter</artifactId>
package org.opendaylight.controller.netconf.persist.impl;
import static org.junit.Assert.assertEquals;
-
+import com.google.common.base.Charsets;
import com.google.common.collect.Sets;
+import com.google.common.io.Resources;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
-import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.opendaylight.controller.netconf.util.xml.XmlUtil;
import org.w3c.dom.Element;
}
private Set<String> readLines(String fileName) throws IOException {
- return new HashSet<>(IOUtils.readLines(getClass().getResourceAsStream(fileName)));
+ return new HashSet<>(Resources.readLines(getClass().getResource(fileName), Charsets.UTF_8));
}
private String readToString(String fileName) throws IOException {
- return IOUtils.toString(getClass().getResourceAsStream(fileName));
+ return Resources.toString(getClass().getResource(fileName), Charsets.UTF_8);
}
}
<type>test-jar</type>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>xmlunit</groupId>
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
-
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import com.google.common.io.ByteStreams;
import io.netty.channel.ChannelFuture;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.commons.io.IOUtils;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
}
LOG.info(sb.toString());
- outToServer.write(IOUtils.toByteArray(clientHello));
+ outToServer.write(ByteStreams.toByteArray(clientHello));
outToServer.write("]]>]]>".getBytes());
outToServer.flush();
// Thread.sleep(100);
- outToServer.write(IOUtils.toByteArray(getConfig));
+ outToServer.write(ByteStreams.toByteArray(getConfig));
outToServer.write("]]>]]>".getBytes());
outToServer.flush();
Thread.sleep(100);
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.mock;
-
+import com.google.common.io.ByteStreams;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.EventLoopGroup;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.TimeUnit;
-import org.apache.commons.io.IOUtils;
import org.junit.After;
import org.junit.Before;
import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
assertNotNull(inputStream);
final byte[] content;
try {
- content = IOUtils.toByteArray(inputStream);
+ content = ByteStreams.toByteArray(inputStream);
} catch (IOException e) {
throw new IllegalStateException("Cannot read " + inputStream, e);
}
<groupId>${project.groupId}</groupId>
<artifactId>netconf-util</artifactId>
</dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>