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());
}
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());
}
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());
}
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;
}
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());
}
Aggregations