Removing Redundant dependency entry for composer.lock

Move all the log statements to debug
This commit is contained in:
brianf
2017-09-19 09:52:32 -04:00
3 changed files with 44 additions and 6 deletions

View File

@@ -90,6 +90,25 @@ public class ComposerLockAnalyzerTest extends BaseDBTestCase {
assertTrue(analyzer.accept(new File("composer.lock")));
}
/**
* Test of basic additions to the depdnency list by parsing the composer.lock file
*
* @throws AnalysisException is thrown when an exception occurs.
*/
@Test
public void testRemoveRedundantParent() throws Exception {
final Engine engine = new Engine();
final Dependency result = new Dependency(BaseTest.getResourceAsFile(this,
"composer.lock"));
///test that we don't remove the parent if it's not redundant by name
result.setDisplayFileName("NotComposer.Lock");
engine.getDependencies().add(result);
analyzer.analyze(result, engine);
//make sure the composer.lock is not removed
assertTrue(engine.getDependencies().contains(result));
}
/**
* Test of inspect method, of class PythonDistributionAnalyzer.
*
@@ -98,13 +117,18 @@ public class ComposerLockAnalyzerTest extends BaseDBTestCase {
@Test
public void testAnalyzePackageJson() throws Exception {
final Engine engine = new Engine();
final Dependency result = new Dependency(BaseTest.getResourceAsFile(this,
"composer.lock"));
//simulate normal operation when the composer.lock is already added to the engine as a dependency
engine.getDependencies().add(result);
analyzer.analyze(result, engine);
//make sure the redundant composer.lock is removed
assertFalse(engine.getDependencies().contains(result));
assertEquals(30,engine.getDependencies().size());
assertThat(engine.getDependencies().get(0).getDisplayFileName(),equalTo("composer.lock:classpreloader/classpreloader/2.0.0"));
}
@Test(expected = InitializationException.class)
public void analyzerIsDisabledInCaseOfMissingMessageDigest() throws InitializationException {