Search in sources :

Example 6 with MockFormFile

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

the class BirtAdminDocumentUploadActionStrutsTest method testShouldSubmitSucessWhenUploadNewAdminDocument.

@Test
public void testShouldSubmitSucessWhenUploadNewAdminDocument() throws Exception {
    setRequestPathInfo("/birtAdminDocumentUploadAction.do");
    BirtAdminDocumentUploadActionForm form = new BirtAdminDocumentUploadActionForm();
    form.setAdminiDocumentTitle("testShouldSubmitSucessWhenUploadNewAdminDocumentWithAVeryLongNameThatExceedsOneHundredCharactersInLength");
    form.setIsActive("1");
    form.setFile(new MockFormFile("testFileName1.rptdesign"));
    setActionForm(form);
    addRequestParameter("method", "upload");
    actionPerform();
    AdminDocumentBO adminDocument = (AdminDocumentBO) request.getAttribute(Constants.BUSINESS_KEY);
    Assert.assertNotNull(adminDocument);
    ReportsPersistence rp = new ReportsPersistence();
    ReportsJasperMap jasper = rp.getPersistentObject(ReportsJasperMap.class, adminDocument.getAdmindocId());
    Assert.assertNotNull(jasper);
    verifyNoActionErrors();
    verifyForward("create_success");
    removeReport(adminDocument.getAdmindocId());
}
Also used : MockFormFile(org.mifos.reports.business.MockFormFile) ReportsPersistence(org.mifos.reports.persistence.ReportsPersistence) AdminDocumentBO(org.mifos.reports.admindocuments.business.AdminDocumentBO) BirtAdminDocumentUploadActionForm(org.mifos.reports.admindocuments.struts.actionforms.BirtAdminDocumentUploadActionForm) ReportsJasperMap(org.mifos.reports.business.ReportsJasperMap) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 MockFormFile (org.mifos.reports.business.MockFormFile)6 BirtReportsUploadActionForm (org.mifos.reports.struts.actionforms.BirtReportsUploadActionForm)5 ReportsBO (org.mifos.reports.business.ReportsBO)3 ReportsJasperMap (org.mifos.reports.business.ReportsJasperMap)3 ReportsPersistence (org.mifos.reports.persistence.ReportsPersistence)3 FormFile (org.apache.struts.upload.FormFile)2 ActivityEntity (org.mifos.security.rolesandpermission.business.ActivityEntity)2 IOException (java.io.IOException)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 PersistenceException (org.mifos.framework.exceptions.PersistenceException)1 AdminDocumentBO (org.mifos.reports.admindocuments.business.AdminDocumentBO)1 BirtAdminDocumentUploadActionForm (org.mifos.reports.admindocuments.struts.actionforms.BirtAdminDocumentUploadActionForm)1 ReportsCategoryBO (org.mifos.reports.business.ReportsCategoryBO)1 AddActivity (org.mifos.security.AddActivity)1 RolesPermissionsBusinessService (org.mifos.security.rolesandpermission.business.service.RolesPermissionsBusinessService)1