Skip to content

Commit

Permalink
fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
kwin committed Sep 11, 2023
1 parent 03ad993 commit b7b75e9
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1080,19 +1080,19 @@ public void testTagletArtifacts() throws Exception {
Path testPom = unit.resolve("tagletArtifacts-test/tagletArtifacts-test-plugin-config.xml");
JavadocReport mojo = lookupMojo(testPom);

MavenSession session = spy(newMavenSession(mojo.project));
ProjectBuildingRequest buildingRequest = mock(ProjectBuildingRequest.class);
when(buildingRequest.getRemoteRepositories()).thenReturn(mojo.project.getRemoteArtifactRepositories());
when(session.getProjectBuildingRequest()).thenReturn(buildingRequest);
DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
repositorySession.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory()
.newInstance(repositorySession, new LocalRepository(localRepo)));
when(buildingRequest.getRepositorySession()).thenReturn(repositorySession);
when(session.getRepositorySession()).thenReturn(repositorySession);
MavenSession session = newMavenSession(mojo.project);
DefaultRepositorySystemSession repoSysSession = (DefaultRepositorySystemSession) session.getRepositorySession();
repoSysSession
.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory()
.newInstance(
session.getRepositorySession(), new LocalRepository(new File("target/local-repo"))));
// Ensure remote repo connection uses SSL
File globalSettingsFile = new File(getBasedir(), "target/test-classes/unit/settings.xml");
session.getRequest().setGlobalSettingsFile(globalSettingsFile);
LegacySupport legacySupport = lookup(LegacySupport.class);
legacySupport.setSession(session);
setVariableValueToObject(mojo, "session", session);
setVariableValueToObject(mojo, "repoSession", repositorySession);
setVariableValueToObject(mojo, "repoSession", repoSysSession);
mojo.execute();

Path optionsFile = new File(mojo.getOutputDirectory(), "options").toPath();
Expand Down

0 comments on commit b7b75e9

Please # to comment.