Skip to content

Commit

Permalink
Merge pull request #874 from nvollmar/wip-864-scala213-deprecations-nvo
Browse files Browse the repository at this point in the history
  • Loading branch information
octonato authored Mar 22, 2021
2 parents 71cf13b + a12c00f commit 53222ef
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import java.{ util => ju }

import akka.util.OptionVal
import akka.serialization.Serialization
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import java.nio.ByteBuffer

import com.datastax.oss.protocol.internal.util.Bytes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class KeyspaceAndTableStatements(
* Cassandra plugin actor.
*/
def getCreateJournalTablesStatements: java.util.List[String] = {
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
createJournalTablesStatements.asJava
}

Expand Down Expand Up @@ -78,7 +78,7 @@ class KeyspaceAndTableStatements(
* Cassandra plugin actor.
*/
def getCreateSnapshotTablesStatements: java.util.List[String] = {
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
createSnapshotTablesStatements.asJava
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package akka.persistence.cassandra.compaction

import com.typesafe.config.{ Config, ConfigFactory }

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

/*
* Based upon https://github.com/apache/cassandra/blob/cassandra-2.2/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import akka.persistence.cassandra.PluginSettings
import akka.persistence.cassandra.journal.CassandraJournal.{ Serialized, TagPidSequenceNr }
import com.datastax.oss.driver.api.core.cql.{ PreparedStatement, Row, Statement }

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.concurrent.{ ExecutionContext, Future }
import java.lang.{ Long => JLong }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import com.datastax.oss.driver.api.core.uuid.Uuids
import com.datastax.oss.protocol.internal.util.Bytes

import scala.annotation.tailrec
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.collection.immutable
import scala.collection.immutable.Seq
import scala.concurrent._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import akka.serialization.Serialization

import scala.concurrent._
import scala.util.control.NonFatal
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import com.typesafe.config.{ Config, ConfigValueType }
import akka.actor.ActorSystem
import akka.actor.ExtendedActorSystem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ abstract class CassandraSpec(
override def write(b: Int): Unit = oldOut.write(b)
}) {
override def println(x: Any): Unit =
oldOut.println(prefix + String.valueOf(x).replaceAllLiterally("\n", s"\n$prefix"))
oldOut.println(prefix + String.valueOf(x).replace("\n", s"\n$prefix"))
}

Console.withOut(prefixingOut) {
Expand All @@ -171,7 +171,7 @@ abstract class CassandraSpec(
try {
if (failed && dumpRowsOnFailure) {
println("RowDump::")
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
if (system.settings.config.getBoolean("akka.persistence.cassandra.events-by-tag.enabled")) {
println("tag_views")
cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package akka.persistence.cassandra

import akka.persistence.cassandra.query.TestActor
import akka.persistence.cassandra.query._
import akka.persistence.journal.Tagged
import akka.persistence.query.NoOffset
import akka.stream.testkit.TestSubscriber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ class CleanupSpec extends CassandraSpec(CleanupSpec.config) with DirectWriting {
}

private def allSnapshots(pid: String): Seq[SnapshotMetadata] = {
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
cluster
.execute(s"select * from ${snapshotName}.snapshots where persistence_id = '${pid}' order by sequence_nr")
.asScala
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TagScanningSpec extends CassandraSpec(TagScanningSpec.config) {
}

awaitAssert {
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
val expected = (0 until nrActors).map(n => (s"$n".toInt, 1L)).toList
val scanning = cluster
.execute(s"select * from ${journalName}.tag_scanning")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package akka.persistence.cassandra.journal

import java.nio.ByteBuffer
import java.util.UUID

import akka.Done
import akka.actor.{ ActorRef, ActorSystem }
import akka.event.Logging.Warning
Expand All @@ -24,6 +23,7 @@ import com.typesafe.config.{ Config, ConfigFactory }
import org.scalatest.{ BeforeAndAfterAll, BeforeAndAfterEach }
import org.scalatest.wordspec.AnyWordSpecLike

import scala.collection.compat.immutable.LazyList
import scala.concurrent.duration._
import scala.concurrent.{ ExecutionContext, Future, Promise }
import scala.util.control.NoStackTrace
Expand Down Expand Up @@ -115,7 +115,7 @@ class TagWriterSpec
val sender3 = TestProbe()
val (probe, ref) =
setup(
writeResponse = Stream(promiseForWrite.future) ++ Stream.continually(Future.successful(Done)),
writeResponse = LazyList(promiseForWrite.future) ++ LazyList.continually(Future.successful(Done)),
settings = defaultSettings.copy(maxBatchSize = 2))
val bucket = nowBucket()
val e1 = event("p1", 1L, "e-1", bucket)
Expand Down Expand Up @@ -148,7 +148,7 @@ class TagWriterSpec
val promiseForWrite = Promise[Done]()
val (probe, ref) =
setup(
writeResponse = Stream(promiseForWrite.future) ++ Stream.continually(Future.successful(Done)),
writeResponse = LazyList(promiseForWrite.future) ++ LazyList.continually(Future.successful(Done)),
settings = defaultSettings.copy(maxBatchSize = 1))
val bucket = nowBucket()
val e1 = event("p1", 1L, "e-1", bucket)
Expand All @@ -174,7 +174,7 @@ class TagWriterSpec
val promiseForWrite = Promise[Done]()
val (probe, ref) =
setup(
writeResponse = Stream(promiseForWrite.future) ++ Stream.continually(Future.successful(Done)),
writeResponse = LazyList(promiseForWrite.future) ++ LazyList.continually(Future.successful(Done)),
settings = defaultSettings.copy(maxBatchSize = 2))
val bucket = nowBucket()
val e1 = event("p1", 1L, "e-1", bucket)
Expand Down Expand Up @@ -326,7 +326,7 @@ class TagWriterSpec
val promiseForWrite = Promise[Done]()
val (probe, ref) =
setup(
writeResponse = Stream(promiseForWrite.future) ++ Stream.continually(Future.successful(Done)),
writeResponse = LazyList(promiseForWrite.future) ++ LazyList.continually(Future.successful(Done)),
settings = defaultSettings.copy(maxBatchSize = 2))
val bucket = nowBucket()

Expand All @@ -348,7 +348,7 @@ class TagWriterSpec
val promiseForWrite = Promise[Done]()
val (probe, ref) =
setup(
writeResponse = Stream(promiseForWrite.future) ++ Stream.continually(Future.successful(Done)),
writeResponse = LazyList(promiseForWrite.future) ++ LazyList.continually(Future.successful(Done)),
settings = defaultSettings.copy(maxBatchSize = 2))
val now = Uuids.timeBased()
val bucketOne = TimeBucket(now, bucketSize)
Expand Down Expand Up @@ -393,7 +393,7 @@ class TagWriterSpec
val promiseForWrite = Promise[Done]()
val (probe, ref) =
setup(
writeResponse = Stream(promiseForWrite.future) ++ Stream.continually(Future.successful(Done)),
writeResponse = LazyList(promiseForWrite.future) ++ LazyList.continually(Future.successful(Done)),
settings = defaultSettings.copy(maxBatchSize = 2))
val bucket = nowBucket()

Expand All @@ -415,7 +415,7 @@ class TagWriterSpec
"do not internal flush if write in progress with no interval" in new Setup {
val promiseForWrite = Promise[Done]()
val (probe, ref) = setup(
writeResponse = Stream(promiseForWrite.future) ++ Stream.continually(Future.successful(Done)),
writeResponse = LazyList(promiseForWrite.future) ++ LazyList.continually(Future.successful(Done)),
settings = defaultSettings.copy(maxBatchSize = 3, flushInterval = 0.millis))
val bucket = nowBucket()

Expand All @@ -437,7 +437,7 @@ class TagWriterSpec
"not flush if internal flush is in progress" in new Setup {
val promiseForWrite = Promise[Done]()
val (probe, ref) = setup(
writeResponse = Stream(promiseForWrite.future) ++ Stream.continually(Future.successful(Done)),
writeResponse = LazyList(promiseForWrite.future) ++ LazyList.continually(Future.successful(Done)),
settings = defaultSettings.copy(maxBatchSize = 2, flushInterval = 500.millis))
val bucket = nowBucket()

Expand Down Expand Up @@ -541,7 +541,7 @@ class TagWriterSpec
val (probe, ref) =
setup(
settings = defaultSettings.copy(maxBatchSize = 1),
writeResponse = Stream(writeInProgressPromise.future) ++ Stream.continually(Future.successful(Done)))
writeResponse = LazyList(writeInProgressPromise.future) ++ LazyList.continually(Future.successful(Done)))
val bucket = nowBucket()

ref ! ResetPersistenceId(tagName, initialProgress)
Expand Down Expand Up @@ -611,7 +611,7 @@ class TagWriterSpec
val (probe, underTest) =
setup(
settings = defaultSettings.copy(maxBatchSize = 1),
writeResponse = Stream(writeInProgressPromise.future) ++ Stream.continually(Future.successful(Done)))
writeResponse = LazyList(writeInProgressPromise.future) ++ LazyList.continually(Future.successful(Done)))
val bucket = nowBucket()

val e1 = event(pid, 1L, "e-1", bucket)
Expand Down Expand Up @@ -648,7 +648,7 @@ class TagWriterSpec
val idleTimeout = 1.second
val (probe, ref) =
setupWithParent(
writeResponse = Stream(promiseForWrite.future) ++ Stream.continually(Future.successful(Done)),
writeResponse = LazyList(promiseForWrite.future) ++ LazyList.continually(Future.successful(Done)),
settings = defaultSettings.copy(maxBatchSize = 2, stopTagWriterWhenIdle = idleTimeout),
parent = parent.ref)
val bucket = nowBucket()
Expand All @@ -671,7 +671,7 @@ class TagWriterSpec
val t = TestEx("Tag write failed")
val (probe, ref) = setup(
settings = defaultSettings.copy(maxBatchSize = 2),
writeResponse = Stream(Future.failed(t)) ++ Stream.continually(Future.successful(Done)))
writeResponse = LazyList(Future.failed(t)) ++ LazyList.continually(Future.successful(Done)))
val bucket = nowBucket()

val e1 = event("p1", 1L, "e-1", bucket)
Expand Down Expand Up @@ -703,7 +703,7 @@ class TagWriterSpec
val (probe, ref) =
setup(
settings = defaultSettings.copy(maxBatchSize = 2),
progressWriteResponse = Stream(Future.failed(t)) ++ Stream.continually(Future.successful(Done)))
progressWriteResponse = LazyList(Future.failed(t)) ++ LazyList.continually(Future.successful(Done)))
val bucket = nowBucket()

val e1 = event("p1", 1L, "e-1", bucket)
Expand Down Expand Up @@ -734,17 +734,17 @@ class TagWriterSpec
private def setup(
tag: String = "tag-1",
settings: TagWriterSettings,
writeResponse: Stream[Future[Done]] = Stream.continually(Future.successful(Done)),
progressWriteResponse: Stream[Future[Done]] = Stream.continually(Future.successful(Done)))
writeResponse: LazyList[Future[Done]] = LazyList.continually(Future.successful(Done)),
progressWriteResponse: LazyList[Future[Done]] = LazyList.continually(Future.successful(Done)))
: (TestProbe, ActorRef) = {
setupWithParent(tag, settings, writeResponse, progressWriteResponse, TestProbe().ref)
}

private def setupWithParent(
tag: String = "tag-1",
settings: TagWriterSettings,
writeResponse: Stream[Future[Done]] = Stream.continually(Future.successful(Done)),
progressWriteResponse: Stream[Future[Done]] = Stream.continually(Future.successful(Done)),
writeResponse: LazyList[Future[Done]] = LazyList.continually(Future.successful(Done)),
progressWriteResponse: LazyList[Future[Done]] = LazyList.continually(Future.successful(Done)),
parent: ActorRef): (TestProbe, ActorRef) = {
var writeResponseStream = writeResponse
var progressWriteResponseStream = progressWriteResponse
Expand Down
1 change: 1 addition & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ object Dependencies {
"com.typesafe.akka" %% "akka-persistence" % AkkaVersion,
"com.typesafe.akka" %% "akka-persistence-query" % AkkaVersion,
"com.typesafe.akka" %% "akka-cluster-tools" % AkkaVersion,
"org.scala-lang.modules" %% "scala-collection-compat" % "2.4.2",
Logback % Test,
"org.scalatest" %% "scalatest" % "3.1.0" % Test,
"org.pegdown" % "pegdown" % "1.6.0" % Test,
Expand Down

0 comments on commit 53222ef

Please sign in to comment.