RemoteRepository extends BaseRepository { @Override public Record delete(RecordId recordId, List<MutationCondition> conditions) throws RepositoryException, InterruptedException { try { ByteBuffer record = lilyProxy.delete(getAuthzContext(), converter.convert(recordId), repositoryName, tableName, converter.convert(null, conditions, this), null); return record == null ? null : converter.convertRecord(record, this); } catch (AvroRepositoryException e) { throw converter.convert(e); } catch (AvroGenericException e) { throw converter.convert(e); } catch (AvroRemoteException e) { throw handleAvroRemoteException(e); } catch (UndeclaredThrowableException e) { throw handleUndeclaredRecordThrowable(e); } } RemoteRepository(RepoTableKey repoTableKey, AvroLilyTransceiver lilyTransceiver, AvroConverter converter,
            AbstractRepositoryManager repositoryManager, BlobManager blobManager, HTableInterface recordTable,
            HTableInterface nonAuthRecordTable, TableManager tableManager, RecordFactory recordFactory); @Override void close(); @Override IdGenerator getIdGenerator(); @Override Record create(Record record); @Override Record delete(RecordId recordId, List<MutationCondition> conditions); @Override void delete(RecordId recordId); @Override void delete(Record record); @Override Record update(Record record); @Override Record update(Record record, List<MutationCondition> conditions); @Override Record update(Record record, boolean updateVersion, boolean useLatestRecordType); @Override Record update(Record record, boolean updateVersion, boolean useLatestRecordType,
                         List<MutationCondition> conditions); @Override Record createOrUpdate(Record record); @Override Record createOrUpdate(Record record, boolean useLatestRecordType); @Override Set<RecordId> getVariants(RecordId recordId); @Override RecordBuilder recordBuilder();  }
@Test public void testDelete_RecordById() throws Exception { RecordId recordId = mock(RecordId.class); remoteRepository.delete(recordId); ByteBuffer encodedRecordId = mock(ByteBuffer.class); when(avroConverter.convert(recordId)).thenReturn(encodedRecordId); remoteRepository.delete(recordId); verify(avroLily).delete(null, encodedRecordId, repositoryName, Table.RECORD.name, null, null); }
@Test public void testDelete_RecordById_WithMutations() throws Exception { RecordId recordId = mock(RecordId.class); List<MutationCondition> mutationConditions = Lists.newArrayList(mock(MutationCondition.class)); ByteBuffer encodedRecordId = mock(ByteBuffer.class); List<AvroMutationCondition> encodedMutationConditions = Lists.newArrayList(mock(AvroMutationCondition.class)); when(avroConverter.convert(recordId)).thenReturn(encodedRecordId); when(avroConverter.convert(null, mutationConditions, remoteRepository)).thenReturn(encodedMutationConditions); remoteRepository.delete(recordId, mutationConditions); verify(avroLily).delete(null, encodedRecordId, repositoryName, Table.RECORD.name, encodedMutationConditions, null); }
@Test public void testDelete_FullRecord() throws Exception { RecordId recordId = mock(RecordId.class); Record record = mock(Record.class); Map<String, String> attributes = Maps.newHashMap(); attributes.put("key", "value"); when(record.getId()).thenReturn(recordId); when(record.getAttributes()).thenReturn(attributes); ByteBuffer encodedRecordId = mock(ByteBuffer.class); when(avroConverter.convert(recordId)).thenReturn(encodedRecordId); remoteRepository.delete(record); verify(avroLily).delete(null, encodedRecordId, repositoryName, Table.RECORD.name, null, attributes); }