Package org.apache.ivory.entity.v0.process

Examples of org.apache.ivory.entity.v0.process.Retry


    @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

        String coordName = EntityUtil.getWorkflowName(Tag.RETENTION, feed).toString();
        retentionApp.setName(coordName);
        retentionApp.setEnd(SchemaHelper.formatDateUTC(feedCluster.getValidity().getEnd()));
        retentionApp.setStart(SchemaHelper.formatDateUTC(new Date()));
        retentionApp.setTimezone(feed.getTimezone().getID());
        TimeUnit timeUnit = feed.getFrequency().getTimeUnit();
        if (timeUnit == TimeUnit.hours || timeUnit == TimeUnit.minutes) {
            retentionApp.setFrequency("${coord:hours(6)}");
        } else {
            retentionApp.setFrequency("${coord:days(1)}");
        }
View Full Code Here

    public FileSystem getFileSystem() throws IOException {
        return FileSystem.get(conf);
    }

    private void buildClusterObject(String name) {
        clusterEntity = new Cluster();
        clusterEntity.setName(name);
        clusterEntity.setColo("local");
        clusterEntity.setDescription("Embeded cluster: " + name);

        Interfaces interfaces = new Interfaces();
View Full Code Here

        Assert.assertEquals(FeedHelper.normalizePartitionExpression(null, null), "");
    }
   
    @Test
    public void testEvaluateExpression() throws Exception {
        Cluster cluster = new Cluster();
        cluster.setName("name");
        cluster.setColo("colo");
        cluster.setProperties(new Properties());
        Property prop = new Property();
        prop.setName("pname");
        prop.setValue("pvalue");
        cluster.getProperties().getProperties().add(prop);
       
        Assert.assertEquals(FeedHelper.evaluateClusterExp(cluster, "${cluster.colo}/*/US"), "colo/*/US");
        Assert.assertEquals(FeedHelper.evaluateClusterExp(cluster, "${cluster.name}/*/${cluster.pname}"), "name/*/pvalue");
        Assert.assertEquals(FeedHelper.evaluateClusterExp(cluster, "IN"), "IN");
    }
View Full Code Here

    @Test
    public void testOnAdd() throws Exception {

        Process process = new Process();
        process.setName("p1");
        Cluster cluster = new Cluster();
        cluster.setName("c1");
        cluster.setColo("1");
        Feed f1 = addInput(process, "f1", cluster);
        Feed f2 = addInput(process, "f2", cluster);
        Feed f3 = addOutput(process, "f3", cluster);
        Feed f4 = addOutput(process, "f4", cluster);
        org.apache.ivory.entity.v0.process.Cluster processCluster = new org.apache.ivory.entity.v0.process.Cluster();
View Full Code Here

    @Test
    public void testOnRemove() throws Exception {
        Process process = new Process();
        process.setName("rp1");
        Cluster cluster = new Cluster();
        cluster.setName("rc1");
        cluster.setColo("2");
        org.apache.ivory.entity.v0.process.Cluster processCluster = new org.apache.ivory.entity.v0.process.Cluster();
        processCluster.setName("rc1");
        process.setClusters(new org.apache.ivory.entity.v0.process.Clusters());
        process.getClusters().getClusters().add(processCluster);
View Full Code Here

TOP

Related Classes of org.apache.ivory.entity.v0.process.Retry

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.