Permalink
Browse files

fixes #567: Parameter maps coming through REST are not parsed correctly

  • Loading branch information...
1 parent 14b66aa commit 924cd11f766114cdbd10a1a7e041231f26152970 @systay committed May 28, 2012
@@ -37,7 +37,7 @@ trait UpdateAction {
def filter(f: Expression => Boolean): Seq[Expression]
}
-trait GraphElementPropertyFunctions {
+trait GraphElementPropertyFunctions extends IterableSupport {
def setProperties(pc: PropertyContainer, props: Map[String, Expression], context: ExecutionContext, state: QueryState) {
props.foreach {
case ("*", expression) => setAllMapKeyValues(expression, context, pc, state)
@@ -71,8 +71,8 @@ trait GraphElementPropertyFunctions {
state.propertySet.increase()
}
- def makeValueNeoSafe(a: Any): Any = if (a.isInstanceOf[Traversable[_]]) {
- transformTraversableToArray(a)
+ def makeValueNeoSafe(a: Any): Any = if (isCollection(a)) {
+ transformTraversableToArray(makeTraversable(a))
} else {
a
}
@@ -383,6 +383,22 @@ return distinct center""")
}
@Test
+ def create_node_from_map_with_array_value_from_java() {
+ val list = new java.util.ArrayList[String]()
+ list.add("foo")
+ list.add("bar")
+
+ val map = new java.util.HashMap[String, Object]()
+ map.put("arrayProp", list)
+
+ val q = "create a={param} return a.arrayProp"
+ val result = executeScalar[Array[String]](q, "param" -> map)
+
+ assertStats(parseAndExecute(q, "param"->map), nodesCreated = 1, propertiesSet = 1)
+ assert(result === Array("foo","bar"))
+ }
+
+ @Test
def failed_query_should_not_leave_dangling_transactions() {
intercept[NotFoundException](parseAndExecute("START left=node(1), right=node(3,4) RELATE left-[r:KNOWS]->right RETURN r"))

0 comments on commit 924cd11

Please sign in to comment.