use of org.activityinfo.legacy.shared.command.GetReportModel in project activityinfo by bedatadriven.
the class GetReportModelTest method serializationDeserialization.
// AI-1359
@Test
public void serializationDeserialization() throws IOException, ClassNotFoundException {
setUser(1);
ReportDTO result = execute(new GetReportModel(3, true));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(result);
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
ReportDTO rereadDto = (ReportDTO) ois.readObject();
assertEquals(result.getReportMetadataDTO().getId(), rereadDto.getReportMetadataDTO().getId());
assertEquals(result.getReportMetadataDTO().getSubscribers(), rereadDto.getReportMetadataDTO().getSubscribers());
assertEquals(result.getReportMetadataDTO().getAmOwner(), rereadDto.getReportMetadataDTO().getAmOwner());
assertEquals(result.getReportMetadataDTO().getEmailDelivery(), rereadDto.getReportMetadataDTO().getEmailDelivery());
assertEquals(result.getReportMetadataDTO().getOwnerName(), rereadDto.getReportMetadataDTO().getOwnerName());
assertEquals(result.getReportMetadataDTO().getDay(), rereadDto.getReportMetadataDTO().getDay());
}
use of org.activityinfo.legacy.shared.command.GetReportModel in project activityinfo by bedatadriven.
the class GetReportModelTest method selectReportWithMetadata.
@Test
public void selectReportWithMetadata() {
setUser(1);
ReportDTO result = execute(new GetReportModel(3, true));
assertNotNull(result.getReport());
assertEquals("Report 3", result.getReport().getTitle());
assertNotNull(result.getReportMetadataDTO());
assertEquals("Alex", result.getReportMetadataDTO().getOwnerName());
}
use of org.activityinfo.legacy.shared.command.GetReportModel in project activityinfo by bedatadriven.
the class GenerateDashboardElementHandler method execute.
@Override
public CommandResult execute(GenerateDashboardElement cmd, User user) throws CommandException {
ReportDTO report = dispatcher.execute(new GetReportModel(cmd.getReportId()));
if (report.getReport().getElements().isEmpty()) {
return new TextReportElement("The report is empty");
} else {
ReportElement element = report.getReport().getElements().get(0);
element.setContent(generator.generateElement(user, element, null, new DateRange()));
return element;
}
}
use of org.activityinfo.legacy.shared.command.GetReportModel in project activityinfo by bedatadriven.
the class GetReportModelTest method selectReportOnly.
@Test
public void selectReportOnly() {
setUser(1);
ReportDTO result = execute(new GetReportModel(3));
assertNotNull(result.getReport());
assertEquals("Report 3", result.getReport().getTitle());
assertNull(result.getReportMetadataDTO());
}
use of org.activityinfo.legacy.shared.command.GetReportModel in project activityinfo by bedatadriven.
the class GetReportModelTest method selectReportOnly2.
@Test
public void selectReportOnly2() {
setUser(1);
ReportDTO result = execute(new GetReportModel(3, false));
assertNotNull(result.getReport());
assertEquals("Report 3", result.getReport().getTitle());
assertNull(result.getReportMetadataDTO());
}
Aggregations