Repository: softwaremill/elasticmq (scala)

Issue:
Remove Bundled logback.xml to Support Custom Logging Configuration
The `elasticmq-server_3` jar currently bundles a [logback.xml](https://github.com/softwaremill/elasticmq/blob/master/server/src/main/resources/logback.xml) file with basic logging settings. This default configuration may conflict with projects that require a custom logback setup. Could we remove this bundled logback.xml to allow users to supply their own logging configuration?

Pull request:
closes #1116

Patch:
diff --git a/README.md b/README.md
index eb35f4c21..decd0a636 100644
--- a/README.md
+++ b/README.md
@@ -114,7 +114,7 @@ aws {
 You can also provide an alternative [Logback](http://logback.qos.ch/) configuration file (the
 [default](server/src/main/resources/logback.xml) is configured to
 log INFO logs and above to the console):
-                 
+
 ```
 java -Dlogback.configurationFile=my_logback.xml -jar elasticmq-server-$VERSION.jar
 ```
@@ -241,12 +241,47 @@ On startup, any queues and their messages persisted in the database will be recr
 Note that the persisted queues take precedence over the queues defined
 in the main configuration file (as described in the previous section) in the `queues` section.
 
+# ElasticMQ dependencies in SBT
+
+```scala
+// Scala 2.13 and 2.12
+val elasticmqSqs        = "org.elasticmq" %% "elasticmq-rest-sqs" % Version
+```
+
+If you don't want the SQS interface, but just use the actors directly, you can add a dependency only to the `core`
+module:
+
+```scala
+val elasticmqCore       = "org.elasticmq" %% "elasticmq-core" % Version
+```
+
+If you want to use a snapshot version, you will need to add the [https://oss.sonatype.org/content/repositories/snapshots/](https://oss.sonatype.org/content/repositories/snapshots/) repository to your configuration.
+
+# ElasticMQ dependencies in Maven
+
+Dependencies:
+
+```xml
+<dependency>
+    <groupId>org.elasticmq</groupId>
+    <artifactId>elasticmq-rest-sqs_2.12</artifactId>
+    <version>${version}</version>
+</dependency>
+```
+
+If you want to use a snapshot version, you will need to add the [https://oss.sonatype.org/content/repositories/snapshots/](https://oss.sonatype.org/content/repositories/snapshots/) repository to your configuration.
+
+# Logging
+
+ElasticMQ uses [Slf4j](http://www.slf4j.org/) for logging. By default, no logger backend is included as a dependency,
+however [Logback](http://logback.qos.ch/) is recommended.
+
 # Starting an embedded ElasticMQ server with an SQS interface
 
-Add ElasticMQ Server to `build.sbt` dependencies
+Add ElasticMQ Rest SQS module to `build.sbt` dependencies
 
 ```scala
-libraryDependencies += "org.elasticmq" %% "elasticmq-server" % Version
+libraryDependencies += "org.elasticmq" %% "elasticmq-rest-sqs" % Version
 ```
 
 Simply start the server using custom configuration (see examples above):
@@ -435,41 +470,6 @@ ENTRYPOINT [ "/usr/bin/java", "-Dconfig.file=/opt/elasticmq/conf/elasticmq.conf"
 
 and override the entrypoint passing the required properties.
 
-# ElasticMQ dependencies in SBT
-                    
-```scala
-// Scala 2.13 and 2.12
-val elasticmqSqs        = "org.elasticmq" %% "elasticmq-rest-sqs" % Version
-```
-
-If you don't want the SQS interface, but just use the actors directly, you can add a dependency only to the `core`
-module:
-    
-```scala
-val elasticmqCore       = "org.elasticmq" %% "elasticmq-core" % Version
-```
-
-If you want to use a snapshot version, you will need to add the [https://oss.sonatype.org/content/repositories/snapshots/](https://oss.sonatype.org/content/repositories/snapshots/) repository to your configuration.
-
-# ElasticMQ dependencies in Maven
-
-Dependencies:
-    
-```xml
-<dependency>
-    <groupId>org.elasticmq</groupId>
-    <artifactId>elasticmq-rest-sqs_2.12</artifactId>
-    <version>${version}</version>
-</dependency>
-```
-
-If you want to use a snapshot version, you will need to add the [https://oss.sonatype.org/content/repositories/snapshots/](https://oss.sonatype.org/content/repositories/snapshots/) repository to your configuration.
-
-# Logging
-
-ElasticMQ uses [Slf4j](http://www.slf4j.org/) for logging. By default no logger backend is included as a dependency,
-however [Logback](http://logback.qos.ch/) is recommended.
-
 # Performance
 
 Tests done on a 2012 MBP, 2.6GHz, 16GB RAM, no replication. Throughput is in messages per second (messages are
diff --git a/build.sbt b/build.sbt
index b8cb2f47f..0d6d94a5d 100644
--- a/build.sbt
+++ b/build.sbt
@@ -195,7 +195,7 @@ lazy val restSqs: Project = (project in file("rest/rest-sqs"))
       ) ++ common
     )
   )
-  .dependsOn(core % "compile->compile;test->test", commonTest % "test")
+  .dependsOn(core % "compile->compile;test->test", persistenceFile, persistenceSql, commonTest % "test")
 
 lazy val restSqsTestingAmazonJavaSdk: Project =
   (project in file("rest/rest-sqs-testing-amazon-java-sdk"))
@@ -230,8 +230,8 @@ lazy val server: Project = (project in file("server"))
       // s3 upload
       s3Upload := {
         import com.amazonaws.auth.{AWSStaticCredentialsProvider, BasicAWSCredentials}
-        import com.amazonaws.services.s3.AmazonS3ClientBuilder
-        import com.amazonaws.services.s3.model.{CannedAccessControlList, PutObjectRequest}
+          import com.amazonaws.services.s3.AmazonS3ClientBuilder
+          import com.amazonaws.services.s3.model.{CannedAccessControlList, PutObjectRequest}
 
         val bucketName = "softwaremill-public"
 
@@ -278,7 +278,7 @@ lazy val server: Project = (project in file("server"))
       dockerExposedVolumes += "/data"
     )
   )
-  .dependsOn(core, restSqs, persistenceFile, persistenceSql, commonTest % "test")
+  .dependsOn(core, restSqs)
 
 val graalVmVersion = "22.1.0"
 val graalVmTag = s"ol8-java11-$graalVmVersion"
diff --git a/rest/rest-sqs/src/main/resources/reference.conf b/rest/rest-sqs/src/main/resources/reference.conf
index e008a270b..72ff4b992 100644
--- a/rest/rest-sqs/src/main/resources/reference.conf
+++ b/rest/rest-sqs/src/main/resources/reference.conf
@@ -1,3 +1,70 @@
 elasticmq {
     debug = false
+}
+
+# What is the outside visible address of this ElasticMQ node
+# Used to create the queue URL (may be different from bind address!)
+node-address {
+  protocol = "http"
+  host = "localhost"
+  port = 9324
+  context-path = ""
+}
+
+rest-sqs {
+  enabled = true
+  bind-port = 9324
+  bind-hostname = "0.0.0.0"
+  # Possible values: relaxed, strict
+  sqs-limits = strict
+}
+
+rest-stats {
+  enabled = true
+  bind-port = 9325
+  bind-hostname = "0.0.0.0"
+}
+
+# Should the node-address be generated from the bind port/hostname
+# Set this to true e.g. when assigning port automatically by using port 0.
+generate-node-address = false
+
+queues {
+#  queueName1 {
+#     // all optional
+#     defaultVisibilityTimeout = 10 seconds
+#     delay = 5 seconds
+#     maxReceiveCount = 3
+#     receiveMessageWait = 0 seconds
+#     deadLettersQueue {
+#       // all mandatory
+#       name = "myDLQ"
+#       maxReceiveCount = 3
+#     }
+#     copyTo = "audit-queue-name"
+#     moveTo = "redirect-queue-name"
+#     tags {
+#       tag1 = "tagged1",
+#       tag2 = "tagged2"
+#     }
+#  }
+}
+
+queues-storage {
+  enabled = false
+  path = ""
+}
+
+aws {
+  region = "elasticmq"
+  accountId = "000000000000"
+}
+
+messages-storage {
+  enabled = false
+  driver-class = "org.h2.Driver"
+  uri = "jdbc:h2:/data/elasticmq-h2"
+  username = ""
+  password = ""
+  prune-data-on-init = false
 }
\ No newline at end of file
diff --git a/server/src/main/scala/org/elasticmq/server/ElasticMQServer.scala b/rest/rest-sqs/src/main/scala/org/elasticmq/server/ElasticMQServer.scala
similarity index 100%
rename from server/src/main/scala/org/elasticmq/server/ElasticMQServer.scala
rename to rest/rest-sqs/src/main/scala/org/elasticmq/server/ElasticMQServer.scala
index f1b4bb198..813f47dfd 100644
--- a/server/src/main/scala/org/elasticmq/server/ElasticMQServer.scala
+++ b/rest/rest-sqs/src/main/scala/org/elasticmq/server/ElasticMQServer.scala
@@ -14,9 +14,9 @@ import org.elasticmq.rest.stats.{StatisticsRestServer, TheStatisticsRestServerBu
 import org.elasticmq.server.config.ElasticMQServerConfig
 import org.elasticmq.util.{Logging, NowProvider}
 
-import scala.concurrent.{Await, ExecutionContextExecutor, Future}
-import scala.concurrent.duration._
 import scala.concurrent.duration.Duration.Inf
+import scala.concurrent.duration._
+import scala.concurrent.{Await, ExecutionContextExecutor, Future}
 
 class ElasticMQServer(config: ElasticMQServerConfig) extends Logging {
   private val actorSystem = ActorSystem("elasticmq")
diff --git a/server/src/main/scala/org/elasticmq/server/config/ElasticMQServerConfig.scala b/rest/rest-sqs/src/main/scala/org/elasticmq/server/config/ElasticMQServerConfig.scala
similarity index 100%
rename from server/src/main/scala/org/elasticmq/server/config/ElasticMQServerConfig.scala
rename to rest/rest-sqs/src/main/scala/org/elasticmq/server/config/ElasticMQServerConfig.scala
index 7b2a52177..15d8c05a4 100644
--- a/server/src/main/scala/org/elasticmq/server/config/ElasticMQServerConfig.scala
+++ b/rest/rest-sqs/src/main/scala/org/elasticmq/server/config/ElasticMQServerConfig.scala
@@ -1,9 +1,9 @@
 package org.elasticmq.server.config
 
 import com.typesafe.config.Config
-import org.elasticmq.persistence.sql.SqlQueuePersistenceConfig
 import org.elasticmq.persistence.CreateQueueMetadata
 import org.elasticmq.persistence.file.QueueConfigUtil
+import org.elasticmq.persistence.sql.SqlQueuePersistenceConfig
 import org.elasticmq.util.Logging
 import org.elasticmq.{NodeAddress, RelaxedSQSLimits, StrictSQSLimits}
 
diff --git a/server/src/main/resources/reference.conf b/server/src/main/resources/reference.conf
deleted file mode 100644
index 421d51f52..000000000
--- a/server/src/main/resources/reference.conf
+++ /dev/null
@@ -1,66 +0,0 @@
-# What is the outside visible address of this ElasticMQ node
-# Used to create the queue URL (may be different from bind address!)
-node-address {
-  protocol = "http"
-  host = "localhost"
-  port = 9324
-  context-path = ""
-}
-
-rest-sqs {
-  enabled = true
-  bind-port = 9324
-  bind-hostname = "0.0.0.0"
-  # Possible values: relaxed, strict
-  sqs-limits = strict
-}
-
-rest-stats {
-  enabled = true
-  bind-port = 9325
-  bind-hostname = "0.0.0.0"
-}
-
-# Should the node-address be generated from the bind port/hostname
-# Set this to true e.g. when assigning port automatically by using port 0.
-generate-node-address = false
-
-queues {
-#  queueName1 {
-#     // all optional
-#     defaultVisibilityTimeout = 10 seconds
-#     delay = 5 seconds
-#     maxReceiveCount = 3
-#     receiveMessageWait = 0 seconds
-#     deadLettersQueue {
-#       // all mandatory
-#       name = "myDLQ"
-#       maxReceiveCount = 3
-#     }
-#     copyTo = "audit-queue-name"
-#     moveTo = "redirect-queue-name"
-#     tags {
-#       tag1 = "tagged1",
-#       tag2 = "tagged2"
-#     }
-#  }
-}
-
-queues-storage {
-  enabled = false
-  path = ""
-}
-
-aws {
-  region = "elasticmq"
-  accountId = "000000000000"
-}
-
-messages-storage {
-  enabled = false
-  driver-class = "org.h2.Driver"
-  uri = "jdbc:h2:/data/elasticmq-h2"
-  username = ""
-  password = ""
-  prune-data-on-init = false
-}
\ No newline at end of file
diff --git a/server/src/main/scala/org/elasticmq/server/config/DeadLettersQueue.scala b/server/src/main/scala/org/elasticmq/server/config/DeadLettersQueue.scala
deleted file mode 100644
index 3dce47931..000000000
--- a/server/src/main/scala/org/elasticmq/server/config/DeadLettersQueue.scala
+++ /dev/null
@@ -1,3 +0,0 @@
-package org.elasticmq.server.config
-
-case class DeadLettersQueue(name: String, maxReceiveCount: Int)


Test patch:
diff --git a/server/src/test/resources/test.conf b/rest/rest-sqs/src/test/resources/test.conf
similarity index 100%
rename from server/src/test/resources/test.conf
rename to rest/rest-sqs/src/test/resources/test.conf
diff --git a/server/src/test/scala/org/elasticmq/server/config/ElasticMQServerConfigTest.scala b/rest/rest-sqs/src/test/scala/org/elasticmq/server/config/ElasticMQServerConfigTest.scala
similarity index 100%
rename from server/src/test/scala/org/elasticmq/server/config/ElasticMQServerConfigTest.scala
rename to rest/rest-sqs/src/test/scala/org/elasticmq/server/config/ElasticMQServerConfigTest.scala
diff --git a/server/src/test/scala/org/elasticmq/server/package.scala b/server/src/test/scala/org/elasticmq/server/package.scala
deleted file mode 100644
index 0187c35cf..000000000
--- a/server/src/test/scala/org/elasticmq/server/package.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.elasticmq
-
-import scala.io.Source
-
-package object server {
-  private[server] def load[T](base: Class[T], fileName: String): String = {
-    Source
-      .fromInputStream(base.getResourceAsStream(s"/$fileName"))
-      .getLines()
-      .mkString("\n")
-  }
-}