Examples of TimeSlot


Examples of com.google.gwt.sample.dynatable.client.TimeSlot

      int dayOfWeek = 1 + rnd.nextInt(5); // Mon - Fri

      int absStartMins = 60 * startHrs + startMins; // convert to minutes
      int absStopMins = absStartMins + CLASS_LENGTH_MINS;

      timeSlots[i] = new TimeSlot(dayOfWeek, absStartMins, absStopMins);
    }

    Arrays.sort(timeSlots);

    for (int i = 0; i < howMany; ++i) {
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.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", System.currentTimeMillis() - start >= 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

        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

        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

    public void testTimeSlotCalculus() throws Exception {
        Throttler throttler = new Throttler(null, constant(3), 1000, null);
        // 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());
       
        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());
       
        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, 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
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.