Skip to content

Commit

Permalink
Merge remote-tracking branch 'neo4j/3.1' into 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fickludd committed Nov 28, 2017
2 parents d823b24 + 67c4f11 commit 71ed837
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
*/
package org.neo4j.internal.cypher.acceptance

import java.io.{File, FileWriter, PrintWriter}
import java.io.{File, PrintWriter}
import java.net.{URL, URLConnection, URLStreamHandler, URLStreamHandlerFactory}
import java.nio.file.Files
import java.util.Collections.emptyMap

import org.neo4j.cypher._
Expand Down Expand Up @@ -117,22 +118,19 @@ class LoadCsvAcceptanceTest
}

test("make sure to release all possible locks/references on input files") {
val file = new File("to-be-removed.csv")
val writer = new FileWriter(file)
writer.write("foo")
writer.close()

val filePathForQuery =
if(System.getProperty("os.name").toLowerCase.startsWith("Windows".toLowerCase)){
file.getAbsolutePath.replace('\\','/').replaceAll(".:/","///"); // matches something like "C:\"
} else {
"//" + file.getAbsolutePath
}

val result = updateWithBothPlannersAndCompatibilityMode(s"LOAD CSV FROM 'file:$filePathForQuery' AS line CREATE (a {name: line[0]}) RETURN a.name")

val path = Files.createTempFile("file",".csv")

Files.write(path,"foo".getBytes)
assert(Files.exists(path))

val filePathForQuery = path.normalize().toUri
val result = innerExecute(s"LOAD CSV FROM '$filePathForQuery' AS line CREATE (a {name: line[0]}) RETURN a.name")
assertStats(result, nodesCreated = 1, propertiesWritten = 1)

assert(file.delete())
result.close()

assert(Files.deleteIfExists(path))
}

test("import three numbers") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class ShortestPathRelationshipUniquenessAcceptanceTest extends ExecutionEngineFu
"""MATCH p=shortestpath((a:Model)-[r*]-(b:Model))
WHERE a.id="2228" AND b.id="2638" AND ANY ( n IN nodes(p)[1..-1] WHERE (n.id = "32") )
RETURN nodes(p) as nodes"""

val result = executeUsingCostPlannerOnly(query).columnAs("nodes").toList
result should be(List(List(p0, pLongPath0, pLongPath1, pLongPath2, pLongPath3, pLongPath4, pLongPath5, p3, p2, p4, p5)))
}
Expand Down

0 comments on commit 71ed837

Please sign in to comment.