Skip to content

Commit 9da59eb

Browse files
committed
Updating test user and fixing getNeighbors
1 parent 57162e0 commit 9da59eb

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

src/Neo4jDFG/services/Neo4jDFG.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ function isConnected(dfg::Neo4jDFG)::Bool
445445
end
446446

447447
function getNeighbors(dfg::Neo4jDFG, node::T; solvable::Int=0)::Vector{Symbol} where T <: DFGNode
448-
query = "(n:$(dfg.userId):$(dfg.robotId):$(dfg.sessionId):$(node.label))-[r:FACTORGRAPH]-(node) where (node:VARIABLE or node:FACTOR) and node.solvable >= $solvable"
448+
query = "(n:`$(dfg.userId)`:`$(dfg.robotId)`:`$(dfg.sessionId)`:$(node.label))-[r:FACTORGRAPH]-(node) where (node:VARIABLE or node:FACTOR) and node.solvable >= $solvable"
449449
@debug "[Query] $query"
450450
neighbors = _getLabelsFromCyphonQuery(dfg.neo4jInstance, query)
451451
# If factor, need to do variable ordering TODO, Do we? does it matter if we always use _variableOrderSymbols in calculations?
@@ -456,7 +456,7 @@ function getNeighbors(dfg::Neo4jDFG, node::T; solvable::Int=0)::Vector{Symbol}
456456
end
457457

