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

Commit

Permalink
Update TODOs and add add release plugins, download source and javadoc #1
Browse files Browse the repository at this point in the history
  • Loading branch information
tdauth committed Nov 13, 2018
1 parent 1d1124d commit ba14ff6
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.project
/.classpath
/.settings
/.idea
Expand Down
18 changes: 14 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name := "gui-state-machine-api"

version := "1.0"
version := "0.1.0"

organization := "retest"

scalaVersion := "2.12.7"

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

// Dependencies to provide a REST service:
libraryDependencies += "com.github.scopt" % "scopt_2.12" % "3.7.0"
Expand All @@ -27,4 +27,14 @@ libraryDependencies += "org.scalamock" %% "scalamock" % "4.1.0" % "test"
// set the main class for 'sbt run'
mainClass in (Compile, run) := Some("de.retest.guistatemachine.rest.WebServer")
// set the main class for packaging the main jar
mainClass in (Compile, packageBin) := Some("de.retest.guistatemachine.rest.WebServer")
mainClass in (Compile, packageBin) := Some("de.retest.guistatemachine.rest.WebServer")

publishTo := {
val nexus = "https://my.artifact.repo.net/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}

credentials += Credentials(Path.userHome / ".sbt" / ".credentials")
1 change: 1 addition & 0 deletions project/sbtrelease.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.10")
3 changes: 2 additions & 1 deletion src/main/scala/de/retest/guistatemachine/api/Action.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package de.retest.guistatemachine.api

/**
* Interaction from the user with the GUI.
* TODO #6 Use an abstract representation of actions from retest-model instead of Selenium.
*/
case class Action(a: org.openqa.selenium.interactions.Action) {

// TODO #5 Convert abstract representation of actions into string.
// TODO #6 Convert abstract representation of actions into string.
override def toString: String = "Selenium Action"
}
12 changes: 10 additions & 2 deletions src/main/scala/de/retest/guistatemachine/api/State.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@ package de.retest.guistatemachine.api

/**
* A state should be identified by its corresponding [[Descriptors]].
* It consists of actions which have not been explored yet and transitions which build up the state machine.
* It consists of actions which have not been explored yet and transitions to states which build up the state machine.
*/
trait State {

/**
* @return The descriptors which identify this state.
*/
def getDescriptors: Descriptors

/**
* @return All actions which have not already been explored/executed from this state.
*/
def getNeverExploredActions: Set[Action]

/**
* NFA states can lead to different states by consuming the same symbol.
* Hence, we have a set of states per action.
* In the legacy code there was a type called `AmbigueState` but a multimap simplifies the implementation.
*/
def getTransitions: Map[Action, Set[State]]

Expand Down Expand Up @@ -39,4 +47,4 @@ trait State {
override def hashCode(): Int = this.getDescriptors.hashCode()

override def toString: String = s"descriptors=${getDescriptors},neverExploredActions=${getNeverExploredActions},transitions=${getTransitions}"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import de.retest.guistatemachine.api.GuiStateMachine
import scala.collection.mutable.HashSet

object GuiStateMachineApiImpl extends GuiStateMachineApi {
// TODO #4 Use Persistence instead of a custom set?
val stateMachines = new HashSet[GuiStateMachine]

override def createStateMachine: GuiStateMachine = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class StateImpl(val descriptors: Descriptors, var neverExploredActions: Set[Acti

/**
* TODO #4 Currently, there is no MultiMap trait for immutable maps in the Scala standard library.
* The legacy code used `AmbigueState` here which was more complicated than just a multi map.
*/
var transitions = new HashMap[Action, Set[State]]

Expand All @@ -24,4 +25,4 @@ class StateImpl(val descriptors: Descriptors, var neverExploredActions: Set[Acti
transitions = transitions + (a -> (transitions(a) + to))
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Persistence {

def getStateMachine(id: Id): Option[StateMachine] = if (stateMachines.stateMachines.hasElement(id)) Some(stateMachines.stateMachines.getElement(id)) else None

// TODO #4 Pass all unexplored actions for the initial state!
// TODO #1 Pass all unexplored actions for the initial state!
def createStateMachine(): Id = stateMachines.stateMachines.addNewElement(StateMachine())

def deleteStateMachine(id: Id): Boolean = stateMachines.stateMachines.removeElement(id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ object WebServer extends App with RestService {
bindingFuture
.flatMap(_.unbind()) // trigger unbinding from the port
.onComplete(_ => system.terminate()) // and shutdown when done
case None => println("Missing config.")
}
}
}

0 comments on commit ba14ff6

Please sign in to comment.