Skip to content

Commit

Permalink
Upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
barryoneill committed Oct 10, 2024
1 parent 49820af commit a1c2def
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.laserdisc.mysql.binlog.models

import com.github.shyiko.mysql.binlog.event.{ EventType, EventHeaderV4 => JEventHeaderV4 }
import com.github.shyiko.mysql.binlog.event.{ EventHeaderV4 => JEventHeaderV4, EventType }

object EventHeaderV4 {
def unapply(arg: JEventHeaderV4): Option[(EventType, Long, Long)] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package io.laserdisc.mysql.binlog.models
import cats.effect.IO
import com.dimafeng.testcontainers.ForAllTestContainer
import db.MySqlContainer
import doobie.util.transactor.Transactor
import doobie.util.transactor.Transactor.Aux
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec
import cats.effect.unsafe.implicits.global
import doobie.util.transactor.Transactor

import java.util.Properties

class SchemaMetadataTest
extends AnyWordSpec
Expand All @@ -19,11 +21,17 @@ class SchemaMetadataTest

"restore schema state from DB" in {
implicit val testTransactor: Aux[IO, Unit] =
Transactor.fromDriverManager[IO](
mySqlContainer.getDriverClassName,
s"${mySqlContainer.getJdbcUrl}?useSSL=false",
mySqlContainer.getUsername,
mySqlContainer.getPassword
Transactor.fromDriverManager(
driver = mySqlContainer.getDriverClassName,
url = s"${mySqlContainer.getJdbcUrl}?useSSL=false",
info = {
// ugh
val p = new Properties()
p.put("user", mySqlContainer.getUsername)
p.put("password", mySqlContainer.getPassword)
p
},
None
)
val schemaState =
SchemaMetadata.buildSchemaMetadata("test").unsafeRunSync()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ package object compaction {
case None => acc.remove(emId)
}
}
//TODO: use this code, once Scala 2.12 support ends, or updateWith back ported to 2.12A
// TODO: use this code, once Scala 2.12 support ends, or updateWith back ported to 2.12A
// acc.updateWith(evt.pk) {
// case Some(latest) =>
// mkNewEvent(evt).andThen(finalizeNewEvent).run(latest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ package object config {

val blc = new BinaryLogClient(v.host, v.port, v.user, v.password)

blc.setEventDeserializer({
blc.setEventDeserializer {
val ed = new EventDeserializer()
ed.setCompatibilityMode(
CompatibilityMode.DATE_AND_TIME_AS_LONG_MICRO,
CompatibilityMode.CHAR_AND_BINARY_AS_BYTE_ARRAY
)
ed
})
}

blc.setSSLMode(if (v.useSSL) SSLMode.VERIFY_IDENTITY else SSLMode.DISABLED)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ object MysqlBinlogStream {
client: BinaryLogClient
): Stream[F, Event] =
for {
d <- Stream.resource(Dispatcher[F])
d <- Stream.resource(Dispatcher.parallel[F])
q <- Stream.eval(Queue.bounded[F, Option[Event]](10000))
proc = new MysSqlBinlogEventProcessor[F](client, q, d)
/* some difficulties here during the cats3 migration. Basically, we would have used:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import com.github.shyiko.mysql.binlog.event.EventType.{ EXT_UPDATE_ROWS, UPDATE_
import com.github.shyiko.mysql.binlog.event.{
Event,
EventData,
EventType,
EventHeaderV4 => JEventHeaderV4
EventHeaderV4 => JEventHeaderV4,
EventType
}
import org.typelevel.log4cats.Logger
import io.circe.Json
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import sbt.Keys.scalaSource
organization := "io.laserdisc"
name := "mysql-binlog-stream"

ThisBuild / scalaVersion := "2.13.9"
ThisBuild / scalaVersion := "2.13.15"

lazy val commonSettings = Seq(
organization := "io.laserdisc",
Expand Down
6 changes: 3 additions & 3 deletions mysql-binlog-stream-examples/app/main/BinLogListener.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ object BinLogListener extends IOApp {
database.transactor[IO](config).use { implicit xa =>
for {
implicit0(logger: Logger[IO]) <- Slf4jLogger.fromName[IO]("application")
//Here we do not provide binlog offset, client will be initialized with default file and offset
// Here we do not provide binlog offset, client will be initialized with default file and offset
binlogClient <- client.createBinLogClient[IO](config)
schemaMetadata <- SchemaMetadata.buildSchemaMetadata(config.schema)
transactionState <- TransactionState
Expand All @@ -51,10 +51,10 @@ object BinLogListener extends IOApp {
.rawEvents[IO](binlogClient)
.through(streamEvents[IO](transactionState))
.evalTap(msg => logger.info(s"received $msg"))
//Here you should do the checkpoint
// Here you should do the checkpoint
.compile
.drain
} yield (ExitCode.Success)
} yield ExitCode.Success
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class BinLogConfigSpec extends AnyWordSpec with Matchers {

"not expose password on toString" in {

template.copy(password = "TOPSECRET").toString should not include ("TOPSECRET")
template.copy(password = "TOPSECRET").toString should not include "TOPSECRET"

}

Expand Down
40 changes: 20 additions & 20 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,36 @@ import sbt.Keys.{ libraryDependencies, _ }
import sbt._

object Dependencies {
val cirisVersion = "2.4.0"
val doobieVersion = "1.0.0-RC2"
val circeVersion = "0.14.1"
val catsEffectVersion = "3.3.14"
val cirisVersion = "3.6.0"
val doobieVersion = "1.0.0-RC6"
val circeVersion = "0.14.10"
val catsEffectVersion = "3.5.4"

val TestLib = Seq(
libraryDependencies ++= Seq(
"org.scalamock" %% "scalamock" % "5.2.0" % Test,
"org.scalatest" %% "scalatest" % "3.2.14" % Test,
"com.dimafeng" %% "testcontainers-scala" % "0.40.11" % Test,
"org.testcontainers" % "mysql" % "1.17.5" % Test,
"org.testcontainers" % "testcontainers" % "1.17.5" % Test
"org.scalamock" %% "scalamock" % "6.0.0" % Test,
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
"com.dimafeng" %% "testcontainers-scala" % "0.41.4" % Test,
"org.testcontainers" % "mysql" % "1.20.2" % Test,
"org.testcontainers" % "testcontainers" % "1.20.2" % Test
)
)

val Config = Seq(
libraryDependencies ++= Seq(
"is.cir" %% "ciris-enumeratum" % cirisVersion,
"is.cir" %% "ciris-refined" % cirisVersion,
"eu.timepit" %% "refined" % "0.10.1"
"eu.timepit" %% "refined" % "0.11.2"
)
)

val Logging = Seq(
libraryDependencies ++= Seq(
"ch.qos.logback" % "logback-classic" % "1.4.4",
"ch.qos.logback" % "logback-core" % "1.4.4",
"org.slf4j" % "jcl-over-slf4j" % "2.0.3",
"org.slf4j" % "jul-to-slf4j" % "2.0.3",
"org.typelevel" %% "log4cats-slf4j" % "2.5.0"
"ch.qos.logback" % "logback-classic" % "1.5.9",
"ch.qos.logback" % "logback-core" % "1.5.9",
"org.slf4j" % "jcl-over-slf4j" % "2.0.16",
"org.slf4j" % "jul-to-slf4j" % "2.0.16",
"org.typelevel" %% "log4cats-slf4j" % "2.7.0"
)
)

Expand All @@ -41,8 +41,8 @@ object Dependencies {
"org.tpolecat" %% "doobie-hikari" % doobieVersion, // HikariCP transactor.
"org.tpolecat" %% "doobie-refined" % doobieVersion, // Postgres driver 42.1.4 + type mappings.
"org.tpolecat" %% "doobie-scalatest" % doobieVersion % Test, // Support for doobie scalatest
"mysql" % "mysql-connector-java" % "8.0.30",
"com.zendesk" % "mysql-binlog-connector-java" % "0.27.3"
"mysql" % "mysql-connector-java" % "8.0.33",
"com.zendesk" % "mysql-binlog-connector-java" % "0.29.2"
)
)

Expand All @@ -51,7 +51,7 @@ object Dependencies {
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"io.circe" %% "circe-optics" % circeVersion % Test
"io.circe" %% "circe-optics" % "0.15.0" % Test
)
)

Expand All @@ -64,8 +64,8 @@ object Dependencies {
val XML = Seq(
libraryDependencies ++= Seq(
"javax.xml.bind" % "jaxb-api" % "2.3.1",
"com.sun.xml.bind" % "jaxb-impl" % "4.0.1",
"com.sun.xml.bind" % "jaxb-core" % "4.0.1",
"com.sun.xml.bind" % "jaxb-impl" % "4.0.5",
"com.sun.xml.bind" % "jaxb-core" % "4.0.5",
"javax.activation" % "activation" % "1.1.1"
)
)
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.7.2
sbt.version=1.10.2
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.2")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.14")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7")

0 comments on commit a1c2def

Please sign in to comment.