Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 0 additions & 137 deletions DEVELOPING_OPAL/validate/src/it/resources/hermes-test-fixtures.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import java.io.File
import java.io.PrintStream
import java.net.URL
import java.net.URLClassLoader
import java.nio.file.Files

import org.scalatest.funspec.AnyFunSpec
import org.scalatest.matchers.should.Matchers
Expand All @@ -22,7 +21,6 @@ import org.opalj.bi.isCurrentJREAtLeastJava16
import org.opalj.br.analyses.Project
import org.opalj.br.reader.InvokedynamicRewriting
import org.opalj.bytecode.JavaBase
import org.opalj.io.JARsFileFilter
import org.opalj.util.InMemoryClassLoader

/**
Expand Down Expand Up @@ -361,50 +359,4 @@ class InvokedynamicRewritingExecutionTest extends AnyFunSpec with Matchers {
}
}
}

describe("behavior of rewritten OPAL") {

it("should execute Hermes successfully") {
val resources = locateTestResources("classfiles/OPAL-MultiJar-SNAPSHOT-01-04-2018.jar", "bi")
val p = JavaFixtureProject(resources)
val opalDependencies =
locateTestResources("classfiles/OPAL-MultiJar-SNAPSHOT-01-04-2018-dependencies/", "bi")
.listFiles(JARsFileFilter).map(_.toURI.toURL)

// Otherwise, the hermes resources are not included and hermes won't find
// HermesCLI.txt for example
val paths = Array(
new File("DEVELOPING_OPAL/tools/src/main/resources/").toURI.toURL,
new File("OPAL/ai/src/main/resources/").toURI.toURL,
new File("OPAL/ba/src/main/resources/").toURI.toURL,
new File("OPAL/bi/src/main/resources/").toURI.toURL,
new File("OPAL/br/src/main/resources/").toURI.toURL,
new File("OPAL/common/src/main/resources/").toURI.toURL
) ++ opalDependencies
val resourceClassloader = new URLClassLoader(paths, this.getClass.getClassLoader)
val inMemoryClassLoader = new ProjectBasedInMemoryClassLoader(p, resourceClassloader)

val c = inMemoryClassLoader.loadClass("org.opalj.hermes.HermesCLI")
val m = c.getMethod("main", classOf[Array[String]])

val tempFile = Files.createTempFile("OPALValidate-Hermes-stats-", ".csv").toFile
tempFile.delete()

info("Starting Hermes...")
m.invoke(
null,
Array(
"-config",
"DEVELOPING_OPAL/validate/src/it/resources/hermes-test-fixtures.json",
"-statistics",
tempFile.getAbsolutePath
)
)

assert(tempFile.exists())
assert(tempFile.length() > 0)

resourceClassloader.close()
}
}
}