YARN-10491. Fix deprecation warnings in SLSWebApp.java (#2519)
Signed-off-by: Akira Ajisaka <ajisaka@apache.org>
This commit is contained in:
parent
01383a2172
commit
aaf9e3d320
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.ObjectInputStream;
|
import java.io.ObjectInputStream;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -94,11 +95,11 @@ public class SLSWebApp extends HttpServlet {
|
|||||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||||
try {
|
try {
|
||||||
simulateInfoTemplate = IOUtils.toString(
|
simulateInfoTemplate = IOUtils.toString(
|
||||||
cl.getResourceAsStream("html/simulate.info.html.template"));
|
cl.getResourceAsStream("html/simulate.info.html.template"), StandardCharsets.UTF_8);
|
||||||
simulateTemplate = IOUtils.toString(
|
simulateTemplate = IOUtils.toString(
|
||||||
cl.getResourceAsStream("html/simulate.html.template"));
|
cl.getResourceAsStream("html/simulate.html.template"), StandardCharsets.UTF_8);
|
||||||
trackTemplate = IOUtils.toString(
|
trackTemplate = IOUtils.toString(
|
||||||
cl.getResourceAsStream("html/track.html.template"));
|
cl.getResourceAsStream("html/track.html.template"), StandardCharsets.UTF_8);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -34,7 +35,7 @@ public class TestSLSWebApp {
|
|||||||
@Test
|
@Test
|
||||||
public void testSimulateInfoPageHtmlTemplate() throws Exception {
|
public void testSimulateInfoPageHtmlTemplate() throws Exception {
|
||||||
String simulateInfoTemplate = FileUtils.readFileToString(
|
String simulateInfoTemplate = FileUtils.readFileToString(
|
||||||
new File("src/main/html/simulate.info.html.template"));
|
new File("src/main/html/simulate.info.html.template"), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
Map<String, Object> simulateInfoMap = new HashMap<>();
|
Map<String, Object> simulateInfoMap = new HashMap<>();
|
||||||
simulateInfoMap.put("Number of racks", 10);
|
simulateInfoMap.put("Number of racks", 10);
|
||||||
@ -72,7 +73,7 @@ public void testSimulateInfoPageHtmlTemplate() throws Exception {
|
|||||||
@Test
|
@Test
|
||||||
public void testSimulatePageHtmlTemplate() throws Exception {
|
public void testSimulatePageHtmlTemplate() throws Exception {
|
||||||
String simulateTemplate = FileUtils.readFileToString(
|
String simulateTemplate = FileUtils.readFileToString(
|
||||||
new File("src/main/html/simulate.html.template"));
|
new File("src/main/html/simulate.html.template"), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
Set<String> queues = new HashSet<String>();
|
Set<String> queues = new HashSet<String>();
|
||||||
queues.add("sls_queue_1");
|
queues.add("sls_queue_1");
|
||||||
@ -96,7 +97,7 @@ public void testSimulatePageHtmlTemplate() throws Exception {
|
|||||||
@Test
|
@Test
|
||||||
public void testTrackPageHtmlTemplate() throws Exception {
|
public void testTrackPageHtmlTemplate() throws Exception {
|
||||||
String trackTemplate = FileUtils.readFileToString(
|
String trackTemplate = FileUtils.readFileToString(
|
||||||
new File("src/main/html/track.html.template"));
|
new File("src/main/html/track.html.template"), StandardCharsets.UTF_8);
|
||||||
String trackedQueueInfo = "";
|
String trackedQueueInfo = "";
|
||||||
Set<String> trackedQueues = new HashSet<String>();
|
Set<String> trackedQueues = new HashSet<String>();
|
||||||
trackedQueues.add("sls_queue_1");
|
trackedQueues.add("sls_queue_1");
|
||||||
|
Loading…
Reference in New Issue
Block a user