Search in sources :

Example 6 with ReportsBO

use of org.mifos.reports.business.ReportsBO in project head by mifos.

the class ReportsPersistenceIntegrationTest method testGetReportPath.

@Test
public void testGetReportPath() {
    List<ReportsCategoryBO> listOfReportCategories = reportsPersistence.getAllReportCategories();
    Set<ReportsBO> reportsSet = listOfReportCategories.get(0).getReportsSet();
    for (ReportsBO reports : reportsSet) {
        if (reports.getReportId().equals("1")) {
            Assert.assertEquals("report_designer", reports.getReportIdentifier());
        }
    }
}
Also used : ReportsCategoryBO(org.mifos.reports.business.ReportsCategoryBO) ReportsBO(org.mifos.reports.business.ReportsBO) Test(org.junit.Test)

Example 7 with ReportsBO

use of org.mifos.reports.business.ReportsBO in project head by mifos.

the class ReportsPersistenceIntegrationTest method testGetReport.

@Test
public void testGetReport() {
    Short reportId = 28;
    ReportsBO report = reportsPersistence.getReport(reportId);
    Assert.assertEquals(reportId, report.getReportId());
}
Also used : ReportsBO(org.mifos.reports.business.ReportsBO) Test(org.junit.Test)

Example 8 with ReportsBO

use of org.mifos.reports.business.ReportsBO in project head by mifos.

the class BirtReportsUploadActionStrutsTest method testEdit.

@Test
public void testEdit() {
    setRequestPathInfo("/birtReportsUploadAction.do");
    addRequestParameter("method", "edit");
    addRequestParameter("reportId", "1");
    actionPerform();
    ReportsBO report = (ReportsBO) request.getAttribute(Constants.BUSINESS_KEY);
    Assert.assertEquals("1", report.getReportId().toString());
    verifyNoActionErrors();
    verifyForward(ActionForwards.edit_success.toString());
}
Also used : ReportsBO(org.mifos.reports.business.ReportsBO) Test(org.junit.Test)

Example 9 with ReportsBO

use of org.mifos.reports.business.ReportsBO in project head by mifos.

the class BirtReportsUploadActionStrutsTest method testShouldSubmitSuccessAfterEdit.

@Test
public void testShouldSubmitSuccessAfterEdit() throws Exception {
    setRequestPathInfo("/birtReportsUploadAction.do");
    ReportsPersistence persistence = new ReportsPersistence();
    ReportsBO report = new ReportsBO();
    report.setReportName("testShouldSubmitSuccessAfterEdit");
    report.setReportsCategoryBO(persistence.getPersistentObject(ReportsCategoryBO.class, (short) 1));
    report.setIsActive((short) 1);
    short newActivityId = (short) legacyRolesPermissionsDao.calculateDynamicActivityId();
    legacyRolesPermissionsDao.createActivityForReports((short) 1, "test" + "testShouldSubmitSuccessAfterEdit");
    report.setActivityId(newActivityId);
    ReportsJasperMap reportJasperMap = report.getReportsJasperMap();
    reportJasperMap.setReportJasper("testFileName_EDIT.rptdesign");
    report.setReportsJasperMap(reportJasperMap);
    persistence.createOrUpdate(report);
    BirtReportsUploadActionForm editForm = new BirtReportsUploadActionForm();
    editForm.setReportId(report.getReportId().toString());
    editForm.setReportTitle("newTestShouldSubmitSuccessAfterEdit");
    editForm.setReportCategoryId("2");
    editForm.setIsActive("0");
    editForm.setFile(new MockFormFile("newTestShouldSubmitSuccessAfterEdit.rptdesign"));
    setActionForm(editForm);
    addRequestParameter("method", "editThenUpload");
    actionPerform();
    ReportsBO newReport = persistence.getReport(report.getReportId());
    Assert.assertEquals("newTestShouldSubmitSuccessAfterEdit", newReport.getReportName());
    Assert.assertEquals(2, newReport.getReportsCategoryBO().getReportCategoryId().shortValue());
    Assert.assertEquals(0, newReport.getIsActive().shortValue());
    Assert.assertEquals("newTestShouldSubmitSuccessAfterEdit.rptdesign", newReport.getReportsJasperMap().getReportJasper());
    ReportsJasperMap jasper = persistence.getPersistentObject(ReportsJasperMap.class, report.getReportsJasperMap().getReportId());
    Assert.assertEquals("newTestShouldSubmitSuccessAfterEdit.rptdesign", jasper.getReportJasper());
    removeReport(newReport.getReportId());
}
Also used : ReportsPersistence(org.mifos.reports.persistence.ReportsPersistence) MockFormFile(org.mifos.reports.business.MockFormFile) ReportsCategoryBO(org.mifos.reports.business.ReportsCategoryBO) BirtReportsUploadActionForm(org.mifos.reports.struts.actionforms.BirtReportsUploadActionForm) ReportsJasperMap(org.mifos.reports.business.ReportsJasperMap) ReportsBO(org.mifos.reports.business.ReportsBO) Test(org.junit.Test)

