Skip to content

Commit

Permalink
#96 CoreGraphSchema to DefaultGraphSchema, GremlinGraphValidator to D…
Browse files Browse the repository at this point in the history
…efaultGraphValidator
  • Loading branch information
augustearth committed Aug 6, 2022
1 parent 5e34350 commit 8e45117
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ abstract class CoreGraph implements GremlinTrait {
//Graph graph

/** */
CoreGraphSchema graphSchema
DefaultGraphSchema graphSchema

/** */
GraphValidator graphValidator
Expand All @@ -131,7 +131,7 @@ abstract class CoreGraph implements GremlinTrait {
///////////////////////////////////////////////////////////////////////////

/** */
protected CoreGraph(Graph graph, CoreGraphSchema graphSchema, GraphValidator graphValidator) {
protected CoreGraph(Graph graph, DefaultGraphSchema graphSchema, GraphValidator graphValidator) {
assert graph
assert graphSchema
assert graphValidator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ class CoreGraphNeo4j extends CoreGraph {
def graph = openGremlinGraph()

def graphSchema
if (args.vertexBuilders) graphSchema = new CoreGraphSchema(args.vertexBuilders)
else graphSchema = new CoreGraphSchema()
if (args.vertexBuilders) graphSchema = new DefaultGraphSchema(args.vertexBuilders)
else graphSchema = new DefaultGraphSchema()

def graphValidator = new GremlinGraphValidator()
def graphValidator = new DefaultGraphValidator()
def coreGraph = new CoreGraphNeo4j(graph, graphSchema, graphValidator)

def g = graph.traversal()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ import carnival.graph.VertexBuilder
*
*/
@Slf4j
class CoreGraphSchema implements GraphSchema {
class DefaultGraphSchema implements GraphSchema {

///////////////////////////////////////////////////////////////////////////
// CONSTRUCTOR
///////////////////////////////////////////////////////////////////////////

/** */
public CoreGraphSchema() { }
public DefaultGraphSchema() { }

/** */
public CoreGraphSchema(Collection<VertexBuilder> vertexBuilders) {
public DefaultGraphSchema(Collection<VertexBuilder> vertexBuilders) {
assert vertexBuilders
assert vertexBuilders.size() > 0
this.vertexBuilders.addAll(vertexBuilders)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ class CoreGraphTinker extends CoreGraph {
def graph = TinkerGraph.open()

def graphSchema
if (args.vertexBuilders) graphSchema = new CoreGraphSchema(args.vertexBuilders)
else graphSchema = new CoreGraphSchema()
if (args.vertexBuilders) graphSchema = new DefaultGraphSchema(args.vertexBuilders)
else graphSchema = new DefaultGraphSchema()

def graphValidator = new GremlinGraphValidator()
def graphValidator = new DefaultGraphValidator()
def coreGraph = new CoreGraphTinker(graph, graphSchema, graphValidator)

def g = graph.traversal()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__

/** */
@Slf4j
public class LegacyValidator extends GremlinGraphValidator {
public class LegacyValidator extends DefaultGraphValidator {

///////////////////////////////////////////////////////////////////////////
// MODEL CHECKING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import carnival.graph.Base

/** */
@Slf4j
public class GremlinGraphValidator implements GraphValidator {
public class DefaultGraphValidator implements GraphValidator {

///////////////////////////////////////////////////////////////////////////
// STATIC METOHDS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ class CoreGraphInitSpec extends Specification {
graph != null

when:
def graphSchema = new CoreGraphSchema()
def graphValidator = new GremlinGraphValidator()
def graphSchema = new DefaultGraphSchema()
def graphValidator = new DefaultGraphValidator()
def coreGraph = new CoreGraphNeo4j(graph, graphSchema, graphValidator)

then:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import test.TestModel


/**
* gradle test --tests "carnival.core.graph.GremlinGraphValidatorSpec"
* gradle test --tests "carnival.core.graph.DefaultGraphValidatorSpec"
*
*/
class GremlinGraphValidatorSpec extends Specification {
class DefaultGraphValidatorSpec extends Specification {

static enum VX1 implements VertexDefinition {
GGV_THING,
Expand Down Expand Up @@ -96,7 +96,7 @@ class GremlinGraphValidatorSpec extends Specification {
coreGraph = CoreGraphTinker.create()
graph = coreGraph.graph
graphSchema = coreGraph.graphSchema
graphValidator = new GremlinGraphValidator()
graphValidator = new DefaultGraphValidator()
g = graph.traversal()
}

Expand Down Expand Up @@ -185,7 +185,7 @@ class GremlinGraphValidatorSpec extends Specification {
graphValidator.checkConstraints(g, graphSchema).size() == 0

when:
Core.VX.APPLICATION.instance().withProperty(Core.PX.NAME, 'GremlinGraphValidatorSpecApp').vertex(graph, g)
Core.VX.APPLICATION.instance().withProperty(Core.PX.NAME, 'DefaultGraphValidatorSpecApp').vertex(graph, g)

then:
graphValidator.checkModel(g, graphSchema).size() == 0
Expand Down

0 comments on commit 8e45117

Please sign in to comment.