diff --git a/cpg-neo4j/src/main/kotlin/de/fraunhofer/aisec/cpg_vis_neo4j/Application.kt b/cpg-neo4j/src/main/kotlin/de/fraunhofer/aisec/cpg_vis_neo4j/Application.kt index cc8780096f..5b55601c45 100644 --- a/cpg-neo4j/src/main/kotlin/de/fraunhofer/aisec/cpg_vis_neo4j/Application.kt +++ b/cpg-neo4j/src/main/kotlin/de/fraunhofer/aisec/cpg_vis_neo4j/Application.kt @@ -342,7 +342,7 @@ class Application : Callable { * point to a file, is a directory or point to a hidden file or the paths does not have the * same top level path. */ - private fun setupTranslationConfiguration(): TranslationConfiguration { + fun setupTranslationConfiguration(): TranslationConfiguration { val translationConfiguration = TranslationConfiguration.builder() .topLevel(topLevel) diff --git a/cpg-neo4j/src/test/kotlin/de/fraunhofer/aisec/cpg_vis_neo4j/ApplicationTest.kt b/cpg-neo4j/src/test/kotlin/de/fraunhofer/aisec/cpg_vis_neo4j/ApplicationTest.kt index 2d1d442867..33f38fe2cb 100644 --- a/cpg-neo4j/src/test/kotlin/de/fraunhofer/aisec/cpg_vis_neo4j/ApplicationTest.kt +++ b/cpg-neo4j/src/test/kotlin/de/fraunhofer/aisec/cpg_vis_neo4j/ApplicationTest.kt @@ -25,47 +25,35 @@ */ package de.fraunhofer.aisec.cpg_vis_neo4j -import de.fraunhofer.aisec.cpg.TranslationConfiguration import de.fraunhofer.aisec.cpg.TranslationManager -import de.fraunhofer.aisec.cpg.TranslationResult import de.fraunhofer.aisec.cpg.graph.declarations.FunctionDeclaration import de.fraunhofer.aisec.cpg.graph.functions -import java.io.File import java.nio.file.Paths import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull import org.junit.jupiter.api.Tag +import picocli.CommandLine @Tag("integration") class ApplicationTest { - - private var translationResult: TranslationResult? = null - @Test @Throws(InterruptedException::class) fun testPush() { val topLevel = Paths.get("src").resolve("test").resolve("resources").toAbsolutePath() val path = topLevel.resolve("client.cpp").toAbsolutePath() - val file = File(path.toString()) - assert(file.exists() && !file.isDirectory && !file.isHidden) - val translationConfiguration = - TranslationConfiguration.builder() - .sourceLocations(file) - .topLevel(topLevel.toFile()) - .defaultPasses() - .defaultLanguages() - .debugParser(true) - .build() - val translationManager = - TranslationManager.builder().config(translationConfiguration).build() - translationResult = translationManager.analyze().get() - assertEquals(31, translationResult.functions.size) + val cmd = CommandLine(Application::class.java) + cmd.parseArgs(path.toString()) + val application = cmd.getCommand() - val application = Application() + val translationConfiguration = application.setupTranslationConfiguration() + val translationResult = + TranslationManager.builder().config(translationConfiguration).build().analyze().get() + + assertEquals(31, translationResult.functions.size) - application.pushToNeo4j(translationResult!!) + application.pushToNeo4j(translationResult) val sessionAndSessionFactoryPair = application.connect()