Example 10 with ReportsBO

use of org.mifos.reports.business.ReportsBO in project head by mifos.

the class BirtReportsUploadActionStrutsTest method testShouldSubmitSucessWhenUploadNewReport.

@Test
public void testShouldSubmitSucessWhenUploadNewReport() throws Exception {
    setRequestPathInfo("/birtReportsUploadAction.do");
    BirtReportsUploadActionForm form = new BirtReportsUploadActionForm();
    form.setReportTitle("testShouldSubmitSucessWhenUploadNewReport");
    form.setReportCategoryId("1");
    form.setIsActive("1");
    form.setFile(new MockFormFile("testFileName1.rptdesign"));
    setActionForm(form);
    addRequestParameter("method", "upload");
    actionPerform();
    ReportsBO report = (ReportsBO) request.getAttribute("report");
    Assert.assertNotNull(report);
    ReportsPersistence rp = new ReportsPersistence();
    ReportsJasperMap jasper = rp.getPersistentObject(ReportsJasperMap.class, report.getReportsJasperMap().getReportId());
    Assert.assertNotNull(jasper);
    verifyNoActionErrors();
    verifyForward("create_success");
    removeReport(report.getReportId());
}
Also used : MockFormFile(org.mifos.reports.business.MockFormFile) ReportsPersistence(org.mifos.reports.persistence.ReportsPersistence) BirtReportsUploadActionForm(org.mifos.reports.struts.actionforms.BirtReportsUploadActionForm) ReportsJasperMap(org.mifos.reports.business.ReportsJasperMap) ReportsBO(org.mifos.reports.business.ReportsBO) Test(org.junit.Test)

Aggregations

ReportsBO (org.mifos.reports.business.ReportsBO)21 ReportsPersistence (org.mifos.reports.persistence.ReportsPersistence)10 Test (org.junit.Test)9 BirtReportsUploadActionForm (org.mifos.reports.struts.actionforms.BirtReportsUploadActionForm)7 ReportsCategoryBO (org.mifos.reports.business.ReportsCategoryBO)6 ReportsJasperMap (org.mifos.reports.business.ReportsJasperMap)5 FormFile (org.apache.struts.upload.FormFile)3 MockFormFile (org.mifos.reports.business.MockFormFile)3 ActivityEntity (org.mifos.security.rolesandpermission.business.ActivityEntity)3 IOException (java.io.IOException)2 ActionErrors (org.apache.struts.action.ActionErrors)2 ActionMessage (org.apache.struts.action.ActionMessage)2 LookUpValueEntity (org.mifos.application.master.business.LookUpValueEntity)2 MifosRuntimeException (org.mifos.core.MifosRuntimeException)2 PersistenceException (org.mifos.framework.exceptions.PersistenceException)2 BufferedInputStream (java.io.BufferedInputStream)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 OutputStream (java.io.OutputStream)1