Search in sources :

Example 1 with ClangPackageManagerInfo

use of com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManagerInfo in project synopsys-detect by blackducksoftware.

the class ClangPackageManagerRunnerTest method testDpkgPkgBuriedArchitecture.

@Test
public void testDpkgPkgBuriedArchitecture() throws ExecutableRunnerException {
    ClangPackageManagerInfoFactory factory = ClangPackageManagerInfoFactory.standardFactory();
    ClangPackageManagerInfo packageManagerInfo = factory.dpkg();
    DpkgPkgDetailsResolver versionResolver = new DpkgPkgDetailsResolver();
    ClangPackageManagerResolver packageResolver = new DpkgPackageManagerResolver(versionResolver);
    String pkgOwnerPattern = "libxt-dev: %s\n";
    String pkgDetailsPattern = "Package: %s\n" + "Architecture: amd64\n" + "Version: 1:1.1.5-1\n" + "Status: install ok installed\n";
    testSuccessCase(packageManagerInfo, packageResolver, "libxt-dev", "amd64", true, "1:1.1.5-1", pkgOwnerPattern, pkgDetailsPattern);
}
Also used : ClangPackageManagerInfoFactory(com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManagerInfoFactory) ClangPackageManagerInfo(com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManagerInfo) ClangPackageManagerResolver(com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.ClangPackageManagerResolver) DpkgPackageManagerResolver(com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.DpkgPackageManagerResolver) DpkgPkgDetailsResolver(com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.DpkgPkgDetailsResolver) Test(org.junit.jupiter.api.Test)

Example 2 with ClangPackageManagerInfo

use of com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManagerInfo in project synopsys-detect by blackducksoftware.

the class ClangPackageManagerRunnerTest method testRpmNonPkgOwnedIncludeFile.

@Test
public void testRpmNonPkgOwnedIncludeFile() throws ExecutableRunnerException {
    ClangPackageManagerInfoFactory factory = ClangPackageManagerInfoFactory.standardFactory();
    ClangPackageManagerInfo packageManagerInfo = factory.rpm();
    ClangPackageManagerResolver packageResolver = new RpmPackageManagerResolver(new Gson());
    String pkgOwnerPattern = "%s is not owned by any package";
    testNonPkgOwnedIncludeFile(packageManagerInfo, packageResolver, pkgOwnerPattern);
}
Also used : ClangPackageManagerInfoFactory(com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManagerInfoFactory) ClangPackageManagerInfo(com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManagerInfo) RpmPackageManagerResolver(com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.RpmPackageManagerResolver) ClangPackageManagerResolver(com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.ClangPackageManagerResolver) Gson(com.google.gson.Gson) Test(org.junit.jupiter.api.Test)

Example 3 with ClangPackageManagerInfo

use of com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManagerInfo in project synopsys-detect by blackducksoftware.

the class ClangPackageManagerRunnerTest method testApkNonPkgOwnedIncludeFile.

@Test
public void testApkNonPkgOwnedIncludeFile() throws ExecutableRunnerException {
    ClangPackageManagerInfoFactory factory = ClangPackageManagerInfoFactory.standardFactory();
    ClangPackageManagerInfo packageManagerInfo = factory.apk();
    ApkArchitectureResolver archResolver = new ApkArchitectureResolver();
    ClangPackageManagerResolver packageResolver = new ApkPackageManagerResolver(archResolver);
    String pkgOwnerPattern = "ERROR: %s: Could not find owner package";
    testNonPkgOwnedIncludeFile(packageManagerInfo, packageResolver, pkgOwnerPattern);
}
Also used : ClangPackageManagerInfoFactory(com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManagerInfoFactory) ClangPackageManagerInfo(com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManagerInfo) ApkArchitectureResolver(com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.ApkArchitectureResolver) ClangPackageManagerResolver(com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.ClangPackageManagerResolver) ApkPackageManagerResolver(com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.ApkPackageManagerResolver) Test(org.junit.jupiter.api.Test)

Example 4 with ClangPackageManagerInfo

use of com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManagerInfo in project synopsys-detect by blackducksoftware.

the class ClangPackageManagerRunnerTest method testDpkgPkg.

