@Test public void testOnRemovedRemovesState() throws IOException, SolrServerException { final TestableProcessor proc = new TestableProcessor(solrClient); TestRunner runner = TestRunners.newTestRunner(proc); runner.setProperty(GetSolr.SOLR_TYPE, PutSolrContentStream.SOLR_TYPE_STANDARD.getValue()); runner.setProperty(GetSolr.SOLR_LOCATION, "http: runner.setProperty(GetSolr.SOLR_QUERY, "last:smith"); runner.setProperty(GetSolr.RETURN_FIELDS, "created"); runner.setProperty(GetSolr.SORT_CLAUSE, "created desc"); runner.setProperty(GetSolr.DATE_FIELD, "created"); runner.setProperty(GetSolr.BATCH_SIZE, "10"); runner.run(); File lastEndDateCache = new File(GetSolr.FILE_PREFIX + proc.getIdentifier()); Assert.assertTrue("State file should exist, but doesn't", lastEndDateCache.exists()); proc.onRemoved(); Assert.assertFalse("State file should have been removed, but wasn't", lastEndDateCache.exists()); }
@OnRemoved public void onRemoved() { final File lastEndDateCache = new File(FILE_PREFIX + getIdentifier()); if (lastEndDateCache.exists()) { lastEndDateCache.delete(); } }
GetSolr extends SolrProcessor { @OnRemoved public void onRemoved() { final File lastEndDateCache = new File(FILE_PREFIX + getIdentifier()); if (lastEndDateCache.exists()) { lastEndDateCache.delete(); } } }
GetSolr extends SolrProcessor { @OnRemoved public void onRemoved() { final File lastEndDateCache = new File(FILE_PREFIX + getIdentifier()); if (lastEndDateCache.exists()) { lastEndDateCache.delete(); } }  }
GetSolr extends SolrProcessor { @OnRemoved public void onRemoved() { final File lastEndDateCache = new File(FILE_PREFIX + getIdentifier()); if (lastEndDateCache.exists()) { lastEndDateCache.delete(); } }  @Override Set<Relationship> getRelationships(); @Override List<PropertyDescriptor> getSupportedPropertyDescriptors(); @Override void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue); @OnStopped void onStopped(); @OnRemoved void onRemoved(); @Override void onTrigger(ProcessContext context, ProcessSession session); }
GetSolr extends SolrProcessor { @OnRemoved public void onRemoved() { final File lastEndDateCache = new File(FILE_PREFIX + getIdentifier()); if (lastEndDateCache.exists()) { lastEndDateCache.delete(); } }  @Override Set<Relationship> getRelationships(); @Override List<PropertyDescriptor> getSupportedPropertyDescriptors(); @Override void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue); @OnStopped void onStopped(); @OnRemoved void onRemoved(); @Override void onTrigger(ProcessContext context, ProcessSession session); static final PropertyDescriptor SOLR_QUERY; static final PropertyDescriptor RETURN_FIELDS; static final PropertyDescriptor SORT_CLAUSE; static final PropertyDescriptor DATE_FIELD; static final PropertyDescriptor BATCH_SIZE; static final Relationship REL_SUCCESS; }