Search in sources :

Example 6 with TranslationConfiguration

use of de.fraunhofer.aisec.cpg.TranslationConfiguration in project cpg by Fraunhofer-AISEC.

the class DemoTests method testHierarchy.

@Test
void testHierarchy() throws Exception {
    Path topLevel = Paths.get("src/test/resources/compiling/hierarchy");
    File[] files = Files.walk(topLevel, Integer.MAX_VALUE).map(Path::toFile).filter(File::isFile).filter(f -> f.getName().endsWith(".java")).toArray(File[]::new);
    TranslationConfiguration config = TranslationConfiguration.builder().sourceLocations(files).topLevel(topLevel.toFile()).defaultPasses().defaultLanguages().debugParser(true).failOnError(true).build();
    TranslationManager analyzer = TranslationManager.builder().config(config).build();
    var result = analyzer.analyze().get();
}
Also used : Path(java.nio.file.Path) Test(org.junit.jupiter.api.Test) TranslationConfiguration(de.fraunhofer.aisec.cpg.TranslationConfiguration) Files(java.nio.file.Files) Paths(java.nio.file.Paths) Assertions(org.junit.jupiter.api.Assertions) TranslationManager(de.fraunhofer.aisec.cpg.TranslationManager) Node(de.fraunhofer.aisec.cpg.graph.Node) BaseTest(de.fraunhofer.aisec.cpg.BaseTest) Path(java.nio.file.Path) TranslationResult(de.fraunhofer.aisec.cpg.TranslationResult) File(java.io.File) TranslationManager(de.fraunhofer.aisec.cpg.TranslationManager) File(java.io.File) TranslationConfiguration(de.fraunhofer.aisec.cpg.TranslationConfiguration) Test(org.junit.jupiter.api.Test) BaseTest(de.fraunhofer.aisec.cpg.BaseTest)

Aggregations

TranslationConfiguration (de.fraunhofer.aisec.cpg.TranslationConfiguration)6 File (java.io.File)6 TranslationManager (de.fraunhofer.aisec.cpg.TranslationManager)5 BaseTest (de.fraunhofer.aisec.cpg.BaseTest)4 Node (de.fraunhofer.aisec.cpg.graph.Node)4 Test (org.junit.jupiter.api.Test)4 TranslationResult (de.fraunhofer.aisec.cpg.TranslationResult)3 TranslationUnitDeclaration (de.fraunhofer.aisec.cpg.graph.declarations.TranslationUnitDeclaration)3 Path (java.nio.file.Path)3 BeforeAll (org.junit.jupiter.api.BeforeAll)3 TestUtils (de.fraunhofer.aisec.cpg.TestUtils)2 FieldDeclaration (de.fraunhofer.aisec.cpg.graph.declarations.FieldDeclaration)2 MethodDeclaration (de.fraunhofer.aisec.cpg.graph.declarations.MethodDeclaration)2 ParamVariableDeclaration (de.fraunhofer.aisec.cpg.graph.declarations.ParamVariableDeclaration)2 RecordDeclaration (de.fraunhofer.aisec.cpg.graph.declarations.RecordDeclaration)2 VariableDeclaration (de.fraunhofer.aisec.cpg.graph.declarations.VariableDeclaration)2 ForStatement (de.fraunhofer.aisec.cpg.graph.statements.ForStatement)2 CallExpression (de.fraunhofer.aisec.cpg.graph.statements.expressions.CallExpression)2 DeclaredReferenceExpression (de.fraunhofer.aisec.cpg.graph.statements.expressions.DeclaredReferenceExpression)2 Expression (de.fraunhofer.aisec.cpg.graph.statements.expressions.Expression)2