import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import static org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs;
import com.google.common.base.Optional;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.config.yang.pcep.topology.provider.SessionState;
assertEquals(PCEPErrors.USED_SYMBOLIC_PATH_NAME, PCEPErrors.forValue(errorObject.getType(), errorObject.getValue()));
}
+ @Test
+ public void testPccResponseTimeout() throws InterruptedException, ExecutionException {
+ this.listener.onSessionUp(this.session);
+ Future<RpcResult<AddLspOutput>> addLspResult = this.topologyRpcs.addLsp(createAddLspInput());
+ try {
+ addLspResult.get(2, TimeUnit.SECONDS);
+ fail();
+ } catch (Exception e) {
+ assertTrue(e instanceof TimeoutException);
+ }
+ Thread.sleep(AbstractPCEPSessionTest.RPC_TIMEOUT);
+ RpcResult<AddLspOutput> rpcResult = addLspResult.get();
+ assertNotNull(rpcResult);
+ assertEquals(rpcResult.getResult().getFailure(), FailureType.Unsent);
+ }
+
@Override
protected Open getLocalPref() {
return new OpenBuilder(super.getLocalPref()).setTlvs(new TlvsBuilder().addAugmentation(Tlvs1.class, new Tlvs1Builder().setStateful(new StatefulBuilder()