Skip to content
This repository was archived by the owner on Mar 12, 2020. It is now read-only.

Commit 04cd7a8

Browse files
committed
Swagger support for REST, execution counters for actions, persistence methods #1 #7 #9
- Besides, update some scalastyle rules. - Move all sbt plugins to one file. - Do some refactoring, so we only used immutable data structures. - Add type ActionTransitions which stores the execution times. - Initial persistence methods. - Add initial Swagger support for the REST service.
1 parent 770af5b commit 04cd7a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+307
-144
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,9 @@ Some suggestions how the REST API for the state machine could look like:
6565
* `/state-machine/<long>/state/<long>/transition/<long>` GET queries a specific transition of a specific state.
6666
* `/state-machine/<long>/execute` POST executes the passed action from the passed state which might lead to a new state and adds a transition to the state machine. The action must be part of all actions?
6767

68+
## Swagger Support
69+
The Swagger support is based on [swagger-akka-http](https://github.com/swagger-akka-http/swagger-akka-http).
70+
The URL `http://localhost:8888/api-docs/swagger.json` should show create Swagger JSON output which can be rendered by Swagger UI.
71+
6872
### Bash Scripts for REST Calls
6973
The directory [scripts](./scripts) contains a number of Bash scripts which use `curl` to send REST calls to a running server.

build.sbt

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ organization := "retest"
77
scalaVersion := "2.12.7"
88

99
// Dependencies to represent the input of states and actions:
10-
libraryDependencies += "de.retest" % "retest-model" % "5.0.0" withSources() withJavadoc()
11-
libraryDependencies += "org.seleniumhq.selenium" % "selenium-java" % "2.35.0" withSources() withJavadoc()
10+
libraryDependencies += "de.retest" % "retest-model" % "5.0.0" withSources () withJavadoc ()
11+
libraryDependencies += "org.seleniumhq.selenium" % "selenium-java" % "2.35.0" withSources () withJavadoc ()
1212

1313
// Dependencies to provide a REST service:
1414
libraryDependencies += "com.github.scopt" % "scopt_2.12" % "3.7.0"
@@ -20,6 +20,10 @@ libraryDependencies += "com.typesafe.akka" %% "akka-http-spray-json" % "10.1.5"
2020
libraryDependencies += "com.typesafe.akka" %% "akka-http-xml" % "10.1.5"
2121
libraryDependencies += "com.typesafe.akka" %% "akka-http-testkit" % "10.1.5" % "test"
2222

23+
// Swagger:
24+
libraryDependencies += "io.swagger" % "swagger-jaxrs" % "1.5.21"
25+
libraryDependencies += "com.github.swagger-akka-http" %% "swagger-akka-http" % "1.0.0"
26+
2327
// Test frameworks:
2428
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.5" % "test"
2529
libraryDependencies += "org.scalamock" %% "scalamock" % "4.1.0" % "test"
@@ -29,12 +33,5 @@ mainClass in (Compile, run) := Some("de.retest.guistatemachine.rest.WebServer")
2933
// set the main class for packaging the main jar
3034
mainClass in (Compile, packageBin) := Some("de.retest.guistatemachine.rest.WebServer")
3135

32-
publishTo := {
33-
val nexus = "https://oss.sonatype.org/"
34-
if (isSnapshot.value)
35-
Some("snapshots" at nexus + "content/repositories/snapshots")
36-
else
37-
Some("releases" at nexus + "service/local/staging/deploy/maven2")
38-
}
39-
40-
credentials += Credentials(Path.userHome / ".sbt" / ".credentials")
36+
// format the code
37+
scalafmtOnCompile := true

project/assembly.sbt

Lines changed: 0 additions & 1 deletion
This file was deleted.

project/plugins.sbt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// to create a standalone JAR file with all dependencies
2+
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")
3+
// code formatting
4+
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.15")
5+
// for signed releases
6+
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1")
7+
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.4")
8+
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.10")
9+
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
10+
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")

project/sbteclipse.sbt

Lines changed: 0 additions & 1 deletion
This file was deleted.

project/sbtrelease.sbt

Lines changed: 0 additions & 1 deletion
This file was deleted.

project/scalafmt.sbt

Lines changed: 0 additions & 1 deletion
This file was deleted.

project/scalastyle.sbt

Lines changed: 0 additions & 1 deletion
This file was deleted.

project/scoverage.sbt

Lines changed: 0 additions & 1 deletion
This file was deleted.

scalastyle-config.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,6 @@
112112
</parameters>
113113
</check>
114114
<check level="warning" class="org.scalastyle.scalariform.PublicMethodsHaveTypeChecker" enabled="true"></check>
115-
<check level="warning" class="org.scalastyle.file.NewLineAtEofChecker" enabled="false"></check>
116-
<check level="warning" class="org.scalastyle.file.NoNewLineAtEofChecker" enabled="true"></check>
115+
<check level="warning" class="org.scalastyle.file.NewLineAtEofChecker" enabled="true"></check>
116+
<check level="warning" class="org.scalastyle.file.NoNewLineAtEofChecker" enabled="false"></check>
117117
</scalastyle>

0 commit comments

Comments
 (0)