From 6743909947dcf1f78136f513da28b38ab32740f6 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Mon, 26 Sep 2022 10:28:47 +0200 Subject: [PATCH 1/4] Update solrj dependency to 8.11.1 * getIdField in SolrFlowStage.scala:109 is reported as deprecated, but I don't know what it should be replaced with --- project/Dependencies.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index e80ddb6988..080c5b867b 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -466,8 +466,8 @@ object Dependencies { ) ++ Mockito ) - val SolrjVersion = "7.7.3" - val SolrVersionForDocs = "7_7" + val SolrjVersion = "8.11.1" + val SolrVersionForDocs = "8_11" val Solr = Seq( libraryDependencies ++= Seq( From 9cff6e6f60e63c6c16e3825ae8d0c77c106783c9 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Tue, 27 Sep 2022 09:27:34 +0200 Subject: [PATCH 2/4] supress warning --- .../scala/akka/stream/alpakka/solr/impl/SolrFlowStage.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/solr/src/main/scala/akka/stream/alpakka/solr/impl/SolrFlowStage.scala b/solr/src/main/scala/akka/stream/alpakka/solr/impl/SolrFlowStage.scala index b44de4ea11..09602edae6 100644 --- a/solr/src/main/scala/akka/stream/alpakka/solr/impl/SolrFlowStage.scala +++ b/solr/src/main/scala/akka/stream/alpakka/solr/impl/SolrFlowStage.scala @@ -4,6 +4,8 @@ package akka.stream.alpakka.solr.impl +import scala.annotation.nowarn + import akka.annotation.InternalApi import akka.stream.ActorAttributes.SupervisionStrategy import akka.stream._ @@ -14,10 +16,8 @@ import org.apache.solr.client.solrj.impl.CloudSolrClient import org.apache.solr.client.solrj.request.UpdateRequest import org.apache.solr.client.solrj.response.UpdateResponse import org.apache.solr.common.SolrInputDocument - import scala.annotation.tailrec import scala.util.control.NonFatal - import scala.collection.immutable import scala.collection.JavaConverters._ @@ -93,6 +93,7 @@ private final class SolrFlowLogic[T, C]( client.add(collection, docs.asJava, settings.commitWithin) } + @nowarn("msg=deprecated") // FIXME #2917 Deprecated getIdField in Solrj 8.11.x private def atomicUpdateBulkToSolr(messages: immutable.Seq[WriteMessage[T, C]]): UpdateResponse = { val docs = messages.map { message => val doc = new SolrInputDocument() From 09c32271b01f5d0d704c440820772ba2488533e0 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Tue, 27 Sep 2022 09:59:24 +0200 Subject: [PATCH 3/4] more deprecations --- solr/src/test/java/docs/javadsl/SolrTest.java | 3 ++- .../test/scala/docs/scaladsl/SolrSpec.scala | 21 +++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/solr/src/test/java/docs/javadsl/SolrTest.java b/solr/src/test/java/docs/javadsl/SolrTest.java index fbf71664cd..25af5bd23f 100644 --- a/solr/src/test/java/docs/javadsl/SolrTest.java +++ b/solr/src/test/java/docs/javadsl/SolrTest.java @@ -45,6 +45,7 @@ import java.io.File; import java.io.IOException; +import java.nio.file.Path; import java.time.Duration; import java.util.*; import java.util.concurrent.CompletableFuture; @@ -830,7 +831,7 @@ private static void setupCluster() throws Exception { File confDir = new File("solr/src/test/resources/conf"); - String zkDir = testWorkingDir.toPath().resolve("zookeeper/server/data").toString(); + Path zkDir = testWorkingDir.toPath().resolve("zookeeper/server/data"); zkTestServer = new ZkTestServer(zkDir, zookeeperPort); zkTestServer.run(); diff --git a/solr/src/test/scala/docs/scaladsl/SolrSpec.scala b/solr/src/test/scala/docs/scaladsl/SolrSpec.scala index fa172fa33d..c42cb7be38 100644 --- a/solr/src/test/scala/docs/scaladsl/SolrSpec.scala +++ b/solr/src/test/scala/docs/scaladsl/SolrSpec.scala @@ -8,6 +8,8 @@ import java.io.File import java.util.concurrent.atomic.AtomicInteger import java.util.{Arrays, Optional} +import scala.annotation.nowarn + import akka.Done import akka.actor.ActorSystem import akka.stream.alpakka.solr._ @@ -26,10 +28,10 @@ import org.apache.solr.common.SolrInputDocument import org.junit.Assert.assertTrue import org.scalatest.concurrent.ScalaFutures import org.scalatest.BeforeAndAfterAll - import scala.collection.immutable import scala.concurrent.duration._ import scala.concurrent.{ExecutionContext, Future} + import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec @@ -365,7 +367,7 @@ class SolrSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll with Sca val deleteDocuments = SolrSource .fromTupleStream(stream2) .map { tuple: Tuple => - val id = tuple.fields.get("title").toString + val id = tuple.getFields.get("title").toString WriteMessage.createDeleteMessage[SolrInputDocument](id) } .groupedWithin(5, 10.millis) @@ -421,8 +423,8 @@ class SolrSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll with Sca val updateCollection = SolrSource .fromTupleStream(stream2) .map { tuple: Tuple => - val id = tuple.fields.get("title").toString - val comment = tuple.fields.get("comment").toString + val id = tuple.getFields.get("title").toString + val comment = tuple.getFields.get("comment").toString WriteMessage.createUpdateMessage[SolrInputDocument]( idField = "title", idValue = id, @@ -495,7 +497,7 @@ class SolrSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll with Sca val deleteElements = SolrSource .fromTupleStream(stream2) .map { tuple: Tuple => - val title = tuple.fields.get("title").toString + val title = tuple.getFields.get("title").toString WriteMessage.createDeleteMessage[Book](title) } .groupedWithin(5, 10.millis) @@ -554,8 +556,8 @@ class SolrSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll with Sca WriteMessage .createUpdateMessage[Book]( idField = "title", - tuple.fields.get("title").toString, - updates = Map("comment" -> Map("set" -> (s"${tuple.fields.get("comment")} It is a good book!!!"))) + tuple.getFields.get("title").toString, + updates = Map("comment" -> Map("set" -> (s"${tuple.getFields.get("comment")} It is a good book!!!"))) ) .withRoutingFieldValue("router-value") } @@ -623,7 +625,7 @@ class SolrSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll with Sca val deleteByQuery = SolrSource .fromTupleStream(stream2) .map { tuple: Tuple => - val title = tuple.fields.get("title").toString + val title = tuple.getFields.get("title").toString WriteMessage.createDeleteByQueryMessage[SolrInputDocument]( s"""title:"$title" """ ) @@ -746,6 +748,7 @@ class SolrSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll with Sca TestKit.shutdownActorSystem(system) } + @nowarn("msg=deprecated") // FIXME #2917 Deprecated getIdField in Solrj 8.11.x private def setupCluster(): Unit = { val targetDir = new File("solr/target") val testWorkingDir = @@ -755,7 +758,7 @@ class SolrSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll with Sca val confDir = new File("solr/src/test/resources/conf") - val zkDir = testWorkingDir.toPath.resolve("zookeeper/server/data").toString + val zkDir = testWorkingDir.toPath.resolve("zookeeper/server/data") zkTestServer = new ZkTestServer(zkDir, zookeeperPort) zkTestServer.run() From 9b7f8d82c236c092eda80c0cd694287f1c0669cb Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Tue, 27 Sep 2022 10:25:19 +0200 Subject: [PATCH 4/4] supress more warning --- solr/src/test/java/docs/javadsl/SolrTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/solr/src/test/java/docs/javadsl/SolrTest.java b/solr/src/test/java/docs/javadsl/SolrTest.java index 25af5bd23f..c26d36777a 100644 --- a/solr/src/test/java/docs/javadsl/SolrTest.java +++ b/solr/src/test/java/docs/javadsl/SolrTest.java @@ -58,6 +58,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +@SuppressWarnings("deprecation") // FIXME #2917 Deprecated getIdField in Solrj 8.11.x public class SolrTest { @Rule public final LogCapturingJunit4 logCapturing = new LogCapturingJunit4();