| 1188 | } |
| 1189 | |
| 1190 | @Test |
| 1191 | public void simpleMultiGets() throws Exception { |
| 1192 | final List<GetRequest> gets = new ArrayList<GetRequest>(); |
| 1193 | final GetRequest get = new GetRequest(TABLE, KEY); |
| 1194 | gets.add(get); |
| 1195 | final GetRequest get2 = new GetRequest(TABLE, KEY2); |
| 1196 | gets.add(get2); |
| 1197 | |
| 1198 | final ArrayList<KeyValue> row = new ArrayList<KeyValue>(1); |
| 1199 | row.add(KV); |
| 1200 | |
| 1201 | final KeyValue KV2 = new KeyValue(KEY2, FAMILY, QUALIFIER, VALUE); |
| 1202 | final ArrayList<KeyValue> row2 = new ArrayList<KeyValue>(1); |
| 1203 | row2.add(KV2); |
| 1204 | |
| 1205 | when(regionclient.isAlive()).thenReturn(true); |
| 1206 | doAnswer(new Answer() { |
| 1207 | public Object answer(final InvocationOnMock invocation) { |
| 1208 | get.getDeferred().callback(row); |
| 1209 | get2.getDeferred().callback(row2); |
| 1210 | return null; |
| 1211 | } |
| 1212 | }).when(regionclient).sendRpc(any(MultiAction.class)); |
| 1213 | |
| 1214 | List<GetResultOrException> result = client.get(gets).joinUninterruptibly(); |
| 1215 | assertSame(row, result.get(0).getCells()); |
| 1216 | assertSame(row2, result.get(1).getCells()); |
| 1217 | } |
| 1218 | |
| 1219 | @Test |
| 1220 | public void simpleMultiGetsException() throws Exception { |