Package com.vst.model

Examples of com.vst.model.DefectType


        DefectType defectType = dao.getDefectType(defectTypeId);
        assertNotNull(defectType);
    }

    public void testGetDefectTypes() throws Exception {
        DefectType defectType = new DefectType();

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


        List results = dao.getDefectTypes(defectType);
        assertTrue(results.size() > 0);
    }

    public void testSaveDefectType() throws Exception {
        DefectType defectType = dao.getDefectType(defectTypeId);

        // update required fields

        dao.saveDefectType(defectType);
View Full Code Here

          for (Object r : res){
            Object[] rescolumns = (Object[]) r;
            ConstructionDefect cd = new ConstructionDefect(
              (Integer) rescolumns[0], (String) rescolumns[1]);
            DefectType dt = new DefectType(
               (Integer) rescolumns[2], (String) rescolumns[3]);
            DefectVarity dv = new DefectVarity(
              (Integer) rescolumns[4], (String) rescolumns[5]);
            DefectZone dz = new DefectZone(
               (Integer) rescolumns[6], (String) rescolumns[7]);
View Full Code Here

    /**
     * @see com.vst.dao.DefectTypeDao#getDefectType(Integer defectTypeId)
     */
    public DefectType getDefectType(final Integer defectTypeId) {
        DefectType defectType = (DefectType) getObject(defectTypeId);
        return defectType;
    }
View Full Code Here

        defectTypeManager = null;
    }

    public void testGetDefectTypes() throws Exception {
        List results = new ArrayList();
        DefectType defectType = new DefectType();
        results.add(defectType);

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

    }

    public void testGetDefectType() throws Exception {
        // set expected behavior on dao
        defectTypeDao.expects(once()).method("getDefectType")
            .will(returnValue(new DefectType()));
        DefectType defectType = defectTypeManager.getDefectType(defectTypeId);
        assertTrue(defectType != null);
        defectTypeDao.verify();
    }
View Full Code Here

        assertTrue(defectType != null);
        defectTypeDao.verify();
    }

    public void testSaveDefectType() throws Exception {
        DefectType defectType = new DefectType();

        // set expected behavior on dao
        defectTypeDao.expects(once()).method("saveDefectType")
            .with(same(defectType)).isVoid();
View Full Code Here

        defectTypeManager.saveDefectType(defectType);
        defectTypeDao.verify();
    }

    public void testAddAndRemoveDefectType() throws Exception {
        DefectType defectType = new DefectType();

        // set required fields

        // set expected behavior on dao
        defectTypeDao.expects(once()).method("saveDefectType")
            .with(same(defectType)).isVoid();
        defectTypeManager.saveDefectType(defectType);
        defectTypeDao.verify();

        // reset expectations
        defectTypeDao.reset();

        defectTypeDao.expects(once()).method("removeDefectType").with(eq(new Long(defectTypeId)));
        defectTypeManager.removeDefectType(defectTypeId);
        defectTypeDao.verify();

        // reset expectations
        defectTypeDao.reset();
        // remove
        Exception ex = new ObjectRetrievalFailureException(DefectType.class, defectType.getDefectTypeId());
        defectTypeDao.expects(once()).method("removeDefectType").isVoid();
        defectTypeDao.expects(once()).method("getDefectType").will(throwException(ex));
        defectTypeManager.removeDefectType(defectTypeId);
        try {
            defectTypeManager.getDefectType(defectTypeId);
View Full Code Here

        return DefectType.class.isAssignableFrom(candidate);
    }

    public void validate(Object obj, Errors errors) {

        DefectType defectType = (DefectType) obj;

        //checking defect materials
        List materialList = defectType.getMaterials();
        for (int i = 0; i < materialList.size(); i++) {
            Material material = (Material) materialList.get(i);
            if (material.getMaterialId().equals(new Long(-1))) {
                errors.rejectValue("materials[" + i + "]", "defectType.noMaterial");
            }
        }

        //checking defect varities
        List varityList = defectType.getVarities();
        for (int i = 0; i < varityList.size(); i++) {
            DefectVarity defectVarity = (DefectVarity) varityList.get(i);
            if (defectVarity.getVarityId().equals(new Long(-1))) {
                errors.rejectValue("varities[" + i + "]", "defectType.noVarity");
            }
        }


                //checking defect varities
        List constructionTypeList = defectType.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 + "]", "defectType.noConstructionType");
            }
View Full Code Here

          for (Object r : res){
            Object[] rescolumns = (Object[]) r;
            ConstructionDefect cd = new ConstructionDefect(
              (Integer) rescolumns[0], (String) rescolumns[1]);
            DefectType dt = new DefectType(
               (Integer) rescolumns[2], (String) rescolumns[3]);
            DefectVarity dv = new DefectVarity(
              (Integer) rescolumns[4], (String) rescolumns[5]);
            DefectZone dz = new DefectZone(
               (Integer) rescolumns[6], (String) rescolumns[7]);
View Full Code Here

TOP

Related Classes of com.vst.model.DefectType

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.