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.
- Loading branch information
Showing
4 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
src/main/scala/de/retest/guistatemachine/api/neo4j/ActionTransitionEntity.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.api.neo4j | ||
import de.retest.recheck.ui.descriptors.SutState | ||
import org.neo4j.ogm.annotation.{EndNode, RelationshipEntity, StartNode} | ||
|
||
@RelationshipEntity(`type` = "EXECUTED") | ||
class ActionTransitionEntity(start: SutState, end: SutState) extends Entity { | ||
|
||
def this() = this(null, null) | ||
|
||
@StartNode val s = start | ||
|
||
@EndNode val e = end | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/scala/de/retest/guistatemachine/api/neo4j/Entity.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,8 @@ | ||
package de.retest.guistatemachine.api.neo4j | ||
|
||
import org.neo4j.ogm.annotation.{GeneratedValue, Id} | ||
|
||
abstract class Entity { | ||
@Id @GeneratedValue private val id = 0L | ||
def getId: Long = id | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/scala/de/retest/guistatemachine/api/neo4j/Neo4jSessionFactory.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,10 @@ | ||
package de.retest.guistatemachine.api.neo4j | ||
|
||
import org.neo4j.ogm.session.SessionFactory | ||
|
||
// TODO #19 Use sessions to modify the state graph. | ||
object Neo4jSessionFactory { | ||
private val sessionFactory = new SessionFactory("de.retest.guistatemachine.api.neo4j") | ||
|
||
def getSession() = sessionFactory.openSession() | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/scala/de/retest/guistatemachine/api/neo4j/SutStateEntity.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,17 @@ | ||
package de.retest.guistatemachine.api.neo4j | ||
|
||
import de.retest.recheck.ui.descriptors.SutState | ||
import org.neo4j.ogm.annotation.typeconversion.Convert | ||
import org.neo4j.ogm.annotation.{GeneratedValue, Id, _} | ||
|
||
// TODO #19 Use this entity and sessions instead of manual transactions. | ||
@NodeEntity | ||
class SutStateEntity(state: SutState) extends Entity { | ||
|
||
def this() = this(null) | ||
|
||
@Id @GeneratedValue private val id = 0L | ||
|
||
@Convert(classOf[SutStateConverter]) | ||
private val sutState = state | ||
} |