congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
TimeRangeConstraint.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
co.cask.cdap.internal.app.runtime.schedule.constraint.TimeRangeConstraint
constructor

Best Java code snippets using co.cask.cdap.internal.app.runtime.schedule.constraint.TimeRangeConstraint.<init> (Showing top 8 results out of 315)

origin: co.cask.cdap/cdap-app-fabric

@Override
public ConstraintProgramScheduleBuilder withTimeWindow(String startTime, String endTime, TimeZone timeZone) {
 constraints.add(new TimeRangeConstraint(startTime, endTime, timeZone));
 return this;
}
origin: cdapio/cdap

@Override
public ConstraintProgramScheduleBuilder withTimeWindow(String startTime, String endTime, TimeZone timeZone) {
 constraints.add(new TimeRangeConstraint(startTime, endTime, timeZone));
 return this;
}
origin: cdapio/cdap

@Override
public ConstraintProgramScheduleBuilder withTimeWindow(String startTime, String endTime) {
 constraints.add(new TimeRangeConstraint(startTime, endTime, TimeZone.getDefault()));
 return this;
}
origin: co.cask.cdap/cdap-app-fabric

@Override
public ConstraintProgramScheduleBuilder withTimeWindow(String startTime, String endTime) {
 constraints.add(new TimeRangeConstraint(startTime, endTime, TimeZone.getDefault()));
 return this;
}
origin: cdapio/cdap

@Test
public void testInit() {
 TimeRangeConstraint timeRangeConstraint = new TimeRangeConstraint("16:00", "17:00", TimeZone.getTimeZone("PST"));
 Assert.assertEquals("PST", timeRangeConstraint.getTimeZone());
 // simple construction should work
 new TimeRangeConstraint("03:16", "03:17", TimeZone.getDefault());
 // leading zero shouldn't be necessary
 new TimeRangeConstraint("03:16", "3:17", TimeZone.getDefault());
 // start time can be a smaller numerical value than the end time
 new TimeRangeConstraint("22:30", "10:00", TimeZone.getDefault());
 // start time must not equal end time
 try {
  new TimeRangeConstraint("03:17", "03:17", TimeZone.getDefault());
  Assert.fail();
 } catch (IllegalArgumentException e) {
  // expected
 }
}
origin: cdapio/cdap

@Test
public void testConstraintCodec() {
 testSerDeser(new ProtoConstraint.ConcurrencyConstraint(3), new ConcurrencyConstraint(3));
 testSerDeser(new ProtoConstraint.DelayConstraint(300000L, TimeUnit.MILLISECONDS),
        new DelayConstraint(300000L, TimeUnit.MILLISECONDS));
 testSerDeser(new ProtoConstraint.LastRunConstraint(3600000L, TimeUnit.MILLISECONDS),
        new LastRunConstraint(3600000L, TimeUnit.MILLISECONDS));
 testSerDeser(new ProtoConstraint.TimeRangeConstraint("02:00", "06:00", TimeZone.getDefault()),
        new TimeRangeConstraint("02:00", "06:00", TimeZone.getDefault()));
}
origin: cdapio/cdap

@Test
public void testForwardRange() {
 // 3:24PM PST
 long now = 1494368640000L;
 SimpleJob job = new SimpleJob(SCHEDULE, now, Collections.<Notification>emptyList(), Job.State.PENDING_TRIGGER, 0L);
 // use a TimeRangeConstraint [4:00PM, 5:00PM)
 TimeRangeConstraint timeRangeConstraint = new TimeRangeConstraint("16:00", "17:00", TimeZone.getTimeZone("PST"));
 ConstraintContext constraintContext = createConstraintContext(job, now);
 ConstraintResult result = timeRangeConstraint.check(SCHEDULE, constraintContext);
 Assert.assertEquals(ConstraintResult.SatisfiedState.NOT_SATISFIED, result.getSatisfiedState());
 // 36 minutes till 4PM
 Assert.assertEquals(constraintContext.getCheckTimeMillis() + TimeUnit.MINUTES.toMillis(36),
           (long) result.getNextCheckTime());
 constraintContext = createConstraintContext(job, result.getNextCheckTime() - 1);
 result = timeRangeConstraint.check(SCHEDULE, constraintContext);
 Assert.assertEquals(ConstraintResult.SatisfiedState.NOT_SATISFIED, result.getSatisfiedState());
 Assert.assertEquals(constraintContext.getCheckTimeMillis() + 1L, (long) result.getNextCheckTime());
 result = timeRangeConstraint.check(SCHEDULE, createConstraintContext(job, now + TimeUnit.MINUTES.toMillis(36)));
 Assert.assertEquals(ConstraintResult.SATISFIED, result);
 // 5:00PM PST
 long fivePM = 1494374400000L;
 constraintContext = createConstraintContext(job, fivePM);
 result = timeRangeConstraint.check(SCHEDULE, constraintContext);
 Assert.assertEquals(ConstraintResult.SatisfiedState.NOT_SATISFIED, result.getSatisfiedState());
 // 23 hours until the next time its 4PM again
 Assert.assertEquals(constraintContext.getCheckTimeMillis() + TimeUnit.HOURS.toMillis(23),
           (long) result.getNextCheckTime());
}
origin: cdapio/cdap

TimeRangeConstraint timeRangeConstraint = new TimeRangeConstraint("22:00", "06:00", TimeZone.getTimeZone("PST"));
ConstraintContext constraintContext = createConstraintContext(job, now);
ConstraintResult result = timeRangeConstraint.check(SCHEDULE, constraintContext);
co.cask.cdap.internal.app.runtime.schedule.constraintTimeRangeConstraint<init>

Popular methods of TimeRangeConstraint

  • check
  • doValidate
  • getTimeZone
  • initialize

Popular in Java

  • Making http post requests using okhttp
  • getSystemService (Context)
  • runOnUiThread (Activity)
  • requestLocationUpdates (LocationManager)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now