@Test public void normalResponse_whenInvocationMissing_thenNothingBadHappens() { Invocation invocation = newInvocation(); invocationRegistry.register(invocation); long callId = invocation.op.getCallId(); invocationRegistry.deregister(invocation); invocationRegistry.notifyNormalResponse(callId, "foo", 0, null); assertNull(invocationRegistry.get(callId)); }
@Test public void normalResponse_whenInvocationExist() { Invocation invocation = newInvocation(); invocationRegistry.register(invocation); long callId = invocation.op.getCallId(); Object value = "foo"; invocationRegistry.notifyNormalResponse(callId, value, 0, null); assertEquals(value, invocation.future.join()); assertNull(invocationRegistry.get(callId)); }
@Test public void normalResponse_whenBackupMissing_thenEventuallySuccess() throws Exception { Invocation invocation = newInvocation(); invocationRegistry.register(invocation); long callId = invocation.op.getCallId(); String result = "foo"; invocationRegistry.notifyNormalResponse(callId, result, 1, null); assertEquals(result, invocation.future.get(1, TimeUnit.MINUTES)); assertNull(invocationRegistry.get(callId)); }