Search in sources :

Example 1 with PearDependencyGraphTransformer

use of com.synopsys.integration.detectable.detectables.pear.transform.PearDependencyGraphTransformer in project synopsys-detect by blackducksoftware.

the class DetectableFactory method createPearCliDetectable.

public PearCliDetectable createPearCliDetectable(DetectableEnvironment environment, PearCliDetectableOptions pearCliDetectableOptions, PearResolver pearResolver) {
    PearDependencyGraphTransformer pearDependencyGraphTransformer = new PearDependencyGraphTransformer(externalIdFactory, pearCliDetectableOptions.getDependencyTypeFilter());
    PearPackageXmlParser pearPackageXmlParser = new PearPackageXmlParser();
    PearPackageDependenciesParser pearPackageDependenciesParser = new PearPackageDependenciesParser();
    PearListParser pearListParser = new PearListParser();
    PearCliExtractor pearCliExtractor = new PearCliExtractor(externalIdFactory, executableRunner, pearDependencyGraphTransformer, pearPackageXmlParser, pearPackageDependenciesParser, pearListParser);
    return new PearCliDetectable(environment, fileFinder, pearResolver, pearCliExtractor);
}
Also used : PearListParser(com.synopsys.integration.detectable.detectables.pear.parse.PearListParser) PearCliDetectable(com.synopsys.integration.detectable.detectables.pear.PearCliDetectable) PearDependencyGraphTransformer(com.synopsys.integration.detectable.detectables.pear.transform.PearDependencyGraphTransformer) PearPackageXmlParser(com.synopsys.integration.detectable.detectables.pear.parse.PearPackageXmlParser) PearPackageDependenciesParser(com.synopsys.integration.detectable.detectables.pear.parse.PearPackageDependenciesParser) PearCliExtractor(com.synopsys.integration.detectable.detectables.pear.PearCliExtractor)

Example 2 with PearDependencyGraphTransformer

use of com.synopsys.integration.detectable.detectables.pear.transform.PearDependencyGraphTransformer in project synopsys-detect by blackducksoftware.

the class PearDependencyGraphTransformerTest method buildDependencyGraph.

private DependencyGraph buildDependencyGraph(PearDependencyType... excludedTypes) {
    ExternalIdFactory externalIdFactory = new ExternalIdFactory();
    PearDependencyGraphTransformer pearDependencyGraphTransformer = new PearDependencyGraphTransformer(externalIdFactory, EnumListFilter.fromExcluded(excludedTypes));
    Map<String, String> nameVersionMap = new HashMap<>();
    nameVersionMap.put("Archive_Tar", "1.4.3");
    nameVersionMap.put("Console_Getopt", "1.4.1");
    List<PackageDependency> packageDependencies = new ArrayList<>();
    packageDependencies.add(new PackageDependency("Archive_Tar", true));
    packageDependencies.add(new PackageDependency("Console_Getopt", false));
    return pearDependencyGraphTransformer.buildDependencyGraph(nameVersionMap, packageDependencies);
}
Also used : PackageDependency(com.synopsys.integration.detectable.detectables.pear.model.PackageDependency) HashMap(java.util.HashMap) ExternalIdFactory(com.synopsys.integration.bdio.model.externalid.ExternalIdFactory) ArrayList(java.util.ArrayList) PearDependencyGraphTransformer(com.synopsys.integration.detectable.detectables.pear.transform.PearDependencyGraphTransformer)

Example 3 with PearDependencyGraphTransformer

use of com.synopsys.integration.detectable.detectables.pear.transform.PearDependencyGraphTransformer in project synopsys-detect by blackducksoftware.

the class PearRequiredOnlyTest method TestParse.

@Test
public void TestParse() throws IntegrationException {
    List<String> pearList = Arrays.asList("Installed packages, channel pear.php.net:", "=========================================", "Package           Version State", "Archive_Tar       1.4.3   stable", "Auth_SASL         1.1.0   stable", "Config            1.10.12 stable", "Console_Getopt    1.4.1   stable", "HTML_Template_IT  1.3.0   stable", "MIME_Type         1.4.1   stable", "Net_SMTP          1.8.0   stable", "Net_Socket        1.2.2   stable", "PEAR              1.10.5  stable", "PEAR_Frontend_Gtk 0.4.0   beta", "PEAR_Frontend_Web 0.7.5   beta", "Structures_Graph  1.1.1   stable", "XML_Util          1.4.2   stable");
    List<String> pearPackageDependencies = Arrays.asList("Dependencies for Net_SMTP", "=========================", "Required? Type           Name            Versioning           Group", "Yes       Php                             (version >= 5.4.0)", "Yes       Pear Installer                  (version >= 1.10.1)", "Yes       Package        pear/Net_Socket  (version >= 1.0.7)", "No        Package        pear/Auth_SASL   (version >= 1.0.5)");
    ExternalIdFactory factory = new ExternalIdFactory();
    Map<String, String> dependencyNameVersionMap = new PearListParser().parse(pearList);
    List<PackageDependency> packageDependencies = new PearPackageDependenciesParser().parse(pearPackageDependencies);
    DependencyGraph dependencyGraph = new PearDependencyGraphTransformer(factory, EnumListFilter.excludeNone()).buildDependencyGraph(dependencyNameVersionMap, packageDependencies);
    Assertions.assertTrue(dependencyGraph.hasDependency(factory.createNameVersionExternalId(Forge.PEAR, "Auth_SASL", "1.1.0")), "Must have Auth_SASL even though it was not a required dependency.");
}
Also used : PearListParser(com.synopsys.integration.detectable.detectables.pear.parse.PearListParser) PackageDependency(com.synopsys.integration.detectable.detectables.pear.model.PackageDependency) ExternalIdFactory(com.synopsys.integration.bdio.model.externalid.ExternalIdFactory) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) PearDependencyGraphTransformer(com.synopsys.integration.detectable.detectables.pear.transform.PearDependencyGraphTransformer) PearPackageDependenciesParser(com.synopsys.integration.detectable.detectables.pear.parse.PearPackageDependenciesParser) Test(org.junit.jupiter.api.Test)

Aggregations

PearDependencyGraphTransformer (com.synopsys.integration.detectable.detectables.pear.transform.PearDependencyGraphTransformer)3 ExternalIdFactory (com.synopsys.integration.bdio.model.externalid.ExternalIdFactory)2 PackageDependency (com.synopsys.integration.detectable.detectables.pear.model.PackageDependency)2 PearListParser (com.synopsys.integration.detectable.detectables.pear.parse.PearListParser)2 PearPackageDependenciesParser (com.synopsys.integration.detectable.detectables.pear.parse.PearPackageDependenciesParser)2 DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)1 PearCliDetectable (com.synopsys.integration.detectable.detectables.pear.PearCliDetectable)1 PearCliExtractor (com.synopsys.integration.detectable.detectables.pear.PearCliExtractor)1 PearPackageXmlParser (com.synopsys.integration.detectable.detectables.pear.parse.PearPackageXmlParser)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Test (org.junit.jupiter.api.Test)1