@Test(groups = "fast") public void testLegendConfiguration() throws Exception { final String configPath = System.getProperty("java.io.tmpdir") + "/TestLegendConfigurationsManager-" + System.currentTimeMillis(); final String legendConfigurationString = "{\n" + " \"JVMMemory\": {\n" + " \"heapMax\": \"formatBase1024KMGTP\",\n" + " \"nonHeapMax\": \"formatBase1024KMGTP\",\n" + " \"heapUsed\": \"formatBase1024KMGTP\",\n" + " \"nonHeapUsed\": \"formatBase1024KMGTP\"\n" + " },\n" + " \"ParSurvivorSpace\": {\n" + " \"memoryPoolMax\": \"formatBase1024KMGTP\",\n" + " \"memoryPoolUsed\": \"formatBase1024KMGTP\"\n" + " }\n" + "}"; Files.write(legendConfigurationString, new File(configPath), Charsets.UTF_8); final DashboardConfig config = Mockito.mock(DashboardConfig.class); Mockito.when(config.getLegendGroupsFile()).thenReturn(configPath); final LegendConfigurationsManager manager = new LegendConfigurationsManager(config); final Map configuration = manager.getConfiguration(); Assert.assertEquals(configuration.size(), 2); final Map configurationMap = (Map) configuration.get(LegendConfigurationsManager.LEGENDS_KEY); Assert.assertEquals(configurationMap.size(), 2); Assert.assertEquals(((Map) configurationMap.get("JVMMemory")).size(), 4); Assert.assertEquals(((Map) configurationMap.get("JVMMemory")).get("heapMax"), "formatBase1024KMGTP"); Assert.assertEquals(((Map) configurationMap.get("ParSurvivorSpace")).size(), 2); Assert.assertEquals(((Map) configurationMap.get("ParSurvivorSpace")).get("memoryPoolMax"), "formatBase1024KMGTP"); Assert.assertEquals(configuration.get(LegendConfigurationsManager.FIXTURES_KEY), ""); }
public Map getConfiguration() { final ImmutableMap.Builder builder = new ImmutableMap.Builder(); builder.put(LEGENDS_KEY, legendConfiguration); builder.put(FIXTURES_KEY, legendFixtures); return builder.build(); }
LegendConfigurationsManager { public Map getConfiguration() { final ImmutableMap.Builder builder = new ImmutableMap.Builder(); builder.put(LEGENDS_KEY, legendConfiguration); builder.put(FIXTURES_KEY, legendFixtures); return builder.build(); } }
LegendConfigurationsManager { public Map getConfiguration() { final ImmutableMap.Builder builder = new ImmutableMap.Builder(); builder.put(LEGENDS_KEY, legendConfiguration); builder.put(FIXTURES_KEY, legendFixtures); return builder.build(); } @Inject  LegendConfigurationsManager(final DashboardConfig config); }
LegendConfigurationsManager { public Map getConfiguration() { final ImmutableMap.Builder builder = new ImmutableMap.Builder(); builder.put(LEGENDS_KEY, legendConfiguration); builder.put(FIXTURES_KEY, legendFixtures); return builder.build(); } @Inject  LegendConfigurationsManager(final DashboardConfig config); Map getConfiguration(); }
LegendConfigurationsManager { public Map getConfiguration() { final ImmutableMap.Builder builder = new ImmutableMap.Builder(); builder.put(LEGENDS_KEY, legendConfiguration); builder.put(FIXTURES_KEY, legendFixtures); return builder.build(); } @Inject  LegendConfigurationsManager(final DashboardConfig config); Map getConfiguration(); static final String LEGENDS_KEY; static final String FIXTURES_KEY; }