Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.11.2")

addSbtPlugin("com.gu" % "sbt-teamcity-test-reporting-plugin" % "1.5")

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.0.1")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend adding such settings to your local setup, ~/.sbt/0.13/plugins.sbt. The eclipse plugin has nothing to do with the project :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was too lazy to locate my home plugins. Thanks for the pointer!


scalacOptions in ThisBuild ++= Seq("-unchecked", "-deprecation")
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class AmazonJavaSdkTestSuite extends FunSuite with Matchers with BeforeAndAfter
// Then
queueVisibilityTimeout(queueUrl) should be (10)
}

test("should send and receive a simple message") {
doTestSendAndReceiveMessage("Message 1")
}
Expand Down Expand Up @@ -795,6 +795,18 @@ class AmazonJavaSdkTestSuite extends FunSuite with Matchers with BeforeAndAfter

result.isLeft should be (true)
}

test("should not return an error if creating an existing queue with a non default visibility timeout") {
// Given
val queueUrl = client.createQueue(new CreateQueueRequest("testQueue1")
.withAttributes(Map(defaultVisibilityTimeoutAttribute -> "42"))).getQueueUrl

// When
val queueUrl2 = client.createQueue(new CreateQueueRequest("testQueue1")).getQueueUrl


queueUrl should equal(queueUrl2)
}

test("should purge the queue") {
// Given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ trait CreateQueueDirectives { this: ElasticMQDirectives with QueueURLModule with
queueNameFromParams(p) { queueName =>
val attributes = attributeNameAndValuesReader.read(p)

val secondsVisibilityTimeout = attributes.parseOptionalLong(VisibilityTimeoutParameter)
.getOrElse(DefaultVisibilityTimeout)
val secondsVisibilityTimeoutOpt = attributes.parseOptionalLong(VisibilityTimeoutParameter)
val secondsVisibilityTimeout = secondsVisibilityTimeoutOpt.getOrElse(DefaultVisibilityTimeout)

val secondsDelay = attributes.parseOptionalLong(DelaySecondsAttribute)
.getOrElse(DefaultDelay)
val secondsDelayOpt = attributes.parseOptionalLong(DelaySecondsAttribute)
val secondsDelay = secondsDelayOpt.getOrElse(DefaultDelay)

val secondsReceiveMessageWaitTimeOpt = attributes.parseOptionalLong(ReceiveMessageWaitTimeSecondsAttribute)
val secondsReceiveMessageWaitTime = secondsReceiveMessageWaitTimeOpt
Expand All @@ -44,9 +44,12 @@ trait CreateQueueDirectives { this: ElasticMQDirectives with QueueURLModule with

val queueData = await(lookupOrCreateQueue(newQueueData))

if ((queueData.delay.getStandardSeconds != secondsDelay) ||
(queueData.receiveMessageWait.getStandardSeconds != secondsReceiveMessageWaitTime) ||
(queueData.defaultVisibilityTimeout.seconds != secondsVisibilityTimeout)) {
// if the request set the attributes compare them against the queue
if ((!secondsDelayOpt.isEmpty && queueData.delay.getStandardSeconds != secondsDelay) ||
(!secondsReceiveMessageWaitTimeOpt.isEmpty
&& queueData.receiveMessageWait.getStandardSeconds != secondsReceiveMessageWaitTime) ||
(!secondsVisibilityTimeoutOpt.isEmpty
&& queueData.defaultVisibilityTimeout.seconds != secondsVisibilityTimeout)) {
// Special case: the queue existed, but has different attributes
throw new SQSException("AWS.SimpleQueueService.QueueNameExists")
}
Expand Down