@Test public void testNoDataSetFound() { String dataSetId = UUID.randomUUID().toString(); contentAnalysis.analyze(dataSetId); assertThat(dataSetMetadataRepository.get(dataSetId), nullValue()); }
@Override public void analyze(String dataSetId) { if (StringUtils.isEmpty(dataSetId)) { throw new IllegalArgumentException("Data set id cannot be null or empty."); } DistributedLock datasetLock = repository.createDatasetMetadataLock(dataSetId); datasetLock.lock(); try { DataSetMetadata metadata = repository.get(dataSetId); if (metadata != null) { LOG.info("Indexing content of data set #{}...", metadata.getId()); updateHeaderAndFooter(metadata); updateLimit(metadata); metadata.getLifecycle().contentIndexed(true); DataSetMetadata savedDataSetMetadata = repository.get(dataSetId); if (savedDataSetMetadata != null) { repository.save(metadata); } LOG.info("Indexed content of data set #{}.", dataSetId); } else { LOG.info("Data set #{} no longer exists.", dataSetId); } } finally { datasetLock.unlock(); } }
ContentAnalysis implements SynchronousDataSetAnalyzer { @Override public void analyze(String dataSetId) { if (StringUtils.isEmpty(dataSetId)) { throw new IllegalArgumentException("Data set id cannot be null or empty."); } DistributedLock datasetLock = repository.createDatasetMetadataLock(dataSetId); datasetLock.lock(); try { DataSetMetadata metadata = repository.get(dataSetId); if (metadata != null) { LOG.info("Indexing content of data set #{}...", metadata.getId()); updateHeaderAndFooter(metadata); updateLimit(metadata); metadata.getLifecycle().contentIndexed(true); DataSetMetadata savedDataSetMetadata = repository.get(dataSetId); if (savedDataSetMetadata != null) { repository.save(metadata); } LOG.info("Indexed content of data set #{}.", dataSetId); } else { LOG.info("Data set #{} no longer exists.", dataSetId); } } finally { datasetLock.unlock(); } } }
ContentAnalysis implements SynchronousDataSetAnalyzer { @Override public void analyze(String dataSetId) { if (StringUtils.isEmpty(dataSetId)) { throw new IllegalArgumentException("Data set id cannot be null or empty."); } DistributedLock datasetLock = repository.createDatasetMetadataLock(dataSetId); datasetLock.lock(); try { DataSetMetadata metadata = repository.get(dataSetId); if (metadata != null) { LOG.info("Indexing content of data set #{}...", metadata.getId()); updateHeaderAndFooter(metadata); updateLimit(metadata); metadata.getLifecycle().contentIndexed(true); DataSetMetadata savedDataSetMetadata = repository.get(dataSetId); if (savedDataSetMetadata != null) { repository.save(metadata); } LOG.info("Indexed content of data set #{}.", dataSetId); } else { LOG.info("Data set #{} no longer exists.", dataSetId); } } finally { datasetLock.unlock(); } }  }
ContentAnalysis implements SynchronousDataSetAnalyzer { @Override public void analyze(String dataSetId) { if (StringUtils.isEmpty(dataSetId)) { throw new IllegalArgumentException("Data set id cannot be null or empty."); } DistributedLock datasetLock = repository.createDatasetMetadataLock(dataSetId); datasetLock.lock(); try { DataSetMetadata metadata = repository.get(dataSetId); if (metadata != null) { LOG.info("Indexing content of data set #{}...", metadata.getId()); updateHeaderAndFooter(metadata); updateLimit(metadata); metadata.getLifecycle().contentIndexed(true); DataSetMetadata savedDataSetMetadata = repository.get(dataSetId); if (savedDataSetMetadata != null) { repository.save(metadata); } LOG.info("Indexed content of data set #{}.", dataSetId); } else { LOG.info("Data set #{} no longer exists.", dataSetId); } } finally { datasetLock.unlock(); } }  @Override void analyze(String dataSetId); @Override int order(); }
ContentAnalysis implements SynchronousDataSetAnalyzer { @Override public void analyze(String dataSetId) { if (StringUtils.isEmpty(dataSetId)) { throw new IllegalArgumentException("Data set id cannot be null or empty."); } DistributedLock datasetLock = repository.createDatasetMetadataLock(dataSetId); datasetLock.lock(); try { DataSetMetadata metadata = repository.get(dataSetId); if (metadata != null) { LOG.info("Indexing content of data set #{}...", metadata.getId()); updateHeaderAndFooter(metadata); updateLimit(metadata); metadata.getLifecycle().contentIndexed(true); DataSetMetadata savedDataSetMetadata = repository.get(dataSetId); if (savedDataSetMetadata != null) { repository.save(metadata); } LOG.info("Indexed content of data set #{}.", dataSetId); } else { LOG.info("Data set #{} no longer exists.", dataSetId); } } finally { datasetLock.unlock(); } }  @Override void analyze(String dataSetId); @Override int order();  }