Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
expose factory methods to create an S3Mock with in-memory provider
Browse files Browse the repository at this point in the history
  • Loading branch information
schoeneu committed Mar 20, 2017
1 parent 1e3801e commit 80de609
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/main/scala/io/findify/s3mock/S3Mock.scala
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
package io.findify.s3mock

import akka.actor.ActorSystem
import akka.event.Logging
import akka.http.scaladsl.Http
import akka.stream.ActorMaterializer
import akka.http.scaladsl._
import akka.http.scaladsl.model.headers.Location
import akka.http.scaladsl.model.{HttpHeader, HttpResponse, Multipart, StatusCodes}
import akka.http.scaladsl.model.{HttpResponse, StatusCodes}
import akka.http.scaladsl.server.Directives._
import akka.stream.scaladsl.{Framing, Sink}
import akka.util.ByteString
import akka.stream.ActorMaterializer
import com.typesafe.scalalogging.LazyLogging
import io.findify.s3mock.error.NoSuchKeyException
import io.findify.s3mock.provider.{FileProvider, Provider}
import io.findify.s3mock.request.{CompleteMultipartUpload, CreateBucketConfiguration}
import io.findify.s3mock.route.{PutObject, _}
import io.findify.s3mock.provider.{FileProvider, InMemoryProvider, Provider}
import io.findify.s3mock.route._

import scala.concurrent.{Await, Future}
import scala.concurrent.Await
import scala.concurrent.duration.Duration
import scala.io.Source
import scala.util.{Failure, Success, Try}
/**
* Created by shutty on 8/9/16.
*/
Expand Down Expand Up @@ -76,6 +67,8 @@ class S3Mock(port:Int, provider:Provider)(implicit system:ActorSystem = ActorSys
}

object S3Mock {
def apply(port: Int): S3Mock = new S3Mock(port, new InMemoryProvider)
def apply(port:Int, dir:String) = new S3Mock(port, new FileProvider(dir))
def create(port:Int) = apply(port) // Java API
def create(port:Int, dir:String) = apply(port, dir) // Java API
}

0 comments on commit 80de609

Please sign in to comment.