public static Map<String, Object> getTopologySummary(TopologyPageInfo topologyPageInfo,
                                                         String window, Map<String, Object> config, String remoteUser) {
        Map<String, Object> result = new HashMap();
        Map<String, Object> topologyConf = (Map<String, Object>) JSONValue.parse(topologyPageInfo.get_topology_conf());
        int messageTimeout = (int) topologyConf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS);
        Map<String, Object> unpackedTopologyPageInfo =
                unpackTopologyInfo(topologyPageInfo, window, config);
        result.putAll(unpackedTopologyPageInfo);
        result.put("user", remoteUser);
        result.put("window", window);
        result.put("windowHint", getWindowHint(window));
        result.put("msgTimeout", messageTimeout);
        result.put("configuration", topologyConf);
        result.put("visualizationTable", new ArrayList());
        result.put("schedulerDisplayResource", config.get(DaemonConfig.SCHEDULER_DISPLAY_RESOURCE));
        result.put("bugtracker-url", config.get(DaemonConfig.UI_PROJECT_BUGTRACKER_URL));
        result.put("central-log-url", config.get(DaemonConfig.UI_CENTRAL_LOGGING_URL));
        return result;
    }
@Test
    void test_getTopologySpoutAggStatsMap_generalFields() {
        // Define inputs
        final String expectedSpoutId = "MySpoutId";
        final double expectedCompleteLatency = 432.0D;
        final long expectedEmitted = 43234L;
        final long expectedAcked = 5553L;
        final long expectedFailed = 220L;
        final int expectedExecutors = 2;
        final int expectedTasks = 3;
        final long expectedTransferred = 3423423L;
        final double expectedOnMemoryHeap = 1024D;
        final double expectedOffMemoryHeap = 2048D;
        final double expectedCpuCorePercent = 75D;

        // Build stats instance for our spout
        final ComponentAggregateStats aggregateStats = buildSpoutAggregateStatsBase();

        // Common stats
        final CommonAggregateStats commonStats = aggregateStats.get_common_stats();
        commonStats.set_acked(expectedAcked);
        commonStats.set_emitted(expectedEmitted);
        commonStats.set_failed(expectedFailed);
        commonStats.set_num_executors(expectedExecutors);
        commonStats.set_num_tasks(expectedTasks);
        commonStats.set_transferred(expectedTransferred);

        // Spout stats
        final SpoutAggregateStats spoutStats = aggregateStats.get_specific_stats().get_spout();
        spoutStats.set_complete_latency_ms(expectedCompleteLatency);

        // Build Resources Map
        final Map<String, Double> resourcesMap = new HashMap<>();
        resourcesMap.put(Constants.COMMON_ONHEAP_MEMORY_RESOURCE_NAME, expectedOnMemoryHeap);
        resourcesMap.put(Constants.COMMON_OFFHEAP_MEMORY_RESOURCE_NAME, expectedOffMemoryHeap);
        resourcesMap.put(Constants.COMMON_CPU_RESOURCE_NAME, expectedCpuCorePercent);
        commonStats.set_resources_map(resourcesMap);

        // Add to TopologyPageInfo
        addSpoutStats(expectedSpoutId, aggregateStats);

        // Call method under test.
        final Map<String, Object> result = UIHelpers.getTopologySummary(
            topoPageInfo,
            WINDOW,
            new HashMap<>(),
            "spp"
        );

        // Validate
        assertNotNull(result, "Should never return null");

        // Validate our Spout result
        final Map<String, Object> spoutResult = getSpoutStatsFromTopologySummaryResult(result, expectedSpoutId);
        assertNotNull(spoutResult, "Should have an entry for spout");

        // Validate fields
        assertEquals(expectedSpoutId, spoutResult.get("spoutId"));
        assertEquals(expectedSpoutId, spoutResult.get("encodedSpoutId"));
        assertEquals(expectedTransferred, spoutResult.get("transferred"));
        assertEquals(String.format("%.3f", expectedCompleteLatency), spoutResult.get("completeLatency"));
        assertEquals(expectedFailed, spoutResult.get("failed"));
        assertEquals(expectedAcked, spoutResult.get("acked"));
        assertEquals(expectedEmitted, spoutResult.get("emitted"));
        assertEquals(expectedExecutors, spoutResult.get("executors"));
        assertEquals(expectedTasks, spoutResult.get("tasks"));

        // Validate resources
        assertEquals(expectedOnMemoryHeap, (double) spoutResult.get("requestedMemOnHeap"), 0.01);
        assertEquals(expectedOffMemoryHeap, (double) spoutResult.get("requestedMemOffHeap"), 0.01);
        assertEquals(expectedCpuCorePercent, (double) spoutResult.get("requestedCpu"), 0.01);
        assertEquals("", spoutResult.get("requestedGenericResourcesComp"));

        // We expect there to be no error populated.
        assertEquals("", spoutResult.get("lastError"), "No error should be reported as empty string");
    }