Search in sources :

Example 1 with Dashboard

use of com.epam.ta.reportportal.entity.dashboard.Dashboard in project service-api by reportportal.

the class DashboardControllerTest method updateDashboardPositive.

@Test
void updateDashboardPositive() throws Exception {
    final UpdateDashboardRQ rq = new UpdateDashboardRQ();
    rq.setName("updated");
    rq.setDescription("updated");
    rq.setShare(false);
    mockMvc.perform(put(DEFAULT_PROJECT_BASE_URL + "/dashboard/17").with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(rq)).contentType(APPLICATION_JSON)).andExpect(status().isOk());
    final Optional<Dashboard> optionalDashboard = dashboardRepository.findById(17L);
    assertTrue(optionalDashboard.isPresent());
    assertEquals("updated", optionalDashboard.get().getName());
    assertEquals("updated", optionalDashboard.get().getDescription());
    assertFalse(optionalDashboard.get().isShared());
}
Also used : Dashboard(com.epam.ta.reportportal.entity.dashboard.Dashboard) UpdateDashboardRQ(com.epam.ta.reportportal.ws.model.dashboard.UpdateDashboardRQ) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest) Test(org.junit.jupiter.api.Test)

Example 2 with Dashboard

use of com.epam.ta.reportportal.entity.dashboard.Dashboard in project service-api by reportportal.

the class DashboardBuilderTest method createDashboard.

@Test
void createDashboard() {
    final String name = "name";
    final String description = "description";
    final boolean share = true;
    final String owner = "owner";
    final Long projectId = 1L;
    CreateDashboardRQ createDashboardRQ = new CreateDashboardRQ();
    createDashboardRQ.setName(name);
    createDashboardRQ.setDescription(description);
    createDashboardRQ.setShare(share);
    final Dashboard dashboard = new DashboardBuilder().addDashboardRq(createDashboardRQ).addOwner(owner).addProject(projectId).get();
    assertEquals(name, dashboard.getName());
    assertEquals(description, dashboard.getDescription());
    assertEquals(share, dashboard.isShared());
    assertEquals(owner, dashboard.getOwner());
    assertEquals(projectId, dashboard.getProject().getId());
}
Also used : Dashboard(com.epam.ta.reportportal.entity.dashboard.Dashboard) CreateDashboardRQ(com.epam.ta.reportportal.ws.model.dashboard.CreateDashboardRQ) Test(org.junit.jupiter.api.Test)

Example 3 with Dashboard

use of com.epam.ta.reportportal.entity.dashboard.Dashboard in project service-api by reportportal.

the class DashboardConverterTest method toResource.

@Test
void toResource() {
    final Dashboard dashboard = getDashboard();
    final DashboardResource resource = DashboardConverter.TO_RESOURCE.apply(dashboard);
    assertEquals(resource.getDashboardId(), dashboard.getId());
    assertEquals(resource.getName(), dashboard.getName());
    assertEquals(resource.getDescription(), dashboard.getDescription());
    assertEquals(resource.getOwner(), dashboard.getOwner());
    assertEquals(resource.isShare(), dashboard.isShared());
    assertEquals(resource.getWidgets().size(), dashboard.getDashboardWidgets().size());
}
Also used : Dashboard(com.epam.ta.reportportal.entity.dashboard.Dashboard) DashboardResource(com.epam.ta.reportportal.ws.model.dashboard.DashboardResource) Test(org.junit.jupiter.api.Test)

Example 4 with Dashboard

use of com.epam.ta.reportportal.entity.dashboard.Dashboard in project service-api by reportportal.

the class DashboardConverterTest method getDashboard.

