{
@Test
public void checkRestApiConfig()
throws Exception
{
GlobalConfigurationResource settings = SettingsMessageUtil.getCurrentSettings();
// *NEXUS-3840
assertEquals(settings.getGlobalRestApiSettings().getUiTimeout(), 60);
// *
Assert.assertNotNull(settings.getGlobalRestApiSettings());
// enable it, not that even the baseUrl is not set, it will be filled with a defaut one
RestApiSettings restApiSettings = new RestApiSettings();
settings.setGlobalRestApiSettings(restApiSettings);
SettingsMessageUtil.save(settings);
settings = SettingsMessageUtil.getCurrentSettings();
Assert.assertNotNull(settings.getGlobalRestApiSettings());
Assert.assertTrue(StringUtils.isNotEmpty(settings.getGlobalRestApiSettings().getBaseUrl()));
Assert.assertEquals(settings.getGlobalRestApiSettings().isForceBaseUrl(), false);
// now edit it
restApiSettings.setBaseUrl("http://myhost/nexus");
restApiSettings.setForceBaseUrl(true);
settings.setGlobalRestApiSettings(restApiSettings);
SettingsMessageUtil.save(settings);
settings = SettingsMessageUtil.getCurrentSettings();
Assert.assertNotNull(settings.getGlobalRestApiSettings());
Assert.assertEquals(settings.getGlobalRestApiSettings().getBaseUrl(), "http://myhost/nexus");
Assert.assertEquals(settings.getGlobalRestApiSettings().isForceBaseUrl(), true);
//now unset it
settings.setGlobalRestApiSettings(null);
SettingsMessageUtil.save(settings);
Assert.assertNull(settings.getGlobalRestApiSettings());
}