use of org.mifos.reports.struts.actionforms.BirtReportsUploadActionForm in project head by mifos.
the class BirtReportsUploadActionStrutsTest method testShouldCreateFailureWhenActivityIdOutOfRange.
@Test
public void testShouldCreateFailureWhenActivityIdOutOfRange() throws Exception {
ActivityEntity activityEntity = insertActivityForTest(Short.MIN_VALUE);
FormFile file = new MockFormFile("testFilename");
BirtReportsUploadActionForm actionForm = new BirtReportsUploadActionForm();
setRequestPathInfo("/birtReportsUploadAction.do");
addRequestParameter("method", "upload");
actionForm.setFile(file);
actionForm.setReportTitle("existingTitle");
actionForm.setReportCategoryId("1");
actionForm.setIsActive("1");
setActionForm(actionForm);
actionPerform();
verifyForward("preview_failure");
String[] errors = { ReportsConstants.ERROR_NOMOREDYNAMICACTIVITYID };
verifyActionErrors(errors);
deleteActivityForTest(activityEntity);
}
use of org.mifos.reports.struts.actionforms.BirtReportsUploadActionForm 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.struts.actionforms.BirtReportsUploadActionForm in project head by mifos.
the class BirtReportsUploadActionStrutsTest method testShouldPreviewSuccessWithReportTemplate.
@Test
public void testShouldPreviewSuccessWithReportTemplate() throws Exception {
setRequestPathInfo("/birtReportsUploadAction.do");
BirtReportsUploadActionForm form = new BirtReportsUploadActionForm();
form.setFile(new MockFormFile("testFileName1.rptdesign"));
form.setIsActive("1");
form.setReportCategoryId("1");
form.setReportTitle("testReportTitle1");
setActionForm(form);
addRequestParameter("method", "preview");
actionPerform();
verifyNoActionErrors();
verifyForward("preview_success");
}
Aggregations