Search in sources :

Example 1 with SimpleGcWriter

use of com.tagtraum.perf.gcviewer.exp.impl.SimpleGcWriter in project GCViewer by chewiebug.

the class SimpleGcWriterTest method exportLocaleSv.

@Test
public void exportLocaleSv() throws Exception {
    Locale.setDefault(new Locale("sv", "se"));
    try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        SimpleGcWriter writer = new SimpleGcWriter(outputStream)) {
        writer.write(gcModel);
        String[] lines = outputStream.toString().split(System.getProperty("line.separator"));
        assertEquals("line count", 2, lines.length);
        String[] firstLine = lines[0].split(" ");
        assertEquals("number of parts in line 1", 3, firstLine.length);
        assertEquals("timestamp", "0.677000", firstLine[1]);
    }
}
Also used : Locale(java.util.Locale) ByteArrayOutputStream(java.io.ByteArrayOutputStream) SimpleGcWriter(com.tagtraum.perf.gcviewer.exp.impl.SimpleGcWriter) Test(org.junit.Test)

Example 2 with SimpleGcWriter

use of com.tagtraum.perf.gcviewer.exp.impl.SimpleGcWriter in project GCViewer by chewiebug.

the class SimpleGcWriterTest method exportLocaleDe.

@Test
public void exportLocaleDe() throws Exception {
    Locale.setDefault(new Locale("de", "ch"));
    try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        SimpleGcWriter writer = new SimpleGcWriter(outputStream)) {
        writer.write(gcModel);
        String[] lines = outputStream.toString().split(System.getProperty("line.separator"));
        assertEquals("line count", 2, lines.length);
        String[] firstLine = lines[0].split(" ");
        assertEquals("number of parts in line 1", 3, firstLine.length);
        assertEquals("name of event", "YoungGC", firstLine[0]);
        assertEquals("timestamp", "0.677000", firstLine[1]);
        assertEquals("duration", "0.030063", firstLine[2]);
        String[] secondLine = lines[1].split(" ");
        assertEquals("number of parts in line 2", 3, secondLine.length);
        assertEquals("name of event 2", "InitialMarkGC", secondLine[0]);
    }
}
Also used : Locale(java.util.Locale) ByteArrayOutputStream(java.io.ByteArrayOutputStream) SimpleGcWriter(com.tagtraum.perf.gcviewer.exp.impl.SimpleGcWriter) Test(org.junit.Test)

Aggregations

SimpleGcWriter (com.tagtraum.perf.gcviewer.exp.impl.SimpleGcWriter)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 Locale (java.util.Locale)2 Test (org.junit.Test)2