Examples of CriterionWithItsType


Examples of org.libreplan.business.resources.entities.CriterionWithItsType

        Criterion other = CriterionDAOTest.createValidCriterion();
        CriterionTypeBase type = createTypeThatMatches(false, criterion);
        CriterionTypeBase otherType = createTypeThatMatches(false, other);
        Worker worker = Worker.create("firstName", "surName", "2333232");
        assertThat(worker.getSatisfactionsFor(criterion).size(), equalTo(0));
        worker.addSatisfaction(new CriterionWithItsType(type, criterion));
        assertTrue(criterion.isSatisfiedBy(worker));
        assertThat(worker.getSatisfactionsFor(criterion).size(), equalTo(1));
        worker.addSatisfaction(new CriterionWithItsType(otherType, other));
        assertTrue(other.isSatisfiedBy(worker));
        assertThat(worker.getSatisfactionsFor(other).size(), equalTo(1));
        assertThat(worker.getSatisfactionsFor(criterion).size(), equalTo(1));
    }
View Full Code Here

Examples of org.libreplan.business.resources.entities.CriterionWithItsType

    @Transactional
    public void testRetrieveActiveCriterionsForCriterionType() {
        final Criterion criterion = CriterionDAOTest.createValidCriterion();
        Criterion otherCriterion = CriterionDAOTest.createValidCriterion();
        ICriterionType<Criterion> criterionType = createTypeThatMatches(criterion);
        CriterionWithItsType criterionWithItsType = new CriterionWithItsType(
                criterionType, criterion);
        CriterionWithItsType otherCriterionWithItsType = new CriterionWithItsType(
                createTypeThatMatches(otherCriterion), otherCriterion);
        Worker worker = Worker.create("firstName", "surName", "2333232");
        worker.addSatisfaction(criterionWithItsType, Interval
                .range(year(2000),year(3000)));
        worker.addSatisfaction(otherCriterionWithItsType, Interval
View Full Code Here

Examples of org.libreplan.business.resources.entities.CriterionWithItsType

    public void testActiveCriterions() {
        final Criterion criterion = CriterionDAOTest.createValidCriterion();
        Criterion otherCriterion = CriterionDAOTest.createValidCriterion();
        ICriterionType<Criterion> type = createTypeThatMatches(criterion,
                otherCriterion);
        CriterionWithItsType criterionWithItsType = new CriterionWithItsType(
                type, criterion);
        CriterionWithItsType otherCriterionWithItsType = new CriterionWithItsType(
                type, otherCriterion);
        Worker worker = Worker.create("firstName", "surName", "2333232");
        assertThat(worker.getCurrentCriterionsFor(type).size(), equalTo(0));
        worker.addSatisfaction(criterionWithItsType, Interval
                .range(year(2000),year(2020)));
View Full Code Here

Examples of org.libreplan.business.resources.entities.CriterionWithItsType

    @Transactional
    public void testRetrieveSatisfactionsInIntervalForCriterionType()
            {
        Criterion criterion = CriterionDAOTest.createValidCriterion();
        ICriterionType<Criterion> criterionType = createTypeThatMatches(criterion);
        CriterionWithItsType criterionWithItsType = new CriterionWithItsType(
                criterionType, criterion);
        Criterion otherCriterion = CriterionDAOTest.createValidCriterion();
        CriterionWithItsType otherCriterionWithItsType = new CriterionWithItsType(
                createTypeThatMatches(otherCriterion), otherCriterion);

        Worker worker = Worker.create("firstName", "surName", "2333232");
        worker.addSatisfaction(criterionWithItsType, Interval
                .range(year(2000),year(2002)));
View Full Code Here

Examples of org.libreplan.business.resources.entities.CriterionWithItsType

    @Transactional
    public void invalidadCriterionWithItsTypeNotAllowd() {
        Criterion criterion = CriterionDAOTest.createValidCriterion();
        Criterion otherCriterion = CriterionDAOTest.createValidCriterion();
        ICriterionType<Criterion> criterionType = createTypeThatMatches(criterion);
        new CriterionWithItsType(criterionType, otherCriterion);
    }
View Full Code Here

Examples of org.libreplan.business.resources.entities.CriterionWithItsType

                criterion, otherCriterion);
        assertThat(worker.getCurrentSatisfactionsFor(criterion).size(),
                equalTo(0));
        assertFalse(criterion.isSatisfiedBy(worker));
        Interval fromNow = Interval.from(new LocalDate());
        assertTrue(worker.canAddSatisfaction(new CriterionWithItsType(
                criterionType, criterion), fromNow));
        worker.addSatisfaction(new CriterionWithItsType(criterionType,
                criterion), fromNow);
        assertTrue(criterion.isSatisfiedBy(worker));
        assertThat(worker.getCurrentSatisfactionsFor(criterion).size(),
                equalTo(1));
        assertFalse(worker.canAddSatisfaction(new CriterionWithItsType(
                criterionType, otherCriterion), fromNow));
        try {
            worker.addSatisfaction(new CriterionWithItsType(criterionType,
                    otherCriterion));
            fail("must send exception since it already is activated for a criterion of the same type and the type doesn't allow repeated criterions per resource");
        } catch (IllegalStateException e) {
            // ok
        }
        assertThat(worker.query().from(criterionType).enforcedInAll(fromNow)
                .result().size(), equalTo(1));
        List<CriterionSatisfaction> finished = worker.finishEnforcedAt(
                criterion, fromNow.getStart());
        assertThat(finished.size(), equalTo(1));
        assertTrue("all satisfactions are finished", worker.query().from(
                criterionType).enforcedInAll(fromNow).result().isEmpty());
        assertTrue(worker.canAddSatisfaction(new CriterionWithItsType(
                criterionType, criterion), fromNow));
    }
View Full Code Here

Examples of org.libreplan.business.resources.entities.CriterionWithItsType

        Criterion criterion = CriterionDAOTest.createValidCriterion();
        Criterion otherCriterion = CriterionDAOTest.createValidCriterion();
        Worker worker = Worker.create("firstName", "surName", "2333232");
        ICriterionType<Criterion> criterionType = createTypeThatMatches(false,
                criterion, otherCriterion);
        worker.addSatisfaction(new CriterionWithItsType(criterionType,
                criterion), Interval.range(year(5000), year(6000)));
        worker.addSatisfaction(new CriterionWithItsType(criterionType,
                criterion), Interval.range(year(4000),year(5000)));

        assertThat(worker.query().from(criterion).enforcedInAll(
                Interval.range(year(4001), year(4999))).result().size(),
                equalTo(1));
        assertThat(worker.query().from(criterion).enforcedInAll(
                Interval.range(year(4001), year(5000))).result().size(),
                equalTo(0));
        assertThat(worker.query().from(criterion).enforcedInAll(
                Interval.range(year(5000), year(5001))).result().size(),
                equalTo(1));
        assertThat(worker.query().from(criterion).enforcedInAll(
                Interval.range(year(5001), year(5500))).result().size(),
                equalTo(1));

        worker.finish(new CriterionWithItsType(criterionType, criterion));

        assertThat(worker.query().from(criterion).enforcedInAll(
                Interval.range(year(4001), year(4999))).result().size(),
                equalTo(1));
        assertThat(worker.query().from(criterion).enforcedInAll(
                Interval.range(year(5001), year(5500))).result().size(),
                equalTo(1));

        assertFalse(worker.canAddSatisfaction(new CriterionWithItsType(
                criterionType, otherCriterion), Interval
                .from(CriterionSatisfactionDAOTest.year(4001))));
    }
View Full Code Here

Examples of org.libreplan.business.resources.entities.CriterionWithItsType

        Criterion criterion = CriterionDAOTest.createValidCriterion();
        Criterion otherCriterion = CriterionDAOTest.createValidCriterion();
        Worker worker = Worker.create("firstName", "surName", "2333232");
        ICriterionType<Criterion> criterionType = createTypeThatMatches(false,
                criterion, otherCriterion);
        worker.addSatisfaction(new CriterionWithItsType(criterionType,
                criterion), Interval.from(year(4000)));
        worker.addSatisfaction(new CriterionWithItsType(criterionType,
                otherCriterion), Interval.range(year(3500),year(4000)));
        assertThat(worker.getSatisfactionsFor(otherCriterion).size(),
                equalTo(1));
        CriterionSatisfaction satisfaction = worker.getSatisfactionsFor(
                otherCriterion).iterator().next();
View Full Code Here

Examples of org.libreplan.business.resources.entities.CriterionWithItsType

        Criterion criterion = CriterionDAOTest.createValidCriterion();
        Criterion otherCriterion = CriterionDAOTest.createValidCriterion();
        Worker worker = Worker.create("firstName", "surName", "2333232");
        ICriterionType<Criterion> criterionType = createTypeThatMatches(false,
                criterion, otherCriterion);
        worker.addSatisfaction(new CriterionWithItsType(criterionType,
                otherCriterion), Interval.from(year(3500)));
        assertFalse(worker.canAddSatisfaction(new CriterionWithItsType(
                criterionType, criterion), Interval.range(year(4000),
                year(5000))));
        worker.addSatisfaction(new CriterionWithItsType(criterionType,
                criterion), Interval.range(year(4000), year(5000)));
    }
View Full Code Here

Examples of org.libreplan.business.resources.entities.CriterionWithItsType

        Criterion criterion = CriterionDAOTest.createValidCriterion();
        Criterion otherCriterion = CriterionDAOTest.createValidCriterion();
        Worker worker = Worker.create("firstName", "surName", "2333232");
        ICriterionType<Criterion> criterionType = createTypeThatMatches(false,
                criterion, otherCriterion);
        worker.addSatisfaction(new CriterionWithItsType(criterionType,
                otherCriterion), Interval.range(year(3500), year(4500)));
        assertFalse(worker.canAddSatisfaction(new CriterionWithItsType(
                criterionType, criterion), Interval.range(year(3600),
                year(3800))));
        worker.addSatisfaction(new CriterionWithItsType(criterionType,
                criterion), Interval.range(year(3600), year(3800)));
    }
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.