use of eu.ggnet.dwoss.report.ee.ReportAgent.ViewReportResult in project dwoss by gg-net.
the class ReportAgentPrepareReportOneLineAfterIT method testOneLineInTheReportOneAfter.
@Test
public void testOneLineInTheReportOneAfter() {
// One line, that should be in the report
ReportLine line1 = helper.makeReportLine(D1, ONESELF, INVOICE, UNIT, ID_ONE);
// Add a line, that is before.
ReportLine line2 = helper.makeReportLine(D2, ONESELF, INVOICE, UNIT, ID_ONE);
ReportParameter.ReportParameterBuilder reportBuilder = ReportParameter.builder().reportName("Report3").contractor(ONESELF).start(D_BEFORE_1).end(D_AFTER_1);
ViewReportResult report = agent.prepareReport(reportBuilder.build(), false);
assertThat(report.getAllLines().size(), is(equalTo(1)));
assertThat(report.getAllLines(), hasItem(line1));
assertThat(report.getLines().get(ViewReportResult.Type.INVOICED), hasItem(line1));
assertThat(report.getAllLines(), not(hasItem(line2)));
}
use of eu.ggnet.dwoss.report.ee.ReportAgent.ViewReportResult in project dwoss by gg-net.
the class ReportAgentPrepareReportOneLineIT method testOneLineInTheReport.
@Test
public void testOneLineInTheReport() {
// One line, that should be in the report
ReportLine line1 = helper.makeReportLine(D1, ONESELF, INVOICE, UNIT, ID_ONE);
ReportParameter.ReportParameterBuilder reportBuilder = ReportParameter.builder().reportName("Report1").contractor(ONESELF).start(D_BEFORE_1).end(D_AFTER_1);
ViewReportResult report = agent.prepareReport(reportBuilder.build(), false);
assertThat(report.getAllLines().size(), is(equalTo(1)));
assertThat(report.getAllLines(), hasItem(line1));
assertThat(report.getLines().keySet(), hasItem(ViewReportResult.Type.INVOICED));
assertThat(report.getLines().get(ViewReportResult.Type.INVOICED), hasItem(line1));
}
use of eu.ggnet.dwoss.report.ee.ReportAgent.ViewReportResult in project dwoss by gg-net.
the class ReportViewTryout method main.
public static void main(String[] args) {
Dl.local().add(RemoteLookup.class, new RemoteLookup() {
@Override
public <T> boolean contains(Class<T> clazz) {
return false;
}
@Override
public <T> T lookup(Class<T> clazz) {
return null;
}
});
TradeName tradeName = TradeName.FUJITSU;
UiCore.startSwing(() -> new JLabel("Main Applikation"));
EnumMap<ViewReportResult.Type, NavigableSet<ReportLine>> lines = new EnumMap<>(ViewReportResult.Type.class);
ReportLineGenerator op = new ReportLineGenerator();
NavigableSet<ReportLine> invoicedLines = new TreeSet<>();
NavigableSet<ReportLine> repayedLinesLines = new TreeSet<>();
for (int i = 0; i < 30; i++) {
invoicedLines.add(op.makeReportLine(Arrays.asList(tradeName), new Date(), i));
repayedLinesLines.add(op.makeReportLine(Arrays.asList(tradeName), new Date(), i));
}
lines.put(INVOICED, invoicedLines);
lines.put(REPAYMENTS, repayedLinesLines);
ViewReportResult result = new ViewReportResult(lines, ReportParameter.builder().reportName("JUnit " + tradeName + " Report").contractor(tradeName).start(new Date()).end(new Date()).build());
Ui.build().fxml().show(() -> new ReportController.In(result, false), ReportController.class);
}
use of eu.ggnet.dwoss.report.ee.ReportAgent.ViewReportResult in project dwoss by gg-net.
the class ReportAgentPrepareReporOneLineBeforeIT method testOneLineInTheReportOneBefore.
@Test
public void testOneLineInTheReportOneBefore() {
// One line, that should be in the report
ReportLine line1 = helper.makeReportLine(D1, ONESELF, INVOICE, UNIT, ID_ONE);
// Add a line, that is before.
ReportLine line2 = helper.makeReportLine(D0, ONESELF, INVOICE, UNIT, ID_ONE);
ReportParameter.ReportParameterBuilder reportBuilder = ReportParameter.builder().reportName("Report2").contractor(ONESELF).start(D_BEFORE_1).end(D_AFTER_1);
ViewReportResult report = agent.prepareReport(reportBuilder.build(), false);
assertThat(report.getAllLines().size(), is(equalTo(1)));
assertThat(report.getAllLines(), hasItem(line1));
assertThat(report.getLines().get(ViewReportResult.Type.INVOICED), hasItem(line1));
assertThat(report.getAllLines(), not(hasItem(line2)));
// Now it should be in here
report = agent.prepareReport(reportBuilder.build(), true);
assertThat(report.getAllLines().size(), is(equalTo(2)));
assertThat(report.getAllLines(), hasItems(line1, line2));
assertThat(report.getLines().get(ViewReportResult.Type.INVOICED), hasItems(line1, line2));
}
Aggregations