Package com.vst.model

Examples of com.vst.model.ConstructionType


    public void setConstructionTypeDao(ConstructionTypeDao dao) {
        this.dao = dao;
    }

    public void testAddConstructionType() throws Exception {
        ConstructionType constructionType = new ConstructionType();

        // set required fields

        dao.saveConstructionType(constructionType);

        // verify a primary key was assigned
        assertNotNull(constructionType.getConstructionTypeId());

        // verify set fields are same after save
    }
View Full Code Here


        // verify set fields are same after save
    }

    public void testGetConstructionType() throws Exception {
        ConstructionType constructionType = dao.getConstructionType(constructionTypeId);
        assertNotNull(constructionType);
    }
View Full Code Here

        ConstructionType constructionType = dao.getConstructionType(constructionTypeId);
        assertNotNull(constructionType);
    }

    public void testGetConstructionTypes() throws Exception {
        ConstructionType constructionType = new ConstructionType();

        List results = dao.getConstructionTypes(constructionType);
        assertTrue(results.size() > 0);
    }
View Full Code Here

        List results = dao.getConstructionTypes(constructionType);
        assertTrue(results.size() > 0);
    }

    public void testSaveConstructionType() throws Exception {
        ConstructionType constructionType = dao.getConstructionType(constructionTypeId);

        // update required fields

        dao.saveConstructionType(constructionType);
View Full Code Here

        List constructionTypeList = defectType.getConstructionTypes();
        String joinConstructionQuery = "";
        String conditionConstructionQuery = "";
        for (int i = 0; i < constructionTypeList.size(); i++) {
            ConstructionType constructionType = (ConstructionType) constructionTypeList.get(i);
            joinConstructionQuery += " inner join fetch defectType.constructionTypes as constructionTypes" + i + " ";
            conditionConstructionQuery += " AND constructionTypes" + i + ".constructionTypeId=" + constructionType.getConstructionTypeId() + " ";
        }
        //System.out.println("from DefectType defectType " + joinMaterialQuery +joinVarityQuery+ joinConstructionQuery+" where defectType.defectTypeName=? AND defectType.defectTypeId<>?" + conditionMaterialQuery+conditionVarityQuery+conditionConstructionQuery);
        int count = super.getSession().createQuery("from DefectType defectType " + joinMaterialQuery +joinVarityQuery+ joinConstructionQuery+" where defectType.defectTypeName=? AND defectType.defectTypeId<>?" + conditionMaterialQuery+conditionVarityQuery+conditionConstructionQuery).setString(0, defectType.getDefectTypeName()).setString(1,String.valueOf(defectType.getDefectTypeId()) ).list().size();
        return count == 0;
    }
View Full Code Here

        constructionTypeManager = null;
    }

    public void testGetConstructionTypes() throws Exception {
        List results = new ArrayList();
        ConstructionType constructionType = new ConstructionType();
        results.add(constructionType);

        // set expected behavior on dao
        constructionTypeDao.expects(once()).method("getConstructionTypes")
            .will(returnValue(results));
View Full Code Here

    }

    public void testGetConstructionType() throws Exception {
        // set expected behavior on dao
        constructionTypeDao.expects(once()).method("getConstructionType")
            .will(returnValue(new ConstructionType()));
        ConstructionType constructionType = constructionTypeManager.getConstructionType(constructionTypeId);
        assertTrue(constructionType != null);
        constructionTypeDao.verify();
    }
View Full Code Here

        assertTrue(constructionType != null);
        constructionTypeDao.verify();
    }

    public void testSaveConstructionType() throws Exception {
        ConstructionType constructionType = new ConstructionType();

        // set expected behavior on dao
        constructionTypeDao.expects(once()).method("saveConstructionType")
            .with(same(constructionType)).isVoid();
View Full Code Here

        constructionTypeManager.saveConstructionType(constructionType);
        constructionTypeDao.verify();
    }

    public void testAddAndRemoveConstructionType() throws Exception {
        ConstructionType constructionType = new ConstructionType();

        // set required fields

        // set expected behavior on dao
        constructionTypeDao.expects(once()).method("saveConstructionType")
            .with(same(constructionType)).isVoid();
        constructionTypeManager.saveConstructionType(constructionType);
        constructionTypeDao.verify();

        // reset expectations
        constructionTypeDao.reset();

        constructionTypeDao.expects(once()).method("removeConstructionType").with(eq(new Long(constructionTypeId)));
        constructionTypeManager.removeConstructionType(constructionTypeId);
        constructionTypeDao.verify();

        // reset expectations
        constructionTypeDao.reset();
        // remove
        Exception ex = new ObjectRetrievalFailureException(ConstructionType.class, constructionType.getConstructionTypeId());
        constructionTypeDao.expects(once()).method("removeConstructionType").isVoid();
        constructionTypeDao.expects(once()).method("getConstructionType").will(throwException(ex));
        constructionTypeManager.removeConstructionType(constructionTypeId);
        try {
            constructionTypeManager.getConstructionType(constructionTypeId);
View Full Code Here

         //checking if all construction types were chosen
         if(!question.isForAllConstructions()){
         List constructionTypeList=question.getConstructionTypes();
         for (int i = 0; i < constructionTypeList.size(); i++) {
             ConstructionType constructionType = (ConstructionType) constructionTypeList.get(i);
             if(constructionType.getConstructionTypeId().equals(new Long(-1))){
                 errors.rejectValue("constructionTypes["+i+"]", "question.noConstructionType");
             }
         }
         }
View Full Code Here

TOP

Related Classes of com.vst.model.ConstructionType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.