use of com.synopsys.integration.detectable.detectables.maven.cli.MavenCodeLocationPackager in project synopsys-detect by blackducksoftware.
the class MavenCodeLocationPackagerTest method testDoesLineContainSegmentsInOrder.
@Test
public void testDoesLineContainSegmentsInOrder() {
MavenCodeLocationPackager mavenCodeLocationPackager = new MavenCodeLocationPackager(null);
assertFalse(mavenCodeLocationPackager.doesLineContainSegmentsInOrder(""));
assertFalse(mavenCodeLocationPackager.doesLineContainSegmentsInOrder("stuff and things"));
assertFalse(mavenCodeLocationPackager.doesLineContainSegmentsInOrder("stuff and things", "things", "and"));
assertFalse(mavenCodeLocationPackager.doesLineContainSegmentsInOrder("stuff and things", "things", "and", "stuff"));
assertTrue(mavenCodeLocationPackager.doesLineContainSegmentsInOrder("stuff and things", "stuff"));
assertTrue(mavenCodeLocationPackager.doesLineContainSegmentsInOrder("stuff and things", "stuff", "and"));
assertTrue(mavenCodeLocationPackager.doesLineContainSegmentsInOrder("stuff and things", "stuff", "and", "things"));
assertTrue(mavenCodeLocationPackager.doesLineContainSegmentsInOrder("stuff and things", "and"));
assertTrue(mavenCodeLocationPackager.doesLineContainSegmentsInOrder("stuff and things", "things"));
}
use of com.synopsys.integration.detectable.detectables.maven.cli.MavenCodeLocationPackager in project synopsys-detect by blackducksoftware.
the class MavenCodeLocationPackagerTest method testLineWithBadColonPlacement.
@Test
public void testLineWithBadColonPlacement() {
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: [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:pants (version selected from", dependency.getExternalId().createExternalId());
}
use of com.synopsys.integration.detectable.detectables.maven.cli.MavenCodeLocationPackager in project synopsys-detect by blackducksoftware.
the class MavenCodeLocationPackagerTest method testIsLineRelevant.
@Test
public void testIsLineRelevant() {
MavenCodeLocationPackager mavenCodeLocationPackager = new MavenCodeLocationPackager(null);
assertTrue(mavenCodeLocationPackager.isLineRelevant("weird garbage 3525356 [thingsINFO 346534623465] stuff"));
assertTrue(mavenCodeLocationPackager.isLineRelevant("[thingsINFO 346534623465]stuff"));
assertTrue(mavenCodeLocationPackager.isLineRelevant("[thingsINFO] stuff"));
assertFalse(mavenCodeLocationPackager.isLineRelevant(" [INFO] "));
assertFalse(mavenCodeLocationPackager.isLineRelevant("weird garbage 3525356 [thingsINFO 346534623465]"));
assertFalse(mavenCodeLocationPackager.isLineRelevant("[thingsINFO 346534623465]"));
assertFalse(mavenCodeLocationPackager.isLineRelevant("[thingsINFO]"));
assertFalse(mavenCodeLocationPackager.isLineRelevant(" [INFO]"));
assertFalse(mavenCodeLocationPackager.isLineRelevant(" "));
assertFalse(mavenCodeLocationPackager.isLineRelevant("[INFO] Downloaded"));
assertFalse(mavenCodeLocationPackager.isLineRelevant("[INFO] stuff and thingsDownloaded stuff and things"));
assertFalse(mavenCodeLocationPackager.isLineRelevant("[INFO] Downloading"));
assertFalse(mavenCodeLocationPackager.isLineRelevant("[INFO] stuff and things Downloadingstuff and things"));
}
use of com.synopsys.integration.detectable.detectables.maven.cli.MavenCodeLocationPackager in project synopsys-detect by blackducksoftware.
the class MavenCorruptOutputTest 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);
}
Aggregations