From b6d5a68f75f8ca1b3bf484c3f42b83fdb05dfedd Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Fri, 9 Jan 2015 08:15:29 -0500 Subject: [PATCH] NIFI-239: Updated deprecated method calls to use newer versions --- .../persistent-provenance-repository/pom.xml | 1 - .../provenance/lucene/DeleteIndexAction.java | 2 +- .../nifi/provenance/lucene/LuceneUtil.java | 2 +- .../TestPersistentProvenanceRepository.java | 35 +++++++------------ 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/nar-bundles/persistent-provenance-repository-bundle/persistent-provenance-repository/pom.xml b/nar-bundles/persistent-provenance-repository-bundle/persistent-provenance-repository/pom.xml index ad5cee39d9..122a977d9f 100644 --- a/nar-bundles/persistent-provenance-repository-bundle/persistent-provenance-repository/pom.xml +++ b/nar-bundles/persistent-provenance-repository-bundle/persistent-provenance-repository/pom.xml @@ -22,7 +22,6 @@ persistent-provenance-repository - 0.0.1-SNAPSHOT Persistent Provenance Repository jar diff --git a/nar-bundles/persistent-provenance-repository-bundle/persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/DeleteIndexAction.java b/nar-bundles/persistent-provenance-repository-bundle/persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/DeleteIndexAction.java index 6d922bd430..46084195cf 100644 --- a/nar-bundles/persistent-provenance-repository-bundle/persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/DeleteIndexAction.java +++ b/nar-bundles/persistent-provenance-repository-bundle/persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/DeleteIndexAction.java @@ -76,7 +76,7 @@ public class DeleteIndexAction implements ExpirationAction { final List indexDirs = indexConfiguration.getIndexDirectories(expiredFile); for (final File indexingDirectory : indexDirs) { try (final Directory directory = FSDirectory.open(indexingDirectory); - final Analyzer analyzer = new StandardAnalyzer(LuceneUtil.LUCENE_VERSION)) { + final Analyzer analyzer = new StandardAnalyzer()) { IndexWriterConfig config = new IndexWriterConfig(LuceneUtil.LUCENE_VERSION, analyzer); config.setWriteLockTimeout(300000L); diff --git a/nar-bundles/persistent-provenance-repository-bundle/persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/LuceneUtil.java b/nar-bundles/persistent-provenance-repository-bundle/persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/LuceneUtil.java index 0f460fe93e..a7076d5a10 100644 --- a/nar-bundles/persistent-provenance-repository-bundle/persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/LuceneUtil.java +++ b/nar-bundles/persistent-provenance-repository-bundle/persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/LuceneUtil.java @@ -41,7 +41,7 @@ import org.apache.lucene.util.Version; public class LuceneUtil { - public static final Version LUCENE_VERSION = Version.LUCENE_43; + public static final Version LUCENE_VERSION = Version.LATEST; public static String substringBefore(final String value, final String searchValue) { final int index = value.indexOf(searchValue); diff --git a/nar-bundles/persistent-provenance-repository-bundle/persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/TestPersistentProvenanceRepository.java b/nar-bundles/persistent-provenance-repository-bundle/persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/TestPersistentProvenanceRepository.java index 7950483999..730587296e 100644 --- a/nar-bundles/persistent-provenance-repository-bundle/persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/TestPersistentProvenanceRepository.java +++ b/nar-bundles/persistent-provenance-repository-bundle/persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/TestPersistentProvenanceRepository.java @@ -16,15 +16,6 @@ */ package org.apache.nifi.provenance; -import org.apache.nifi.provenance.PersistentProvenanceRepository; -import org.apache.nifi.provenance.RepositoryConfiguration; -import org.apache.nifi.provenance.IndexConfiguration; -import org.apache.nifi.provenance.AsyncLineageSubmission; -import org.apache.nifi.provenance.SearchableFields; -import org.apache.nifi.provenance.StandardProvenanceEventRecord; -import org.apache.nifi.provenance.ProvenanceEventType; -import org.apache.nifi.provenance.ProvenanceEventRecord; -import org.apache.nifi.provenance.ProvenanceEventBuilder; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -43,6 +34,16 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.analysis.core.SimpleAnalyzer; +import org.apache.lucene.document.Document; +import org.apache.lucene.index.DirectoryReader; +import org.apache.lucene.queryparser.classic.ParseException; +import org.apache.lucene.queryparser.classic.QueryParser; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.ScoreDoc; +import org.apache.lucene.search.TopDocs; +import org.apache.lucene.store.FSDirectory; import org.apache.nifi.events.EventReporter; import org.apache.nifi.flowfile.FlowFile; import org.apache.nifi.provenance.lineage.EventNode; @@ -58,18 +59,6 @@ import org.apache.nifi.provenance.search.SearchableField; import org.apache.nifi.provenance.serialization.RecordReader; import org.apache.nifi.provenance.serialization.RecordReaders; import org.apache.nifi.reporting.Severity; - -import org.apache.lucene.analysis.Analyzer; -import org.apache.lucene.analysis.core.SimpleAnalyzer; -import org.apache.lucene.document.Document; -import org.apache.lucene.index.DirectoryReader; -import org.apache.lucene.queryparser.classic.ParseException; -import org.apache.lucene.queryparser.classic.QueryParser; -import org.apache.lucene.search.IndexSearcher; -import org.apache.lucene.search.ScoreDoc; -import org.apache.lucene.search.TopDocs; -import org.apache.lucene.store.FSDirectory; -import org.apache.lucene.util.Version; import org.junit.After; import org.junit.Before; import org.junit.Ignore; @@ -1058,8 +1047,8 @@ public class TestPersistentProvenanceRepository { try (final DirectoryReader directoryReader = DirectoryReader.open(FSDirectory.open(indexDirectory))) { final IndexSearcher searcher = new IndexSearcher(directoryReader); - final Analyzer analyzer = new SimpleAnalyzer(Version.LUCENE_43); - final org.apache.lucene.search.Query luceneQuery = new QueryParser(Version.LUCENE_43, "uuid", analyzer).parse(query); + final Analyzer analyzer = new SimpleAnalyzer(); + final org.apache.lucene.search.Query luceneQuery = new QueryParser("uuid", analyzer).parse(query); final Query q = new Query(""); q.setMaxResults(1000);