Search in sources :

Example 1 with PackageResolved

use of com.synopsys.integration.detectable.detectables.swift.lock.data.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();
    DependencyGraph dependencyGraph = transformer.transform(packageResolved);
    GraphAssert graphAssert = new GraphAssert(Forge.GITHUB, dependencyGraph);
    ExternalId swiftCollections = ExternalId.FACTORY.createNameVersionExternalId(Forge.GITHUB, "apple/swift-collections", "1.0.1");
    graphAssert.hasRootDependency(swiftCollections);
    graphAssert.hasRootSize(1);
}
Also used : PackageResolved(com.synopsys.integration.detectable.detectables.swift.lock.data.PackageResolved) GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) ExternalId(com.synopsys.integration.bdio.model.externalid.ExternalId) PackageState(com.synopsys.integration.detectable.detectables.swift.lock.data.PackageState) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) ResolvedPackage(com.synopsys.integration.detectable.detectables.swift.lock.data.ResolvedPackage) Test(org.junit.jupiter.api.Test)

Example 2 with PackageResolved

use of com.synopsys.integration.detectable.detectables.swift.lock.data.PackageResolved in project synopsys-detect by blackducksoftware.

the class PackageResolvedTransformerTest method testHttpWithGit.

@Test
void testHttpWithGit() {
    ResolvedPackage auth0Package = new ResolvedPackage("Auth0", "http://github.com/auth0/Auth0.swift.git", new PackageState(null, "8e8a6b0337a27a3342beb72b5407141fdd4a7860", "1.35.0"));
    PackageResolved packageResolved = createPackageResolved(auth0Package);
    PackageResolvedTransformer transformer = new PackageResolvedTransformer();
    DependencyGraph dependencyGraph = transformer.transform(packageResolved);
    GraphAssert graphAssert = new GraphAssert(Forge.GITHUB, dependencyGraph);
    ExternalId auth0 = ExternalId.FACTORY.createNameVersionExternalId(Forge.GITHUB, "auth0/Auth0.swift", "1.35.0");
    graphAssert.hasRootDependency(auth0);
    graphAssert.hasRootSize(1);
}
Also used : PackageResolved(com.synopsys.integration.detectable.detectables.swift.lock.data.PackageResolved) GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) ExternalId(com.synopsys.integration.bdio.model.externalid.ExternalId) PackageState(com.synopsys.integration.detectable.detectables.swift.lock.data.PackageState) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) ResolvedPackage(com.synopsys.integration.detectable.detectables.swift.lock.data.ResolvedPackage) Test(org.junit.jupiter.api.Test)

Example 3 with PackageResolved

use of com.synopsys.integration.detectable.detectables.swift.lock.data.PackageResolved in project synopsys-detect by blackducksoftware.

the class PackageResolvedTransformerTest method noGitExtensionTest.

@Test
void noGitExtensionTest() {
    ResolvedPackage swiftLogPackage = new ResolvedPackage("swift-log", // Won't be malformed for sanity check
    "http://github.com/apple/swift-log", new PackageState(null, "5d66f7ba25daf4f94100e7022febf3c75e37a6c7", "1.4.2"));
    PackageResolvedTransformer transformer = new PackageResolvedTransformer();
    PackageResolved packageResolved = createPackageResolved(swiftLogPackage);
    DependencyGraph dependencyGraph = transformer.transform(packageResolved);
    GraphAssert graphAssert = new GraphAssert(Forge.GITHUB, dependencyGraph);
    ExternalId swiftLog = ExternalId.FACTORY.createNameVersionExternalId(Forge.GITHUB, "apple/swift-log", "1.4.2");
    graphAssert.hasRootDependency(swiftLog);
    graphAssert.hasRootSize(1);
}
Also used : PackageResolved(com.synopsys.integration.detectable.detectables.swift.lock.data.PackageResolved) GraphAssert(com.synopsys.integration.detectable.util.graph.GraphAssert) ExternalId(com.synopsys.integration.bdio.model.externalid.ExternalId) PackageState(com.synopsys.integration.detectable.detectables.swift.lock.data.PackageState) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) ResolvedPackage(com.synopsys.integration.detectable.detectables.swift.lock.data.ResolvedPackage) Test(org.junit.jupiter.api.Test)

Example 4 with PackageResolved

use of com.synopsys.integration.detectable.detectables.swift.lock.data.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);
    assertFalse(formatChecker.checkForVersionCompatibility(packageResolved));
}
Also used : PackageResolved(com.synopsys.integration.detectable.detectables.swift.lock.data.PackageResolved) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 5 with PackageResolved

use of com.synopsys.integration.detectable.detectables.swift.lock.data.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);
    assertTrue(formatChecker.checkForVersionCompatibility(packageResolved));
}
Also used : PackageResolved(com.synopsys.integration.detectable.detectables.swift.lock.data.PackageResolved) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

PackageResolved (com.synopsys.integration.detectable.detectables.swift.lock.data.PackageResolved)8 ResolvedPackage (com.synopsys.integration.detectable.detectables.swift.lock.data.ResolvedPackage)6 Test (org.junit.jupiter.api.Test)6 DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)5 PackageState (com.synopsys.integration.detectable.detectables.swift.lock.data.PackageState)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 ResolvedObject (com.synopsys.integration.detectable.detectables.swift.lock.data.ResolvedObject)1 MethodSource (org.junit.jupiter.params.provider.MethodSource)1