Package com.peusoft.ptcollect.core.util

Examples of com.peusoft.ptcollect.core.util.DayPeriod


    public static final String NAME = "Project1";
    public static final String NUMBER = "0001";
    public static final ProjectState PROJECT_STATE = ProjectState.OPENED;

    public static Project getProject() {
        DayPeriod dp = new DayPeriod();
        dp.setBegin(BEGIN);
        dp.setEnd(END);
        Project project = new Project();
        project.setProjectPeriod(dp);
        project.setBudget(BUDGET);
        project.setDescription(DESCRIPTION);
        project.setProjectName(NAME);
View Full Code Here


        UserProjectActivityPrice price1 = new UserProjectActivityPrice();
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.YEAR, 2006);
        cal.set(Calendar.MONTH, Calendar.JANUARY);
        cal.set(Calendar.DAY_OF_MONTH, 1);
        DayPeriod p = new DayPeriod();
        p.setBegin(cal.getTime());
        cal.set(Calendar.YEAR, 2007);
        cal.set(Calendar.MONTH, Calendar.DECEMBER);
        cal.set(Calendar.DAY_OF_MONTH, 31);
        p.setEnd(cal.getTime());
        price1.setPeriod(p);
        price1.setPrice(PRICE1);
        price1.setUserProjectActivity(userProjectActivity);

        UserProjectActivityPrice price2 = new UserProjectActivityPrice();
        cal = Calendar.getInstance();
        cal.set(Calendar.YEAR, 2008);
        cal.set(Calendar.MONTH, Calendar.JANUARY);
        cal.set(Calendar.DAY_OF_MONTH, 1);
        p = new DayPeriod();
        p.setBegin(cal.getTime());
        cal.set(Calendar.YEAR, 2009);
        cal.set(Calendar.MONTH, Calendar.DECEMBER);
        cal.set(Calendar.DAY_OF_MONTH, 31);
        p.setEnd(cal.getTime());
        price2.setPeriod(p);
        price2.setPrice(PRICE2);
        price2.setUserProjectActivity(userProjectActivity);

        UserProjectActivityPrice price3 = new UserProjectActivityPrice();
        cal = Calendar.getInstance();
        cal.set(Calendar.YEAR, 2010);
        cal.set(Calendar.MONTH, Calendar.JANUARY);
        cal.set(Calendar.DAY_OF_MONTH, 1);
        p = new DayPeriod();
        p.setBegin(cal.getTime());
        cal.set(Calendar.YEAR, 2011);
        cal.set(Calendar.MONTH, Calendar.DECEMBER);
        cal.set(Calendar.DAY_OF_MONTH, 31);
        p.setEnd(cal.getTime());
        price3.setPeriod(p);
        price3.setPrice(PRICE3);
        price3.setUserProjectActivity(userProjectActivity);

        prices.add(price1);
View Full Code Here

    @Before
    @Override
    public void setUp() throws Exception {
        super.setUp();
        vat = new Vat();
        vat.setVatPeriod(new DayPeriod());
    }
View Full Code Here

        Calendar begin = Calendar.getInstance();
        begin.set(2005, 5, 1);
        Calendar end = Calendar.getInstance();
        end.set(2006, 7, 12);
        DayPeriod period = new DayPeriod();
        period.setBegin(begin.getTime());
        period.setEnd(end.getTime());
        BigDecimal val = new BigDecimal("16");

        Vat vat1 = new Vat();
        vat1.setVatPeriod(period);
        vat1.setVat(val);

        assertEquals("Wrong vat: ", val, vat1.getVat());
        assertEquals("Wrong begin: ", begin.getTime(), vat1.getBegin());
        assertEquals("Wrong end: ", end.getTime(), vat1.getEnd());
        assertEquals("Wrong period: ", period, vat1.getVatPeriod());
        assertEquals("Wrong logical key size: ", 1, vat1.getLogicalKey().length);
        assertEquals("Wrong logical key: ", period, vat1.getLogicalKey()[0]);

        begin.set(2006, 7, 13);
        end.set(2009, 8, 11);
        period = new DayPeriod();
        period.setBegin(begin.getTime());
        period.setEnd(end.getTime());
        val = new BigDecimal("19");

        Vat vat2 = new Vat();
        vat2.setVatPeriod(period);
        vat2.setVat(val);

        assertFalse(vat1 + " is not equal to " + vat2, vat1.equals(vat2));

        begin.set(2005, 5, 1);
        end.set(2006, 7, 12);
        period = new DayPeriod();
        period.setBegin(begin.getTime());
        period.setEnd(end.getTime());
        val = new BigDecimal("16");

        vat2.setVatPeriod(period);
        vat2.setVat(val);
View Full Code Here

        Calendar begin = Calendar.getInstance();
        begin.set(2005, 5, 1);
        Calendar end = Calendar.getInstance();
        end.set(2006, 7, 12);

        DayPeriod period = new DayPeriod();
        period.setBegin(begin.getTime());
        period.setEnd(end.getTime());

        Vat vat1 = new Vat();
        vat1.setVatPeriod(period);
        vat1.setVat(new BigDecimal("16"));

        em.persist(vat1);

        List<Vat> res = em.createQuery("select v from Vat v").getResultList();
        assertEquals("wrong number of VATs", 1, res.size());
        assertEquals("VAT is not equal", vat1.getId(), res.get(0).getId());
        assertEquals("VAT is not equal", vat1, res.get(0));

        begin.set(2006, 7, 13);
        end.set(2009, 8, 11);

        period = new DayPeriod();
        period.setBegin(begin.getTime());
        period.setEnd(end.getTime());

        Vat vat2 = new Vat();
        vat2.setVatPeriod(period);
        vat2.setVat(new BigDecimal("19"));
View Full Code Here

TOP

Related Classes of com.peusoft.ptcollect.core.util.DayPeriod

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.