Search in sources :

Example 26 with LookUpValueEntity

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();
}
Also used : LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity) Test(org.junit.Test)

Example 27 with LookUpValueEntity

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());
}
Also used : FeeDto(org.mifos.dto.domain.FeeDto) LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity) Test(org.junit.Test)

Example 28 with LookUpValueEntity

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);
    }
}
Also used : LabelKey(org.mifos.config.util.helpers.LabelKey) LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity)

Example 29 with LookUpValueEntity

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);
}
Also used : LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity)

Example 30 with LookUpValueEntity

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;
}
Also used : ActivityEntity(org.mifos.security.rolesandpermission.business.ActivityEntity) LookUpEntity(org.mifos.application.master.business.LookUpEntity) LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity)

Aggregations

LookUpValueEntity (org.mifos.application.master.business.LookUpValueEntity)38 Test (org.junit.Test)11 ActivityEntity (org.mifos.security.rolesandpermission.business.ActivityEntity)9 LookUpEntity (org.mifos.application.master.business.LookUpEntity)8 MessageLookup (org.mifos.application.master.MessageLookup)7 MifosRuntimeException (org.mifos.core.MifosRuntimeException)7 PersistenceException (org.mifos.framework.exceptions.PersistenceException)7 ApplicationException (org.mifos.framework.exceptions.ApplicationException)5 SystemException (org.mifos.framework.exceptions.SystemException)5 LookUpValueLocaleEntity (org.mifos.application.master.business.LookUpValueLocaleEntity)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)3 CategoryTypeEntity (org.mifos.accounts.fees.business.CategoryTypeEntity)3 FeeBO (org.mifos.accounts.fees.business.FeeBO)3 FeeFrequencyTypeEntity (org.mifos.accounts.fees.business.FeeFrequencyTypeEntity)3 RateFeeBO (org.mifos.accounts.fees.business.RateFeeBO)3 FeeActionForm (org.mifos.accounts.fees.struts.actionforms.FeeActionForm)3 GLCodeEntity (org.mifos.accounts.financial.business.GLCodeEntity)3 ProductDefinitionException (org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException)3