Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBakerEffendi committed Jul 3, 2024
1 parent 827970a commit 9d33f11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@ class PlumeDriverFixture(val driver: IDriver)
val changes = diffGraph1.iterator.asScala.toList
val srcNode = changes
.collectFirst {
case c: DetachedNodeGeneric if c.getRefOrId == m.getOrElse("id", -1L).toString.toLong =>
case c: DetachedNodeGeneric
if c.getRefOrId.asInstanceOf[StoredNode].id() == m.getOrElse("id", -1L).toString.toLong =>
c
} match {
case Some(src) => src
case None => fail("Unable to extract method node")
}
val dstNode = changes
.collectFirst {
case c: NewBlock if c.getRefOrId().asInstanceOf[Long] == b.getOrElse("id", -1L).toString.toLong => c
case c: NewBlock if c.getRefOrId().asInstanceOf[StoredNode].id() == b.getOrElse("id", -1L).toString.toLong =>
c
} match {
case Some(dst) => dst
case None => fail("Unable to extract block node")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.plume.oss.drivers

import better.files.File
import com.github.plume.oss.testfixtures.PlumeDriverFixture
import com.github.plume.oss.testfixtures.PlumeDriverFixture.{b1, m1}
import io.shiftleft.codepropertygraph.generated.{Cpg, EdgeTypes}
Expand All @@ -25,11 +26,11 @@ class OverflowDbTests extends PlumeDriverFixture(new OverflowDbDriver()) {
val outFile = Paths.get("./odbGraph.xml").toFile
td.exportAsGraphML(outFile)
// Should be valid if TinkerGraph can accept it
Try({
Try {
val graph = TinkerGraph.open()
graph.traversal().io[Any](outFile.getAbsolutePath).read().iterate()
graph.close()
}) match {
} match {
case Failure(e) => fail("TinkerGraph could not import ODB generated XML", e)
case _ =>
}
Expand All @@ -38,7 +39,7 @@ class OverflowDbTests extends PlumeDriverFixture(new OverflowDbDriver()) {

private def createSimpleGraph(driver: IDriver): Unit = {
val diffGraph = new BatchedUpdate.DiffGraphBuilder()
diffGraph.addNode(m1).addNode(b1).addEdge(m1, b1, EdgeTypes.AST)
diffGraph.addNode(m1.copy).addNode(b1.copy).addEdge(m1.copy, b1.copy, EdgeTypes.AST)
driver.bulkTx(diffGraph)
}

Expand Down

0 comments on commit 9d33f11

Please sign in to comment.