Search in sources :

Example 1 with LocaleService

use of org.eclipse.smarthome.io.rest.LocaleService in project smarthome by eclipse.

the class SitemapResourceTest method setup.

@Before
public void setup() throws Exception {
    initMocks(this);
    sitemapResource = new SitemapResource();
    when(uriInfo.getAbsolutePathBuilder()).thenReturn(UriBuilder.fromPath(SITEMAP_PATH));
    when(uriInfo.getBaseUriBuilder()).thenReturn(UriBuilder.fromPath(SITEMAP_PATH));
    sitemapResource.uriInfo = uriInfo;
    when(request.getRemoteAddr()).thenReturn(CLIENT_IP);
    sitemapResource.request = request;
    item = new TestItem(ITEM_NAME);
    visibilityRuleItem = new TestItem(VISIBILITY_RULE_ITEM_NAME);
    labelColorItem = new TestItem(LABEL_COLOR_ITEM_NAME);
    valueColorItem = new TestItem(VALUE_COLOR_ITEM_NAME);
    LocaleService localeService = mock(LocaleService.class);
    when(localeService.getLocale(null)).thenReturn(Locale.US);
    sitemapResource.setLocaleService(localeService);
    configureSitemapProviderMock();
    configureSitemapMock();
    sitemapResource.addSitemapProvider(sitemapProvider);
    widgets = initSitemapWidgets();
    configureItemUIRegistry(PercentType.HUNDRED, OnOffType.ON);
    sitemapResource.setItemUIRegistry(itemUIRegistry);
    // Disable long polling
    when(headers.getRequestHeader(HTTP_HEADER_X_ATMOSPHERE_TRANSPORT)).thenReturn(null);
}
Also used : LocaleService(org.eclipse.smarthome.io.rest.LocaleService) Before(org.junit.Before)

Aggregations

LocaleService (org.eclipse.smarthome.io.rest.LocaleService)1 Before (org.junit.Before)1