Package org.threeten.bp

Examples of org.threeten.bp.Instant.plusSeconds()


  public void testShortSequence() {
    final ViewProcessWorkerFactoryMock underlying = new ViewProcessWorkerFactoryMock();
    final SequencePartitioningViewProcessWorkerFactory test = createFactory(underlying);
    final Instant t = Instant.now();
    final ViewCycleExecutionSequence sequence = ArbitraryViewCycleExecutionSequence.of(t, t.plusSeconds(1), t.plusSeconds(2));
    final ViewExecutionOptions options = ExecutionOptions.of(sequence, EnumSet.of(ViewExecutionFlags.RUN_AS_FAST_AS_POSSIBLE));
    test.createWorker(Mockito.mock(ViewProcessWorkerContext.class), options, Mockito.mock(ViewDefinition.class));
    assertEquals(underlying._executionOptions.size(), 1);
    assertEquals(underlying._executionOptions.get(0), options);
  }
View Full Code Here


  public void testShortSequence() {
    final ViewProcessWorkerFactoryMock underlying = new ViewProcessWorkerFactoryMock();
    final SequencePartitioningViewProcessWorkerFactory test = createFactory(underlying);
    final Instant t = Instant.now();
    final ViewCycleExecutionSequence sequence = ArbitraryViewCycleExecutionSequence.of(t, t.plusSeconds(1), t.plusSeconds(2));
    final ViewExecutionOptions options = ExecutionOptions.of(sequence, EnumSet.of(ViewExecutionFlags.RUN_AS_FAST_AS_POSSIBLE));
    test.createWorker(Mockito.mock(ViewProcessWorkerContext.class), options, Mockito.mock(ViewDefinition.class));
    assertEquals(underlying._executionOptions.size(), 1);
    assertEquals(underlying._executionOptions.get(0), options);
  }
View Full Code Here

    final ViewProcessWorkerFactoryMock underlying = new ViewProcessWorkerFactoryMock();
    final SequencePartitioningViewProcessWorkerFactory test = createFactory(underlying);
    final Instant t = Instant.now();
    final List<ViewCycleExecutionOptions> cycles = new ArrayList<ViewCycleExecutionOptions>(20);
    for (int i = 0; i < 20; i++) {
      cycles.add(ViewCycleExecutionOptions.builder().setValuationTime(t.plusSeconds(i)).create());
    }
    final ViewCycleExecutionSequence sequence = new ArbitraryViewCycleExecutionSequence(cycles);
    final ViewExecutionOptions options = ExecutionOptions.of(sequence, EnumSet.of(ViewExecutionFlags.RUN_AS_FAST_AS_POSSIBLE));
    test.createWorker(Mockito.mock(ViewProcessWorkerContext.class), options, Mockito.mock(ViewDefinition.class));
    assertEquals(underlying._executionOptions.size(), 3);
View Full Code Here

  public void testFiniteSequence() throws InterruptedException {
    final ViewProcessWorkerFactoryMock underlying = new ViewProcessWorkerFactoryMock(0);
    final Instant t = Instant.now();
    final List<ViewCycleExecutionOptions> cycles = new ArrayList<ViewCycleExecutionOptions>(20);
    for (int i = 0; i < 37; i++) {
      cycles.add(ViewCycleExecutionOptions.builder().setValuationTime(t.plusSeconds(i)).create());
    }
    final ViewCycleExecutionSequence sequence = new ArbitraryViewCycleExecutionSequence(cycles);
    final ViewExecutionOptions options = ExecutionOptions.of(sequence, EnumSet.of(ViewExecutionFlags.RUN_AS_FAST_AS_POSSIBLE));
    final ViewProcessWorkerContext context = Mockito.mock(ViewProcessWorkerContext.class);
    final SequencePartitioningViewProcessWorker worker = new SequencePartitioningViewProcessWorker(underlying, context, options, Mockito.mock(ViewDefinition.class), 10, 2);
View Full Code Here

  Object[][] data_timeBounds() {
    Instant now = Instant.now();
    return new Object[][] {
        {null, null, null, true},
        {null, now.minusSeconds(20), null, true},
        {null, now.plusSeconds(20), null, false},
        {null, null, now.minusSeconds(20), false},
        {null, null, now.plusSeconds(20), true},
        {now, null, null, true},
        {now, now.minusSeconds(20), null, true},
        {now, now.plusSeconds(20), null, false},
View Full Code Here

    return new Object[][] {
        {null, null, null, true},
        {null, now.minusSeconds(20), null, true},
        {null, now.plusSeconds(20), null, false},
        {null, null, now.minusSeconds(20), false},
        {null, null, now.plusSeconds(20), true},
        {now, null, null, true},
        {now, now.minusSeconds(20), null, true},
        {now, now.plusSeconds(20), null, false},
        {now, null, now.minusSeconds(20), false},
        {now, null, now.plusSeconds(20), true},
View Full Code Here

        {null, now.plusSeconds(20), null, false},
        {null, null, now.minusSeconds(20), false},
        {null, null, now.plusSeconds(20), true},
        {now, null, null, true},
        {now, now.minusSeconds(20), null, true},
        {now, now.plusSeconds(20), null, false},
        {now, null, now.minusSeconds(20), false},
        {now, null, now.plusSeconds(20), true},
        {now, now.minusSeconds(20), now.plusSeconds(20), true},
        {now, now.minusSeconds(40), now.minusSeconds(20), false},
        {now, now.minusSeconds(20), now.minusSeconds(40), false},
View Full Code Here

        {null, null, now.plusSeconds(20), true},
        {now, null, null, true},
        {now, now.minusSeconds(20), null, true},
        {now, now.plusSeconds(20), null, false},
        {now, null, now.minusSeconds(20), false},
        {now, null, now.plusSeconds(20), true},
        {now, now.minusSeconds(20), now.plusSeconds(20), true},
        {now, now.minusSeconds(40), now.minusSeconds(20), false},
        {now, now.minusSeconds(20), now.minusSeconds(40), false},
        {now, now.plusSeconds(20), now.plusSeconds(40), false},
        {now, now.plusSeconds(40), now.plusSeconds(20), false},
View Full Code Here

        {now, null, null, true},
        {now, now.minusSeconds(20), null, true},
        {now, now.plusSeconds(20), null, false},
        {now, null, now.minusSeconds(20), false},
        {now, null, now.plusSeconds(20), true},
        {now, now.minusSeconds(20), now.plusSeconds(20), true},
        {now, now.minusSeconds(40), now.minusSeconds(20), false},
        {now, now.minusSeconds(20), now.minusSeconds(40), false},
        {now, now.plusSeconds(20), now.plusSeconds(40), false},
        {now, now.plusSeconds(40), now.plusSeconds(20), false},
    };
View Full Code Here

        {now, null, now.minusSeconds(20), false},
        {now, null, now.plusSeconds(20), true},
        {now, now.minusSeconds(20), now.plusSeconds(20), true},
        {now, now.minusSeconds(40), now.minusSeconds(20), false},
        {now, now.minusSeconds(20), now.minusSeconds(40), false},
        {now, now.plusSeconds(20), now.plusSeconds(40), false},
        {now, now.plusSeconds(40), now.plusSeconds(20), false},
    };
  }

  @Test(dataProvider = "timeBounds")
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.