diff --git a/README.md b/README.md index 76c9058..92e8b87 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ The rest of the operations return dummy responses when invoked. For starting an embedded server the `BonsaiSnsServerBuilder` can be used ``` BonsaiSnsServer server = new BonsaiSnsServer.Builder() - .withAccountId(123L) + .withAccountId("123") .withPort(9999) .withRegion("someRegion") .withSqsEndpoint("http://localhost:9324") @@ -40,13 +40,13 @@ server.stop(); ### Stand-alone server -Download the [jar](https://repo1.maven.org/maven2/io/github/gilbertojrequena/bonsai-sns/0.1.6/bonsai-sns-0.1.6.jar) and execute it +Download the [jar](https://repo1.maven.org/maven2/io/github/gilbertojrequena/bonsai-sns/0.1.7/bonsai-sns-0.1.7.jar) and execute it -`java -jar bonsai-sns-0.1.6.jar port=9494 region=region accountId=987654321 sqsEndpoint=http://localhost:9432 sqsAccessKey=foo sqsSecretKey=bar` +`java -jar bonsai-sns-0.1.7.jar port=9494 region=region accountId=987654321 sqsEndpoint=http://localhost:9432 sqsAccessKey=foo sqsSecretKey=bar` or -`java -Dconfig.file=bonsai-sns.conf -jar bonsai-sns-0.1.6.jar` +`java -Dconfig.file=bonsai-sns.conf -jar bonsai-sns-0.1.7.jar` ### Environment configuration bonsai-sns uses [Typesafe Config](https://github.com/lightbend/config) for loading its configuration, topics and subscriptions can be created on startup by providing an `application.conf` @@ -57,7 +57,7 @@ configuration file bonsai-sns { port = 7979 region = "region" - accountId = 123456789 + accountId = "123456789" sqsEndpoint = "http://localhost:9324" sqsAccessKey = "foo" sqsSecretKey = "bar" @@ -103,7 +103,7 @@ Environment configuration can also be done using the `BonsaiSnsServerBuilder` an ``` BonsaiSnsServer server = new BonsaiSnsServer.Builder() - .withAccountId(123L) + .withAccountId("123") .withPort(9999) .withRegion("someRegion") .withSqsEndpoint("http://localhost:9324") @@ -198,7 +198,7 @@ server.stop(); io.github.gilbertojrequena bonsai-sns - 0.1.6 + 0.1.7 ``` diff --git a/build.gradle b/build.gradle index e94d30a..703804b 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { } group 'io.github.gilbertojrequena' -version '0.1.7-SNAPSHOT' +version '0.1.7' sourceCompatibility = 1.8 diff --git a/example.conf b/example.conf index db5aa76..5e670e7 100644 --- a/example.conf +++ b/example.conf @@ -1,7 +1,7 @@ bonsai-sns { port = 7979 region = "region" - accountId = 123456789 + accountId = "123456789" sqsEndpoint = "http://localhost:9324" sqsAccessKey = "foo" sqsSecretKey = "bar" diff --git a/src/main/kotlin/io/github/gilbertojrequena/bonsai_sns/Main.kt b/src/main/kotlin/io/github/gilbertojrequena/bonsai_sns/Main.kt index 2e74994..edff8ff 100644 --- a/src/main/kotlin/io/github/gilbertojrequena/bonsai_sns/Main.kt +++ b/src/main/kotlin/io/github/gilbertojrequena/bonsai_sns/Main.kt @@ -20,7 +20,7 @@ private fun configFromArgs(args: Array): BonsaiSnsConfig { return BonsaiSnsConfig( port = argsMap["port"]?.toInt(), region = argsMap["region"], - accountId = argsMap["accountId"]?.toLong(), + accountId = argsMap["accountId"], sqsEndpoint = argsMap["sqsEndpoint"], sqsAccessKey = argsMap["sqsAccessKey"], sqsSecretKey = argsMap["sqsSecretKey"] diff --git a/src/main/kotlin/io/github/gilbertojrequena/bonsai_sns/server/BonsaiSnsConfig.kt b/src/main/kotlin/io/github/gilbertojrequena/bonsai_sns/server/BonsaiSnsConfig.kt index 8140bf0..36d4206 100644 --- a/src/main/kotlin/io/github/gilbertojrequena/bonsai_sns/server/BonsaiSnsConfig.kt +++ b/src/main/kotlin/io/github/gilbertojrequena/bonsai_sns/server/BonsaiSnsConfig.kt @@ -7,7 +7,7 @@ import com.typesafe.config.ConfigFactory public class BonsaiSnsConfig( internal var port: Int? = null, internal var region: String? = null, - internal var accountId: Long? = null, + internal var accountId: String? = null, internal var bonsaiSnsEnvironment: BonsaiSnsEnvironment? = null, internal var sqsEndpoint: String? = null, internal var sqsAccessKey: String? = null, @@ -16,7 +16,7 @@ public class BonsaiSnsConfig( companion object { private const val DEFAULT_PORT = 7979 private const val DEFAULT_REGION = "region" - private const val DEFAULT_ACCOUNT_ID = 123456789L + private const val DEFAULT_ACCOUNT_ID = "123456789" } init { @@ -37,7 +37,7 @@ public class BonsaiSnsConfig( } if (accountId == null) { accountId = getOrDefault(bonsaiSnsConfig, DEFAULT_ACCOUNT_ID) { - it.getLong("accountId") + it.getString("accountId") } } if (sqsEndpoint.isNullOrBlank()) { diff --git a/src/main/kotlin/io/github/gilbertojrequena/bonsai_sns/server/BonsaiSnsServer.kt b/src/main/kotlin/io/github/gilbertojrequena/bonsai_sns/server/BonsaiSnsServer.kt index 8544204..c900c24 100644 --- a/src/main/kotlin/io/github/gilbertojrequena/bonsai_sns/server/BonsaiSnsServer.kt +++ b/src/main/kotlin/io/github/gilbertojrequena/bonsai_sns/server/BonsaiSnsServer.kt @@ -113,7 +113,7 @@ class BonsaiSnsServer(private val config: BonsaiSnsConfig) { class Builder { internal var port: Int? = null private set - internal var accountId: Long? = null + internal var accountId: String? = null private set internal var region: String? = null private set @@ -127,7 +127,7 @@ class BonsaiSnsServer(private val config: BonsaiSnsConfig) { private set fun withPort(port: Int): Builder = apply { this.port = port } - fun withAccountId(accountId: Long): Builder = apply { this.accountId = accountId } + fun withAccountId(accountId: String): Builder = apply { this.accountId = accountId } fun withRegion(region: String): Builder = apply { this.region = region } fun withBonsaiSnsEnvironmentDefinition(bonsaiSnsEnvironment: BonsaiSnsEnvironment): Builder = apply { this.bonsaiSnsEnvironment = bonsaiSnsEnvironment } diff --git a/src/test/kotlin/io/github/gilbertojrequena/bonsai_sns/api/AwsSnsInterfaceTest.kt b/src/test/kotlin/io/github/gilbertojrequena/bonsai_sns/api/AwsSnsInterfaceTest.kt index 38158d9..7022b0a 100644 --- a/src/test/kotlin/io/github/gilbertojrequena/bonsai_sns/api/AwsSnsInterfaceTest.kt +++ b/src/test/kotlin/io/github/gilbertojrequena/bonsai_sns/api/AwsSnsInterfaceTest.kt @@ -50,7 +50,7 @@ internal class AwsSnsInterfaceTest { private val basicAWSCredentials = BasicAWSCredentials("foo", "bar") private const val region = "region" private const val port = 7979 - private const val accountId = 123456789L + private const val accountId = "123456789" @JvmStatic @BeforeAll diff --git a/src/test/kotlin/io/github/gilbertojrequena/bonsai_sns/core/actor/dispatcher/MessageFactoryTest.kt b/src/test/kotlin/io/github/gilbertojrequena/bonsai_sns/core/actor/dispatcher/MessageFactoryTest.kt index 592c291..f74672c 100644 --- a/src/test/kotlin/io/github/gilbertojrequena/bonsai_sns/core/actor/dispatcher/MessageFactoryTest.kt +++ b/src/test/kotlin/io/github/gilbertojrequena/bonsai_sns/core/actor/dispatcher/MessageFactoryTest.kt @@ -12,7 +12,7 @@ import org.junit.jupiter.api.TestInstance @TestInstance(TestInstance.Lifecycle.PER_METHOD) internal class MessageFactoryTest { - private val config = BonsaiSnsConfig(1234, "region", 123456789) + private val config = BonsaiSnsConfig(1234, "region", "123456789") private val subscription = mockk() private lateinit var messageFactory: MessageFactory diff --git a/src/test/kotlin/io/github/gilbertojrequena/bonsai_sns/core/manager/SubscriptionManagerTest.kt b/src/test/kotlin/io/github/gilbertojrequena/bonsai_sns/core/manager/SubscriptionManagerTest.kt index a1ccae9..54f8ab8 100644 --- a/src/test/kotlin/io/github/gilbertojrequena/bonsai_sns/core/manager/SubscriptionManagerTest.kt +++ b/src/test/kotlin/io/github/gilbertojrequena/bonsai_sns/core/manager/SubscriptionManagerTest.kt @@ -20,7 +20,7 @@ import org.junit.jupiter.api.assertThrows @TestInstance(TestInstance.Lifecycle.PER_METHOD) internal class SubscriptionManagerTest { - private val config = BonsaiSnsConfig(1234, "region", 123456789) + private val config = BonsaiSnsConfig(1234, "region", "123456789") private val snsOpActor = snsOpsActor() private val subscriptionManager = SubscriptionManager(snsOpActor, config) diff --git a/src/test/kotlin/io/github/gilbertojrequena/bonsai_sns/core/manager/TopicManagerTest.kt b/src/test/kotlin/io/github/gilbertojrequena/bonsai_sns/core/manager/TopicManagerTest.kt index 421ee6e..99a4bf4 100644 --- a/src/test/kotlin/io/github/gilbertojrequena/bonsai_sns/core/manager/TopicManagerTest.kt +++ b/src/test/kotlin/io/github/gilbertojrequena/bonsai_sns/core/manager/TopicManagerTest.kt @@ -12,7 +12,7 @@ import org.junit.jupiter.api.assertThrows @TestInstance(TestInstance.Lifecycle.PER_METHOD) internal class TopicManagerTest { - private val config = BonsaiSnsConfig(1234, "region", 123456789) + private val config = BonsaiSnsConfig(1234, "region", "123456789") private val topicManager = TopicManager(snsOpsActor(), config) @Test