Examples of TimeSlot


Examples of org.apache.camel.processor.Throttler.TimeSlot

    public void testTimeSlotCalculusForPeriod() throws InterruptedException {
        Throttler throttler = new Throttler(context, null, constant(3), 1000, null, false, false);
        throttler.calculateDelay(new DefaultExchange(context));

        TimeSlot slot = throttler.getSlot();
        assertNotNull(slot);
        assertSame(slot, throttler.nextSlot());

        // we've only used up two of three slots, but now we introduce a time delay
        // so to make the slot not valid anymore
        Thread.sleep((long) (1.5 * 1000));
        assertFalse(slot.isActive());
        assertNotSame(slot, throttler.nextSlot());
    }
View Full Code Here

Examples of org.apache.camel.processor.Throttler.TimeSlot

        assertTrue("Should take at least " + minimumTime + "ms", System.currentTimeMillis() - start >= minimumTime);
    }
   
    public void testTimeSlotCalculus() throws Exception {
        Throttler throttler = new Throttler(null, 2, 1000);
        TimeSlot slot = throttler.nextSlot();
        // start a new time slot
        assertNotNull(slot);
        // make sure the same slot is used (2 exchanges per slot)
        assertSame(slot, throttler.nextSlot());
        assertTrue(slot.isFull());
       
        TimeSlot next = throttler.nextSlot();
        // now we should have a new slot that starts somewhere in the future
        assertNotSame(slot, next);
        assertFalse(next.isActive());
    }
View Full Code Here

Examples of org.apache.camel.processor.Throttler.TimeSlot

        assertTrue("Should take at least " + minimumTime + "ms, was: " + delta, delta >= minimumTime);
    }

    public void testTimeSlotCalculus() throws Exception {
        Throttler throttler = new Throttler(null, 2, 1000, null);
        TimeSlot slot = throttler.nextSlot();
        // start a new time slot
        assertNotNull(slot);
        // make sure the same slot is used (2 exchanges per slot)
        assertSame(slot, throttler.nextSlot());
        assertTrue(slot.isFull());
       
        TimeSlot next = throttler.nextSlot();
        // now we should have a new slot that starts somewhere in the future
        assertNotSame(slot, next);
        assertFalse(next.isActive());
    }
View Full Code Here

Examples of org.apache.camel.processor.Throttler.TimeSlot

    public void testTimeSlotCalculus() throws Exception {
        Throttler throttler = new Throttler(context, null, constant(3), 1000, null, false);
        // calculate will assign a new slot
        throttler.calculateDelay(new DefaultExchange(context));
        TimeSlot slot = throttler.nextSlot();
        // start a new time slot
        assertNotNull(slot);
        // make sure the same slot is used (3 exchanges per slot)
        assertSame(slot, throttler.nextSlot());
        assertTrue(slot.isFull());
        assertTrue(slot.isActive());
       
        TimeSlot next = throttler.nextSlot();
        // now we should have a new slot that starts somewhere in the future
        assertNotSame(slot, next);
        assertFalse(next.isActive());
    }
View Full Code Here

Examples of org.apache.camel.processor.Throttler.TimeSlot

    public void testTimeSlotCalculusForPeriod() throws InterruptedException {
        Throttler throttler = new Throttler(context, null, constant(3), 1000, null, false);
        throttler.calculateDelay(new DefaultExchange(context));

        TimeSlot slot = throttler.getSlot();
        assertNotNull(slot);
        assertSame(slot, throttler.nextSlot());

        // we've only used up two of three slots, but now we introduce a time delay
        // so to make the slot not valid anymore
        Thread.sleep((long) (1.5 * 1000));
        assertFalse(slot.isActive());
        assertNotSame(slot, throttler.nextSlot());
    }
View Full Code Here

Examples of org.drools.planner.examples.curriculumcourse.domain.Timeslot

                dayList.add(day);
            }
            schedule.setDayList(dayList);
            List<Timeslot> timeslotList = new ArrayList<Timeslot>(timeslotListSize);
            for (int i = 0; i < timeslotListSize; i++) {
                Timeslot timeslot = new Timeslot();
                timeslot.setId((long) i);
                timeslot.setTimeslotIndex(i);
                timeslotList.add(timeslot);
            }
            schedule.setTimeslotList(timeslotList);
            List<Period> periodList = new ArrayList<Period>(periodListSize);
            for (int i = 0; i < dayListSize; i++) {
View Full Code Here

Examples of org.drools.planner.examples.curriculumcourse.domain.Timeslot

                dayList.add(day);
            }
            schedule.setDayList(dayList);
            List<Timeslot> timeslotList = new ArrayList<Timeslot>(timeslotListSize);
            for (int i = 0; i < timeslotListSize; i++) {
                Timeslot timeslot = new Timeslot();
                timeslot.setId((long) i);
                timeslot.setTimeslotIndex(i);
                timeslotList.add(timeslot);
            }
            schedule.setTimeslotList(timeslotList);
            List<Period> periodList = new ArrayList<Period>(periodListSize);
            for (int i = 0; i < dayListSize; i++) {
View Full Code Here

Examples of org.drools.planner.examples.curriculumcourse.domain.Timeslot

                dayList.add(day);
            }
            schedule.setDayList(dayList);
            List<Timeslot> timeslotList = new ArrayList<Timeslot>(timeslotListSize);
            for (int i = 0; i < timeslotListSize; i++) {
                Timeslot timeslot = new Timeslot();
                timeslot.setId((long) i);
                timeslot.setTimeslotIndex(i);
                timeslotList.add(timeslot);
            }
            schedule.setTimeslotList(timeslotList);
            List<Period> periodList = new ArrayList<Period>(periodListSize);
            for (int i = 0; i < dayListSize; i++) {
View Full Code Here

Examples of org.optaplanner.examples.curriculumcourse.domain.Timeslot

                dayList.add(day);
            }
            schedule.setDayList(dayList);
            List<Timeslot> timeslotList = new ArrayList<Timeslot>(timeslotListSize);
            for (int i = 0; i < timeslotListSize; i++) {
                Timeslot timeslot = new Timeslot();
                timeslot.setId((long) i);
                timeslot.setTimeslotIndex(i);
                timeslotList.add(timeslot);
            }
            schedule.setTimeslotList(timeslotList);
            List<Period> periodList = new ArrayList<Period>(periodListSize);
            for (int i = 0; i < dayListSize; i++) {
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.