use of com.synopsys.integration.detectable.detectables.maven.cli.MavenCodeLocationPackager 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);
}
use of com.synopsys.integration.detectable.detectables.maven.cli.MavenCodeLocationPackager in project synopsys-detect by blackducksoftware.
the class MavenCodeLocationPackagerTest method testIsProjectSection.
@Test
public void testIsProjectSection() {
MavenCodeLocationPackager mavenCodeLocationPackager = new MavenCodeLocationPackager(null);
assertFalse(mavenCodeLocationPackager.isProjectSection(" "));
assertFalse(mavenCodeLocationPackager.isProjectSection(" "));
assertFalse(mavenCodeLocationPackager.isProjectSection("---maven-dependency-plugin:"));
assertFalse(mavenCodeLocationPackager.isProjectSection("---maven-dependency-plugin:other stuff"));
assertFalse(mavenCodeLocationPackager.isProjectSection("maven-dependency-plugin:tree stuff"));
assertTrue(mavenCodeLocationPackager.isProjectSection("---maven-dependency-plugin:tree stuff"));
assertTrue(mavenCodeLocationPackager.isProjectSection("things --- stuff maven-dependency-plugin garbage:tree stuff"));
assertTrue(mavenCodeLocationPackager.isProjectSection("things --- stuff maven-dependency-plugin:tree stuff"));
assertTrue(mavenCodeLocationPackager.isProjectSection("---maven-dependency-plugin:tree"));
assertTrue(mavenCodeLocationPackager.isProjectSection(" --- maven-dependency-plugin : tree"));
}
use of com.synopsys.integration.detectable.detectables.maven.cli.MavenCodeLocationPackager in project synopsys-detect by blackducksoftware.
the class MavenCodeLocationPackagerTest method testParseProject.
@Test
public void testParseProject() {
MavenCodeLocationPackager mavenCodeLocationPackager = new MavenCodeLocationPackager(new ExternalIdFactory());
Dependency dependency = mavenCodeLocationPackager.textToProject("stuff:things:jar:0.0.1");
assertNotNull(dependency);
dependency = mavenCodeLocationPackager.textToProject("stuff:things:jar:classifier:0.0.1");
assertNotNull(dependency);
dependency = mavenCodeLocationPackager.textToProject("stuff:things:jar");
assertNull(dependency);
dependency = mavenCodeLocationPackager.textToProject("stuff:things:jar:classifier:0.0.1:monkey");
assertNull(dependency);
}
use of com.synopsys.integration.detectable.detectables.maven.cli.MavenCodeLocationPackager in project synopsys-detect by blackducksoftware.
the class MavenCodeLocationPackagerTest method testIndexOfEndOfSegments.
@Test
public void testIndexOfEndOfSegments() {
MavenCodeLocationPackager mavenCodeLocationPackager = new MavenCodeLocationPackager(null);
assertEquals(-1, mavenCodeLocationPackager.indexOfEndOfSegments(""));
assertEquals(-1, mavenCodeLocationPackager.indexOfEndOfSegments("stuff and things"));
assertEquals(-1, mavenCodeLocationPackager.indexOfEndOfSegments("stuff and things", "things", "and"));
assertEquals(-1, mavenCodeLocationPackager.indexOfEndOfSegments("stuff and things", "things", "and", "stuff"));
assertEquals(5, mavenCodeLocationPackager.indexOfEndOfSegments("stuff and things", "stuff"));
assertEquals(9, mavenCodeLocationPackager.indexOfEndOfSegments("stuff and things", "stuff", "and"));
assertEquals(16, mavenCodeLocationPackager.indexOfEndOfSegments("stuff and things", "stuff", "and", "things"));
assertEquals(9, mavenCodeLocationPackager.indexOfEndOfSegments("stuff and things", "and"));
assertEquals(16, mavenCodeLocationPackager.indexOfEndOfSegments("stuff and things", "things"));
}
use of com.synopsys.integration.detectable.detectables.maven.cli.MavenCodeLocationPackager 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());
}
Aggregations