Examples of UnitTypeDTO


Examples of org.libreplan.ws.unittypes.api.UnitTypeDTO

    @Transactional
    public void testAddUnitTypeRepeatedMeasure() {
        loadRequiredaData();

        /* Build material with same code (1 constraint violations). */
        UnitTypeDTO m1 = new UnitTypeDTO("CodeA", "measure1");
        UnitTypeDTO m2 = new UnitTypeDTO("CodeB", "measure1");
        UnitTypeDTO m3 = new UnitTypeDTO("measure1");

        List<UnitTypeDTO> unitTypeDTOs = new ArrayList<UnitTypeDTO>();
        unitTypeDTOs.add(m1);
        unitTypeDTOs.add(m2);
        unitTypeDTOs.add(m3);
View Full Code Here

Examples of org.libreplan.ws.unittypes.api.UnitTypeDTO

                return null;
            }
        });

        /* Build unittype (0 constraint violations). */
        UnitTypeDTO m1 = new UnitTypeDTO("XXX", "measureX");
        UnitTypeDTO m2 = new UnitTypeDTO("YYY", "measureY");

        List<UnitTypeDTO> unitTypeDTOs = new ArrayList<UnitTypeDTO>();
        unitTypeDTOs.add(m1);
        unitTypeDTOs.add(m2);

        UnitTypeListDTO unitTypeListDTO = createUnitTypeListDTO(m1, m2);

        List<InstanceConstraintViolationsDTO> instanceConstraintViolationsList = unitTypeService
                .addUnitTypes(unitTypeListDTO).instanceConstraintViolationsList;

        assertTrue(instanceConstraintViolationsList.toString(),
                instanceConstraintViolationsList.size() == 0);

        transactionService.runOnTransaction(new IOnTransaction<Void>() {
            @Override
            public Void execute() {
                try {
                    UnitType typeX = unitTypeDAO.findByCode("XXX");
                    assertTrue(typeX.getMeasure().equalsIgnoreCase("measureX"));
                    UnitType typeY = unitTypeDAO.findByCode("YYY");
                    assertTrue(typeY.getMeasure().equalsIgnoreCase("measureY"));
                    unitTypeDAO.flush();
                    sessionFactory.getCurrentSession().evict(typeX);
                    sessionFactory.getCurrentSession().evict(typeY);
                } catch (InstanceNotFoundException e) {
                    throw new RuntimeException(e);
                }
                return null;
            }
        });

        /* Update the measure unit type */
        m1 = new UnitTypeDTO("XXX", "update-measureX");
        m2 = new UnitTypeDTO("YYY", "update-measureY");

        unitTypeDTOs = new ArrayList<UnitTypeDTO>();
        unitTypeDTOs.add(m1);
        unitTypeDTOs.add(m2);

View Full Code Here

Examples of org.libreplan.ws.unittypes.api.UnitTypeDTO

    private UnitTypeConverter() {
    }

    public final static UnitTypeDTO toDTO(UnitType unitType) {
        return new UnitTypeDTO(unitType.getCode(), unitType.getMeasure());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.