Search in sources :

Example 1 with ScopedDependency

use of com.synopsys.integration.detectable.detectables.maven.cli.ScopedDependency in project synopsys-detect by blackducksoftware.

the class MavenCodeLocationPackagerTest method testParseDependency.

@Test
public void testParseDependency() {
    MavenCodeLocationPackager mavenCodeLocationPackager = new MavenCodeLocationPackager(new ExternalIdFactory());
    ScopedDependency dependency = mavenCodeLocationPackager.textToDependency("stuff:things:jar:0.0.1:compile");
    assertNotNull(dependency);
    dependency = mavenCodeLocationPackager.textToDependency("stuff:things:jar:classifier:0.0.1:test");
    assertNotNull(dependency);
    dependency = mavenCodeLocationPackager.textToDependency("stuff:things:jar");
    assertNull(dependency);
    dependency = mavenCodeLocationPackager.textToDependency("stuff:things:jar:classifier:0.0.1");
    assertNotNull(dependency);
}
Also used : ScopedDependency(com.synopsys.integration.detectable.detectables.maven.cli.ScopedDependency) ExternalIdFactory(com.synopsys.integration.bdio.model.externalid.ExternalIdFactory) MavenCodeLocationPackager(com.synopsys.integration.detectable.detectables.maven.cli.MavenCodeLocationPackager) Test(org.junit.jupiter.api.Test) UnitTest(com.synopsys.integration.detectable.annotations.UnitTest)

Example 2 with ScopedDependency

use of com.synopsys.integration.detectable.detectables.maven.cli.ScopedDependency in project synopsys-detect by blackducksoftware.

the class MavenCodeLocationPackagerTest method testLineWithUnknownScope.

@Test
public void testLineWithUnknownScope() {
    MavenCodeLocationPackager mavenCodeLocationPackager = new MavenCodeLocationPackager(new ExternalIdFactory());
    String line = "[INFO] |  |  |  \\- org.eclipse.scout.sdk.deps:org.eclipse.core.jobs:jar:3.8.0.v20160509-0411:pants (version selected from constraint [3.8.0,3.8.1))";
    line = mavenCodeLocationPackager.trimLogLevel(line);
    String cleanedLine = mavenCodeLocationPackager.calculateCurrentLevelAndCleanLine(line);
    ScopedDependency scopedDependency = mavenCodeLocationPackager.textToDependency(cleanedLine);
    assertEquals("org.eclipse.scout.sdk.deps:org.eclipse.core.jobs:3.8.0.v20160509-0411", scopedDependency.getExternalId().createExternalId());
}
Also used : ScopedDependency(com.synopsys.integration.detectable.detectables.maven.cli.ScopedDependency) ExternalIdFactory(com.synopsys.integration.bdio.model.externalid.ExternalIdFactory) MavenCodeLocationPackager(com.synopsys.integration.detectable.detectables.maven.cli.MavenCodeLocationPackager) Test(org.junit.jupiter.api.Test) UnitTest(com.synopsys.integration.detectable.annotations.UnitTest)

Aggregations

ExternalIdFactory (com.synopsys.integration.bdio.model.externalid.ExternalIdFactory)2 UnitTest (com.synopsys.integration.detectable.annotations.UnitTest)2 MavenCodeLocationPackager (com.synopsys.integration.detectable.detectables.maven.cli.MavenCodeLocationPackager)2 ScopedDependency (com.synopsys.integration.detectable.detectables.maven.cli.ScopedDependency)2 Test (org.junit.jupiter.api.Test)2