Codota Logo
TimeRangeConstraint.<init>
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
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 requests using okhttp
  • scheduleAtFixedRate (Timer)
  • requestLocationUpdates (LocationManager)
  • onRequestPermissionsResult (Fragment)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Path (java.nio.file)
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
  • SortedSet (java.util)
    A Set that further provides a total ordering on its elements. The elements are ordered using their C
  • Vector (java.util)
    The Vector class implements a growable array of objects. Like an array, it contains components that
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now