Skip to content

Commit e8191f9

Browse files
authored
Update solrj dependency to 8.11.1 (#2918)
* 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 * supress warning * more deprecations * supress more warning
1 parent 5b10ebe commit e8191f9

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

project/Dependencies.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,8 @@ object Dependencies {
466466
) ++ Mockito
467467
)
468468

469-
val SolrjVersion = "7.7.3"
470-
val SolrVersionForDocs = "7_7"
469+
val SolrjVersion = "8.11.1"
470+
val SolrVersionForDocs = "8_11"
471471

472472
val Solr = Seq(
473473
libraryDependencies ++= Seq(

solr/src/main/scala/akka/stream/alpakka/solr/impl/SolrFlowStage.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
package akka.stream.alpakka.solr.impl
66

7+
import scala.annotation.nowarn
8+
79
import akka.annotation.InternalApi
810
import akka.stream.ActorAttributes.SupervisionStrategy
911
import akka.stream._
@@ -14,10 +16,8 @@ import org.apache.solr.client.solrj.impl.CloudSolrClient
1416
import org.apache.solr.client.solrj.request.UpdateRequest
1517
import org.apache.solr.client.solrj.response.UpdateResponse
1618
import org.apache.solr.common.SolrInputDocument
17-
1819
import scala.annotation.tailrec
1920
import scala.util.control.NonFatal
20-
2121
import scala.collection.immutable
2222
import scala.collection.JavaConverters._
2323

@@ -93,6 +93,7 @@ private final class SolrFlowLogic[T, C](
9393
client.add(collection, docs.asJava, settings.commitWithin)
9494
}
9595

96+
@nowarn("msg=deprecated") // FIXME #2917 Deprecated getIdField in Solrj 8.11.x
9697
private def atomicUpdateBulkToSolr(messages: immutable.Seq[WriteMessage[T, C]]): UpdateResponse = {
9798
val docs = messages.map { message =>
9899
val doc = new SolrInputDocument()

solr/src/test/java/docs/javadsl/SolrTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545

4646
import java.io.File;
4747
import java.io.IOException;
48+
import java.nio.file.Path;
4849
import java.time.Duration;
4950
import java.util.*;
5051
import java.util.concurrent.CompletableFuture;
@@ -57,6 +58,7 @@
5758
import static org.junit.Assert.assertEquals;
5859
import static org.junit.Assert.assertTrue;
5960

61+
@SuppressWarnings("deprecation") // FIXME #2917 Deprecated getIdField in Solrj 8.11.x
6062
public class SolrTest {
6163
@Rule public final LogCapturingJunit4 logCapturing = new LogCapturingJunit4();
6264

@@ -830,7 +832,7 @@ private static void setupCluster() throws Exception {
830832

831833
File confDir = new File("solr/src/test/resources/conf");
832834

833-
String zkDir = testWorkingDir.toPath().resolve("zookeeper/server/data").toString();
835+
Path zkDir = testWorkingDir.toPath().resolve("zookeeper/server/data");
834836
zkTestServer = new ZkTestServer(zkDir, zookeeperPort);
835837
zkTestServer.run();
836838

solr/src/test/scala/docs/scaladsl/SolrSpec.scala

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import java.io.File
88
import java.util.concurrent.atomic.AtomicInteger
99
import java.util.{Arrays, Optional}
1010

11+
import scala.annotation.nowarn
12+
1113
import akka.Done
1214
import akka.actor.ActorSystem
1315
import akka.stream.alpakka.solr._
@@ -26,10 +28,10 @@ import org.apache.solr.common.SolrInputDocument
2628
import org.junit.Assert.assertTrue
2729
import org.scalatest.concurrent.ScalaFutures
2830
import org.scalatest.BeforeAndAfterAll
29-
3031
import scala.collection.immutable
3132
import scala.concurrent.duration._
3233
import scala.concurrent.{ExecutionContext, Future}
34+
3335
import org.scalatest.matchers.should.Matchers
3436
import org.scalatest.wordspec.AnyWordSpec
3537

@@ -365,7 +367,7 @@ class SolrSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll with Sca
365367
val deleteDocuments = SolrSource
366368
.fromTupleStream(stream2)
367369
.map { tuple: Tuple =>
368-
val id = tuple.fields.get("title").toString
370+
val id = tuple.getFields.get("title").toString
369371
WriteMessage.createDeleteMessage[SolrInputDocument](id)
370372
}
371373
.groupedWithin(5, 10.millis)
@@ -421,8 +423,8 @@ class SolrSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll with Sca
421423
val updateCollection = SolrSource
422424
.fromTupleStream(stream2)
423425
.map { tuple: Tuple =>
424-
val id = tuple.fields.get("title").toString
425-
val comment = tuple.fields.get("comment").toString
426+
val id = tuple.getFields.get("title").toString
427+
val comment = tuple.getFields.get("comment").toString
426428
WriteMessage.createUpdateMessage[SolrInputDocument](
427429
idField = "title",
428430
idValue = id,
@@ -495,7 +497,7 @@ class SolrSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll with Sca
495497
val deleteElements = SolrSource
496498
.fromTupleStream(stream2)
497499
.map { tuple: Tuple =>
498-
val title = tuple.fields.get("title").toString
500+
val title = tuple.getFields.get("title").toString
499501
WriteMessage.createDeleteMessage[Book](title)
500502
}
501503
.groupedWithin(5, 10.millis)
@@ -554,8 +556,8 @@ class SolrSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll with Sca
554556
WriteMessage
555557
.createUpdateMessage[Book](
556558
idField = "title",
557-
tuple.fields.get("title").toString,
558-
updates = Map("comment" -> Map("set" -> (s"${tuple.fields.get("comment")} It is a good book!!!")))
559+
tuple.getFields.get("title").toString,
560+
updates = Map("comment" -> Map("set" -> (s"${tuple.getFields.get("comment")} It is a good book!!!")))
559561
)
560562
.withRoutingFieldValue("router-value")
561563
}
@@ -623,7 +625,7 @@ class SolrSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll with Sca
623625
val deleteByQuery = SolrSource
624626
.fromTupleStream(stream2)
625627
.map { tuple: Tuple =>
626-
val title = tuple.fields.get("title").toString
628+
val title = tuple.getFields.get("title").toString
627629
WriteMessage.createDeleteByQueryMessage[SolrInputDocument](
628630
s"""title:"$title" """
629631
)
@@ -746,6 +748,7 @@ class SolrSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll with Sca
746748
TestKit.shutdownActorSystem(system)
747749
}
748750

751+
@nowarn("msg=deprecated") // FIXME #2917 Deprecated getIdField in Solrj 8.11.x
749752
private def setupCluster(): Unit = {
750753
val targetDir = new File("solr/target")
751754
val testWorkingDir =
@@ -755,7 +758,7 @@ class SolrSpec extends AnyWordSpec with Matchers with BeforeAndAfterAll with Sca
755758

756759
val confDir = new File("solr/src/test/resources/conf")
757760

758-
val zkDir = testWorkingDir.toPath.resolve("zookeeper/server/data").toString
761+
val zkDir = testWorkingDir.toPath.resolve("zookeeper/server/data")
759762
zkTestServer = new ZkTestServer(zkDir, zookeeperPort)
760763
zkTestServer.run()
761764

0 commit comments

Comments
 (0)