use of org.opendaylight.bgpcep.programming.spi.Instruction in project bgpcep by opendaylight.
the class ProgrammingServiceImplTest method testTimeoutWhileScheduledTransaction.
@Test(timeout = 30 * 1000)
public void testTimeoutWhileScheduledTransaction() throws Exception {
final BigInteger deadlineOffset = BigInteger.valueOf(1000L * 1000 * 1000 * INSTRUCTION_DEADLINE_OFFSET_IN_SECONDS);
final Nanotime current = NanotimeUtil.currentTime();
final Nanotime deadlineNano = new Nanotime(current.getValue().add(deadlineOffset));
final Optional<Nanotime> deadline = Optional.of(deadlineNano);
final SubmitInstructionInput mockedSubmit1 = getMockedSubmitInstructionInput("mockedSubmit1", deadline);
final ListenableFuture<Instruction> future = this.testedProgrammingService.scheduleInstruction(mockedSubmit1);
this.mockedNotificationServiceWrapper.assertNotificationsCount(1);
future.get();
this.mockedNotificationServiceWrapper.assertNotificationsCount(2);
this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(1, mockedSubmit1.getId(), InstructionStatus.Cancelled);
}
Aggregations