Search in sources :

Example 1 with StartupSuggestionsForm

use of org.motechproject.server.web.form.StartupSuggestionsForm in project motech by motech.

the class StartupControllerTest method testStartup.

@Test
public void testStartup() {
    Properties properties = new Properties();
    properties.put("host", "localhost");
    properties.put("port", "12345");
    NavigableMap<String, String> map = new TreeMap<>();
    when(startupManager.canLaunchBundles()).thenReturn(false);
    when(startupManager.getDefaultSettings()).thenReturn(motechSettings);
    when(localeService.getUserLocale(httpServletRequest)).thenReturn(new Locale("en"));
    when(localeService.getSupportedLanguages()).thenReturn(map);
    when(configurationService.getPlatformSettings()).thenReturn(motechSettings);
    StartupViewData result = startupController.getStartupViewData(httpServletRequest);
    verify(startupManager).canLaunchBundles();
    verify(localeService).getSupportedLanguages();
    verify(localeService).getUserLocale(httpServletRequest);
    assertThat(result.getRedirectHome(), Is.is(false));
    StartupSuggestionsForm startupSuggestionsForm = result.getSuggestions();
    assertTrue(startupSuggestionsForm.getDatabaseUrls().isEmpty());
    assertTrue(startupSuggestionsForm.getQueueUrls().isEmpty());
    assertTrue(startupSuggestionsForm.getSchedulerUrls().isEmpty());
    StartupForm startupSettings = result.getStartupSettings();
    Boolean requiresConfigFiles = result.getRequireConfigFiles();
    Assert.assertFalse(requiresConfigFiles);
    assertEquals("en", startupSettings.getLanguage());
}
Also used : Locale(java.util.Locale) StartupSuggestionsForm(org.motechproject.server.web.form.StartupSuggestionsForm) StartupForm(org.motechproject.server.web.form.StartupForm) Matchers.anyString(org.mockito.Matchers.anyString) Properties(java.util.Properties) TreeMap(java.util.TreeMap) StartupViewData(org.motechproject.server.web.dto.StartupViewData) Test(org.junit.Test)

Aggregations

Locale (java.util.Locale)1 Properties (java.util.Properties)1 TreeMap (java.util.TreeMap)1 Test (org.junit.Test)1 Matchers.anyString (org.mockito.Matchers.anyString)1 StartupViewData (org.motechproject.server.web.dto.StartupViewData)1 StartupForm (org.motechproject.server.web.form.StartupForm)1 StartupSuggestionsForm (org.motechproject.server.web.form.StartupSuggestionsForm)1