MCPcopy Index your code
hub / github.com/OpenTSDB/asynchbase / setupWrap

Method setupWrap

test/BaseTestSecureRpcHelper.java:178–192  ·  view source on GitHub ↗

Helper to wrap a buffer, pretending the sasl client simply prepends the length. @throws Exception it really shouldn't. Really.

()

Source from the content-addressed store, hash-verified

176 * @throws Exception it really shouldn't. Really.
177 */
178 protected void setupWrap() throws Exception {
179 when(sasl_client.wrap(any(byte[].class), anyInt(), anyInt()))
180 .thenAnswer(new Answer<byte[]>() {
181 @Override
182 public byte[] answer(final InvocationOnMock invocation)
183 throws Throwable {
184 final byte[] buffer = (byte[])invocation.getArguments()[0];
185 final int length = (Integer)invocation.getArguments()[2];
186 final byte[] wrapped = new byte[length + 4];
187 System.arraycopy(buffer, 0, wrapped, 4, length);
188 Bytes.setInt(wrapped, length);
189 return wrapped;
190 }
191 });
192 }
193
194 @SuppressWarnings("unchecked")
195 protected void setupChallenge() throws Exception {

Callers 2

wrapMethod · 0.80
wrapNotWrappedMethod · 0.80

Calls 1

wrapMethod · 0.45

Tested by

no test coverage detected