| 1217 | } |
| 1218 | |
| 1219 | @Test |
| 1220 | public void simpleMultiGetsException() throws Exception { |
| 1221 | final List<GetRequest> gets = new ArrayList<GetRequest>(); |
| 1222 | final GetRequest get = new GetRequest(TABLE, KEY); |
| 1223 | gets.add(get); |
| 1224 | final GetRequest get2 = new GetRequest(TABLE, KEY2); |
| 1225 | gets.add(get2); |
| 1226 | |
| 1227 | final ArrayList<KeyValue> row = new ArrayList<KeyValue>(1); |
| 1228 | row.add(KV); |
| 1229 | |
| 1230 | final KeyValue KV2 = new KeyValue(KEY2, FAMILY, QUALIFIER, VALUE); |
| 1231 | final ArrayList<KeyValue> row2 = new ArrayList<KeyValue>(1); |
| 1232 | row2.add(KV2); |
| 1233 | |
| 1234 | when(regionclient.isAlive()).thenReturn(true); |
| 1235 | doAnswer(new Answer() { |
| 1236 | public Object answer(final InvocationOnMock invocation) { |
| 1237 | get.getDeferred().callback(row); |
| 1238 | get2.getDeferred().callback(new NoSuchColumnFamilyException("boo", get2)); |
| 1239 | return null; |
| 1240 | } |
| 1241 | }).when(regionclient).sendRpc(any(MultiAction.class)); |
| 1242 | |
| 1243 | List<GetResultOrException> result = client.get(gets).joinUninterruptibly(); |
| 1244 | assertSame(row, result.get(0).getCells()); |
| 1245 | assertTrue(null == result.get(0).getException()); |
| 1246 | assertTrue(null == result.get(1).getCells()); |
| 1247 | assertTrue(result.get(1).getException() != null); |
| 1248 | } |
| 1249 | |
| 1250 | } |