Search in sources :

Example 6 with PackageResolved

use of com.synopsys.integration.detectable.detectables.xcode.model.PackageResolved in project synopsys-detect by blackducksoftware.

the class PackageResolvedTransformerTest method testHttpsWithGit.

@Test
void testHttpsWithGit() {
    ResolvedPackage swiftCollectionsPackage = new ResolvedPackage("swift-collections", "https://github.com/apple/swift-collections.git", new PackageState(null, "2d33a0ea89c961dcb2b3da2157963d9c0370347e", "1.0.1"));
    PackageResolved packageResolved = createPackageResolved(swiftCollectionsPackage);
    PackageResolvedTransformer transformer = new PackageResolvedTransformer(externalIdFactory);
    DependencyGraph dependencyGraph = transformer.transform(packageResolved);
    GraphAssert graphAssert = new GraphAssert(Forge.GITHUB, dependencyGraph);
    ExternalId swiftCollections = externalIdFactory.createNameVersionExternalId(Forge.GITHUB, "apple/swift-collections", "1.0.1");
    graphAssert.hasRootDependency(swiftCollections);
    graphAssert.hasRootSize(1);
}
Also used : PackageResolved(com.synopsys.integration.detectable.detectables.xcode.model.PackageResolved) PackageResolvedTransformer(com.synopsys.integration.detectable.detectables.xcode.process.PackageResolvedTransformer) GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) ExternalId(com.synopsys.integration.bdio.model.externalid.ExternalId) PackageState(com.synopsys.integration.detectable.detectables.xcode.model.PackageState) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) ResolvedPackage(com.synopsys.integration.detectable.detectables.xcode.model.ResolvedPackage) Test(org.junit.jupiter.api.Test)

Example 7 with PackageResolved

use of com.synopsys.integration.detectable.detectables.xcode.model.PackageResolved in project synopsys-detect by blackducksoftware.

the class PackageResolvedTransformerTest method createPackageResolved.

private PackageResolved createPackageResolved(ResolvedPackage resolvedPackage) {
    List<ResolvedPackage> resolvedPackages = Collections.singletonList(resolvedPackage);
    ResolvedObject resolvedObject = new ResolvedObject(resolvedPackages);
    return new PackageResolved(resolvedObject, "1");
}
Also used : ResolvedObject(com.synopsys.integration.detectable.detectables.xcode.model.ResolvedObject) PackageResolved(com.synopsys.integration.detectable.detectables.xcode.model.PackageResolved) ResolvedPackage(com.synopsys.integration.detectable.detectables.xcode.model.ResolvedPackage)

Example 8 with PackageResolved

use of com.synopsys.integration.detectable.detectables.xcode.model.PackageResolved in project synopsys-detect by blackducksoftware.

the class PackageResolvedFormatCheckerTest method compatibilityTest.

@ParameterizedTest
@MethodSource("knownFileFormats")
void compatibilityTest(String knownVersion) {
    PackageResolvedFormatChecker formatChecker = new PackageResolvedFormatChecker();
    PackageResolved packageResolved = new PackageResolved(null, knownVersion);
    formatChecker.handleVersionCompatibility(packageResolved, (version, knownVersions) -> Assertions.fail(version + " is a known version and should not have failed the check."));
}
Also used : PackageResolved(com.synopsys.integration.detectable.detectables.xcode.model.PackageResolved) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 9 with PackageResolved

use of com.synopsys.integration.detectable.detectables.xcode.model.PackageResolved in project synopsys-detect by blackducksoftware.

the class PackageResolvedFormatCheckerTest method incompatibilityTest.

@Test
void incompatibilityTest() {
    PackageResolvedFormatChecker formatChecker = new PackageResolvedFormatChecker();
    String unknownVersion = "some unknown version";
    PackageResolved packageResolved = new PackageResolved(null, unknownVersion);
    formatChecker.handleVersionCompatibility(packageResolved, (version, knownVersions) -> Assertions.assertEquals(unknownVersion, version));
}
Also used : PackageResolved(com.synopsys.integration.detectable.detectables.xcode.model.PackageResolved) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

PackageResolved (com.synopsys.integration.detectable.detectables.xcode.model.PackageResolved)9 DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)6 ResolvedPackage (com.synopsys.integration.detectable.detectables.xcode.model.ResolvedPackage)6 Test (org.junit.jupiter.api.Test)6 PackageState (com.synopsys.integration.detectable.detectables.xcode.model.PackageState)5 PackageResolvedTransformer (com.synopsys.integration.detectable.detectables.xcode.process.PackageResolvedTransformer)5 GraphAssert (com.synopsys.integration.detectable.util.graph.GraphAssert)5 ExternalId (com.synopsys.integration.bdio.model.externalid.ExternalId)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 MutableMapDependencyGraph (com.synopsys.integration.bdio.graph.MutableMapDependencyGraph)1 CodeLocation (com.synopsys.integration.detectable.detectable.codelocation.CodeLocation)1 ResolvedObject (com.synopsys.integration.detectable.detectables.xcode.model.ResolvedObject)1 FileReader (java.io.FileReader)1 MethodSource (org.junit.jupiter.params.provider.MethodSource)1