Search in sources :

Example 6 with Instruction

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);
}
Also used : BigInteger(java.math.BigInteger) Instruction(org.opendaylight.bgpcep.programming.spi.Instruction) SubmitInstructionInput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.SubmitInstructionInput) Nanotime(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.Nanotime) Test(org.junit.Test)

Aggregations

Instruction (org.opendaylight.bgpcep.programming.spi.Instruction)6 BigInteger (java.math.BigInteger)4 Test (org.junit.Test)4 Nanotime (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.Nanotime)4 SubmitInstructionInput (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.SubmitInstructionInput)4 SchedulerException (org.opendaylight.bgpcep.programming.spi.SchedulerException)2 Timeout (io.netty.util.Timeout)1 DuplicateInstructionId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.DuplicateInstructionId)1 InstructionId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.InstructionId)1 UnknownInstruction (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.UnknownInstruction)1 FailureCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.submit.instruction.output.result.FailureCaseBuilder)1 FailureBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.submit.instruction.output.result.failure._case.FailureBuilder)1