use of org.mifos.application.master.business.LookUpValueEntity in project head by mifos.
the class FeeActionStrutsTest method testFailureEditPreviewForZeroAmount.
@Test
public void testFailureEditPreviewForZeroAmount() throws Exception {
fee = TestObjectFactory.createOneTimeAmountFee("One Time Fee", FeeCategory.ALLCUSTOMERS, "12.34", FeePayment.UPFRONT);
LookUpValueEntity lookUpValue = new LookUpValueEntity();
fee.getFeeFrequency().getFeeFrequencyType().setLookUpValue(lookUpValue);
fee.getFeeFrequency().getFeePayment().setLookUpValue(lookUpValue);
String feeId = fee.getFeeId().toString();
request.setAttribute("feeModel", TestObjectFactory.getAmountBasedFee(feeId, "1", "0"));
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
setRequestPathInfo("/feeaction.do");
addRequestParameter("method", "manage");
addRequestParameter("feeId", feeId);
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
setRequestPathInfo("/feeaction.do");
addRequestParameter("method", "editPreview");
addRequestParameter("amount", "0");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
Assert.assertEquals(1, getErrorSize());
Assert.assertEquals("Fee Amount", 1, getErrorSize(FeeConstants.AMOUNT));
verifyInputForward();
}
use of org.mifos.application.master.business.LookUpValueEntity in project head by mifos.
the class FeeActionStrutsTest method testSuccessfulGetFee.
@Test
public void testSuccessfulGetFee() throws Exception {
fee = TestObjectFactory.createOneTimeRateFee("One Time Fee", FeeCategory.ALLCUSTOMERS, 24.0, FeeFormula.AMOUNT, FeePayment.UPFRONT, "non null lookup value");
LookUpValueEntity lookUpValue = new LookUpValueEntity();
fee.getFeeFrequency().getFeeFrequencyType().setLookUpValue(lookUpValue);
fee.getFeeFrequency().getFeePayment().setLookUpValue(lookUpValue);
((RateFeeBO) fee).getFeeFormula().setLookUpValue(lookUpValue);
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
setRequestPathInfo("/feeaction.do");
addRequestParameter("method", "get");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
addRequestParameter("feeId", fee.getFeeId().toString());
actionPerform();
Object sessionObj = getRequest().getAttribute("feeModel");
Assert.assertTrue("Should have got FeeDto", sessionObj instanceof FeeDto);
Assert.assertNotNull(sessionObj);
FeeDto feeDto = (FeeDto) sessionObj;
Assert.assertEquals("One Time Fee", feeDto.getName());
Assert.assertEquals(24.0, feeDto.getRate());
}
use of org.mifos.application.master.business.LookUpValueEntity in project head by mifos.
the class MessageLookup method updateLabelCache.
public void updateLabelCache() {
List<LookUpValueEntity> lookupValueEntities = applicationConfigurationDao.findLookupValues();
for (LookUpValueEntity lookupValueEntity : lookupValueEntities) {
String keyString = lookupValueEntity.getPropertiesKey();
if (keyString == null) {
throw new IllegalStateException("Key is empty");
}
String messageText = lookupValueEntity.getMessageText();
if (StringUtils.isBlank(messageText)) {
messageText = lookup(keyString);
}
labelCache.put(new LabelKey(keyString, getLocaleId()), messageText);
}
}
use of org.mifos.application.master.business.LookUpValueEntity in project head by mifos.
the class BirtReportsUploadActionStrutsTest method deleteActivityForTest.
private void deleteActivityForTest(ActivityEntity activityEntity) throws PersistenceException {
legacyRolesPermissionsDao.getSession().clear();
LookUpValueEntity anLookUp = activityEntity.getActivityNameLookupValues();
legacyRolesPermissionsDao.delete(activityEntity);
legacyRolesPermissionsDao.delete(anLookUp);
}
use of org.mifos.application.master.business.LookUpValueEntity in project head by mifos.
the class BirtReportsUploadActionStrutsTest method insertActivityForTest.
private ActivityEntity insertActivityForTest(short activityId) throws PersistenceException {
LookUpValueEntity anLookUp = new LookUpValueEntity();
LookUpEntity lookUpEntity = legacyMasterDao.getPersistentObject(LookUpEntity.class, Short.valueOf((short) LookUpEntity.ACTIVITY));
anLookUp.setLookUpEntity(lookUpEntity);
ActivityEntity parent = legacyMasterDao.getPersistentObject(ActivityEntity.class, (short) 13);
ActivityEntity activityEntity = new ActivityEntity(activityId, parent, anLookUp);
legacyRolesPermissionsDao.createOrUpdate(anLookUp);
legacyRolesPermissionsDao.createOrUpdate(activityEntity);
return activityEntity;
}
Aggregations