Package net.java.quickcheck.generator.support

Examples of net.java.quickcheck.generator.support.DefaultFrequencyGenerator$Frequency


    @Test
    public void testGetInstanceSequence2() throws Exception {
        Date instance = getDate("2012-05-22 12:41 UTC");
        Date start = getDate("2012-05-14 07:40 UTC");

        Frequency frequency = Frequency.fromString("hours(1)");
        Assert.assertEquals(199, EntityUtil.getInstanceSequence(start,
                frequency, tz, instance));
    }
View Full Code Here


    @Test
    public void testGetInstanceSequence3() throws Exception {
        Date instance = getDate("2010-01-02 01:01 UTC");
        Date start = getDate("2010-01-02 01:00 UTC");

        Frequency frequency = Frequency.fromString("minutes(1)");
        Assert.assertEquals(2, EntityUtil.getInstanceSequence(start,
                frequency, tz, instance));
    }
View Full Code Here

    @Test
    public void testGetInstanceSequence4() throws Exception {
        Date instance = getDate("2010-01-01 01:03 UTC");
        Date start = getDate("2010-01-01 01:01 UTC");

        Frequency frequency = Frequency.fromString("minutes(2)");
        Assert.assertEquals(2, EntityUtil.getInstanceSequence(start,
                frequency, tz, instance));
    }
View Full Code Here

    @Test
    public void testGetInstanceSequence5() throws Exception {
        Date instance = getDate("2010-01-01 02:01 UTC");
        Date start = getDate("2010-01-01 01:01 UTC");

        Frequency frequency = Frequency.fromString("hours(1)");
        Assert.assertEquals(2, EntityUtil.getInstanceSequence(start,
                frequency, tz, instance));
    }
View Full Code Here

    @Test
    public void testGetInstanceSequence6() throws Exception {
        Date instance = getDate("2010-01-01 01:04 UTC");
        Date start = getDate("2010-01-01 01:01 UTC");

        Frequency frequency = Frequency.fromString("minutes(3)");
        Assert.assertEquals(2, EntityUtil.getInstanceSequence(start,
                frequency, tz, instance));
    }
View Full Code Here

    @Test
    public void testGetInstanceSequence7() throws Exception {
        Date instance = getDate("2010-01-01 01:03 UTC");
        Date start = getDate("2010-01-01 01:01 UTC");

        Frequency frequency = Frequency.fromString("minutes(1)");
        Assert.assertEquals(3, EntityUtil.getInstanceSequence(start,
                frequency, tz, instance));
    }
View Full Code Here

        // TODO Auto-generated method stub
        return 0;
      }
    };

    Frequency frequency = new Frequency("minutes(1)");
    Assert.assertEquals(policy.getDurationInMilliSec(frequency), 60000);
    frequency = new Frequency("minutes(15)");
    Assert.assertEquals(policy.getDurationInMilliSec(frequency), 900000);
    frequency = new Frequency("hours(2)");
    Assert.assertEquals(policy.getDurationInMilliSec(frequency), 7200000);
  }
View Full Code Here

  }

  @Test
  public void TestExpBackoffPolicy() throws IvoryException {
    AbstractRerunPolicy backoff = new ExpBackoffPolicy();
    long delay = backoff.getDelay(new Frequency("minutes(2)"), 2);
    Assert.assertEquals(delay, 480000);

    long currentTime = System.currentTimeMillis();
    delay = backoff.getDelay(new Frequency("minutes(2)"), new Date(
        currentTime - 1 * 4 * 60 * 1000), new Date(currentTime + 1 * 60
        * 60 * 1000));
    Assert.assertEquals(delay, 1 * 6 * 60 * 1000);
   
    currentTime = System.currentTimeMillis();
    delay = backoff.getDelay(new Frequency("minutes(1)"), new Date(
        currentTime - 1 * 9 * 60 * 1000), new Date(currentTime + 1 * 60
        * 60 * 1000));
    Assert.assertEquals(delay, 900000);
  }
View Full Code Here

  }

  @Test
  public void TestPeriodicPolicy() throws IvoryException, InterruptedException {
    AbstractRerunPolicy periodic = new PeriodicPolicy();
    long delay = periodic.getDelay(new Frequency("minutes(2)"), 2);
    Assert.assertEquals(delay, 120000);
    delay = periodic.getDelay(new Frequency("minutes(2)"), 5);
    Assert.assertEquals(delay, 120000);

    long currentTime = System.currentTimeMillis();
    //Thread.sleep(1000);
    delay = periodic.getDelay(new Frequency("minutes(3)"), new Date(
        currentTime), new Date(currentTime + 1 * 60
        * 60 * 1000));
    Assert.assertEquals(delay, 180000);
  }
View Full Code Here

     
            replicationCoord.getControls().setTimeout(String.valueOf(timeout_ms / (1000 * 60)));
            replicationCoord.getControls().setThrottle(String.valueOf(timeout_ms / frequency_ms * 2));
            replicationCoord.getControls().setConcurrency(String.valueOf(parallel));
           
      Frequency replicationDelay = FeedHelper.getCluster(feed,
          srcCluster.getName()).getDelay();
      long delay_ms=0;
      if (replicationDelay != null) {
        delay_ms = ExpressionHelper.get().evaluate(
            replicationDelay.toString(), Long.class);
        long delay_mins = -1 * delay_ms / (1000 * 60);
        String elExp = "${now(0," + delay_mins + ")}";
        replicationCoord.getInputEvents().getDataIn().get(0)
            .getInstance().set(0, elExp);
        replicationCoord.getOutputEvents().getDataOut().get(0)
View Full Code Here

TOP

Related Classes of net.java.quickcheck.generator.support.DefaultFrequencyGenerator$Frequency

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.