Exemplo n.º 1
0
  public void testUpdate() throws Exception {
    fund = createFund("Fund-1");
    StaticHibernateUtil.closeSession();
    fund = (FundBO) TestObjectFactory.getObject(FundBO.class, fund.getFundId());
    setRequestPathInfo("/fundAction.do");
    addRequestParameter("method", Methods.manage.toString());
    addRequestParameter("fundCodeId", fund.getFundId().toString());
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();

    setRequestPathInfo("/fundAction.do");
    addRequestParameter("method", Methods.previewManage.toString());
    addRequestParameter("fundName", "Fund-2");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();

    setRequestPathInfo("/fundAction.do");
    addRequestParameter("method", Methods.update.toString());
    addRequestParameter("fundName", "Fund-2");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyForward(ActionForwards.update_success.toString());
    Assert.assertNull(
        ((FlowManager) request.getSession().getAttribute(Constants.FLOWMANAGER)).getFlow(flowKey));
    StaticHibernateUtil.closeSession();
    fund = (FundBO) TestObjectFactory.getObject(FundBO.class, fund.getFundId());
    Assert.assertNotNull(fund);
    Assert.assertEquals("Fund-2", fund.getFundName());
  }
Exemplo n.º 2
0
  public void testUpdateForDuplicateFundName() throws Exception {
    fund = createFund("Fund-1");
    fundBO = createFund("Fund-2");
    StaticHibernateUtil.closeSession();
    fund = (FundBO) TestObjectFactory.getObject(FundBO.class, fund.getFundId());
    setRequestPathInfo("/fundAction.do");
    addRequestParameter("method", Methods.manage.toString());
    addRequestParameter("fundCodeId", fund.getFundId().toString());
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();

    setRequestPathInfo("/fundAction.do");
    addRequestParameter("method", Methods.previewManage.toString());
    addRequestParameter("fundName", "Fund-1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();

    setRequestPathInfo("/fundAction.do");
    addRequestParameter("method", Methods.update.toString());
    addRequestParameter("fundName", fundBO.getFundName());
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyActionErrors(new String[] {FundConstants.DUPLICATE_FUNDNAME_EXCEPTION});
    verifyForward(ActionForwards.update_failure.toString());
  }
Exemplo n.º 3
0
 private void reloadMembers() {
   if (fund != null) {
     fund = (FundBO) StaticHibernateUtil.getSessionTL().get(FundBO.class, fund.getFundId());
   }
   if (fundBO != null) {
     fundBO = (FundBO) StaticHibernateUtil.getSessionTL().get(FundBO.class, fundBO.getFundId());
   }
 }
Exemplo n.º 4
0
 public void testManage() throws Exception {
   fund = createFund("Fund-1");
   StaticHibernateUtil.closeSession();
   fund = (FundBO) TestObjectFactory.getObject(FundBO.class, fund.getFundId());
   setRequestPathInfo("/fundAction.do");
   addRequestParameter("method", Methods.manage.toString());
   addRequestParameter("fundCodeId", fund.getFundId().toString());
   addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
   actionPerform();
   verifyNoActionErrors();
   verifyForward(ActionForwards.manage_success.toString());
   StaticHibernateUtil.closeSession();
   fund = (FundBO) TestObjectFactory.getObject(FundBO.class, fund.getFundId());
   Assert.assertNotNull(fund);
   Assert.assertEquals("Fund-1", fund.getFundName());
   Assert.assertEquals("Fund-1", SessionUtils.getAttribute(FundConstants.OLDFUNDNAME, request));
 }
Exemplo n.º 5
0
 public void testViewAllFunds() throws Exception {
   fund = createFund("Fund-1");
   StaticHibernateUtil.closeSession();
   fund = (FundBO) TestObjectFactory.getObject(FundBO.class, fund.getFundId());
   setRequestPathInfo("/fundAction.do");
   addRequestParameter("method", Methods.viewAllFunds.toString());
   actionPerform();
   verifyNoActionErrors();
   verifyForward(ActionForwards.viewAllFunds_success.toString());
   List<FundBO> fundList =
       (List<FundBO>) SessionUtils.getAttribute(FundConstants.FUNDLIST, request);
   Assert.assertEquals("The size of master data for funds should be 6", 6, fundList.size());
 }