Skip to content

Commit

Permalink
regression test for ltearno#48
Browse files Browse the repository at this point in the history
- write @ignored regression tests
- FIXME at the corresponding position in code
  • Loading branch information
Robert Stoll committed Feb 7, 2018
1 parent 2419e85 commit 720b996
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ private boolean processProjectForCompleteness( Project project, PomFileLoader ca

private Project loadAndCheckProject( Gav gav, PomFileLoader callback, Project resolvedProject )
{
//FIXME #48, NullPointerException if callback was not defined (flag nofetch was set)
File pomFile = callback.loadPomFileForGav( gav, null, log );
if( pomFile == null )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import fr.lteconsulting.pomexplorer.graph.ProjectRepository;
import fr.lteconsulting.pomexplorer.graph.relation.BuildDependencyRelation;
import fr.lteconsulting.pomexplorer.graph.relation.DependencyRelation;
import org.junit.Ignore;
import org.junit.Test;

import fr.lteconsulting.pomexplorer.graph.PomGraph.PomGraphReadTransaction;
Expand Down Expand Up @@ -237,6 +238,47 @@ public void test09_multiModule()
assertNoNullGavs(session);
}

@Test
@Ignore("Regression test for #48")
public void test10_unresolvedParent()
{
//arrange
Session session = new Session();
//act
runFullRecursiveAnalysis(session, "testSets/set10");
//assert
assertProjects(session, 1);
assertDependencies(session, PROJECT_A, 1);
assertParentDependency(session, PROJECT_A, PROJECT_C);

List<String> shouldBeMissing = new ArrayList<>();
shouldBeMissing.add(PROJECT_D);
shouldBeMissing.add(PROJECT_C);

session.projects().values().forEach(project ->
{
System.out.println("PROJECT " + project);
System.out.println("DEPENDENCIES");
session.graph().read().dependencies(project.getGav()).forEach(System.out::println);

// Checks that transitive dependencies cannot be resolved
TransitivityResolver resolver = new TransitivityResolver();
resolver.getTransitiveDependencyTree(session, project, true, true, null, new PomFileLoader()
{
@Override
public File loadPomFileForGav(Gav gav, List<Repository> additionalRepos, Log log)
{
assertTrue(shouldBeMissing.contains(gav.toString()));
shouldBeMissing.remove(gav.toString());

return null;
}
}, System.out::println);
});

assertTrue(shouldBeMissing.isEmpty());
}

@Test
public void localTest1()
{
Expand Down
38 changes: 38 additions & 0 deletions pom-explorer-core/testSets/set10/a.pom
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>

<project>
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>fr.lteconsulting</groupId>
<artifactId>c</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<groupId>fr.lteconsulting</groupId>
<artifactId>a</artifactId>
<version>1.0-SNAPSHOT</version>

<packaging>jar</packaging>

<description>test project a</description>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>fr.lteconsulting</groupId>
<artifactId>d</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>fr.lteconsulting</groupId>
<artifactId>d</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public void directory( CommandOptions options, Client client, ApplicationSession

PomAnalysis.runFullRecursiveAnalysis( directory, session.session(), pomFileLoader, profiles, options.hasFlag( "verbose" ), log );

log.html( "Analyzis completed.<br/>" );
log.html( "Analysis completed.<br/>" );
}
}

0 comments on commit 720b996

Please sign in to comment.