<artifactId>guava</artifactId>
</dependency>
<!--Test dependencies-->
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-binding-dom-adapter</artifactId>
import static org.junit.Assert.assertEquals;
import static org.opendaylight.protocol.bgp.cli.utils.BGPOperationalStateUtils.PROTOCOLS_IID;
import static org.opendaylight.protocol.bgp.cli.utils.NeighborStateCliUtilsTest.NEIGHBOR_ADDRESS;
-import static org.opendaylight.protocol.bgp.cli.utils.PeerGroupStateCliUtilsTest.UTF8;
+import com.google.common.io.Resources;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
+import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.concurrent.ExecutionException;
-import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractConcurrentDataBrokerTest;
public void testDisplayBgpOperationalStateFound() throws IOException, ExecutionException, InterruptedException {
createDefaultProtocol();
BGPOperationalStateUtils.displayBgpOperationalState(getDataBroker(), this.stream, RIB_ID, null, null);
- final String expected = IOUtils.toString(
- getClass().getClassLoader().getResourceAsStream("global.txt"), UTF8);
+ final String expected = Resources.toString(getClass().getClassLoader().getResource("global.txt"),
+ StandardCharsets.UTF_8);
assertEquals(expected, this.output.toString());
}
createDefaultProtocol();
BGPOperationalStateUtils.displayBgpOperationalState(getDataBroker(), this.stream, RIB_ID, null,
NEIGHBOR_ADDRESS);
- final String expected = IOUtils.toString(
- getClass().getClassLoader().getResourceAsStream("empty-neighbor.txt"), UTF8);
+ final String expected = Resources.toString(getClass().getClassLoader().getResource("empty-neighbor.txt"),
+ StandardCharsets.UTF_8);
assertEquals(expected, this.output.toString());
}
}
\ No newline at end of file
import static org.junit.Assert.assertEquals;
import static org.opendaylight.protocol.bgp.cli.utils.BGPOperationalStateUtilsTest.RIB_ID;
-import static org.opendaylight.protocol.bgp.cli.utils.PeerGroupStateCliUtilsTest.UTF8;
+import com.google.common.io.Resources;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
+import java.nio.charset.StandardCharsets;
import java.util.Collections;
-import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.AfiSafisBuilder;
final GlobalBuilder builder = buildGlobal(false);
GlobalStateCliUtils.displayRibOperationalState(RIB_ID, builder.build(), this.stream);
- final String expected = IOUtils.toString(
- getClass().getClassLoader().getResourceAsStream("empty-global.txt"), UTF8);
+ final String expected = Resources.toString(getClass().getClassLoader().getResource("empty-global.txt"),
+ StandardCharsets.UTF_8);
assertEquals(expected, this.output.toString());
}
final GlobalBuilder builder = buildGlobal(true);
GlobalStateCliUtils.displayRibOperationalState(RIB_ID, builder.build(), this.stream);
- final String expected = IOUtils.toString(
- getClass().getClassLoader().getResourceAsStream("global.txt"), UTF8);
+ final String expected = Resources.toString(getClass().getClassLoader().getResource("global.txt"),
+ StandardCharsets.UTF_8);
assertEquals(expected, this.output.toString());
}
package org.opendaylight.protocol.bgp.cli.utils;
import static org.junit.Assert.assertEquals;
-import static org.opendaylight.protocol.bgp.cli.utils.PeerGroupStateCliUtilsTest.UTF8;
+import com.google.common.io.Resources;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.math.BigDecimal;
import java.math.BigInteger;
+import java.nio.charset.StandardCharsets;
import java.util.Collections;
-import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder;
NeighborStateCliUtils.displayNeighborOperationalState(NEIGHBOR_ADDRESS,
neighbor, this.stream);
- final String expected = IOUtils.toString(
- getClass().getClassLoader().getResourceAsStream("empty-neighbor.txt"), UTF8);
+ final String expected = Resources.toString(getClass().getClassLoader().getResource("empty-neighbor.txt"),
+ StandardCharsets.UTF_8);
assertEquals(expected, this.output.toString());
}
NeighborStateCliUtils.displayNeighborOperationalState(NEIGHBOR_ADDRESS,
neighbor, this.stream);
- final String expected = IOUtils.toString(
- getClass().getClassLoader().getResourceAsStream("neighbor.txt"), UTF8);
+ final String expected = Resources.toString(getClass().getClassLoader().getResource("neighbor.txt"),
+ StandardCharsets.UTF_8);
assertEquals(expected, this.output.toString());
}
}
\ No newline at end of file
import static org.junit.Assert.assertEquals;
+import com.google.common.io.Resources;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
+import java.nio.charset.StandardCharsets;
import java.util.Collections;
-import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.peer.group.PeerGroupBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.PeerGroupStateAugmentation;
public final class PeerGroupStateCliUtilsTest {
private static final String TEST_GROUP = "test-group";
- static final String UTF8 = "UTF-8";
private final ByteArrayOutputStream output = new ByteArrayOutputStream();
private final PrintStream stream = new PrintStream(this.output);
final PeerGroupBuilder peerGroup = new PeerGroupBuilder().setPeerGroupName(TEST_GROUP);
PeerGroupStateCliUtils.displayPeerOperationalState(Collections.singletonList(peerGroup.build()), this.stream);
- final String expected = IOUtils.toString(
- getClass().getClassLoader().getResourceAsStream("empty-peer-group.txt"), UTF8);
+ final String expected = Resources.toString(getClass().getClassLoader().getResource("empty-peer-group.txt"),
+ StandardCharsets.UTF_8);
assertEquals(expected, this.output.toString());
}
.StateBuilder().addAugmentation(PeerGroupStateAugmentation.class, groupState).build());
PeerGroupStateCliUtils.displayPeerOperationalState(Collections.singletonList(peerGroup.build()), this.stream);
- final String expected = IOUtils.toString(
- getClass().getClassLoader().getResourceAsStream("peer-group.txt"), UTF8);
+ final String expected = Resources.toString(getClass().getClassLoader().getResource("peer-group.txt"),
+ StandardCharsets.UTF_8);
assertEquals(expected, this.output.toString());
}
}
\ No newline at end of file
<artifactId>guava</artifactId>
</dependency>
<!--Test dependencies-->
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-binding-dom-adapter</artifactId>
import static org.junit.Assert.assertEquals;
+import com.google.common.io.Resources;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
+import java.nio.charset.StandardCharsets;
import java.util.concurrent.ExecutionException;
-import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractConcurrentDataBrokerTest;
private static final String IP_ADDRESS = "127.0.0.1";
private static final String RIB_NOT_FOUND = "Node [pcc://" + IP_ADDRESS + "] not found\n";
private static final String NODE_ID = "pcc://127.0.0.1";
- private static final String UTF8 = "UTF-8";
private static final byte[] SPEAKER_ID = {0x01, 0x02, 0x03, 0x04};
+
private final ByteArrayOutputStream output = new ByteArrayOutputStream();
private final PrintStream stream = new PrintStream(this.output);
public void testDisplayNodeState() throws IOException, ExecutionException, InterruptedException {
createDefaultProtocol();
PcepStateUtils.displayNodeState(getDataBroker(), this.stream, PCEP_TOPOLOGY, NODE_ID);
- final String expected = IOUtils.toString(
- getClass().getClassLoader().getResourceAsStream("node.txt"), UTF8);
+ final String expected = Resources.toString(getClass().getClassLoader().getResource("node.txt"),
+ StandardCharsets.UTF_8);
assertEquals(expected, this.output.toString());
}