This repository has been archived by the owner on Mar 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add custom JSON formatter for our Map type - Move Furrer model into seprate package since it is not valid - Separate persistence layer into separate package - Add Bash scripts for REST calls - Simplify documentation
- Loading branch information
Showing
25 changed files
with
268 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
curl -H "Content-Type: application/json" -X GET http://localhost:8888/applications |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
curl -H "Content-Type: application/json" -X POST http://localhost:8888/create-application |
30 changes: 30 additions & 0 deletions
30
src/main/scala/de/retest/guistatemachine/JsonFormatForIdMap.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package de.retest.guistatemachine | ||
|
||
import spray.json._ | ||
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._ | ||
import spray.json.DefaultJsonProtocol._ | ||
|
||
import de.retest.guistatemachine.model.Id | ||
import de.retest.guistatemachine.model.Map | ||
import scala.collection.immutable.HashMap | ||
|
||
/** | ||
* Transforms a [[Map]] into a `scala.collection.immutable.Map[String, T]`, so it can be converted into valid JSON. | ||
* Besides, transforms a JSON object which is a `scala.collection.immutable.Map[String, T]` back into a [[Map]]. | ||
* This transformer requires a JSON format for the type `K`. | ||
*/ | ||
class JsonFormatForIdMap[T](implicit val jsonFormat: JsonFormat[T]) extends RootJsonFormat[Map[T]] { | ||
override def write(obj: Map[T]): JsValue = | ||
obj.values.map { field => (field._1.id.toString -> field._2) }.toJson | ||
|
||
override def read(json: JsValue): Map[T] = { | ||
val obj = json.asJsObject | ||
if (obj.fields.isEmpty) { | ||
new Map[T](new HashMap[Id, T]()) | ||
// TODO Fix conversation back into the Map type. | ||
} else { | ||
val map = json.asInstanceOf[scala.collection.immutable.Map[String, T]] | ||
new Map[T](map.map { x => (Id(x._1.toLong) -> x._2) }) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/main/scala/de/retest/guistatemachine/furrermodel/GuiApplication.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package de.retest.guistatemachine.furrermodel | ||
|
||
/** | ||
* The tested GUI application with an initial state and a number of test suites. | ||
* | ||
* @param id This ID is for the REST API only. | ||
*/ | ||
class GuiApplication(val id : Long, initialState: State, testSuites: Seq[TestSuite]) { | ||
|
||
def getTestSuites: Seq[TestSuite] = testSuites | ||
|
||
def getInitialState: State = initialState | ||
} |
2 changes: 1 addition & 1 deletion
2
...est/guistatemachine/model/GuiWidget.scala → ...istatemachine/furrermodel/GuiWidget.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...est/guistatemachine/model/GuiWindow.scala → ...istatemachine/furrermodel/GuiWindow.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../retest/guistatemachine/model/State.scala → ...t/guistatemachine/furrermodel/State.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...test/guistatemachine/model/TestCase.scala → ...uistatemachine/furrermodel/TestCase.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/scala/de/retest/guistatemachine/furrermodel/TestSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package de.retest.guistatemachine.furrermodel | ||
|
||
class TestSuite { | ||
private val cases = Set[TestCase]() | ||
|
||
def size = cases.size | ||
|
||
def length = cases.foldLeft(0)((size, c) => size + c.length) | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/scala/de/retest/guistatemachine/furrermodel/UIAction.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package de.retest.guistatemachine.furrermodel | ||
|
||
trait UIAction { | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...retest/guistatemachine/model/UIPath.scala → .../guistatemachine/furrermodel/UIPath.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.