458458
function getNeighbors(dfg::Neo4jDFG, label::Symbol; solvable::Int=0)::Vector{Symbol}
459-
query = "(n:$(dfg.userId):$(dfg.robotId):$(dfg.sessionId):$(label))-[r:FACTORGRAPH]-(node) where (node:VARIABLE or node:FACTOR) and node.solvable >= $solvable"
459+
query = "(n:`$(dfg.userId)`:`$(dfg.robotId)`:`$(dfg.sessionId)`:$(label))-[r:FACTORGRAPH]-(node) where (node:VARIABLE or node:FACTOR) and node.solvable >= $solvable"
460460
neighbors = _getLabelsFromCyphonQuery(dfg.neo4jInstance, query)
461461
# If factor, need to do variable ordering TODO, Do we? does it matter if we always use _variableOrderSymbols in calculations?
462462
if isFactor(dfg, label)
@@ -473,10 +473,10 @@ function getSubgraphAroundNode(dfg::Neo4jDFG, node::DFGNode, distance::Int64=1,
473473
# Thank you Neo4j for 0..* awesomeness!!
474474
neighborList = _getLabelsFromCyphonQuery(dfg.neo4jInstance,
475475
"""
476-
(n:$(dfg.userId):$(dfg.robotId):$(dfg.sessionId):$(node.label))-[FACTORGRAPH*0..$distance]-(node:$(dfg.userId):$(dfg.robotId):$(dfg.sessionId))
476+
(n:`$(dfg.userId)`:`$(dfg.robotId)`:`$(dfg.sessionId)`:$(node.label))-[FACTORGRAPH*0..$distance]-(node:`$(dfg.userId)`:`$(dfg.robotId)`:`$(dfg.sessionId)`)
477477
WHERE (n:VARIABLE OR n:FACTOR OR node:VARIABLE OR node:FACTOR)
478478
and not (node:SESSION)
479-
and (node.solvable >= $solvable or node:$(dfg.userId):$(dfg.robotId):$(dfg.sessionId):$(node.label))""" # Always return the root node
479+
and (node.solvable >= $solvable or node:`$(dfg.userId)`:`$(dfg.robotId)`:`$(dfg.sessionId)`:$(node.label))""" # Always return the root node
480480
)
481481

482482
# Copy the section of graph we want

test/CGStructureTests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dfg = Neo4jDFG{SolverParams}("localhost", 7474, "neo4j", "test",
2-
"testUser", "testRobot", "testSession",
2+
"[email protected]", "testRobot", "testSession",
33
"Description of test session",
44
solverParams=SolverParams())
55

test/iifInterfaceTests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ end
4646
T = typeof(dfg)
4747
if dfg isa Neo4jDFG
4848
#TODO
49-
dfg2 = Neo4jDFG(solverParams=SolverParams(), userId="testUserId")
49+
dfg2 = Neo4jDFG(solverParams=SolverParams(), userId="[email protected]")
5050
else
51-
dfg2 = T(solverParams=SolverParams(), userId="testUserId")
51+
dfg2 = T(solverParams=SolverParams(), userId="[email protected]")
5252
end
5353

5454
# Build a new in-memory IIF graph to transfer into the new graph.

test/interfaceTests.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ end
152152
##
153153
@testset "Adjacency Matrices" begin
154154

155-
fg = testDFGAPI(userId="testUserId")
155+
fg = testDFGAPI(userId="[email protected]")
156156
addVariable!(fg, var1)
157157
setSolvable!(fg, :a, 1)
158158
addVariable!(fg, var2)
@@ -196,7 +196,7 @@ end
196196

197197
@testset "Copy Functions" begin
198198
rand(6)
199-
fg = testDFGAPI(userId="testUserId")
199+
fg = testDFGAPI(userId="[email protected]")
200200
addVariable!(fg, var1)
201201
addVariable!(fg, var2)
202202
addVariable!(fg, var3)
@@ -207,7 +207,7 @@ end
207207
# @test getVariableOrder(fg,:f1) == getVariableOrder(fgcopy,:f1)
208208

209209
#test copyGraph, deepcopyGraph[!]
210-
fgcopy = testDFGAPI(userId="testUserId")
210+
fgcopy = testDFGAPI(userId="[email protected]")
211211
DFG.deepcopyGraph!(fgcopy, fg)
212212
@test getVariableOrder(fg,:abf1) == getVariableOrder(fgcopy,:abf1)
213213

test/runtests.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ if get(ENV, "DO_CGDFG_TESTS", "") == "true"
4040
LightDFG,
4141
Neo4jDFG,
4242
]
43-
@warn "TEST: Removing all data for user 'testUserId'!"
44-
clearUser!!(Neo4jDFG(userId="testUserId"))
43+
@warn "TEST: Removing all data for user '[email protected]'!"
44+
clearUser!!(Neo4jDFG(userId="[email protected]"))
4545

4646
else
4747
apis = [
@@ -90,8 +90,8 @@ if get(ENV, "IIF_TEST", "") == "true"
9090
using IncrementalInference
9191

9292
apis = Vector{AbstractDFG}()
93-
push!(apis, LightDFG(solverParams=SolverParams(), userId="testUserId"))
94-
get(ENV, "DO_CGDFG_TESTS", "false") == "true" && push!(apis, Neo4jDFG(solverParams=SolverParams(), userId="testUserId"))
93+
push!(apis, LightDFG(solverParams=SolverParams(), userId="[email protected]"))
94+
get(ENV, "DO_CGDFG_TESTS", "false") == "true" && push!(apis, Neo4jDFG(solverParams=SolverParams(), userId="[email protected]"))
9595

9696
for api in apis
9797
@testset "Testing Driver: $(typeof(api))" begin
@@ -122,8 +122,8 @@ if get(ENV, "IIF_TEST", "") == "true"
122122
# This is just to validate we're not going to blow up downstream.
123123
apis = [
124124
# GraphsDFG{SolverParams}(),
125-
LightDFG(solverParams=SolverParams(), userId="testUserId"),
126-
Neo4jDFG(solverParams=SolverParams(), userId="testUserId")
125+
LightDFG(solverParams=SolverParams(), userId="[email protected]"),
126+
Neo4jDFG(solverParams=SolverParams(), userId="[email protected]")
127127
]
128128
for api in apis
129129
@info "Running simple solver test: $(typeof(api))"

test/testBlocks.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ function DFGStructureAndAccessors(::Type{T}, solparams::AbstractParams=NoSolverP
131131
# "DFG Structure and Accessors"
132132
# Constructors
133133
# Constructors to be implemented
134-
fg = T(solverParams=solparams, userId="testUserId")
134+
fg = T(solverParams=solparams, userId="[email protected]")
135135
#TODO test something better
136136
@test isa(fg, T)
137-
@test getUserId(fg)=="testUserId"
137+
@test getUserId(fg)=="[email protected]"
138138
@test getRobotId(fg)=="DefaultRobot"
139139
@test getSessionId(fg)[1:8] == "Session_"
140140

@@ -151,12 +151,12 @@ function DFGStructureAndAccessors(::Type{T}, solparams::AbstractParams=NoSolverP
151151

152152
#NOTE I don't like, so not exporting, and not recommended to use
153153
# Technically if you set Ids its a new object
154-
@test DistributedFactorGraphs.setUserId!(fg, "testUserId") == "testUserId"
154+
@test DistributedFactorGraphs.setUserId!(fg, "[email protected]") == "[email protected]"
155155
@test DistributedFactorGraphs.setRobotId!(fg, "testRobotId") == "testRobotId"
156156
@test DistributedFactorGraphs.setSessionId!(fg, "testSessionId") == "testSessionId"
157157

158158
des = "description for runtest"
159-
uId = "testUserId"
159+
160160
rId = "testRobotId"
161161
sId = "testSessionId"
162162
ud = :ud=>"udEntry"
@@ -1211,7 +1211,7 @@ function connectivityTestGraph(::Type{T}; VARTYPE=DFGVariable, FACTYPE=DFGFactor
12111211
numNodesType1 = 5
12121212
numNodesType2 = 5
12131213

1214-
dfg = T(userId="testUserId")
1214+
dfg = T(userId="[email protected]")
12151215

12161216
vars = vcat(map(n -> VARTYPE(Symbol("x$n"), VariableNodeData{TestVariableType1}()), 1:numNodesType1),
12171217
map(n -> VARTYPE(Symbol("x$(numNodesType1+n)"), VariableNodeData{TestVariableType2}()), 1:numNodesType2))
@@ -1419,7 +1419,7 @@ function ProducingDotFiles(testDFGAPI,
14191419
FACTYPE=DFGFactor)
14201420
# "Producing Dot Files"
14211421
# create a simpler graph for dot testing
1422-
dotdfg = testDFGAPI(userId="testUserId")
1422+
dotdfg = testDFGAPI(userId="[email protected]")
14231423

14241424
if v1 == nothing
14251425
v1 = VARTYPE(:a, VariableNodeData{TestVariableType1}())
@@ -1524,7 +1524,7 @@ function CopyFunctionsTest(testDFGAPI; kwargs...)
15241524
dcdfg_part1 = deepcopyGraph(LightDFG, dfg, vlbls1)
15251525
dcdfg_part2 = deepcopyGraph(LightDFG, dfg, vlbls2)
15261526

1527-
mergedGraph = testDFGAPI(userId="testUserId")
1527+
mergedGraph = testDFGAPI(userId="[email protected]")
15281528
mergeGraph!(mergedGraph, dcdfg_part1)
15291529
mergeGraph!(mergedGraph, dcdfg_part2)
15301530

@@ -1591,7 +1591,7 @@ function FileDFGTestBlock(testDFGAPI; kwargs...)
15911591
# Save and load the graph to test.
15921592
saveDFG(dfg, filename)
15931593

1594-
retDFG = testDFGAPI(userId="testUserId")
1594+
retDFG = testDFGAPI(userId="[email protected]")
15951595
@info "Going to load $filename"
15961596

15971597
@test_throws AssertionError loadDFG!(retDFG,"badfilename")

0 commit comments

Comments
 (0)