Search in sources :

Example 1 with PictureEntity

use of io.gravitee.rest.api.model.PictureEntity in project gravitee-management-rest-api by gravitee-io.

the class ThemeServiceTest method shouldGetBackgroundImageUrl.

@Test
public void shouldGetBackgroundImageUrl() throws TechnicalException {
    final Theme theme = mock(Theme.class);
    when(theme.getBackgroundImage()).thenReturn("http://localhost/image");
    when(theme.getId()).thenReturn(THEME_ID);
    when(theme.getName()).thenReturn("NAME");
    when(theme.isEnabled()).thenReturn(true);
    when(theme.getDefinition()).thenReturn(themeServiceImpl.getDefaultDefinition());
    when(themeRepository.findByReferenceIdAndReferenceType(GraviteeContext.getCurrentEnvironment(), ENVIRONMENT.name())).thenReturn(singleton(theme));
    PictureEntity backgroundImage = themeService.getBackgroundImage(THEME_ID);
    assertNotNull(backgroundImage);
    assertTrue(backgroundImage instanceof UrlPictureEntity);
}
Also used : UrlPictureEntity(io.gravitee.rest.api.model.UrlPictureEntity) Theme(io.gravitee.repository.management.model.Theme) InlinePictureEntity(io.gravitee.rest.api.model.InlinePictureEntity) PictureEntity(io.gravitee.rest.api.model.PictureEntity) UrlPictureEntity(io.gravitee.rest.api.model.UrlPictureEntity) Test(org.junit.Test)

Example 2 with PictureEntity

use of io.gravitee.rest.api.model.PictureEntity in project gravitee-management-rest-api by gravitee-io.

the class ThemeServiceTest method shouldGetBackgroundImage.

@Test
public void shouldGetBackgroundImage() throws TechnicalException {
    final Theme theme = mock(Theme.class);
    Mockito.lenient().when(theme.getReferenceType()).thenReturn(ENVIRONMENT.name());
    PictureEntity backgroundImage = themeService.getBackgroundImage(THEME_ID);
    assertNull(backgroundImage);
}
Also used : Theme(io.gravitee.repository.management.model.Theme) InlinePictureEntity(io.gravitee.rest.api.model.InlinePictureEntity) PictureEntity(io.gravitee.rest.api.model.PictureEntity) UrlPictureEntity(io.gravitee.rest.api.model.UrlPictureEntity) Test(org.junit.Test)

Example 3 with PictureEntity

use of io.gravitee.rest.api.model.PictureEntity in project gravitee-management-rest-api by gravitee-io.

the class ThemeServiceTest method shouldGetLogo.

@Test
public void shouldGetLogo() throws TechnicalException {
    final Theme theme = mock(Theme.class, withSettings().lenient());
    Mockito.lenient().when(theme.getReferenceType()).thenReturn(ENVIRONMENT.name());
    when(theme.getReferenceId()).thenReturn("DEFAULT");
    when(theme.getLogo()).thenReturn(themeServiceImpl.getDefaultLogo());
    PictureEntity logo = themeService.getLogo(THEME_ID);
    assertNotNull(logo);
    assertTrue(logo instanceof InlinePictureEntity);
}
Also used : Theme(io.gravitee.repository.management.model.Theme) InlinePictureEntity(io.gravitee.rest.api.model.InlinePictureEntity) PictureEntity(io.gravitee.rest.api.model.PictureEntity) UrlPictureEntity(io.gravitee.rest.api.model.UrlPictureEntity) InlinePictureEntity(io.gravitee.rest.api.model.InlinePictureEntity) Test(org.junit.Test)

Aggregations

Theme (io.gravitee.repository.management.model.Theme)3 InlinePictureEntity (io.gravitee.rest.api.model.InlinePictureEntity)3 PictureEntity (io.gravitee.rest.api.model.PictureEntity)3 UrlPictureEntity (io.gravitee.rest.api.model.UrlPictureEntity)3 Test (org.junit.Test)3