Remove some legacy APIs
Change-Id: I689190caf9be2357b2ffb2d2197783ebaba694d9
Signed-off-by: Vladyslav Marchenko <vladyslav.marchenko@pantheon.tech>
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.LinkedHashSet;
} catch (IOException e) {
throw new IllegalStateException("Cannot write error response body", e);
}
} catch (IOException e) {
throw new IllegalStateException("Cannot write error response body", e);
}
- try {
- return outputStream.toString(StandardCharsets.UTF_8.name());
- } catch (UnsupportedEncodingException e) {
- throw new IllegalStateException("Output stream cannot be converted to string representation", e);
- }
+ return outputStream.toString(StandardCharsets.UTF_8);
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
writer.writeTo(patchStatusContext, PatchStatusContext.class, null, EMPTY_ANNOTATIONS,
MediaType.APPLICATION_JSON_TYPE, null, outputStream);
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
writer.writeTo(patchStatusContext, PatchStatusContext.class, null, EMPTY_ANNOTATIONS,
MediaType.APPLICATION_JSON_TYPE, null, outputStream);
- return outputStream.toString(StandardCharsets.UTF_8.name());
+ return outputStream.toString(StandardCharsets.UTF_8);
}
private static String toJson(final NormalizedNodeContext readData) throws IOException {
}
private static String toJson(final NormalizedNodeContext readData) throws IOException {
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
writer.writeTo(readData, NormalizedNodeContext.class, null, EMPTY_ANNOTATIONS,
MediaType.APPLICATION_JSON_TYPE, null, outputStream);
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
writer.writeTo(readData, NormalizedNodeContext.class, null, EMPTY_ANNOTATIONS,
MediaType.APPLICATION_JSON_TYPE, null, outputStream);
- return outputStream.toString(StandardCharsets.UTF_8.name());
+ return outputStream.toString(StandardCharsets.UTF_8);
}
private static boolean isDataMissing(final Exception exception) {
}
private static boolean isDataMissing(final Exception exception) {
}
public static String loadTextFile(final String filePath) throws IOException {
}
public static String loadTextFile(final String filePath) throws IOException {
- final FileReader fileReader = new FileReader(filePath);
+ final FileReader fileReader = new FileReader(filePath, StandardCharsets.UTF_8);
final BufferedReader bufReader = new BufferedReader(fileReader);
String line = null;
final BufferedReader bufReader = new BufferedReader(fileReader);
String line = null;
Builders.containerBuilder(rpcInputSchemaNode);
final QName lfQName = QName.create(rpcModule.getQNameModule(), inputOutputName);
Builders.containerBuilder(rpcInputSchemaNode);
final QName lfQName = QName.create(rpcModule.getQNameModule(), inputOutputName);
- final DataSchemaNode lfSchemaNode = rpcInputSchemaNode.getDataChildByName(lfQName);
+ final DataSchemaNode lfSchemaNode = rpcInputSchemaNode.findDataChildByName(lfQName).orElseThrow();
assertTrue(lfSchemaNode instanceof LeafSchemaNode);
assertTrue(lfSchemaNode instanceof LeafSchemaNode);
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.Optional;
import javax.ws.rs.core.Response;
import java.util.Collection;
import java.util.Optional;
import javax.ws.rs.core.Response;
Response response = PostDataTransactionUtil.postData(this.uriInfo, payload,
new MdsalRestconfStrategy(transactionChainHandler), this.schema, null, null);
assertEquals(201, response.getStatus());
Response response = PostDataTransactionUtil.postData(this.uriInfo, payload,
new MdsalRestconfStrategy(transactionChainHandler), this.schema, null, null);
assertEquals(201, response.getStatus());
- assertThat(URLDecoder.decode(response.getLocation().toString(), "UTF-8"),
+ assertThat(URLDecoder.decode(response.getLocation().toString(), StandardCharsets.UTF_8),
containsString(identifier.getValue(identifier.keySet().iterator().next()).toString()));
verify(this.readWrite).exists(LogicalDatastoreType.CONFIGURATION, node);
verify(this.readWrite).put(LogicalDatastoreType.CONFIGURATION, node, data.getValue().iterator().next());
containsString(identifier.getValue(identifier.keySet().iterator().next()).toString()));
verify(this.readWrite).exists(LogicalDatastoreType.CONFIGURATION, node);
verify(this.readWrite).put(LogicalDatastoreType.CONFIGURATION, node, data.getValue().iterator().next());
response = PostDataTransactionUtil.postData(this.uriInfo, payload,
new NetconfRestconfStrategy(netconfService), this.schema, null, null);
assertEquals(201, response.getStatus());
response = PostDataTransactionUtil.postData(this.uriInfo, payload,
new NetconfRestconfStrategy(netconfService), this.schema, null, null);
assertEquals(201, response.getStatus());
- assertThat(URLDecoder.decode(response.getLocation().toString(), "UTF-8"),
+ assertThat(URLDecoder.decode(response.getLocation().toString(), StandardCharsets.UTF_8),
containsString(identifier.getValue(identifier.keySet().iterator().next()).toString()));
verify(this.netconfService).getConfig(node);
verify(this.netconfService).create(LogicalDatastoreType.CONFIGURATION, node, data.getValue().iterator().next(),
containsString(identifier.getValue(identifier.keySet().iterator().next()).toString()));
verify(this.netconfService).getConfig(node);
verify(this.netconfService).create(LogicalDatastoreType.CONFIGURATION, node, data.getValue().iterator().next(),