Search in sources :

Example 1 with ViewReportResult

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)));
}
Also used : ReportLine(eu.ggnet.dwoss.report.ee.entity.ReportLine) ReportParameter(eu.ggnet.dwoss.report.ee.ReportAgent.ReportParameter) ViewReportResult(eu.ggnet.dwoss.report.ee.ReportAgent.ViewReportResult) Test(org.junit.Test)

Example 2 with ViewReportResult

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));
}
Also used : ReportLine(eu.ggnet.dwoss.report.ee.entity.ReportLine) ReportParameter(eu.ggnet.dwoss.report.ee.ReportAgent.ReportParameter) ViewReportResult(eu.ggnet.dwoss.report.ee.ReportAgent.ViewReportResult) Test(org.junit.Test)

Example 3 with ViewReportResult

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);
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) ReportLine(eu.ggnet.dwoss.report.ee.entity.ReportLine) JLabel(javax.swing.JLabel) RemoteLookup(eu.ggnet.saft.core.cap.RemoteLookup) ViewReportResult(eu.ggnet.dwoss.report.ee.ReportAgent.ViewReportResult) ReportController(eu.ggnet.dwoss.report.ui.main.ReportController) ReportLineGenerator(eu.ggnet.dwoss.report.ee.assist.gen.ReportLineGenerator)

Example 4 with ViewReportResult

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));
}
Also used : ReportLine(eu.ggnet.dwoss.report.ee.entity.ReportLine) ReportParameter(eu.ggnet.dwoss.report.ee.ReportAgent.ReportParameter) ViewReportResult(eu.ggnet.dwoss.report.ee.ReportAgent.ViewReportResult) Test(org.junit.Test)

Aggregations

ViewReportResult (eu.ggnet.dwoss.report.ee.ReportAgent.ViewReportResult)4 ReportLine (eu.ggnet.dwoss.report.ee.entity.ReportLine)4 ReportParameter (eu.ggnet.dwoss.report.ee.ReportAgent.ReportParameter)3 Test (org.junit.Test)3 ReportLineGenerator (eu.ggnet.dwoss.report.ee.assist.gen.ReportLineGenerator)1 ReportController (eu.ggnet.dwoss.report.ui.main.ReportController)1 TradeName (eu.ggnet.dwoss.rules.TradeName)1 RemoteLookup (eu.ggnet.saft.core.cap.RemoteLookup)1 JLabel (javax.swing.JLabel)1