MCPcopy Create free account
hub / github.com/OpenTSDB/asynchbase / enqueueTimeoutTimerShuttingDown

Method enqueueTimeoutTimerShuttingDown

test/TestHBaseRpc.java:159–181  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

157 }
158
159 @Test
160 public void enqueueTimeoutTimerShuttingDown() throws Exception {
161 timer = mock(FakeTimer.class);
162 when(timer.newTimeout(any(TimerTask.class), anyLong(), any(TimeUnit.class)))
163 .thenThrow(new IllegalStateException("Shutdown!"));
164 Whitebox.setInternalState(client, "rpc_timeout_timer", timer);
165 final GetRequest rpc = new GetRequest(TABLE, KEY, FAMILY);
166 final Deferred<Object> deferred = rpc.getDeferred();
167 assertNull(rpc.timeout_handle);
168 assertFalse(rpc.hasTimedOut());
169
170 rpc.enqueueTimeout(regionclient);
171
172 assertNull(rpc.timeout_handle);
173 assertEquals(default_timeout, rpc.getTimeout());
174 assertFalse(rpc.hasTimedOut());
175 verify(regionclient, never()).removeRpc(any(HBaseRpc.class), anyBoolean());
176 verify(timer).newTimeout(any(TimerTask.class), anyLong(), any(TimeUnit.class));
177 try {
178 deferred.join(1);
179 fail("Expected a TimeoutException");
180 } catch (TimeoutException e) { }
181 }
182
183 @Test
184 public void callback() throws Exception {

Callers

nothing calls this directly

Calls 6

hasTimedOutMethod · 0.80
getTimeoutMethod · 0.80
removeRpcMethod · 0.80
newTimeoutMethod · 0.45
getDeferredMethod · 0.45
enqueueTimeoutMethod · 0.45

Tested by

no test coverage detected