Search in sources :

Example 6 with GcResourceSeries

use of com.tagtraum.perf.gcviewer.model.GcResourceSeries in project GCViewer by chewiebug.

the class TestGCResourceGroup method testGetGCResourceList_SeveralSeries.

@Test
public void testGetGCResourceList_SeveralSeries() throws Exception {
    File file1 = temporaryFolder.newFile();
    File file2 = temporaryFolder.newFile();
    File file3 = temporaryFolder.newFile();
    List<GCResource> resourcesForSeries1 = Arrays.asList(new GcResourceFile(file1), new GcResourceFile(file2), new GcResourceFile(file3));
    File file4 = temporaryFolder.newFile();
    File file5 = temporaryFolder.newFile();
    File file6 = temporaryFolder.newFile();
    String resourceNameGroup1 = file1.toURI().toURL().toString() + ">" + file2.toURI().toURL().toString() + ">" + file3.toURI().toURL().toString();
    String resourceNameGroup2 = file4.toURI().toURL().toString() + ">" + file5.toURI().toURL().toString() + ">" + file6.toURI().toURL().toString();
    GCResourceGroup group = new GCResourceGroup(resourceNameGroup1 + ";" + resourceNameGroup2);
    List<GCResource> resourcesForSeries2 = Arrays.asList(new GcResourceFile(file4), new GcResourceFile(file5), new GcResourceFile(file6));
    assertThat(group.getGCResourceList(), contains(new GcResourceSeries(resourcesForSeries1), new GcResourceSeries(resourcesForSeries2)));
}
Also used : GCResource(com.tagtraum.perf.gcviewer.model.GCResource) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) File(java.io.File) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GcResourceSeries(com.tagtraum.perf.gcviewer.model.GcResourceSeries) Test(org.junit.Test)

Example 7 with GcResourceSeries

use of com.tagtraum.perf.gcviewer.model.GcResourceSeries in project GCViewer by chewiebug.

the class GCModelLoaderControllerImpl method openAsSeries.

@Override
public void openAsSeries(List<GCResource> gcResourceList) {
    GcResourceSeries resourceSeries = new GcResourceSeries(gcResourceList);
    GCModelLoader loader = GCModelLoaderFactory.createFor(resourceSeries);
    openGCResource(loader.getGcResource(), loader);
    getRecentGCResourcesModel().add(Collections.singletonList(resourceSeries));
}
Also used : GCModelLoader(com.tagtraum.perf.gcviewer.ctrl.GCModelLoader) GcResourceSeries(com.tagtraum.perf.gcviewer.model.GcResourceSeries)

Example 8 with GcResourceSeries

use of com.tagtraum.perf.gcviewer.model.GcResourceSeries in project GCViewer by chewiebug.

the class GCViewerTest method singleArgumentWithSeriesOpensGui.

@Test
public void singleArgumentWithSeriesOpensGui() throws Exception {
    GCViewerGuiController controller = mock(GCViewerGuiController.class);
    GCViewer gcViewer = new GCViewer(controller, new GCViewerArgsParser());
    String[] args = { "some_gc.log.0;some_gc.log.1;some_gc.log.2" };
    gcViewer.doMain(args);
    verify(controller).startGui(new GcResourceSeries(Arrays.asList(new GcResourceFile("some_gc.log.0"), new GcResourceFile("some_gc.log.1"), new GcResourceFile("some_gc.log.2"))));
    assertThat(outContent.toString(), isEmptyString());
    assertThat(errContent.toString(), isEmptyString());
}
Also used : Matchers.isEmptyString(org.hamcrest.Matchers.isEmptyString) Matchers.containsString(org.hamcrest.Matchers.containsString) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GcResourceSeries(com.tagtraum.perf.gcviewer.model.GcResourceSeries) GCViewerGuiController(com.tagtraum.perf.gcviewer.ctrl.impl.GCViewerGuiController) Test(org.junit.Test)

Example 9 with GcResourceSeries

use of com.tagtraum.perf.gcviewer.model.GcResourceSeries in project GCViewer by chewiebug.

the class TestGCModelLoaderController method open_GcResourceSeries.

@Test
public void open_GcResourceSeries() throws Exception {
    List<GCResource> resources = getGcResourcesForSeries();
    GCResource series = new GcResourceSeries(resources);
    controller.open(series);
    assertThat(getOpenResources(), contains(series));
}
Also used : GCResource(com.tagtraum.perf.gcviewer.model.GCResource) GcResourceSeries(com.tagtraum.perf.gcviewer.model.GcResourceSeries) Test(org.junit.Test)

Example 10 with GcResourceSeries

use of com.tagtraum.perf.gcviewer.model.GcResourceSeries in project GCViewer by chewiebug.

the class TestGCViewerArgsParser method onlyGcLogSeries.

@Test
public void onlyGcLogSeries() throws Exception {
    String[] args = { "some_gc.log.0;some_gc.log.1;some_gc.log.2" };
    GCViewerArgsParser gcViewerArgsParser = new GCViewerArgsParser();
    gcViewerArgsParser.parseArguments(args);
    assertEquals(gcViewerArgsParser.getArgumentCount(), 1);
    List<GCResource> resources = Arrays.asList(new GcResourceFile("some_gc.log.0"), new GcResourceFile("some_gc.log.1"), new GcResourceFile("some_gc.log.2"));
    assertEquals(gcViewerArgsParser.getGcResource(), new GcResourceSeries(resources));
    assertEquals(gcViewerArgsParser.getType(), DataWriterType.SUMMARY);
}
Also used : GCResource(com.tagtraum.perf.gcviewer.model.GCResource) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GcResourceSeries(com.tagtraum.perf.gcviewer.model.GcResourceSeries) Test(org.junit.Test)

Aggregations

GcResourceSeries (com.tagtraum.perf.gcviewer.model.GcResourceSeries)14 GcResourceFile (com.tagtraum.perf.gcviewer.model.GcResourceFile)11 Test (org.junit.Test)11 GCResource (com.tagtraum.perf.gcviewer.model.GCResource)10 ArrayList (java.util.ArrayList)6 GCModel (com.tagtraum.perf.gcviewer.model.GCModel)3 GCModelLoader (com.tagtraum.perf.gcviewer.ctrl.GCModelLoader)2 File (java.io.File)2 GCViewerGuiController (com.tagtraum.perf.gcviewer.ctrl.impl.GCViewerGuiController)1 IOException (java.io.IOException)1 Logger (java.util.logging.Logger)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Matchers.isEmptyString (org.hamcrest.Matchers.isEmptyString)1