/
TestOptionsWithLocale.java
40 lines (35 loc) · 1.25 KB
/
TestOptionsWithLocale.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package jdk.jfr.startupargs;
import java.io.IOException;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
/**
* @test
* @summary Checks that locale is respected when using -XX:FlightRecorderOptions
* See JDK-8244508
* @key jfr
* @requires vm.hasJFR
* @modules jdk.jfr
* @library /test/lib
* @run main jdk.jfr.startupargs.TestOptionsWithLocale
*/
public class TestOptionsWithLocale {
public static class PrintDate {
public static void main(String... args) {
GregorianCalendar date = new GregorianCalendar(2020, Calendar.JANUARY, 1);
DateFormat formatter = DateFormat.getDateTimeInstance();
System.out.println(formatter.format(date.getTime()));
}
}
public static void main(String... args) throws IOException {
ProcessBuilder pb = ProcessTools.createTestJvm(
"-Duser.country=DE",
"-Duser.language=de",
"-XX:FlightRecorderOptions:stackdepth=128",
PrintDate.class.getName());
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("01.01.2020, 00:00:00");
}
}