Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update solrj dependency to 8.11.1 #2918

Merged
merged 4 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand All @@ -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._

Expand Down Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion solr/src/test/java/docs/javadsl/SolrTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -57,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();

Expand Down Expand Up @@ -830,7 +832,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();

Expand Down
21 changes: 12 additions & 9 deletions solr/src/test/scala/docs/scaladsl/SolrSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand All @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
}
Expand Down Expand Up @@ -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" """
)
Expand Down Expand Up @@ -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 =
Expand All @@ -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()

Expand Down