use of org.mifos.reports.business.ReportsBO in project head by mifos.
the class AddReportIntegrationTest method testStartFromStandardStore.
@Test
public void testStartFromStandardStore() throws Exception {
short newId = 17032;
AddReport upgrade = new AddReport(ReportsCategoryBO.ANALYSIS, "Detailed Aging of Portfolio at Risk", "DetailedAgingPortfolioAtRisk.rptdesign");
upgrade.upgrade(session.connection());
ReportsBO fetched = (ReportsBO) session.get(ReportsBO.class, newId);
Assert.assertEquals(newId, (int) fetched.getReportId());
Assert.assertEquals(ReportsBO.ACTIVE, fetched.getIsActive());
Assert.assertEquals(null, fetched.getActivityId());
Assert.assertEquals("Detailed Aging of Portfolio at Risk", fetched.getReportName());
Assert.assertEquals("aging_portfolio_at_risk", fetched.getReportIdentifier());
Assert.assertEquals(ReportsCategoryBO.ANALYSIS, (int) fetched.getReportsCategoryBO().getReportCategoryId());
ReportsJasperMap map = fetched.getReportsJasperMap();
Assert.assertEquals("DetailedAgingPortfolioAtRisk.rptdesign", map.getReportJasper());
}
use of org.mifos.reports.business.ReportsBO in project head by mifos.
the class AddReportUpgradeIntegrationTest method testShouldUpgrade.
@Test
public void testShouldUpgrade() throws Exception {
AddReport addReport = createReport();
addReport.upgrade(connection);
ReportsBO report = new ReportsPersistence().getReport(ReportsCategoryBO.ANALYSIS);
Assert.assertNotNull(report.getActivityId());
Assert.assertTrue(report.getIsActive() == (short) 1);
}
use of org.mifos.reports.business.ReportsBO in project head by mifos.
the class ReportsPersistenceIntegrationTest method testGetAllReportsForACategory.
@Test
public void testGetAllReportsForACategory() {
List<ReportsCategoryBO> listOfReportCategories = reportsPersistence.getAllReportCategories();
Set<ReportsBO> reportsSet = listOfReportCategories.get(0).getReportsSet();
for (Object element : reportsSet) {
ReportsBO reports = (ReportsBO) element;
if (reports.getReportId().equals("1")) {
Assert.assertEquals("Client Detail", reports.getReportName());
} else if (reports.getReportId().equals("2")) {
Assert.assertEquals("Performance", reports.getReportName());
} else if (reports.getReportId().equals("3")) {
Assert.assertEquals("Kendra", reports.getReportName());
} else if (reports.getReportId().equals("4")) {
Assert.assertEquals("Loan Product Detail", reports.getReportName());
} else if (reports.getReportId().equals("5")) {
Assert.assertEquals("Status", reports.getReportName());
} else if (reports.getReportId().equals("6")) {
Assert.assertEquals("Analysis", reports.getReportName());
} else if (reports.getReportId().equals("7")) {
Assert.assertEquals("Miscellaneous", reports.getReportName());
} else {
/*
* We always get here, because the above code is comparing a
* Short to a String. TODO: how do we really want to test this,
* anyway?
*/
// Assert.fail("unexpected report " + reports.getReportId());
}
}
}
use of org.mifos.reports.business.ReportsBO in project head by mifos.
the class BirtReportsUploadActionStrutsTest method testUpgradePathNotRuined.
@Test
public void testUpgradePathNotRuined() throws Exception {
// TODO Temporary solution to avoid unsuccessful test on some machines
// Retrieve initial activities information
List<ActivityEntity> activities = new RolesPermissionsBusinessService().getActivities();
int newActivityId = activities.get(activities.size() - 1).getId() + 1;
// Upload a report creating an activity for the report
FormFile file = new MockFormFile("testFilename.rptdesign");
BirtReportsUploadActionForm actionForm = new BirtReportsUploadActionForm();
setRequestPathInfo("/birtReportsUploadAction.do");
addRequestParameter("method", "upload");
actionForm.setFile(file);
actionForm.setReportTitle("exsitTitle");
actionForm.setReportCategoryId("1");
actionForm.setIsActive("1");
setActionForm(actionForm);
actionPerform();
Assert.assertEquals(0, getErrorSize());
Assert.assertNotNull(request.getAttribute("report"));
// Simulate an future activities upgrade
AddActivity activity = null;
try {
activity = new AddActivity((short) newActivityId, SecurityConstants.ORGANIZATION_MANAGEMENT, "no name");
activity.upgrade(StaticHibernateUtil.getSessionTL().connection());
} catch (Exception e) {
legacyRolesPermissionsDao.delete(request.getAttribute("report"));
StaticHibernateUtil.flushSession();
throw e;
}
// Undo
ReportsBO report = (ReportsBO) request.getAttribute("report");
removeReport(report.getReportId());
}
use of org.mifos.reports.business.ReportsBO in project head by mifos.
the class BirtReportsUploadActionStrutsTest method removeReport.
private void removeReport(Short reportId) throws PersistenceException {
ReportsPersistence reportPersistence = new ReportsPersistence();
reportPersistence.getSession().clear();
ReportsBO report = reportPersistence.getPersistentObject(ReportsBO.class, reportId);
ActivityEntity activityEntity = legacyRolesPermissionsDao.getPersistentObject(ActivityEntity.class, report.getActivityId());
reportPersistence.delete(report);
LookUpValueEntity anLookUp = activityEntity.getActivityNameLookupValues();
legacyRolesPermissionsDao.delete(activityEntity);
legacyRolesPermissionsDao.delete(anLookUp);
StaticHibernateUtil.flushSession();
}
Aggregations