Search in sources :

Example 1 with PubDepsParser

use of com.synopsys.integration.detectable.detectables.dart.pubdep.PubDepsParser in project synopsys-detect by blackducksoftware.

the class DetectableFactory method createDartPubDepDetectable.

public DartPubDepDetectable createDartPubDepDetectable(DetectableEnvironment environment, DartPubDepsDetectableOptions dartPubDepsDetectableOptions, DartResolver dartResolver, FlutterResolver flutterResolver) {
    PubDepsParser pubDepsParser = new PubDepsParser();
    PubSpecYamlNameVersionParser pubSpecYamlNameVersionParser = new PubSpecYamlNameVersionParser();
    PubDepsExtractor pubDepsExtractor = new PubDepsExtractor(executableRunner, pubDepsParser, pubSpecYamlNameVersionParser, toolVersionLogger);
    return new DartPubDepDetectable(environment, fileFinder, pubDepsExtractor, dartPubDepsDetectableOptions, dartResolver, flutterResolver);
}
Also used : PubDepsParser(com.synopsys.integration.detectable.detectables.dart.pubdep.PubDepsParser) PubSpecYamlNameVersionParser(com.synopsys.integration.detectable.detectables.dart.PubSpecYamlNameVersionParser) PubDepsExtractor(com.synopsys.integration.detectable.detectables.dart.pubdep.PubDepsExtractor) DartPubDepDetectable(com.synopsys.integration.detectable.detectables.dart.pubdep.DartPubDepDetectable)

Example 2 with PubDepsParser

use of com.synopsys.integration.detectable.detectables.dart.pubdep.PubDepsParser in project synopsys-detect by blackducksoftware.

the class PubDepsExtractorTest method testGracefulFailure.

private void testGracefulFailure(ExecutableOutput mockExecutableOutput) throws ExecutableRunnerException {
    DetectableExecutableRunner executableRunner = Mockito.mock(DetectableExecutableRunner.class);
    Mockito.when(executableRunner.execute(Mockito.any())).thenReturn(mockExecutableOutput);
    PubDepsExtractor extractor = new PubDepsExtractor(executableRunner, new PubDepsParser(), null, new ToolVersionLogger(executableRunner));
    Extraction extraction = extractor.extract(null, null, null, new DartPubDepsDetectableOptions(EnumListFilter.excludeNone()), null);
    Assertions.assertFalse(extraction.isSuccess() && null == extraction.getError());
}
Also used : PubDepsParser(com.synopsys.integration.detectable.detectables.dart.pubdep.PubDepsParser) DetectableExecutableRunner(com.synopsys.integration.detectable.detectable.executable.DetectableExecutableRunner) DartPubDepsDetectableOptions(com.synopsys.integration.detectable.detectables.dart.pubdep.DartPubDepsDetectableOptions) PubDepsExtractor(com.synopsys.integration.detectable.detectables.dart.pubdep.PubDepsExtractor) Extraction(com.synopsys.integration.detectable.extraction.Extraction) ToolVersionLogger(com.synopsys.integration.detectable.util.ToolVersionLogger)

Example 3 with PubDepsParser

use of com.synopsys.integration.detectable.detectables.dart.pubdep.PubDepsParser in project synopsys-detect by blackducksoftware.

the class PubDepsParserTest method test.

@Test
public void test() {
    List<String> pubDepsLines = FunctionalTestFiles.asListOfStrings("/dart/pubDeps.txt");
    PubDepsParser pubDepsParser = new PubDepsParser();
    DependencyGraph dependencyGraph = pubDepsParser.parse(pubDepsLines);
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.DART, dependencyGraph);
    graphAssert.hasRootSize(4);
    graphAssert.hasRootDependency("charcode", "1.1.3");
    graphAssert.hasRootDependency("pedantic", "1.9.2");
    graphAssert.hasRootDependency("test", "1.15.3");
    graphAssert.hasRootDependency("typed_data", "1.2.0");
    graphAssert.hasParentChildRelationship("analyzer", "0.39.17", "_fe_analyzer_shared", "7.0.0");
    graphAssert.hasParentChildRelationship("glob", "1.2.0", "node_io", "1.1.1");
    graphAssert.hasParentChildRelationship("node_interop", "1.1.1", "js", "1.1.0");
    graphAssert.hasParentChildRelationship("js", "1.1.0", "async", "2.2.1");
    graphAssert.hasParentChildRelationship("async", "2.2.1", "charcode", "1.1.3");
    graphAssert.hasParentChildRelationship("typed_data", "1.2.0", "webkit_inspection_protocol", "0.7.3");
}
Also used : PubDepsParser(com.synopsys.integration.detectable.detectables.dart.pubdep.PubDepsParser) NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) Test(org.junit.jupiter.api.Test)

Aggregations

PubDepsParser (com.synopsys.integration.detectable.detectables.dart.pubdep.PubDepsParser)3 PubDepsExtractor (com.synopsys.integration.detectable.detectables.dart.pubdep.PubDepsExtractor)2 DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)1 DetectableExecutableRunner (com.synopsys.integration.detectable.detectable.executable.DetectableExecutableRunner)1 PubSpecYamlNameVersionParser (com.synopsys.integration.detectable.detectables.dart.PubSpecYamlNameVersionParser)1 DartPubDepDetectable (com.synopsys.integration.detectable.detectables.dart.pubdep.DartPubDepDetectable)1 DartPubDepsDetectableOptions (com.synopsys.integration.detectable.detectables.dart.pubdep.DartPubDepsDetectableOptions)1 Extraction (com.synopsys.integration.detectable.extraction.Extraction)1 ToolVersionLogger (com.synopsys.integration.detectable.util.ToolVersionLogger)1 NameVersionGraphAssert (com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)1 Test (org.junit.jupiter.api.Test)1