private static Dashboard getDashboard() {
    Dashboard dashboard = new Dashboard();
    dashboard.setId(1L);
    dashboard.setName("name");
    dashboard.setDescription("description");
    dashboard.setCreationDate(LocalDateTime.now());
    dashboard.setOwner("owner");
    final Project project = new Project();
    project.setId(2L);
    dashboard.setProject(project);
    dashboard.setShared(true);
    final DashboardWidget dashboardWidget = new DashboardWidget();
    dashboardWidget.setId(new DashboardWidgetId(1L, 3L));
    dashboardWidget.setPositionY(2);
    dashboardWidget.setPositionX(3);
    dashboardWidget.setWidth(5);
    dashboardWidget.setHeight(6);
    dashboardWidget.setWidgetName("widgetName");
    dashboardWidget.setDashboard(dashboard);
    final Widget widget = new Widget();
    dashboardWidget.setWidget(widget);
    dashboard.addWidget(dashboardWidget);
    return dashboard;
}
Also used : Project(com.epam.ta.reportportal.entity.project.Project) DashboardWidget(com.epam.ta.reportportal.entity.dashboard.DashboardWidget) Widget(com.epam.ta.reportportal.entity.widget.Widget) DashboardWidget(com.epam.ta.reportportal.entity.dashboard.DashboardWidget) Dashboard(com.epam.ta.reportportal.entity.dashboard.Dashboard) DashboardWidgetId(com.epam.ta.reportportal.entity.dashboard.DashboardWidgetId)

Example 5 with Dashboard

use of com.epam.ta.reportportal.entity.dashboard.Dashboard in project service-api by reportportal.

the class DashboardConverterTest method toActivityResource.

@Test
void toActivityResource() {
    final Dashboard dashboard = getDashboard();
    final DashboardActivityResource activityResource = DashboardConverter.TO_ACTIVITY_RESOURCE.apply(dashboard);
    assertEquals(activityResource.getId(), dashboard.getId());
    assertEquals(activityResource.getName(), dashboard.getName());
    assertEquals(activityResource.getDescription(), dashboard.getDescription());
    assertEquals(activityResource.getProjectId(), dashboard.getProject().getId());
    assertEquals(activityResource.isShared(), dashboard.isShared());
}
Also used : DashboardActivityResource(com.epam.ta.reportportal.ws.model.activity.DashboardActivityResource) Dashboard(com.epam.ta.reportportal.entity.dashboard.Dashboard) Test(org.junit.jupiter.api.Test)

Aggregations

Dashboard (com.epam.ta.reportportal.entity.dashboard.Dashboard)16 DashboardWidget (com.epam.ta.reportportal.entity.dashboard.DashboardWidget)8 Test (org.junit.jupiter.api.Test)8 Widget (com.epam.ta.reportportal.entity.widget.Widget)6 OperationCompletionRS (com.epam.ta.reportportal.ws.model.OperationCompletionRS)4 DashboardWidgetId (com.epam.ta.reportportal.entity.dashboard.DashboardWidgetId)3 DashboardBuilder (com.epam.ta.reportportal.ws.converter.builders.DashboardBuilder)3 DashboardActivityResource (com.epam.ta.reportportal.ws.model.activity.DashboardActivityResource)3 UpdateDashboardRQ (com.epam.ta.reportportal.ws.model.dashboard.UpdateDashboardRQ)3 ShareableObjectsHandler (com.epam.ta.reportportal.auth.acl.ShareableObjectsHandler)2 ReportPortalUser (com.epam.ta.reportportal.commons.ReportPortalUser)2 MessageBus (com.epam.ta.reportportal.core.events.MessageBus)2 DashboardUpdatedEvent (com.epam.ta.reportportal.core.events.activity.DashboardUpdatedEvent)2 WidgetDeletedEvent (com.epam.ta.reportportal.core.events.activity.WidgetDeletedEvent)2 GetShareableEntityHandler (com.epam.ta.reportportal.core.shareable.GetShareableEntityHandler)2 WidgetContentRemover (com.epam.ta.reportportal.core.widget.content.remover.WidgetContentRemover)2 DashboardRepository (com.epam.ta.reportportal.dao.DashboardRepository)2 DashboardWidgetRepository (com.epam.ta.reportportal.dao.DashboardWidgetRepository)2 WidgetRepository (com.epam.ta.reportportal.dao.WidgetRepository)2 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)2