Skip to content

Commit

Permalink
Switch from akka to pekko (#1)
Browse files Browse the repository at this point in the history
* migrate from Akka 2.5.31 and Akka HTTP 10.1.12 to Pekko 1.0.1 and Pekko HTTP 1.0.0
* drop Scala 2.11 support
  • Loading branch information
marko-asplund authored Dec 16, 2023
1 parent c51b21d commit 994bbd2
Show file tree
Hide file tree
Showing 41 changed files with 155 additions and 147 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

0.5.0
=======
* migrate from Akka 2.5.31 and Akka HTTP 10.1.12 to Pekko 1.0.1 and Pekko HTTP 1.0.0
* drop Scala 2.11 support

0.2.7
=======
* fork project and update publish info
Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Not supported features (these might be implemented later):

## Installation

s3mock package is available for Scala 2.11/2.12/2.13 (on Java 8/11). To install using SBT, add these
s3mock package is available for Scala 2.12/2.13 (on Java 8/11). To install using SBT, add these
statements to your `build.sbt`:

libraryDependencies += "io.github.marko-asplund" %% "s3mock" % "0.2.6" % "test",
Expand Down Expand Up @@ -133,25 +133,25 @@ Scala with AWS S3 SDK:
api.shutdown() // this one terminates the actor system. Use api.stop() to just unbind the service without messing with the ActorSystem
```

Scala with Alpakka 1.0.0:
Scala with Pekko Connectors 1.0:
```scala
import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import akka.stream.alpakka.s3.scaladsl.S3Client
import akka.stream.scaladsl.Sink
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.stream.ActorMaterializer
import org.apache.pekko.stream.connectors.s3.scaladsl.S3
import org.apache.pekko.stream.scaladsl.Sink
import com.typesafe.config.ConfigFactory
import scala.collection.JavaConverters._

val config = ConfigFactory.parseMap(Map(
"alpakka.s3.proxy.host" -> "localhost",
"alpakka.s3.proxy.port" -> 8001,
"alpakka.s3.proxy.secure" -> false,
"alpakka.s3.path-style-access" -> true,
"alpakka.s3.aws.credentials.provider" -> "static",
"alpakka.s3.aws.credentials.access-key-id" -> "foo",
"alpakka.s3.aws.credentials.secret-access-key" -> "bar",
"alpakka.s3.aws.region.provider" -> "static",
"alpakka.s3.aws.region.default-region" -> "us-east-1"
"pekko.connectors.s3.proxy.host" -> "localhost",
"pekko.connectors.s3.proxy.port" -> 8001,
"pekko.connectors.s3.proxy.secure" -> false,
"pekko.connectors.s3.path-style-access" -> true,
"pekko.connectors.s3.aws.credentials.provider" -> "static",
"pekko.connectors.s3.aws.credentials.access-key-id" -> "foo",
"pekko.connectors.s3.aws.credentials.secret-access-key" -> "bar",
"pekko.connectors.s3.aws.region.provider" -> "static",
"pekko.connectors.s3.aws.region.default-region" -> "us-east-1"
).asJava)
implicit val system = ActorSystem.create("test", config)
implicit val mat = ActorMaterializer()
Expand Down
15 changes: 8 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
name := "s3mock"

version := "0.2.7-SNAPSHOT"
version := "0.3.0-SNAPSHOT"

scalaVersion in ThisBuild := "2.13.2"

crossScalaVersions in ThisBuild := Seq("2.11.12", "2.12.10","2.13.2")
crossScalaVersions in ThisBuild := Seq("2.12.10", "2.13.2")

val akkaVersion = "2.5.31"
val pekkoVersion = "1.0.1"
val pekkoHttpVersion = "1.0.0"

libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
"com.typesafe.akka" %% "akka-http" % "10.1.12",
"com.typesafe.akka" %% "akka-stream-testkit" % akkaVersion % "test",
"org.apache.pekko" %% "pekko-stream" % pekkoVersion,
"org.apache.pekko" %% "pekko-http" % pekkoHttpVersion,
"org.apache.pekko" %% "pekko-stream-testkit" % pekkoVersion % Test,
"org.scala-lang.modules" %% "scala-xml" % "1.3.0",
"org.scala-lang.modules" %% "scala-collection-compat" % "2.1.6",
"com.github.pathikrit" %% "better-files" % "3.9.1",
Expand All @@ -20,7 +21,7 @@ libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.8" % "test",
"ch.qos.logback" % "logback-classic" % "1.2.3" % "test",
"org.iq80.leveldb" % "leveldb" % "0.12",
"com.lightbend.akka" %% "akka-stream-alpakka-s3" % "1.1.2" % "test",
"org.apache.pekko" %% "pekko-connectors-s3" % pekkoVersion % "test",
"javax.xml.bind" % "jaxb-api" % "2.3.0",
"com.sun.xml.bind" % "jaxb-core" % "2.3.0",
"com.sun.xml.bind" % "jaxb-impl" % "2.3.0"
Expand Down
1 change: 0 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")
addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.5.0")

9 changes: 6 additions & 3 deletions src/main/resources/application.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
akka.http.parsing.illegal-header-warnings = off
pekko.http.parsing.illegal-header-warnings = off

akka.http.server.parsing.max-content-length = 512 M
akka.http.client.parsing.max-content-length = 512 M
pekko.http.server.parsing.max-content-length = 512 M
pekko.http.client.parsing.max-content-length = 512 M

# see https://github.com/akka/akka-http/issues/2088
pekko.http.server.transparent-head-requests = true
6 changes: 3 additions & 3 deletions src/main/scala/io/findify/s3mock/S3ChunkedProtocolStage.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.findify.s3mock

import akka.stream._
import akka.stream.stage.{GraphStage, GraphStageLogic, InHandler, OutHandler}
import akka.util.ByteString
import org.apache.pekko.stream._
import org.apache.pekko.stream.stage.{GraphStage, GraphStageLogic, InHandler, OutHandler}
import org.apache.pekko.util.ByteString
import com.typesafe.scalalogging.LazyLogging

/**
Expand Down
10 changes: 5 additions & 5 deletions src/main/scala/io/findify/s3mock/S3Mock.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.findify.s3mock

import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.{HttpResponse, StatusCodes}
import akka.http.scaladsl.server.Directives._
import akka.stream.ActorMaterializer
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.http.scaladsl.model.{HttpResponse, StatusCodes}
import org.apache.pekko.http.scaladsl.server.Directives._
import org.apache.pekko.stream.ActorMaterializer
import com.typesafe.scalalogging.LazyLogging
import io.findify.s3mock.provider.{FileProvider, InMemoryProvider, Provider}
import io.findify.s3mock.route._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.findify.s3mock.provider
import java.util.UUID
import java.io.{FileInputStream, File => JFile}

import akka.http.scaladsl.model.DateTime
import org.apache.pekko.http.scaladsl.model.DateTime
import better.files.File
import better.files.File.OpenOptions
import com.amazonaws.services.s3.model.ObjectMetadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package io.findify.s3mock.provider
import java.time.Instant
import java.util.{Date, UUID}

import akka.http.scaladsl.model.DateTime
import org.apache.pekko.http.scaladsl.model.DateTime
import com.amazonaws.services.s3.model.ObjectMetadata
import com.typesafe.scalalogging.LazyLogging
import io.findify.s3mock.error.{NoSuchBucketException, NoSuchKeyException}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.findify.s3mock.response

import akka.http.scaladsl.model.DateTime
import org.apache.pekko.http.scaladsl.model.DateTime


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.findify.s3mock.response

import akka.http.scaladsl.model.DateTime
import org.apache.pekko.http.scaladsl.model.DateTime


/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/io/findify/s3mock/response/ListBucket.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.findify.s3mock.response

import akka.http.scaladsl.model.DateTime
import org.apache.pekko.http.scaladsl.model.DateTime


/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/io/findify/s3mock/route/CopyObject.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package io.findify.s3mock.route
import java.net.URLDecoder
import java.util

import akka.http.scaladsl.model.{HttpRequest, HttpResponse, StatusCodes}
import akka.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.model.{HttpRequest, HttpResponse, StatusCodes}
import org.apache.pekko.http.scaladsl.server.Directives._
import com.amazonaws.services.s3.model.ObjectMetadata
import com.typesafe.scalalogging.LazyLogging
import io.findify.s3mock.error.{InternalErrorException, NoSuchBucketException, NoSuchKeyException}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package io.findify.s3mock.route

import java.util

import akka.http.scaladsl.model.{HttpRequest, HttpResponse, StatusCodes}
import akka.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.model.{HttpRequest, HttpResponse, StatusCodes}
import org.apache.pekko.http.scaladsl.server.Directives._
import com.amazonaws.services.s3.model.ObjectMetadata
import com.typesafe.scalalogging.LazyLogging
import io.findify.s3mock.error.{InternalErrorException, NoSuchBucketException, NoSuchKeyException}
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/io/findify/s3mock/route/CreateBucket.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.findify.s3mock.route

import akka.http.scaladsl.model.headers.Location
import akka.http.scaladsl.model.{HttpResponse, StatusCodes}
import akka.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.model.headers.Location
import org.apache.pekko.http.scaladsl.model.{HttpResponse, StatusCodes}
import org.apache.pekko.http.scaladsl.server.Directives._
import com.typesafe.scalalogging.LazyLogging
import io.findify.s3mock.provider.Provider
import io.findify.s3mock.request.CreateBucketConfiguration
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/io/findify/s3mock/route/DeleteBucket.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.findify.s3mock.route

import akka.http.scaladsl.model.{HttpResponse, StatusCodes}
import akka.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.model.{HttpResponse, StatusCodes}
import org.apache.pekko.http.scaladsl.server.Directives._
import com.typesafe.scalalogging.LazyLogging
import io.findify.s3mock.error.{InternalErrorException, NoSuchBucketException}
import io.findify.s3mock.provider.Provider
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/io/findify/s3mock/route/DeleteObject.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.findify.s3mock.route

import akka.http.scaladsl.model.{HttpResponse, StatusCodes}
import akka.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.model.{HttpResponse, StatusCodes}
import org.apache.pekko.http.scaladsl.server.Directives._
import com.typesafe.scalalogging.LazyLogging
import io.findify.s3mock.error.NoSuchKeyException
import io.findify.s3mock.provider.Provider
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/io/findify/s3mock/route/DeleteObjects.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.findify.s3mock.route

import akka.http.scaladsl.model.{HttpResponse, StatusCodes, Uri}
import akka.http.scaladsl.server.Directives.{path, _}
import org.apache.pekko.http.scaladsl.model.{HttpResponse, StatusCodes, Uri}
import org.apache.pekko.http.scaladsl.server.Directives.{path, _}
import com.typesafe.scalalogging.LazyLogging
import io.findify.s3mock.error.NoSuchKeyException
import io.findify.s3mock.provider.Provider
Expand Down
8 changes: 4 additions & 4 deletions src/main/scala/io/findify/s3mock/route/GetObject.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import java.io.StringWriter
import java.net.URLDecoder
import java.util.Date

import akka.http.scaladsl.model.HttpEntity.Strict
import akka.http.scaladsl.model._
import akka.http.scaladsl.model.headers.{RawHeader, `Last-Modified`}
import akka.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.model.HttpEntity.Strict
import org.apache.pekko.http.scaladsl.model._
import org.apache.pekko.http.scaladsl.model.headers.{RawHeader, `Last-Modified`}
import org.apache.pekko.http.scaladsl.server.Directives._
import com.amazonaws.services.s3.Headers
import com.amazonaws.services.s3.model.ObjectMetadata
import com.amazonaws.util.DateUtils
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/io/findify/s3mock/route/ListBucket.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.findify.s3mock.route

import akka.http.scaladsl.model._
import akka.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.model._
import org.apache.pekko.http.scaladsl.server.Directives._
import com.typesafe.scalalogging.LazyLogging
import io.findify.s3mock.error.{InternalErrorException, NoSuchBucketException}
import io.findify.s3mock.provider.Provider
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/io/findify/s3mock/route/ListBuckets.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.findify.s3mock.route

import akka.http.scaladsl.model._
import akka.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.model._
import org.apache.pekko.http.scaladsl.server.Directives._
import com.typesafe.scalalogging.LazyLogging
import io.findify.s3mock.provider.Provider

Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/io/findify/s3mock/route/MetadataUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package io.findify.s3mock.route
import java.lang.Iterable
import java.util

import akka.http.javadsl.model.HttpHeader
import akka.http.scaladsl.model.HttpRequest
import org.apache.pekko.http.javadsl.model.HttpHeader
import org.apache.pekko.http.scaladsl.model.HttpRequest
import com.amazonaws.AmazonClientException
import com.amazonaws.services.s3.Headers
import com.amazonaws.services.s3.internal.ServiceUtils
Expand Down
10 changes: 5 additions & 5 deletions src/main/scala/io/findify/s3mock/route/PutObject.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.findify.s3mock.route

import akka.http.scaladsl.model.{HttpRequest, HttpResponse, StatusCodes}
import akka.http.scaladsl.server.Directives._
import akka.stream.Materializer
import akka.stream.scaladsl.Sink
import akka.util.ByteString
import org.apache.pekko.http.scaladsl.model.{HttpRequest, HttpResponse, StatusCodes}
import org.apache.pekko.http.scaladsl.server.Directives._
import org.apache.pekko.stream.Materializer
import org.apache.pekko.stream.scaladsl.Sink
import org.apache.pekko.util.ByteString
import com.amazonaws.services.s3.model.ObjectMetadata
import com.typesafe.scalalogging.LazyLogging
import io.findify.s3mock.S3ChunkedProtocolStage
Expand Down
14 changes: 7 additions & 7 deletions src/main/scala/io/findify/s3mock/route/PutObjectMultipart.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.findify.s3mock.route

import akka.NotUsed
import akka.http.scaladsl.model._
import akka.http.scaladsl.model.headers.ETag
import akka.http.scaladsl.server.Directives._
import akka.stream.scaladsl.{Flow, Sink}
import akka.stream.{FlowShape, Graph, Materializer}
import akka.util.ByteString
import org.apache.pekko.NotUsed
import org.apache.pekko.http.scaladsl.model._
import org.apache.pekko.http.scaladsl.model.headers.ETag
import org.apache.pekko.http.scaladsl.server.Directives._
import org.apache.pekko.stream.scaladsl.{Flow, Sink}
import org.apache.pekko.stream.{FlowShape, Graph, Materializer}
import org.apache.pekko.util.ByteString
import com.typesafe.scalalogging.LazyLogging
import io.findify.s3mock.S3ChunkedProtocolStage
import io.findify.s3mock.error.{InternalErrorException, NoSuchBucketException}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.findify.s3mock.route

import akka.http.scaladsl.model._
import akka.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.model._
import org.apache.pekko.http.scaladsl.server.Directives._
import com.typesafe.scalalogging.LazyLogging
import io.findify.s3mock.error.{InternalErrorException, NoSuchBucketException}
import io.findify.s3mock.provider.Provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package io.findify.s3mock.route

import java.nio.charset.StandardCharsets

import akka.http.scaladsl.model._
import akka.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.model._
import org.apache.pekko.http.scaladsl.server.Directives._
import com.typesafe.scalalogging.LazyLogging
import io.findify.s3mock.error.{InternalErrorException, NoSuchBucketException}
import io.findify.s3mock.provider.Provider
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/io/findify/s3mock/ChunkBufferTest.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.findify.s3mock

import akka.util.ByteString
import org.apache.pekko.util.ByteString
import org.scalatest.{FlatSpec, Matchers}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/io/findify/s3mock/DeleteTest.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.findify.s3mock

import akka.http.scaladsl.Http
import akka.http.scaladsl.model._
import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.http.scaladsl.model._
import com.amazonaws.services.s3.model.{AmazonS3Exception, DeleteObjectsRequest}

import scala.collection.JavaConverters._
Expand Down
8 changes: 4 additions & 4 deletions src/test/scala/io/findify/s3mock/GetPutObjectTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package io.findify.s3mock
import java.io.ByteArrayInputStream
import java.util

import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.{HttpMethods, HttpRequest}
import akka.stream.ActorMaterializer
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.http.scaladsl.model.{HttpMethods, HttpRequest}
import org.apache.pekko.stream.ActorMaterializer
import com.amazonaws.services.s3.model._
import com.amazonaws.util.IOUtils

Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/io/findify/s3mock/ListBucketsTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package io.findify.s3mock
/**
* Created by shutty on 8/9/16.
*/
import akka.http.scaladsl.Http
import akka.http.scaladsl.model._
import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.http.scaladsl.model._

import scala.collection.JavaConverters._
import scala.concurrent.Await
Expand Down
Loading

0 comments on commit 994bbd2

Please sign in to comment.