Skip to content

Commit

Permalink
Fixed neo4j database existence detection
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBakerEffendi committed Sep 18, 2024
1 parent c2e99cd commit 7704e86
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.github.plume.oss.Benchmark.deserializeConfig
import com.github.plume.oss.drivers.IDriver
import com.github.plume.oss.{Benchmark, JimpleAst2Database, PlumeConfig, TinkerGraphConfig}
import io.joern.jimple2cpg.Config
import io.shiftleft.codepropertygraph.generated.{NodeTypes, PropertyNames}
import org.openjdk.jmh.annotations.*
import org.openjdk.jmh.infra.{BenchmarkParams, Blackhole}

Expand Down Expand Up @@ -41,10 +42,11 @@ trait GraphReadBenchmark {
val (driver_, _) = oss.Benchmark.initializeDriverAndInputDir(configStr, deleteExistingStorage = false)
driver = driver_
val createAst = config.dbConfig match {
case TinkerGraphConfig(_, Some(path)) => !File(path).exists()
case oss.OverflowDbConfig(path, _, _) => !File(path).exists()
case oss.Neo4jEmbeddedConfig(_, path, _) => !File(path).exists()
case _ => true
case TinkerGraphConfig(_, Some(path)) => !File(path).exists()
case oss.OverflowDbConfig(path, _, _) => !File(path).exists()
case oss.Neo4jEmbeddedConfig(_, path, _) =>
if !File(path).exists() then true else driver.propertyFromNodes(NodeTypes.FILE, PropertyNames.NAME).isEmpty
case _ => true
}
if (createAst) JimpleAst2Database(driver).createAst(Config().withInputPath(config.inputDir))
}
Expand Down

0 comments on commit 7704e86

Please sign in to comment.