use of com.synopsys.integration.detectable.detectables.maven.cli.MavenCodeLocationPackager in project synopsys-detect by blackducksoftware.
the class MavenCodeLocationPackagerTest method testLineWithExtraTextAfterScope.
@Test
public void testLineWithExtraTextAfterScope() {
MavenCodeLocationPackager mavenCodeLocationPackager = new MavenCodeLocationPackager(new ExternalIdFactory());
String line = "[INFO] | | | \\- org.eclipse.scout.sdk.deps:org.eclipse.core.jobs:jar:3.8.0.v20160509-0411:compile (version selected from constraint [3.8.0,3.8.1))";
line = mavenCodeLocationPackager.trimLogLevel(line);
String cleanedLine = mavenCodeLocationPackager.calculateCurrentLevelAndCleanLine(line);
Dependency dependency = mavenCodeLocationPackager.textToDependency(cleanedLine);
assertEquals("org.eclipse.scout.sdk.deps:org.eclipse.core.jobs:3.8.0.v20160509-0411", dependency.getExternalId().createExternalId());
}
use of com.synopsys.integration.detectable.detectables.maven.cli.MavenCodeLocationPackager in project synopsys-detect by blackducksoftware.
the class MavenComplexOutputTest method test.
@Test
public void test() {
ExternalIdFactory externalIdFactory = new ExternalIdFactory();
MavenCodeLocationPackager packager = new MavenCodeLocationPackager(externalIdFactory);
List<MavenParseResult> results = packager.extractCodeLocations("", getInput(), Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.MAVEN, results.get(0).getCodeLocation().getDependencyGraph());
graphAssert.hasRootSize(1);
ExternalId hubCommon = externalIdFactory.createMavenExternalId("com.blackducksoftware.integration", "hub-common", "13.1.2");
ExternalId integrationCommon = externalIdFactory.createMavenExternalId("com.blackducksoftware.integration", "integration-common", "6.0.2");
ExternalId hubCommonRest = externalIdFactory.createMavenExternalId("com.blackducksoftware.integration", "hub-common-rest", "2.1.3");
graphAssert.hasRootDependency(hubCommon);
graphAssert.hasParentChildRelationship(hubCommonRest, integrationCommon);
graphAssert.hasParentChildRelationship(hubCommon, hubCommonRest);
}
use of com.synopsys.integration.detectable.detectables.maven.cli.MavenCodeLocationPackager in project synopsys-detect by blackducksoftware.
the class MavenCodeLocationPackagerTest method testIsDependencyTreeUpdates.
@Test
public void testIsDependencyTreeUpdates() {
MavenCodeLocationPackager mavenCodeLocationPackager = new MavenCodeLocationPackager(null);
assertTrue(mavenCodeLocationPackager.isDependencyTreeUpdates("artifact com.google.guava:guava:jar:15.0:compile checking for updates from"));
assertTrue(mavenCodeLocationPackager.isDependencyTreeUpdates(" artifact com.google.guava:guava: checking for updates"));
assertTrue(mavenCodeLocationPackager.isDependencyTreeUpdates(" checking for updates artifact com.google.guava:guava: "));
assertTrue(mavenCodeLocationPackager.isDependencyTreeUpdates("checking for updates"));
assertFalse(mavenCodeLocationPackager.isDependencyTreeUpdates("com.google.guava:guava:jar:15.0:compile"));
assertFalse(mavenCodeLocationPackager.isDependencyTreeUpdates("+- com.google.guava:guava:jar:15.0:compile"));
assertFalse(mavenCodeLocationPackager.isDependencyTreeUpdates("| \\- com.google.guava:guava:jar:15.0:compile"));
}
use of com.synopsys.integration.detectable.detectables.maven.cli.MavenCodeLocationPackager in project synopsys-detect by blackducksoftware.
the class MavenCodeLocationPackagerTest method testIsGav.
@Test
public void testIsGav() {
MavenCodeLocationPackager mavenCodeLocationPackager = new MavenCodeLocationPackager(null);
assertFalse(mavenCodeLocationPackager.isGav(" "));
assertFalse(mavenCodeLocationPackager.isGav(" "));
assertFalse(mavenCodeLocationPackager.isGav("::::"));
assertFalse(mavenCodeLocationPackager.isGav(" : : : : "));
assertFalse(mavenCodeLocationPackager.isGav("group"));
assertFalse(mavenCodeLocationPackager.isGav("group:artifact"));
assertFalse(mavenCodeLocationPackager.isGav("group:artifact:version"));
assertFalse(mavenCodeLocationPackager.isGav("group-artifact:type-classifier-version:scope-garbage"));
assertFalse(mavenCodeLocationPackager.isGav("group:artifact::classifier:version: :garbage"));
assertTrue(mavenCodeLocationPackager.isGav("group:artifact:type:version"));
assertTrue(mavenCodeLocationPackager.isGav("group:artifact:type:classifier:version"));
assertTrue(mavenCodeLocationPackager.isGav("group:artifact:type:classifier:version:scope"));
assertTrue(mavenCodeLocationPackager.isGav("group:artifact:type:classifier:version:scope:garbage"));
}
use of com.synopsys.integration.detectable.detectables.maven.cli.MavenCodeLocationPackager in project synopsys-detect by blackducksoftware.
the class MavenCodeLocationPackagerTest method testTrimLogLevel.
@Test
public void testTrimLogLevel() {
MavenCodeLocationPackager mavenCodeLocationPackager = new MavenCodeLocationPackager(null);
String actualLine = "";
final String expectedValue = "thing";
actualLine = mavenCodeLocationPackager.trimLogLevel("weird garbage 3525356 [thingsINFO 346534623465]" + expectedValue);
assertEquals(expectedValue, actualLine);
actualLine = mavenCodeLocationPackager.trimLogLevel("[thingsINFO 346534623465]" + expectedValue);
assertEquals(expectedValue, actualLine);
actualLine = mavenCodeLocationPackager.trimLogLevel("[thingsINFO]" + expectedValue);
assertEquals(expectedValue, actualLine);
actualLine = mavenCodeLocationPackager.trimLogLevel(" [INFO] " + expectedValue);
assertEquals(expectedValue, actualLine);
}
Aggregations