Skip to content

Commit

Permalink
Merge 3.0 into 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
davidegrohmann committed May 9, 2016
2 parents 13e795d + 0a31eed commit 534e573
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class RuntimeJavaValueConverter(skip: Any => Boolean) {
def asDeepJavaValue(value: Any): Any = value match {
case anything if skip(anything) => anything
case map: Map[_, _] => immutableMapValues(map, asDeepJavaValue).asJava: JavaMap[_, _]
case iterable: Iterable[_] => iterable.map(asDeepJavaValue).toSeq.asJava: JavaList[_]
case traversable: TraversableOnce[_] => traversable.map(asDeepJavaValue).toSeq.asJava: JavaList[_]
case iterable: Iterable[_] => iterable.map(asDeepJavaValue).toVector.asJava: JavaList[_]
case traversable: TraversableOnce[_] => traversable.map(asDeepJavaValue).toVector.asJava: JavaList[_]
case anything => anything
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2002-2016 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.cypher.internal.compiler.v3_1.helpers

import org.neo4j.cypher.internal.frontend.v3_1.test_helpers.CypherFunSuite

import scala.collection.convert.Wrappers.SeqWrapper

class RuntimeJavaValueConverterTest extends CypherFunSuite {

test("should used indexed seq when converting list") {
val converter: RuntimeJavaValueConverter = new RuntimeJavaValueConverter(_ => false)

val converted = converter.asDeepJavaValue(List(1, 2, 3)).asInstanceOf[SeqWrapper[_]]

converted.underlying shouldBe a [Vector[_]]
}

test("should used indexed seq when converting iterator") {
val converter: RuntimeJavaValueConverter = new RuntimeJavaValueConverter(_ => false)

val converted = converter.asDeepJavaValue(List(1, 2, 3).iterator).asInstanceOf[SeqWrapper[_]]

converted.underlying shouldBe a [Vector[_]]
}
}

This file was deleted.

0 comments on commit 534e573

Please sign in to comment.