@Test public void testDelete() throws Exception { LocalDocument doc = new LocalDocument(); doc.setAction(Action.DELETE); doc.putContentField("name", "jonas"); try { solrOutput.output(doc); } catch(Exception e) {} Mockito.verify(mockServer, Mockito.never()).deleteById(Mockito.any(String.class)); doc.putContentField("id", "someid"); solrOutput.output(doc); Mockito.verify(mockServer).deleteById(Mockito.any(String.class)); }
private void delete(LocalDocument doc) throws SolrServerException, IOException, RequiredArgumentMissingException { if(!doc.hasContentField(idField)) { throw new RequiredArgumentMissingException("Document has no ID field"); } if (getCommitWithin() != 0) { solr.deleteById(doc.getContentField(idField).toString(), getCommitWithin()); } else { solr.deleteById(doc.getContentField(idField).toString()); } }
SolrOutputStage extends AbstractOutputStage { private void delete(LocalDocument doc) throws SolrServerException, IOException, RequiredArgumentMissingException { if(!doc.hasContentField(idField)) { throw new RequiredArgumentMissingException("Document has no ID field"); } if (getCommitWithin() != 0) { solr.deleteById(doc.getContentField(idField).toString(), getCommitWithin()); } else { solr.deleteById(doc.getContentField(idField).toString()); } } }
SolrOutputStage extends AbstractOutputStage { private void delete(LocalDocument doc) throws SolrServerException, IOException, RequiredArgumentMissingException { if(!doc.hasContentField(idField)) { throw new RequiredArgumentMissingException("Document has no ID field"); } if (getCommitWithin() != 0) { solr.deleteById(doc.getContentField(idField).toString(), getCommitWithin()); } else { solr.deleteById(doc.getContentField(idField).toString()); } }  }
SolrOutputStage extends AbstractOutputStage { private void delete(LocalDocument doc) throws SolrServerException, IOException, RequiredArgumentMissingException { if(!doc.hasContentField(idField)) { throw new RequiredArgumentMissingException("Document has no ID field"); } if (getCommitWithin() != 0) { solr.deleteById(doc.getContentField(idField).toString(), getCommitWithin()); } else { solr.deleteById(doc.getContentField(idField).toString()); } }  @Override void output(LocalDocument doc); @Override void init(); Map<String, Object> getFieldMappings(); void setFieldMappings(Map<String, Object> fieldConfigs); int getCommitWithin(); void setCommitWithin(int commitWithin); }
SolrOutputStage extends AbstractOutputStage { private void delete(LocalDocument doc) throws SolrServerException, IOException, RequiredArgumentMissingException { if(!doc.hasContentField(idField)) { throw new RequiredArgumentMissingException("Document has no ID field"); } if (getCommitWithin() != 0) { solr.deleteById(doc.getContentField(idField).toString(), getCommitWithin()); } else { solr.deleteById(doc.getContentField(idField).toString()); } }  @Override void output(LocalDocument doc); @Override void init(); Map<String, Object> getFieldMappings(); void setFieldMappings(Map<String, Object> fieldConfigs); int getCommitWithin(); void setCommitWithin(int commitWithin);  }