Search in sources :

Example 1 with Position

use of com.epam.ta.reportportal.ws.model.Position in project service-api by reportportal.

the class DashboardControllerTest method addWidget.

@Test
void addWidget() throws Exception {
    AddWidgetRq rq = new AddWidgetRq();
    rq.setAddWidget(new DashboardResource.WidgetObjectModel("kek", 10L, new Size(5, 5), new Position(0, 0)));
    mockMvc.perform(put(DEFAULT_PROJECT_BASE_URL + "/dashboard/17/add").with(token(oAuthHelper.getDefaultToken())).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(rq))).andExpect(status().isOk());
}
Also used : AddWidgetRq(com.epam.ta.reportportal.ws.model.dashboard.AddWidgetRq) Position(com.epam.ta.reportportal.ws.model.Position) Size(com.epam.ta.reportportal.ws.model.Size) DashboardResource(com.epam.ta.reportportal.ws.model.dashboard.DashboardResource) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest) Test(org.junit.jupiter.api.Test)

Example 2 with Position

use of com.epam.ta.reportportal.ws.model.Position in project service-api by reportportal.

the class WidgetConverterTest method getWidgetObjectModel.

private static DashboardResource.WidgetObjectModel getWidgetObjectModel() {
    final DashboardResource.WidgetObjectModel widgetObjectModel = new DashboardResource.WidgetObjectModel();
    widgetObjectModel.setWidgetId(1L);
    widgetObjectModel.setWidgetPosition(new Position(3, 5));
    widgetObjectModel.setWidgetSize(new Size(4, 8));
    return widgetObjectModel;
}
Also used : Position(com.epam.ta.reportportal.ws.model.Position) Size(com.epam.ta.reportportal.ws.model.Size) DashboardResource(com.epam.ta.reportportal.ws.model.dashboard.DashboardResource)

Example 3 with Position

use of com.epam.ta.reportportal.ws.model.Position in project service-api by reportportal.

the class DashboardBuilderTest method updateDashboard.

@Test
void updateDashboard() {
    final String name = "name";
    final String description = "description";
    final boolean share = true;
    UpdateDashboardRQ updateDashboardRQ = new UpdateDashboardRQ();
    updateDashboardRQ.setName(name);
    updateDashboardRQ.setDescription(description);
    updateDashboardRQ.setShare(share);
    updateDashboardRQ.setWidgets(Collections.singletonList(new DashboardResource.WidgetObjectModel("kek", 1L, new Size(10, 20), new Position(30, 40))));
    DashboardWidget dashboardWidget = new DashboardWidget();
    dashboardWidget.setHeight(5);
    dashboardWidget.setWidth(10);
    dashboardWidget.setPositionX(1);
    dashboardWidget.setPositionY(2);
    dashboardWidget.setId(new DashboardWidgetId(1L, 1L));
    final Dashboard existDashboard = new Dashboard();
    existDashboard.addWidget(dashboardWidget);
    final Dashboard dashboard = new DashboardBuilder(existDashboard).addUpdateRq(updateDashboardRQ).get();
    assertEquals(name, dashboard.getName());
    assertEquals(description, dashboard.getDescription());
    assertEquals(share, dashboard.isShared());
}
Also used : DashboardWidget(com.epam.ta.reportportal.entity.dashboard.DashboardWidget) Position(com.epam.ta.reportportal.ws.model.Position) Size(com.epam.ta.reportportal.ws.model.Size) Dashboard(com.epam.ta.reportportal.entity.dashboard.Dashboard) UpdateDashboardRQ(com.epam.ta.reportportal.ws.model.dashboard.UpdateDashboardRQ) DashboardWidgetId(com.epam.ta.reportportal.entity.dashboard.DashboardWidgetId) Test(org.junit.jupiter.api.Test)

Aggregations

Position (com.epam.ta.reportportal.ws.model.Position)3 Size (com.epam.ta.reportportal.ws.model.Size)3 DashboardResource (com.epam.ta.reportportal.ws.model.dashboard.DashboardResource)2 Test (org.junit.jupiter.api.Test)2 Dashboard (com.epam.ta.reportportal.entity.dashboard.Dashboard)1 DashboardWidget (com.epam.ta.reportportal.entity.dashboard.DashboardWidget)1 DashboardWidgetId (com.epam.ta.reportportal.entity.dashboard.DashboardWidgetId)1 BaseMvcTest (com.epam.ta.reportportal.ws.BaseMvcTest)1 AddWidgetRq (com.epam.ta.reportportal.ws.model.dashboard.AddWidgetRq)1 UpdateDashboardRQ (com.epam.ta.reportportal.ws.model.dashboard.UpdateDashboardRQ)1