Skip to content

Commit

Permalink
Build changes
Browse files Browse the repository at this point in the history
  • Loading branch information
s12v authored Jun 10, 2016
1 parent 077dccb commit a959610
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 18 deletions.
10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ install:
- docker run -it -v "$PWD":/tmp -w /tmp composer/composer:1-alpine install

script:
- sbt coverage assembly
- sbt run > log.txt &
- bash <(curl -s https://raw.githubusercontent.com/s12v/wait4port/master/wait4port.sh) localhost:9911 localhost:9324
- sbt coverage test coverageReport
- sbt assembly
- java -jar $(ls $TRAVIS_BUILD_DIR/target/scala-2.11/sns-*.jar | tail -1) > log.txt &
- >
bash <(curl -s https://raw.githubusercontent.com/s12v/wait4port/master/wait4port.sh)
http://localhost:9911
http://localhost:9324
- bundle exec cucumber
- >
docker run -it
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ EXPOSE 9911

VOLUME /etc/sns

ENV DB_PATH=/etc/sns/db.json VERSION=0.0.2
ENV DB_PATH=/etc/sns/db.json VERSION=0.1.0

ADD https://github.com/s12v/sns/releases/download/$VERSION/sns-$VERSION.jar /sns.jar

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![Build Status](https://travis-ci.org/s12v/sns.svg?branch=master)](https://travis-ci.org/s12v/sns)
# SNS
[![codecov](https://codecov.io/gh/s12v/sns/branch/master/graph/badge.svg)](https://codecov.io/gh/s12v/sns)
# Fake SNS

Fake Amazon Simple Notification Service (SNS) for testing. Supports:
- Create/List/Delete topics
Expand All @@ -20,7 +21,7 @@ docker run -d -p 9911:9911 -v example:/etc/sns s12v/sns

Download the latest release from https://github.com/s12v/sns/releases and run:
```
DB_PATH=/tmp/db.json java -jar sns-0.0.1.jar
DB_PATH=/tmp/db.json java -jar sns-0.1.0.jar
```
Requires Java8.

Expand Down
25 changes: 15 additions & 10 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
name := "sns"

version := "0.0.2"
version := "0.1.0"

scalaVersion := "2.11.8"

// sbt-assembly
assemblyJarName in assembly := s"sns-${version.value}.jar"
test in assembly := {}

libraryDependencies ++= {
val akkaVersion = "2.4.6"
val akkaVersion = "2.4.7"
val camelVersion = "2.17.0"

Seq(
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
"com.typesafe.akka" %% "akka-http-experimental" % akkaVersion,
"com.typesafe.akka" %% "akka-http-xml-experimental" % akkaVersion,
"com.typesafe.akka" %% "akka-http-spray-json-experimental" % akkaVersion,
"com.typesafe.akka" %% "akka-http-spray-json-experimental" % akkaVersion
,
"com.typesafe.akka" %% "akka-http-testkit" % akkaVersion % Test,

"org.slf4j" % "slf4j-api" % "1.7.2",
"ch.qos.logback" % "logback-classic" % "1.0.7",
"com.typesafe.akka" %% "akka-camel" % "2.3.15",
"org.apache.camel" % "camel-aws" % "2.17.0"
"com.typesafe.akka" %% "akka-camel" % akkaVersion,
"org.apache.camel" % "camel-aws" % camelVersion
exclude("com.amazonaws", "aws-java-sdk-acm")
exclude("com.amazonaws", "aws-java-sdk-api-gateway")
exclude("com.amazonaws", "aws-java-sdk-autoscaling")
Expand Down Expand Up @@ -76,10 +80,11 @@ libraryDependencies ++= {
exclude("com.amazonaws", "aws-java-sdk-elasticbeanstalk")
exclude("com.amazonaws", "aws-java-sdk-ecr")
,
"org.apache.camel" % "camel-http" % "2.17.0",
"org.apache.camel" % "camel-rabbitmq" % "2.17.0",
"org.apache.camel" % "camel-slack" % "2.17.0",

"org.scalatest" %% "scalatest" % "2.2.6" % Test
"org.apache.camel" % "camel-http" % camelVersion,
"org.apache.camel" % "camel-rabbitmq" % camelVersion,
"org.apache.camel" % "camel-slack" % camelVersion
exclude("junit", "junit")
,
"org.scalatest" %% "scalatest" % "2.2.6" % Test
)
}
3 changes: 2 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.3.5")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.3")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.3.5")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.2")
2 changes: 1 addition & 1 deletion src/main/scala/me/snov/sns/api/TopicApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ object TopicApi {
case _ => HttpResponse(404, entity = "NotFound")
}
}
case _ => complete(HttpResponse(400, entity = "Invalid topic name"))
case _ => complete(HttpResponse(400, entity = "Invalid topic ARN"))
} ~
complete(HttpResponse(404, entity = "NotFound"))
} ~
Expand Down
6 changes: 6 additions & 0 deletions src/test/scala/me/snov/sns/api/TopicSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ class TopicSpec extends WordSpec with Matchers with ScalatestRouteTest {
}
}

"TopicDelete validates topic name" in {
Post("/", FormData(Map("Action" -> "DeleteTopic", "TopicArn" -> "f$$"))) ~> route ~> check {
status shouldBe StatusCodes.BadRequest
}
}

"Sends create command to actor" in {
probe.setAutoPilot(new TestActor.AutoPilot {
def run(sender: ActorRef, msg: Any) = {
Expand Down

0 comments on commit a959610

Please sign in to comment.