@Test
public void testDpkgPkg() throws ExecutableRunnerException {
    ClangPackageManagerInfoFactory factory = ClangPackageManagerInfoFactory.standardFactory();
    ClangPackageManagerInfo packageManagerInfo = factory.dpkg();
    DpkgPkgDetailsResolver versionResolver = new DpkgPkgDetailsResolver();
    ClangPackageManagerResolver packageResolver = new DpkgPackageManagerResolver(versionResolver);
    String pkgOwnerPattern = "libxt-dev:amd64: %s\n";
    String pkgDetailsPattern = "Package: %s\n" + "Architecture: amd64\n" + "Version: 1:1.1.5-1\n" + "Status: install ok installed\n";
    testSuccessCase(packageManagerInfo, packageResolver, "libxt-dev", "amd64", false, "1:1.1.5-1", pkgOwnerPattern, pkgDetailsPattern);
}
Also used : ClangPackageManagerInfoFactory(com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManagerInfoFactory) ClangPackageManagerInfo(com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManagerInfo) ClangPackageManagerResolver(com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.ClangPackageManagerResolver) DpkgPackageManagerResolver(com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.DpkgPackageManagerResolver) DpkgPkgDetailsResolver(com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.DpkgPkgDetailsResolver) Test(org.junit.jupiter.api.Test)

Example 5 with ClangPackageManagerInfo

use of com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManagerInfo in project synopsys-detect by blackducksoftware.

the class RpmPackageManagerTest method testResolve.

@Test
public void testResolve() throws ExecutableRunnerException, NotOwnedByAnyPkgException {
    RpmPackageManagerResolver resolver = new RpmPackageManagerResolver(new Gson());
    ClangPackageManagerInfo currentPackageManager = null;
    DetectableExecutableRunner executableRunner = null;
    File workingDirectory = null;
    final String queryPackageOutput = "{ epoch: \"(none)\", name: \"glibc-headers\", version: \"2.17-222.el7\", arch: \"x86_64\" }\n" + "{ epoch: \"3\", name: \"test-package\", version: \"test-version\", arch: \"test_arch\" }\n";
    List<PackageDetails> pkgs = resolver.resolvePackages(currentPackageManager, executableRunner, workingDirectory, queryPackageOutput);
    assertEquals(2, pkgs.size());
    boolean foundGLibcHeaders = false;
    boolean foundTestPkg = false;
    for (PackageDetails pkg : pkgs) {
        if (pkg.getPackageName().equals("glibc-headers")) {
            foundGLibcHeaders = true;
            assertEquals("2.17-222.el7", pkg.getPackageVersion());
            assertEquals("x86_64", pkg.getPackageArch());
        }
        if (pkg.getPackageName().equals("test-package")) {
            foundTestPkg = true;
            assertEquals("3:test-version", pkg.getPackageVersion());
            assertEquals("test_arch", pkg.getPackageArch());
        }
    }
    assertTrue(foundGLibcHeaders);
    assertTrue(foundTestPkg);
}
Also used : ClangPackageManagerInfo(com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManagerInfo) DetectableExecutableRunner(com.synopsys.integration.detectable.detectable.executable.DetectableExecutableRunner) RpmPackageManagerResolver(com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.RpmPackageManagerResolver) Gson(com.google.gson.Gson) File(java.io.File) PackageDetails(com.synopsys.integration.detectable.detectables.clang.packagemanager.PackageDetails) Test(org.junit.jupiter.api.Test)

Aggregations

ClangPackageManagerInfo (com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManagerInfo)9 Test (org.junit.jupiter.api.Test)9 ClangPackageManagerInfoFactory (com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManagerInfoFactory)7 ClangPackageManagerResolver (com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.ClangPackageManagerResolver)6 DpkgPackageManagerResolver (com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.DpkgPackageManagerResolver)4 DpkgPkgDetailsResolver (com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.DpkgPkgDetailsResolver)4 Gson (com.google.gson.Gson)2 PackageDetails (com.synopsys.integration.detectable.detectables.clang.packagemanager.PackageDetails)2 ApkArchitectureResolver (com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.ApkArchitectureResolver)2 ApkPackageManagerResolver (com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.ApkPackageManagerResolver)2 RpmPackageManagerResolver (com.synopsys.integration.detectable.detectables.clang.packagemanager.resolver.RpmPackageManagerResolver)2 Forge (com.synopsys.integration.bdio.model.Forge)1 DetectableExecutableRunner (com.synopsys.integration.detectable.detectable.executable.DetectableExecutableRunner)1 ForgeChooser (com.synopsys.integration.detectable.detectables.clang.ForgeChooser)1 LinuxDistroToForgeMapper (com.synopsys.integration.detectable.detectables.clang.LinuxDistroToForgeMapper)1 LinuxDistro (com.synopsys.integration.detectable.detectables.clang.linux.LinuxDistro)1 ClangPackageManager (com.synopsys.integration.detectable.detectables.clang.packagemanager.ClangPackageManager)1 File (java.io.File)1