Package org.sonar.core.dashboard

Examples of org.sonar.core.dashboard.WidgetDto


    for (int columnIndex = 1; columnIndex <= dashboard.getLayout().getColumns(); columnIndex++) {
      List<Dashboard.Widget> widgets = dashboard.getWidgetsOfColumn(columnIndex);
      for (int rowIndex = 1; rowIndex <= widgets.size(); rowIndex++) {
        Dashboard.Widget widget = widgets.get(rowIndex - 1);
        WidgetDto widgetDto = new WidgetDto()
          .setWidgetKey(widget.getId())
          .setColumnIndex(columnIndex)
          .setRowIndex(rowIndex)
          .setConfigured(true);
        widgetDto.setCreatedAt(now).setUpdatedAt(now);
        dashboardDto.addWidget(widgetDto);

        for (Entry<String, String> property : widget.getProperties().entrySet()) {
          WidgetPropertyDto propDto = new WidgetPropertyDto()
            .setPropertyKey(property.getKey())
            .setTextValue(property.getValue());
          widgetDto.addWidgetProperty(propDto);
        }
      }
    }
    return dashboardDto;
  }
View Full Code Here


    assertThat(dto.getShared()).isTrue();
    assertThat(dto.getGlobal()).isTrue();
    assertThat(dto.getCreatedAt()).isNotNull();
    assertThat(dto.getUpdatedAt()).isNotNull();

    WidgetDto widgetDto = Iterables.getOnlyElement(dto.getWidgets());
    assertThat(widgetDto.getWidgetKey()).isEqualTo("fake-widget");
    assertThat(widgetDto.getDescription()).isNull();
    assertThat(widgetDto.getColumnIndex()).isEqualTo(1);
    assertThat(widgetDto.getRowIndex()).isEqualTo(1);
    assertThat(widgetDto.getConfigured()).isTrue();
    assertThat(widgetDto.getCreatedAt()).isNotNull();
    assertThat(widgetDto.getUpdatedAt()).isNotNull();

    Collection<WidgetPropertyDto> props = widgetDto.getWidgetProperties();
    assertThat(props).hasSize(1);
    WidgetPropertyDto prop = Iterables.getFirst(props, null);
    assertThat(prop.getPropertyKey()).isEqualTo("fake-property");
    assertThat(prop.getTextValue()).isEqualTo("fake_metric");
  }
View Full Code Here

TOP

Related Classes of org.sonar.core.dashboard.WidgetDto

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.