# HG changeset patch # User Roman Kennke # Date 1347397189 -7200 # Node ID 5cd4aaf85d0264f58d8aebbc9f8f57b8b0018c42 # Parent 55792b78bcc45a0ea84e8a55ae59611137cf4b2a# Parent 2eeca26d586fee15c82a2e1678b414f0c32a8078 Merge diff -r 55792b78bcc4 -r 5cd4aaf85d02 client/core/src/main/java/com/redhat/thermostat/client/locale/LocaleResources.java --- a/client/core/src/main/java/com/redhat/thermostat/client/locale/LocaleResources.java Tue Sep 11 22:55:50 2012 +0200 +++ b/client/core/src/main/java/com/redhat/thermostat/client/locale/LocaleResources.java Tue Sep 11 22:59:49 2012 +0200 @@ -78,6 +78,8 @@ HOURS, DAYS, + NUMBER_AND_UNIT, + SEARCH_HINT, CHART_DURATION_SELECTOR_LABEL, diff -r 55792b78bcc4 -r 5cd4aaf85d02 client/core/src/main/java/com/redhat/thermostat/client/ui/HostMemoryController.java --- a/client/core/src/main/java/com/redhat/thermostat/client/ui/HostMemoryController.java Tue Sep 11 22:55:50 2012 +0200 +++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/HostMemoryController.java Tue Sep 11 22:59:49 2012 +0200 @@ -59,6 +59,7 @@ import com.redhat.thermostat.common.model.DiscreteTimeData; import com.redhat.thermostat.common.model.MemoryStat; import com.redhat.thermostat.common.model.MemoryType; +import com.redhat.thermostat.common.utils.DisplayableValues; public class HostMemoryController { @@ -107,7 +108,9 @@ backgroundUpdateTimer.setAction(new Runnable() { @Override public void run() { - view.setTotalMemory(String.valueOf(hostInfoDAO.getHostInfo(ref).getTotalMemory())); + long memorySize = hostInfoDAO.getHostInfo(ref).getTotalMemory(); + String[] memorySizeParts = DisplayableValues.bytes(memorySize); + view.setTotalMemory(localize(LocaleResources.NUMBER_AND_UNIT, memorySizeParts[0], memorySizeParts[1])); doMemoryChartUpdate(); } }); diff -r 55792b78bcc4 -r 5cd4aaf85d02 client/core/src/main/java/com/redhat/thermostat/client/ui/HostOverviewController.java --- a/client/core/src/main/java/com/redhat/thermostat/client/ui/HostOverviewController.java Tue Sep 11 22:55:50 2012 +0200 +++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/HostOverviewController.java Tue Sep 11 22:59:49 2012 +0200 @@ -59,6 +59,7 @@ import com.redhat.thermostat.common.dao.NetworkInterfaceInfoDAO; import com.redhat.thermostat.common.model.HostInfo; import com.redhat.thermostat.common.model.NetworkInterfaceInfo; +import com.redhat.thermostat.common.utils.DisplayableValues; import com.redhat.thermostat.common.utils.LoggingUtils; public class HostOverviewController { @@ -96,7 +97,10 @@ view.setOsKernel(hostInfo.getOsKernel()); view.setCpuModel(hostInfo.getCpuModel()); view.setCpuCount(String.valueOf(hostInfo.getCpuCount())); - view.setTotalMemory(String.valueOf(hostInfo.getTotalMemory())); + + String[] parts = DisplayableValues.bytes(hostInfo.getTotalMemory()); + String readableTotalMemory = localize(LocaleResources.NUMBER_AND_UNIT, parts[0], parts[1]); + view.setTotalMemory(readableTotalMemory); List networkInfo = networkInfoDAO.getNetworkInterfaces(ref); diff -r 55792b78bcc4 -r 5cd4aaf85d02 client/core/src/main/resources/com/redhat/thermostat/client/locale/strings.properties --- a/client/core/src/main/resources/com/redhat/thermostat/client/locale/strings.properties Tue Sep 11 22:55:50 2012 +0200 +++ b/client/core/src/main/resources/com/redhat/thermostat/client/locale/strings.properties Tue Sep 11 22:59:49 2012 +0200 @@ -38,6 +38,8 @@ HOURS = Hours DAYS = Days +NUMBER_AND_UNIT = {0} {1} + SEARCH_HINT = Type here to search CHART_DURATION_SELECTOR_LABEL = Display the most recent diff -r 55792b78bcc4 -r 5cd4aaf85d02 client/core/src/test/java/com/redhat/thermostat/client/ui/HostMemoryControllerTest.java --- a/client/core/src/test/java/com/redhat/thermostat/client/ui/HostMemoryControllerTest.java Tue Sep 11 22:55:50 2012 +0200 +++ b/client/core/src/test/java/com/redhat/thermostat/client/ui/HostMemoryControllerTest.java Tue Sep 11 22:59:49 2012 +0200 @@ -76,7 +76,8 @@ @SuppressWarnings("unchecked") // any(List.class) @Test public void testUpdate() { - HostInfo hostInfo = new HostInfo("someHost", "someOS", "linux_0.0.1", "lreally_fast_cpu", 2, 1024); + final long TOTAL_MEMORY = 512; + HostInfo hostInfo = new HostInfo("someHost", "someOS", "linux_0.0.1", "lreally_fast_cpu", 2, TOTAL_MEMORY); HostInfoDAO hostInfoDAO = mock(HostInfoDAO.class); when(hostInfoDAO.getHostInfo(any(HostRef.class))).thenReturn(hostInfo); @@ -118,7 +119,7 @@ verify(timer).start(); timerActionCaptor.getValue().run(); - verify(view, times(1)).setTotalMemory(any(String.class)); + verify(view, times(1)).setTotalMemory(eq(TOTAL_MEMORY + " B")); verify(view, times(6)).addMemoryData(any(String.class), any(List.class)); l.actionPerformed(new ActionEvent<>(view, HostMemoryView.Action.HIDDEN)); diff -r 55792b78bcc4 -r 5cd4aaf85d02 client/core/src/test/java/com/redhat/thermostat/client/ui/HostOverviewControllerTest.java --- a/client/core/src/test/java/com/redhat/thermostat/client/ui/HostOverviewControllerTest.java Tue Sep 11 22:55:50 2012 +0200 +++ b/client/core/src/test/java/com/redhat/thermostat/client/ui/HostOverviewControllerTest.java Tue Sep 11 22:59:49 2012 +0200 @@ -157,7 +157,9 @@ verify(view).setOsKernel(eq(KERNEL_NAME)); verify(view).setOsName(eq(OS_NAME)); - verify(view).setTotalMemory(eq(String.valueOf(TOTAL_MEMORY))); + + final String UNITS = " B"; + verify(view).setTotalMemory(eq(String.valueOf(TOTAL_MEMORY + UNITS))); } @Test diff -r 55792b78bcc4 -r 5cd4aaf85d02 eclipse/com.redhat.thermostat.eclipse.target_platform/.project --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/eclipse/com.redhat.thermostat.eclipse.target_platform/.project Tue Sep 11 22:59:49 2012 +0200 @@ -0,0 +1,11 @@ + + + com.redhat.thermostat.eclipse.target_platform + + + + + + + + diff -r 55792b78bcc4 -r 5cd4aaf85d02 eclipse/com.redhat.thermostat.eclipse.target_platform/thermostat_fedora.target --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/eclipse/com.redhat.thermostat.eclipse.target_platform/thermostat_fedora.target Tue Sep 11 22:59:49 2012 +0200 @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + +