# HG changeset patch # User Severin Gehwolf # Date 1359653622 -3600 # Node ID 228ad727f418dd36b41737408a4480bfcc9bd2c6 # Parent b5693fd9f6b89032429b8ea13009d2a03b7e6abf Change default URL for gui back to mongodb://. Reviewed-by: omajid, vanaltj Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2013-January/005474.html diff -r b5693fd9f6b8 -r 228ad727f418 common/core/src/main/java/com/redhat/thermostat/common/config/ClientPreferences.java --- a/common/core/src/main/java/com/redhat/thermostat/common/config/ClientPreferences.java Thu Jan 31 14:37:55 2013 -0500 +++ b/common/core/src/main/java/com/redhat/thermostat/common/config/ClientPreferences.java Thu Jan 31 18:33:42 2013 +0100 @@ -48,6 +48,7 @@ static final String PASSWORD = "password"; static final String CONNECTION_URL = "connection-url"; static final String SAVE_ENTITLEMENTS = "save-entitlements"; + static final String DEFAULT_CONNECTION_URL = "mongodb://127.0.0.1:27518"; private final Preferences prefs; @@ -82,7 +83,7 @@ } public String getConnectionUrl() { - return prefs.get(CONNECTION_URL, "http://127.0.0.1:8082"); + return prefs.get(CONNECTION_URL, DEFAULT_CONNECTION_URL); } public String getPassword() { diff -r b5693fd9f6b8 -r 228ad727f418 common/core/src/test/java/com/redhat/thermostat/common/config/ClientPreferencesTest.java --- a/common/core/src/test/java/com/redhat/thermostat/common/config/ClientPreferencesTest.java Thu Jan 31 14:37:55 2013 -0500 +++ b/common/core/src/test/java/com/redhat/thermostat/common/config/ClientPreferencesTest.java Thu Jan 31 18:33:42 2013 +0100 @@ -37,16 +37,14 @@ package com.redhat.thermostat.common.config; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.times; import java.util.prefs.Preferences; @@ -160,5 +158,16 @@ clientPrefs.setSaveEntitlements(true); verify(prefs).putBoolean(eq(ClientPreferences.SAVE_ENTITLEMENTS), eq(true)); } + + @Test + public void testDefaultPreferencesIsMongodb() { + // Default preferences for GUI is mongodb:// since this is accomodates + // more use cases + Keyring keyring = mock(Keyring.class); + Preferences prefs = mock(Preferences.class); + when(prefs.get(eq("connection-url"), any(String.class))).thenReturn(ClientPreferences.DEFAULT_CONNECTION_URL); + ClientPreferences clientPrefs = new ClientPreferences(prefs, keyring); + assertEquals("mongodb://127.0.0.1:27518", clientPrefs.getConnectionUrl()); + } }