List of usage examples for java.lang Short valueOf
@HotSpotIntrinsicCandidate public static Short valueOf(short s)
From source file:org.gvnix.web.screen.roo.addon.SeleniumServicesImpl.java
/** * Get test value for a field.// ww w. ja v a2 s. c o m * * @param field Field to auto generate a value * @param random Should be the initialized value generated randomly ? * @return Field test value */ private String convertToInitializer(FieldMetadata field, boolean random) { String initializer = " "; short index = 1; if (random) { index = (short) RANDOM_GENERATOR.nextInt(); } AnnotationMetadata min = MemberFindingUtils.getAnnotationOfType(field.getAnnotations(), new JavaType("javax.validation.constraints.Min")); if (min != null) { AnnotationAttributeValue<?> value = min.getAttribute(new JavaSymbolName("value")); if (value != null) { index = Short.valueOf(value.getValue().toString()); } } if (field.getFieldName().getSymbolName().contains("email") || field.getFieldName().getSymbolName().contains("Email")) { initializer = "some@email.com"; } else if (field.getFieldType().equals(JavaType.STRING)) { initializer = "some" + field.getFieldName().getSymbolNameCapitalisedFirstLetter() + index; } else if (field.getFieldType().equals(new JavaType(Date.class.getName())) || field.getFieldType().equals(new JavaType(Calendar.class.getName()))) { Calendar cal = Calendar.getInstance(); AnnotationMetadata dateTimeFormat = null; String style = null; if (null != (dateTimeFormat = MemberFindingUtils.getAnnotationOfType(field.getAnnotations(), new JavaType("org.springframework.format.annotation.DateTimeFormat")))) { AnnotationAttributeValue<?> value = dateTimeFormat.getAttribute(new JavaSymbolName("style")); if (value != null) { style = value.getValue().toString(); } } if (null != MemberFindingUtils.getAnnotationOfType(field.getAnnotations(), new JavaType("javax.validation.constraints.Past"))) { cal.add(Calendar.YEAR, -1); cal.add(Calendar.MONTH, -1); cal.add(Calendar.DAY_OF_MONTH, -1); } else if (null != MemberFindingUtils.getAnnotationOfType(field.getAnnotations(), new JavaType("javax.validation.constraints.Future"))) { cal.add(Calendar.YEAR, +1); cal.add(Calendar.MONTH, +1); cal.add(Calendar.DAY_OF_MONTH, +1); } if (style != null) { if (style.startsWith("-")) { initializer = ((SimpleDateFormat) DateFormat .getTimeInstance(DateTime.parseDateFormat(style.charAt(1)), Locale.getDefault())) .format(cal.getTime()); } else if (style.endsWith("-")) { initializer = ((SimpleDateFormat) DateFormat .getDateInstance(DateTime.parseDateFormat(style.charAt(0)), Locale.getDefault())) .format(cal.getTime()); } else { initializer = ((SimpleDateFormat) DateFormat.getDateTimeInstance( DateTime.parseDateFormat(style.charAt(0)), DateTime.parseDateFormat(style.charAt(1)), Locale.getDefault())).format(cal.getTime()); } } else { initializer = ((SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault())) .format(cal.getTime()); } } else if (field.getFieldType().equals(JavaType.BOOLEAN_OBJECT) || field.getFieldType().equals(JavaType.BOOLEAN_PRIMITIVE)) { initializer = Boolean.FALSE.toString(); } else if (field.getFieldType().equals(JavaType.INT_OBJECT) || field.getFieldType().equals(JavaType.INT_PRIMITIVE)) { initializer = Integer.valueOf(index).toString(); } else if (field.getFieldType().equals(JavaType.DOUBLE_OBJECT) || field.getFieldType().equals(JavaType.DOUBLE_PRIMITIVE)) { initializer = Double.valueOf(index).toString(); } else if (field.getFieldType().equals(JavaType.FLOAT_OBJECT) || field.getFieldType().equals(JavaType.FLOAT_PRIMITIVE)) { initializer = Float.valueOf(index).toString(); } else if (field.getFieldType().equals(JavaType.LONG_OBJECT) || field.getFieldType().equals(JavaType.LONG_PRIMITIVE)) { initializer = Long.valueOf(index).toString(); } else if (field.getFieldType().equals(JavaType.SHORT_OBJECT) || field.getFieldType().equals(JavaType.SHORT_PRIMITIVE)) { initializer = Short.valueOf(index).toString(); } else if (field.getFieldType().equals(new JavaType("java.math.BigDecimal"))) { initializer = BigDecimal.valueOf(index).toString(); } return initializer; }
From source file:org.mifos.accounts.loan.struts.action.LoanAccountAction.java
/** * Create new meeting for the repayment day. * <p/>/*from w ww.j a va2 s . c om*/ * Depending on the recurrence id (WEEKLY or MONTHLY) a MeetingBO will be created and returned * * @throws InvalidDateException */ private MeetingBO createNewMeetingForRepaymentDay(final HttpServletRequest request, final LoanAccountActionForm loanAccountActionForm, final CustomerBO customer) throws MeetingException, InvalidDateException { MeetingBO newMeetingForRepaymentDay = null; Short recurrenceId = Short.valueOf(loanAccountActionForm.getRecurrenceId()); final Date repaymentStartDate = this.resolveRepaymentStartDate( loanAccountActionForm.getDisbursementDateValue(getUserContext(request).getPreferredLocale())); if (RecurrenceType.WEEKLY.getValue().equals(recurrenceId)) { newMeetingForRepaymentDay = new MeetingBO( WeekDay.getWeekDay(Short.valueOf(loanAccountActionForm.getWeekDay())), Short.valueOf(loanAccountActionForm.getRecurWeek()), repaymentStartDate, MeetingType.LOAN_INSTALLMENT, customer.getCustomerMeeting().getMeeting().getMeetingPlace()); } else if (RecurrenceType.MONTHLY.getValue().equals(recurrenceId)) { if (loanAccountActionForm.getMonthType().equals("1")) { newMeetingForRepaymentDay = new MeetingBO(Short.valueOf(loanAccountActionForm.getMonthDay()), Short.valueOf(loanAccountActionForm.getDayRecurMonth()), repaymentStartDate, MeetingType.LOAN_INSTALLMENT, customer.getCustomerMeeting().getMeeting().getMeetingPlace()); } else { newMeetingForRepaymentDay = new MeetingBO(Short.valueOf(loanAccountActionForm.getMonthWeek()), Short.valueOf(loanAccountActionForm.getRecurMonth()), repaymentStartDate, MeetingType.LOAN_INSTALLMENT, customer.getCustomerMeeting().getMeeting().getMeetingPlace(), Short.valueOf(loanAccountActionForm.getMonthRank())); } } return newMeetingForRepaymentDay; }
From source file:org.mifos.customers.persistence.CustomerDaoHibernate.java
@SuppressWarnings("unchecked") @Override/*from w w w. j a v a2 s.co m*/ public ClientDisplayDto getClientDisplayDto(Integer clientId, UserContext userContext) { Map<String, Object> queryParameters = new HashMap<String, Object>(); queryParameters.put("CLIENT_ID", clientId); List<Object[]> queryResult = (List<Object[]>) this.genericDao.executeNamedQuery("getClientDisplayDto", queryParameters); if (queryResult.size() == 0) { throw new MifosRuntimeException("Client not found: " + clientId); } if (queryResult.size() > 1) { throw new MifosRuntimeException( "Error finding Client id: " + clientId + " - Number found: " + queryResult.size()); } final Integer customerId = (Integer) queryResult.get(0)[0]; final String globalCustNum = (String) queryResult.get(0)[1]; final String displayName = (String) queryResult.get(0)[2]; final String parentCustomerDisplayName = (String) queryResult.get(0)[3]; final String branchName = (String) queryResult.get(0)[4]; final String externalId = (String) queryResult.get(0)[5]; final String customerFormedByDisplayName = (String) queryResult.get(0)[6]; final Date customerActivationDate = (Date) queryResult.get(0)[7]; final Short customerLevelId = (Short) queryResult.get(0)[8]; final Short customerStatusId = (Short) queryResult.get(0)[9]; final String lookupName = (String) queryResult.get(0)[10]; final Date trainedDate = (Date) queryResult.get(0)[11]; final Date dateOfBirth = (Date) queryResult.get(0)[12]; final String governmentId = (String) queryResult.get(0)[13]; final Short groupFlag = (Short) queryResult.get(0)[14]; final Boolean blackListed = (Boolean) queryResult.get(0)[15]; final Short loanOfficerId = (Short) queryResult.get(0)[16]; final String loanOfficerName = (String) queryResult.get(0)[17]; final String businessActivitiesName = (String) queryResult.get(0)[18]; final String handicappedName = (String) queryResult.get(0)[19]; final String maritalStatusName = (String) queryResult.get(0)[20]; final String citizenshipName = (String) queryResult.get(0)[21]; final String ethnicityName = (String) queryResult.get(0)[22]; final String educationLevelName = (String) queryResult.get(0)[23]; final String povertyStatusName = (String) queryResult.get(0)[24]; final Short numChildren = (Short) queryResult.get(0)[25]; final Integer branchId = (Integer) queryResult.get(0)[26]; Boolean clientUnderGroup = false; if (groupFlag.compareTo(Short.valueOf("0")) > 0) { clientUnderGroup = true; } final String customerStatusName = ApplicationContextProvider.getBean(MessageLookup.class) .lookup(lookupName); final String businessActivities = ApplicationContextProvider.getBean(MessageLookup.class) .lookup(businessActivitiesName); final String handicapped = ApplicationContextProvider.getBean(MessageLookup.class).lookup(handicappedName); final String maritalStatus = ApplicationContextProvider.getBean(MessageLookup.class) .lookup(maritalStatusName); final String citizenship = ApplicationContextProvider.getBean(MessageLookup.class).lookup(citizenshipName); final String ethnicity = ApplicationContextProvider.getBean(MessageLookup.class).lookup(ethnicityName); final String educationLevel = ApplicationContextProvider.getBean(MessageLookup.class) .lookup(educationLevelName); final String povertyStatus = ApplicationContextProvider.getBean(MessageLookup.class) .lookup(povertyStatusName); String spouseFatherValue = null; String spouseFatherName = null; List<ClientFamilyDetailOtherDto> familyDetails = null; Boolean areFamilyDetailsRequired = ClientRules.isFamilyDetailsRequired(); if (areFamilyDetailsRequired) { familyDetails = new ArrayList<ClientFamilyDetailOtherDto>(); List<Object[]> familyDetailsQueryResult = (List<Object[]>) this.genericDao .executeNamedQuery("getClientFamilyDetailDto", queryParameters); for (Object[] familyDetail : familyDetailsQueryResult) { final String relationshipLookup = (String) familyDetail[0]; final String familyDisplayName = (String) familyDetail[1]; final Date familyDateOfBirth = (Date) familyDetail[2]; final String genderLookup = (String) familyDetail[3]; final String livingStatusLookup = (String) familyDetail[4]; final String relationship = ApplicationContextProvider.getBean(MessageLookup.class) .lookup(relationshipLookup); final String gender = ApplicationContextProvider.getBean(MessageLookup.class).lookup(genderLookup); final String livingStatus = ApplicationContextProvider.getBean(MessageLookup.class) .lookup(livingStatusLookup); String dateOfBirthAsString = ""; if (familyDateOfBirth != null) { dateOfBirthAsString = DateUtils.makeDateAsSentFromBrowser(familyDateOfBirth); } familyDetails.add(new ClientFamilyDetailOtherDto(relationship, familyDisplayName, familyDateOfBirth, gender, livingStatus, dateOfBirthAsString)); } } else { List<Object[]> clientNameDetailsQueryResult = (List<Object[]>) this.genericDao .executeNamedQuery("getClientNameDetailDto", queryParameters); if (clientNameDetailsQueryResult.size() > 0) { final String spouseFatherValueLookUp = (String) clientNameDetailsQueryResult.get(0)[0]; spouseFatherName = (String) clientNameDetailsQueryResult.get(0)[1]; spouseFatherValue = ApplicationContextProvider.getBean(MessageLookup.class) .lookup(spouseFatherValueLookUp); } } Integer age = null; if (dateOfBirth != null) { age = DateUtils.DateDiffInYears(new java.sql.Date(dateOfBirth.getTime())); } return new ClientDisplayDto(customerId, globalCustNum, displayName, parentCustomerDisplayName, branchId, branchName, externalId, customerFormedByDisplayName, customerActivationDate, customerLevelId, customerStatusId, customerStatusName, trainedDate, dateOfBirth, governmentId, clientUnderGroup, blackListed, loanOfficerId, loanOfficerName, businessActivities, handicapped, maritalStatus, citizenship, ethnicity, educationLevel, povertyStatus, numChildren, areFamilyDetailsRequired, spouseFatherValue, spouseFatherName, familyDetails, age); }
From source file:org.mifos.accounts.loan.business.LoanBOIntegrationTest.java
public void testWaiveMiscPenaltyAfterPayment() throws Exception { accountBO = getLoanAccount();//w w w. ja v a 2 s. co m TestObjectFactory.flushandCloseSession(); accountBO = TestObjectFactory.getObject(LoanBO.class, accountBO.getAccountId()); accountBO.setUserContext(TestUtils.makeUser()); Date currentDate = new Date(System.currentTimeMillis()); LoanBO loan = (LoanBO) accountBO; loan.applyCharge(Short.valueOf("-2"), Double.valueOf("200")); TestObjectFactory.updateObject(loan); for (AccountActionDateEntity accountActionDateEntity : loan.getAccountActionDates()) { LoanScheduleEntity loanScheduleEntity = (LoanScheduleEntity) accountActionDateEntity; if (loanScheduleEntity.getInstallmentId().equals(Short.valueOf("1"))) { Assert.assertEquals(loanScheduleEntity.getMiscPenalty(), new Money(getCurrency(), "200")); Assert.assertEquals(loanScheduleEntity.getMiscPenaltyPaid(), new Money(getCurrency())); } } Assert.assertEquals(loan.getLoanSummary().getOriginalPenalty(), new Money(getCurrency(), "200")); Assert.assertEquals(loan.getLoanSummary().getPenaltyPaid(), new Money(getCurrency())); List<AccountActionDateEntity> accntActionDates = new ArrayList<AccountActionDateEntity>(); accntActionDates.addAll(loan.getAccountActionDates()); PaymentData paymentData = TestObjectFactory.getLoanAccountPaymentData(accntActionDates, TestUtils.createMoney(200), null, accountBO.getPersonnel(), "receiptNum", Short.valueOf("1"), currentDate, currentDate); loan.applyPaymentWithPersist(paymentData); TestObjectFactory.updateObject(loan); for (AccountActionDateEntity accountActionDateEntity : loan.getAccountActionDates()) { LoanScheduleEntity loanScheduleEntity = (LoanScheduleEntity) accountActionDateEntity; if (loanScheduleEntity.getInstallmentId().equals(Short.valueOf("1"))) { Assert.assertEquals(loanScheduleEntity.getMiscPenalty(), new Money(getCurrency(), "200")); Assert.assertEquals(loanScheduleEntity.getMiscPenaltyPaid(), new Money(getCurrency(), "200")); } } Assert.assertEquals(loan.getLoanSummary().getOriginalPenalty(), new Money(getCurrency(), "200")); Assert.assertEquals(loan.getLoanSummary().getPenaltyPaid(), new Money(getCurrency(), "200")); loan.applyCharge(Short.valueOf("-2"), Double.valueOf("300")); TestObjectFactory.updateObject(loan); for (AccountActionDateEntity accountActionDateEntity : loan.getAccountActionDates()) { LoanScheduleEntity loanScheduleEntity = (LoanScheduleEntity) accountActionDateEntity; if (loanScheduleEntity.getInstallmentId().equals(Short.valueOf("1"))) { Assert.assertEquals(loanScheduleEntity.getMiscPenalty(), new Money(getCurrency(), "500")); Assert.assertEquals(loanScheduleEntity.getMiscPenaltyPaid(), new Money(getCurrency(), "200")); } } Assert.assertEquals(loan.getLoanSummary().getOriginalPenalty(), new Money(getCurrency(), "500")); Assert.assertEquals(loan.getLoanSummary().getPenaltyPaid(), new Money(getCurrency(), "200")); loan.waiveAmountDue(WaiveEnum.PENALTY); for (AccountActionDateEntity accountActionDateEntity : loan.getAccountActionDates()) { LoanScheduleEntity loanScheduleEntity = (LoanScheduleEntity) accountActionDateEntity; if (loanScheduleEntity.getInstallmentId().equals(Short.valueOf("1"))) { Assert.assertEquals(loanScheduleEntity.getMiscPenalty(), new Money(getCurrency(), "200")); Assert.assertEquals(loanScheduleEntity.getMiscPenaltyPaid(), new Money(getCurrency(), "200")); } } Assert.assertEquals(loan.getLoanSummary().getOriginalPenalty(), new Money(getCurrency(), "200")); Assert.assertEquals(loan.getLoanSummary().getPenaltyPaid(), new Money(getCurrency(), "200")); }
From source file:com.mimp.controllers.familia.java
@RequestMapping("/FfichaGuardar/opc2") public ModelAndView FfichaGuardarEl(ModelMap map, @RequestParam("nombre_el") String nombre, @RequestParam("apellido_p_el") String apellido_p, @RequestParam("apellido_m_el") String apellido_m, @RequestParam("edad_el") String edad, @RequestParam("lugar_nac_el") String lugar_nac, @RequestParam("depa_nac_el") String depa_nac, @RequestParam("pais_nac_el") String pais_nac, @RequestParam("TipoDoc") String tipo_doc, @RequestParam("n_doc_el") String n_doc, @RequestParam("domicilio") String domicilio, @RequestParam("telefono") String telefono, @RequestParam("celular_el") String celular, @RequestParam("correo_el") String correo, @RequestParam("estCivil") String est_civil, @RequestParam("fechaMatri") String fecha_matri, @RequestParam("nivel_inst_el") String nivel_inst, @RequestParam("culm_nivel_el") String culm_nivel, @RequestParam("prof_el") String prof, @RequestParam("Trabajador_Depend_el") String trab_depend, @RequestParam(value = "ocup_act_dep_el", required = false) String ocup_actual, @RequestParam(value = "centro_trabajo_el", required = false) String centro_trabajo, @RequestParam(value = "dir_centro_el", required = false) String dir_centro, @RequestParam(value = "tel_centro_el", required = false) String tel_centro, @RequestParam(value = "ingreso_dep_el", required = false) String ingreso_dep, @RequestParam("Trabajador_Indep_el") String trab_indep, @RequestParam(value = "ocup_act_indep_el", required = false) String ocup_act_indep, @RequestParam(value = "ingreso_ind_el", required = false) String ingreso_ind, @RequestParam("seguro_salud_el") String seguro_salud, @RequestParam("tipo_seguro") String tipo_seguro, @RequestParam("seguro_vida_el") String seguro_vida, @RequestParam("sist_pen_el") String sist_pen, @RequestParam("est_salud_el") String est_salud, HttpSession session) { Familia usuario = (Familia) session.getAttribute("usuario"); if (usuario == null) { String mensaje = "La sesin ha finalizado. Favor identificarse nuevamente"; map.addAttribute("mensaje", mensaje); return new ModelAndView("login", map); }// ww w .j a v a2s .co m dateFormat format = new dateFormat(); Date factual = new Date(); String fechaactual = format.dateToString(factual); map.addAttribute("factual", fechaactual); FichaSolicitudAdopcion ficha = (FichaSolicitudAdopcion) session.getAttribute("ficha"); Solicitante sol = new Solicitante(); for (Iterator iter2 = ficha.getSolicitantes().iterator(); iter2.hasNext();) { sol = (Solicitante) iter2.next(); if (sol.getSexo() == 'M') { ficha.getSolicitantes().remove(sol); break; } } sol.setNombre(nombre); sol.setApellidoP(apellido_p); sol.setApellidoM(apellido_m); try { sol.setEdad(Short.parseShort(edad)); } catch (Exception ex) { String mensaje_edad = "ERROR: El campo Edad contiene parmetros invlidos"; map.addAttribute("mensaje_edad", mensaje_edad); } sol.setLugarNac(lugar_nac); sol.setDepaNac(depa_nac); sol.setPaisNac(pais_nac); try { sol.setTipoDoc(tipo_doc.charAt(0)); } catch (Exception ex) { } sol.setNDoc(n_doc); ficha.setDomicilio(domicilio); ficha.setFijo(telefono); sol.setCelular(celular); sol.setCorreo(correo); try { ficha.setEstadoCivil(est_civil); } catch (Exception ex) { } Date tempfecha = ficha.getFechaMatrimonio(); if (fecha_matri.contains("ene") || fecha_matri.contains("feb") || fecha_matri.contains("mar") || fecha_matri.contains("abr") || fecha_matri.contains("may") || fecha_matri.contains("jun") || fecha_matri.contains("jul") || fecha_matri.contains("ago") || fecha_matri.contains("set") || fecha_matri.contains("oct") || fecha_matri.contains("nov") || fecha_matri.contains("dic")) { ficha.setFechaMatrimonio(tempfecha); } else { ficha.setFechaMatrimonio(format.stringToDate(fecha_matri)); } sol.setNivelInstruccion(nivel_inst); sol.setCulminoNivel(Short.valueOf(culm_nivel)); sol.setProfesion(prof); sol.setTrabajadorDepend(Short.valueOf(trab_depend)); sol.setOcupActualDep(ocup_actual); sol.setCentroTrabajo(centro_trabajo); sol.setDireccionCentro(dir_centro); sol.setTelefonoCentro(tel_centro); try { sol.setIngresoDep(Long.valueOf(ingreso_dep)); } catch (Exception ex) { String mensaje_ingreso_dep = "ERROR: La informacin contenida en este campo contiene parmetros invlidos"; map.addAttribute("mensaje_ing_dep", mensaje_ingreso_dep); } sol.setTrabajadorIndepend(Short.valueOf(trab_indep)); sol.setOcupActualInd(ocup_act_indep); try { sol.setIngresoIndep(Long.valueOf(ingreso_ind)); } catch (Exception ex) { String mensaje_ingreso_indep = "ERROR: La informacin contenida en este campo contiene parmetros invlidos"; map.addAttribute("mensaje_ing_indep", mensaje_ingreso_indep); } sol.setSeguroSalud(Short.valueOf(seguro_salud)); sol.setTipoSeguro(tipo_seguro); sol.setSeguroVida(Short.valueOf(seguro_vida)); sol.setSistPensiones(Short.valueOf(sist_pen)); sol.setSaludActual(est_salud); ficha.getSolicitantes().add(sol); session.removeAttribute("ficha"); session.setAttribute("ficha", ficha); map.put("sol", sol); String fechanac = format.dateToString(sol.getFechaNac()); map.addAttribute("fechanac", fechanac); map.addAttribute("estCivil", est_civil.charAt(0)); map.addAttribute("fechaMatri", format.dateToString(ficha.getFechaMatrimonio())); map.addAttribute("estCivil", ficha.getEstadoCivil().charAt(0)); map.addAttribute("domicilio", ficha.getDomicilio()); map.addAttribute("fijo", ficha.getFijo()); String pagina = "/Familia/Ficha/ficha_inscripcion_el"; return new ModelAndView(pagina, map); }
From source file:net.sf.json.TestJSONObject.java
public void testToBean_ObjectBean() { // FR 1611204 ObjectBean bean = new ObjectBean(); bean.setPbyte(Byte.valueOf("1")); bean.setPshort(Short.valueOf("1")); bean.setPint(Integer.valueOf("1")); bean.setPlong(Long.valueOf("1")); bean.setPfloat(Float.valueOf("1")); bean.setPdouble(Double.valueOf("1")); bean.setPchar(new Character('1')); bean.setPboolean(Boolean.TRUE); bean.setPstring("json"); bean.setParray(new String[] { "a", "b" }); bean.setPbean(new BeanA()); List list = new ArrayList(); list.add("1"); list.add("2"); bean.setPlist(list);// ww w .j a va 2s . c o m Map map = new HashMap(); map.put("string", "json"); bean.setPmap(map); bean.setPfunction(new JSONFunction("this;")); JSONObject json = JSONObject.fromObject(bean); Map classMap = new HashMap(); classMap.put("pbean", BeanA.class); ObjectBean obj = (ObjectBean) JSONObject.toBean(json, ObjectBean.class, classMap); assertEquals(Integer.valueOf("1"), obj.getPbyte()); assertEquals(Integer.valueOf("1"), obj.getPshort()); assertEquals(Integer.valueOf("1"), obj.getPint()); assertEquals(Integer.valueOf("1"), obj.getPlong()); assertEquals(Double.valueOf("1"), obj.getPfloat()); assertEquals(Double.valueOf("1"), obj.getPdouble()); assertEquals("1", obj.getPchar()); assertEquals("json", obj.getPstring()); List l = new ArrayList(); l.add("a"); l.add("b"); ArrayAssertions.assertEquals(l.toArray(), (Object[]) obj.getParray()); l = new ArrayList(); l.add("1"); l.add("2"); ArrayAssertions.assertEquals(l.toArray(), (Object[]) obj.getPlist()); assertEquals(new BeanA(), obj.getPbean()); assertTrue(obj.getPmap() instanceof MorphDynaBean); }
From source file:org.mifos.accounts.loan.business.LoanBORedoDisbursalIntegrationTest.java
private LoanBO redoLoanAccount(GroupBO group, LoanOfferingBO loanOffering, MeetingBO meeting, List<AccountFeesEntity> feeDtos) throws AccountException { Short numberOfInstallments = Short.valueOf("6"); List<Date> meetingDates = TestObjectFactory.getMeetingDates(group.getOfficeId(), meeting, numberOfInstallments);// w w w . j a v a2s .c o m loanBO = LoanBO.redoLoan(TestUtils.makeUser(), loanOffering, group, AccountState.LOAN_APPROVED, TestUtils.createMoney("300.0"), numberOfInstallments, meetingDates.get(0), false, 1.2, (short) 0, null, feeDtos, DOUBLE_ZERO, DOUBLE_ZERO, SHORT_ZERO, SHORT_ZERO, false, null); ((LoanBO) loanBO).save(); new TestObjectPersistence().persist(loanBO); return (LoanBO) loanBO; }
From source file:org.mifos.accounts.loan.business.LoanBORedoDisbursalIntegrationTest.java
private void disburseLoan(UserContext userContext, LoanBO loan, Date loanDisbursalDate) throws AccountException, PersistenceException { PersonnelBO personnel = legacyPersonnelDao.getPersonnel(userContext.getId()); loan.disburseLoan(null, loanDisbursalDate, Short.valueOf("1"), personnel, null, Short.valueOf("1")); new TestObjectPersistence().persist(loan); }
From source file:org.mifos.accounts.loan.business.LoanBOIntegrationTest.java
public void testAddLoanDetailsForDisbursal() { LoanBO loan = (LoanBO) createLoanAccount(); loan.setLoanAmount(TestUtils.createMoney(100)); loan.setNoOfInstallments(Short.valueOf("5")); InterestTypesEntity interestType = new InterestTypesEntity(InterestType.FLAT); loan.setInterestType(interestType);// w w w . j av a 2s.c o m List<LoanBO> loanWithDisbursalDate = new ArrayList<LoanBO>(); loanWithDisbursalDate.add(loan); CollectionSheetBO collSheet = new CollectionSheetBO(); collSheet.addLoanDetailsForDisbursal(loanWithDisbursalDate); CollSheetCustBO collectionSheetCustomer = collSheet .getCollectionSheetCustomerForCustomerId(group.getCustomerId()); Assert.assertNotNull(collectionSheetCustomer); Assert.assertEquals( collectionSheetCustomer.getLoanDetailsForAccntId(loan.getAccountId()).getTotalNoOfInstallments(), Short.valueOf("5")); }