This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch replace-old-resolution
in repository https://gitbox.apache.org/repos/asf/maven-doxia-sitetools.git


The following commit(s) were added to refs/heads/replace-old-resolution by this 
push:
     new b76ead8  Last bits?
b76ead8 is described below

commit b76ead876990cff33a77b3f07512bbff32098f0b
Author: Michael Osipov <[email protected]>
AuthorDate: Mon Mar 13 21:37:23 2023 +0100

    Last bits?
---
 .../apache/maven/doxia/tools/DefaultSiteTool.java  | 238 +++++++++------------
 .../org/apache/maven/doxia/tools/SiteTool.java     |   6 +-
 .../org/apache/maven/doxia/tools/SiteToolTest.java |  43 ++--
 3 files changed, 123 insertions(+), 164 deletions(-)

diff --git 
a/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
 
b/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
index 1824783..fe8ad18 100644
--- 
a/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
+++ 
b/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
@@ -47,7 +47,6 @@ import org.apache.maven.artifact.DefaultArtifact;
 import org.apache.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactResolver;
 import 
org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.doxia.site.decoration.DecorationModel;
@@ -59,13 +58,8 @@ import 
org.apache.maven.doxia.site.decoration.io.xpp3.DecorationXpp3Reader;
 import org.apache.maven.doxia.site.decoration.io.xpp3.DecorationXpp3Writer;
 import org.apache.maven.model.DistributionManagement;
 import org.apache.maven.model.Plugin;
-import org.apache.maven.model.Site;
-import org.apache.maven.project.DefaultProjectBuildingRequest;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.ProjectBuilder;
-import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.project.ProjectBuildingRequest;
-import org.apache.maven.project.ProjectBuildingResult;
 import org.apache.maven.reporting.MavenReport;
 import org.codehaus.plexus.i18n.I18N;
 import org.codehaus.plexus.interpolation.EnvarBasedValueSource;
@@ -81,7 +75,6 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 import org.eclipse.aether.RepositorySystem;
 import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.artifact.ArtifactType;
 import org.eclipse.aether.resolution.ArtifactRequest;
 import org.eclipse.aether.resolution.ArtifactResolutionException;
 import org.eclipse.aether.resolution.ArtifactResult;
@@ -139,9 +132,7 @@ public class DefaultSiteTool implements SiteTool {
 
     /** {@inheritDoc} */
     public Artifact getSkinArtifactFromRepository(
-            RepositorySystemSession repoSession,
-            List<ArtifactRepository> remoteArtifactRepositories,
-            Skin skin)
+            RepositorySystemSession repoSession, List<ArtifactRepository> 
remoteArtifactRepositories, Skin skin)
             throws SiteToolException {
         Objects.requireNonNull(repoSession, "repoSession cannot be null");
         Objects.requireNonNull(remoteArtifactRepositories, 
"remoteArtifactRepositories cannot be null");
@@ -154,21 +145,28 @@ public class DefaultSiteTool implements SiteTool {
             }
             VersionRange versionSpec = 
VersionRange.createFromVersionSpec(version);
             String type = "jar";
-            Artifact artifact = new DefaultArtifact(skin.getGroupId(), 
skin.getArtifactId(), versionSpec,
-                    Artifact.SCOPE_RUNTIME, type, null,
+            Artifact artifact = new DefaultArtifact(
+                    skin.getGroupId(),
+                    skin.getArtifactId(),
+                    versionSpec,
+                    Artifact.SCOPE_RUNTIME,
+                    type,
+                    null,
                     artifactHandlerManager.getArtifactHandler(type));
-             ArtifactRequest request = new ArtifactRequest(
+            ArtifactRequest request = new ArtifactRequest(
                     RepositoryUtils.toArtifact(artifact),
                     RepositoryUtils.toRepos(remoteArtifactRepositories),
                     "remote-skin");
             ArtifactResult result = 
repositorySystem.resolveArtifact(repoSession, request);
 
-            if (!result.isResolved())
+            if (!result.isResolved()) {
                 throw new SiteToolException(
                         "The skin '" + ArtifactUtils.key(artifact) + "' does 
not exist",
-                        result.getExceptions().stream().filter(
-                                e -> (e instanceof ArtifactNotFoundException))
-                                .findFirst().orElse(null));
+                        result.getExceptions().stream()
+                                .filter(e -> (e instanceof 
ArtifactNotFoundException))
+                                .findFirst()
+                                .orElse(null));
+            }
 
             return RepositoryUtils.toArtifact(result.getArtifact());
         } catch (InvalidVersionSpecificationException e) {
@@ -379,13 +377,11 @@ public class DefaultSiteTool implements SiteTool {
             File siteDirectory,
             Locale locale,
             MavenProject project,
-            List<MavenProject> reactorProjects,
             RepositorySystemSession repoSession,
             List<ArtifactRepository> remoteArtifactRepositories)
             throws SiteToolException {
         Objects.requireNonNull(locale, "locale cannot be null");
         Objects.requireNonNull(project, "project cannot be null");
-        Objects.requireNonNull(reactorProjects, "reactorProjects cannot be 
null");
         Objects.requireNonNull(repoSession, "repoSession cannot be null");
         Objects.requireNonNull(remoteArtifactRepositories, 
"remoteArtifactRepositories cannot be null");
 
@@ -393,7 +389,7 @@ public class DefaultSiteTool implements SiteTool {
                 + (locale.equals(SiteTool.DEFAULT_LOCALE) ? "default locale" : 
"locale '" + locale + "'"));
 
         Map.Entry<DecorationModel, MavenProject> result =
-                getDecorationModel(0, siteDirectory, locale, project, 
reactorProjects, repoSession, remoteArtifactRepositories);
+                getDecorationModel(0, siteDirectory, locale, project, 
repoSession, remoteArtifactRepositories);
         DecorationModel decorationModel = result.getKey();
         MavenProject parentProject = result.getValue();
 
@@ -415,7 +411,7 @@ public class DefaultSiteTool implements SiteTool {
         }
 
         try {
-            populateModulesMenu(decorationModel, locale, project, 
reactorProjects, repoSession.getLocalRepository(), true);
+            populateModulesMenu(decorationModel, locale, project, true);
         } catch (IOException e) {
             throw new SiteToolException("Error while populating modules menu", 
e);
         }
@@ -547,25 +543,16 @@ public class DefaultSiteTool implements SiteTool {
      * @param decorationModel the Doxia Sitetools DecorationModel, not null.
      * @param locale the locale used for the i18n in DecorationModel, not null.
      * @param project a Maven project, not null.
-     * @param reactorProjects the Maven reactor projects, not null.
-     * @param localRepository the Maven local repository, not null.
      * @param keepInheritedRefs used for inherited references.
      * @throws SiteToolException if any
      * @throws IOException
      */
     private void populateModulesMenu(
-            DecorationModel decorationModel,
-            Locale locale,
-            MavenProject project,
-            List<MavenProject> reactorProjects,
-            ArtifactRepository localRepository,
-            boolean keepInheritedRefs)
+            DecorationModel decorationModel, Locale locale, MavenProject 
project, boolean keepInheritedRefs)
             throws SiteToolException, IOException {
         Objects.requireNonNull(decorationModel, "decorationModel cannot be 
null");
         Objects.requireNonNull(locale, "locale cannot be null");
         Objects.requireNonNull(project, "project cannot be null");
-        Objects.requireNonNull(reactorProjects, "reactorProjects cannot be 
null");
-        Objects.requireNonNull(localRepository, "localRepository cannot be 
null");
 
         Menu menu = decorationModel.getMenuRef("modules");
 
@@ -578,39 +565,13 @@ public class DefaultSiteTool implements SiteTool {
         }
 
         // we require child modules and reactors to process module menu
-        if (project.getModules().size() > 0) {
+        List<MavenProject> projectModules = project.getCollectedProjects();
+        if (projectModules != null && !projectModules.isEmpty()) {
             if (menu.getName() == null) {
                 menu.setName(i18n.getString("site-tool", locale, 
"decorationModel.menu.projectmodules"));
             }
 
-            for (String module : (List<String>) project.getModules()) {
-                MavenProject moduleProject = getModuleFromReactor(project, 
reactorProjects, module);
-
-                if (moduleProject == null) {
-                    LOGGER.warn("Module " + module + " not found in reactor: 
loading locally");
-
-                    File f = new File(project.getBasedir(), module + 
"/pom.xml");
-                    if (f.exists()) {
-                        try {
-                            ProjectBuildingRequest request = new 
DefaultProjectBuildingRequest();
-                            request.setLocalRepository(localRepository);
-
-                            ProjectBuildingResult result = 
projectBuilder.build(f, request);
-                            moduleProject = result.getProject();
-                        } catch (ProjectBuildingException e) {
-                            throw new SiteToolException("Unable to read local 
module POM", e);
-                        }
-                    } else {
-                        LOGGER.warn("No filesystem module POM available");
-
-                        moduleProject = new MavenProject();
-                        moduleProject.setName(module);
-                        moduleProject.setDistributionManagement(new 
DistributionManagement());
-                        moduleProject.getDistributionManagement().setSite(new 
Site());
-                        
moduleProject.getDistributionManagement().getSite().setUrl(module);
-                    }
-                }
-
+            for (MavenProject moduleProject : projectModules) {
                 final String pluginId = 
"org.apache.maven.plugins:maven-site-plugin";
                 String skipFlag = getPluginParameter(moduleProject, pluginId, 
"skip");
                 if (skipFlag == null) {
@@ -630,20 +591,6 @@ public class DefaultSiteTool implements SiteTool {
         }
     }
 
-    private static MavenProject getModuleFromReactor(
-            MavenProject project, List<MavenProject> reactorProjects, String 
module) throws IOException {
-        File moduleBasedir = new File(project.getBasedir(), 
module).getCanonicalFile();
-
-        for (MavenProject reactorProject : reactorProjects) {
-            if (moduleBasedir.equals(reactorProject.getBasedir())) {
-                return reactorProject;
-            }
-        }
-
-        // module not found in reactor
-        return null;
-    }
-
     /** {@inheritDoc} */
     public void populateReportsMenu(
             DecorationModel decorationModel, Locale locale, Map<String, 
List<MavenReport>> categories) {
@@ -841,108 +788,136 @@ public class DefaultSiteTool implements SiteTool {
 
         if (!variant.isEmpty()) {
             String localeStr = language + "_" + country + "_" + variant;
-            artifact = new DefaultArtifact(project.getGroupId(), 
project.getArtifactId(), project.getVersion(),
-                    Artifact.SCOPE_RUNTIME, type, "site_" + localeStr,
+            artifact = new DefaultArtifact(
+                    project.getGroupId(),
+                    project.getArtifactId(),
+                    project.getVersion(),
+                    Artifact.SCOPE_RUNTIME,
+                    type,
+                    "site_" + localeStr,
                     artifactHandler);
-             ArtifactRequest request = new ArtifactRequest(
+            ArtifactRequest request = new ArtifactRequest(
                     RepositoryUtils.toArtifact(artifact),
                     RepositoryUtils.toRepos(remoteArtifactRepositories),
                     "remote-site-descriptor");
 
-             ArtifactResult result = 
repositorySystem.resolveArtifact(repoSession, request);
+            ArtifactResult result = 
repositorySystem.resolveArtifact(repoSession, request);
 
-             if (result.isResolved()) {
+            if (result.isResolved()) {
                 siteDescriptor = result.getArtifact().getFile();
                 found = true;
-             } else {
-                Exception anfe = result.getExceptions().stream().filter(
-                         e -> (e instanceof 
ArtifactNotFoundException)).findFirst().orElse(null);
-                 if (anfe == null) {
+            } else {
+                Exception anfe = result.getExceptions().stream()
+                        .filter(e -> (e instanceof ArtifactNotFoundException))
+                        .findFirst()
+                        .orElse(null);
+                if (anfe == null) {
                     LOGGER.debug("No site descriptor found for '" + 
project.getId() + "' for locale '" + localeStr
-                             + "', trying without variant...");
-                 } else {
+                            + "', trying without variant...");
+                } else {
                     LOGGER.debug("Unable to locate site descriptor for locale 
'" + localeStr + "'", anfe);
-                 }
-             }
+                }
+            }
         }
 
         if (!found && !country.isEmpty()) {
             String localeStr = language + "_" + country;
-            artifact = new DefaultArtifact(project.getGroupId(), 
project.getArtifactId(), project.getVersion(),
-                    Artifact.SCOPE_RUNTIME, type, "site_" + localeStr,
+            artifact = new DefaultArtifact(
+                    project.getGroupId(),
+                    project.getArtifactId(),
+                    project.getVersion(),
+                    Artifact.SCOPE_RUNTIME,
+                    type,
+                    "site_" + localeStr,
                     artifactHandler);
-             ArtifactRequest request = new ArtifactRequest(
+            ArtifactRequest request = new ArtifactRequest(
                     RepositoryUtils.toArtifact(artifact),
                     RepositoryUtils.toRepos(remoteArtifactRepositories),
                     "remote-site-descriptor");
 
-             ArtifactResult result = 
repositorySystem.resolveArtifact(repoSession, request);
+            ArtifactResult result = 
repositorySystem.resolveArtifact(repoSession, request);
 
-             if (result.isResolved()) {
+            if (result.isResolved()) {
                 siteDescriptor = result.getArtifact().getFile();
                 found = true;
-             } else {
-                Exception anfe = result.getExceptions().stream().filter(
-                         e -> (e instanceof 
ArtifactNotFoundException)).findFirst().orElse(null);
-                 if (anfe == null) {
+            } else {
+                Exception anfe = result.getExceptions().stream()
+                        .filter(e -> (e instanceof ArtifactNotFoundException))
+                        .findFirst()
+                        .orElse(null);
+                if (anfe == null) {
                     LOGGER.debug("No site descriptor found for '" + 
project.getId() + "' for locale '" + localeStr
-                             + "', trying without country...");
-                 } else {
+                            + "', trying without country...");
+                } else {
                     LOGGER.debug("Unable to locate site descriptor for locale 
'" + localeStr + "'", anfe);
-                 }
-             }
+                }
+            }
         }
 
         if (!found && !language.isEmpty()) {
             String localeStr = language;
-            artifact = new DefaultArtifact(project.getGroupId(), 
project.getArtifactId(), project.getVersion(),
-                    Artifact.SCOPE_RUNTIME, type, "site_" + localeStr,
+            artifact = new DefaultArtifact(
+                    project.getGroupId(),
+                    project.getArtifactId(),
+                    project.getVersion(),
+                    Artifact.SCOPE_RUNTIME,
+                    type,
+                    "site_" + localeStr,
                     artifactHandler);
-             ArtifactRequest request = new ArtifactRequest(
+            ArtifactRequest request = new ArtifactRequest(
                     RepositoryUtils.toArtifact(artifact),
                     RepositoryUtils.toRepos(remoteArtifactRepositories),
                     "remote-site-descriptor");
 
-             ArtifactResult result = 
repositorySystem.resolveArtifact(repoSession, request);
+            ArtifactResult result = 
repositorySystem.resolveArtifact(repoSession, request);
 
-             if (result.isResolved()) {
+            if (result.isResolved()) {
                 siteDescriptor = result.getArtifact().getFile();
                 found = true;
-             } else {
-                Exception anfe = result.getExceptions().stream().filter(
-                         e -> (e instanceof 
ArtifactNotFoundException)).findFirst().orElse(null);
-                 if (anfe == null) {
+            } else {
+                Exception anfe = result.getExceptions().stream()
+                        .filter(e -> (e instanceof ArtifactNotFoundException))
+                        .findFirst()
+                        .orElse(null);
+                if (anfe == null) {
                     LOGGER.debug("No site descriptor found for '" + 
project.getId() + "' for locale '" + localeStr
-                             + "', trying default locale...");
-                 } else {
+                            + "', trying default locale...");
+                } else {
                     LOGGER.debug("Unable to locate site descriptor for locale 
'" + localeStr + "'", anfe);
-                 }
-             }
+                }
+            }
         }
 
         if (!found) {
-            artifact = new DefaultArtifact(project.getGroupId(), 
project.getArtifactId(), project.getVersion(),
-                    Artifact.SCOPE_RUNTIME, type, "site",
+            artifact = new DefaultArtifact(
+                    project.getGroupId(),
+                    project.getArtifactId(),
+                    project.getVersion(),
+                    Artifact.SCOPE_RUNTIME,
+                    type,
+                    "site",
                     artifactHandler);
-             ArtifactRequest request = new ArtifactRequest(
+            ArtifactRequest request = new ArtifactRequest(
                     RepositoryUtils.toArtifact(artifact),
                     RepositoryUtils.toRepos(remoteArtifactRepositories),
                     "remote-site-descriptor");
 
-             ArtifactResult result = 
repositorySystem.resolveArtifact(repoSession, request);
+            ArtifactResult result = 
repositorySystem.resolveArtifact(repoSession, request);
 
-             if (result.isResolved()) {
+            if (result.isResolved()) {
                 siteDescriptor = result.getArtifact().getFile();
-             } else {
-                Exception anfe = result.getExceptions().stream().filter(
-                         e -> (e instanceof 
ArtifactNotFoundException)).findFirst().orElse(null);
-                 if (anfe == null) {
+            } else {
+                Exception anfe = result.getExceptions().stream()
+                        .filter(e -> (e instanceof ArtifactNotFoundException))
+                        .findFirst()
+                        .orElse(null);
+                if (anfe == null) {
                     LOGGER.debug("No site descriptor found for '" + 
project.getId() + "' with default locale.");
                     siteDescriptor = null;
-                 } else {
+                } else {
                     throw (ArtifactNotFoundException) anfe;
-                 }
-             }
+                }
+            }
         }
 
         return siteDescriptor;
@@ -953,7 +928,6 @@ public class DefaultSiteTool implements SiteTool {
      * @param siteDirectory, can be null if project.basedir is null, ie POM 
from repository
      * @param locale not null
      * @param project not null
-     * @param reactorProjects not null
      * @param repoSession not null
      * @param remoteArtifactRepositories not null
      * @return the decoration model depending the locale and the parent project
@@ -964,7 +938,6 @@ public class DefaultSiteTool implements SiteTool {
             File siteDirectory,
             Locale locale,
             MavenProject project,
-            List<MavenProject> reactorProjects,
             RepositorySystemSession repoSession,
             List<ArtifactRepository> remoteArtifactRepositories)
             throws SiteToolException {
@@ -973,7 +946,8 @@ public class DefaultSiteTool implements SiteTool {
         if (project.getBasedir() == null) {
             // POM is in the repository: look into the repository for site 
descriptor
             try {
-                siteDescriptor = getSiteDescriptorFromRepository(project, 
repoSession, remoteArtifactRepositories, locale);
+                siteDescriptor =
+                        getSiteDescriptorFromRepository(project, repoSession, 
remoteArtifactRepositories, locale);
             } catch (SiteToolException e) {
                 throw new SiteToolException("The site descriptor cannot be 
resolved from the repository", e);
             }
@@ -1030,13 +1004,7 @@ public class DefaultSiteTool implements SiteTool {
             }
 
             DecorationModel parentDecorationModel = getDecorationModel(
-                            depth,
-                            parentSiteDirectory,
-                            locale,
-                            parentProject,
-                            reactorProjects,
-                            repoSession,
-                            remoteArtifactRepositories)
+                            depth, parentSiteDirectory, locale, parentProject, 
repoSession, remoteArtifactRepositories)
                     .getKey();
 
             // MSHARED-116 requires an empty decoration model (instead of a 
null one)
diff --git 
a/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java
 
b/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java
index c4e3578..632e8c1 100644
--- 
a/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java
+++ 
b/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java
@@ -55,9 +55,7 @@ public interface SiteTool {
      * @throws SiteToolException if any
      */
     Artifact getSkinArtifactFromRepository(
-            RepositorySystemSession repoSession,
-            List<ArtifactRepository> remoteArtifactRepositories,
-            Skin skin)
+            RepositorySystemSession repoSession, List<ArtifactRepository> 
remoteArtifactRepositories, Skin skin)
             throws SiteToolException;
 
     /**
@@ -115,7 +113,6 @@ public interface SiteTool {
      * @param locale the locale used for the i18n in DecorationModel, not null.
      * See {@link #getSiteDescriptor(File, Locale)} for details.
      * @param project the Maven project, not null.
-     * @param reactorProjects the Maven reactor projects, not null.
      * @param repoSession the repository system session, not null.
      * @param remoteArtifactRepositories the Maven remote repositories, not 
null.
      * @return the <code>DecorationModel</code> object corresponding to the 
<code>site.xml</code> file with some
@@ -127,7 +124,6 @@ public interface SiteTool {
             File siteDirectory,
             Locale locale,
             MavenProject project,
-            List<MavenProject> reactorProjects,
             RepositorySystemSession repoSession,
             List<ArtifactRepository> remoteArtifactRepositories)
             throws SiteToolException;
diff --git 
a/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java
 
b/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java
index 34ce2e4..22c50ff 100644
--- 
a/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java
+++ 
b/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java
@@ -23,12 +23,10 @@ import javax.inject.Named;
 
 import java.io.File;
 import java.io.Writer;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Locale;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -40,12 +38,16 @@ import org.apache.maven.doxia.site.decoration.LinkItem;
 import org.apache.maven.doxia.site.decoration.Skin;
 import org.apache.maven.doxia.site.decoration.io.xpp3.DecorationXpp3Writer;
 import org.apache.maven.doxia.tools.stubs.SiteToolMavenProjectStub;
-import org.apache.maven.project.MavenProject;
+import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
 import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.testing.PlexusTest;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.WriterFactory;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
+import org.eclipse.aether.repository.LocalRepository;
 import org.junit.jupiter.api.Test;
 
 import static org.codehaus.plexus.testing.PlexusExtension.getTestFile;
@@ -105,6 +107,13 @@ public class SiteToolTest {
         return new File(getLocalRepo().getBasedir());
     }
 
+    protected RepositorySystemSession newRepoSession() throws Exception {
+        DefaultRepositorySystemSession repoSession = 
MavenRepositorySystemUtils.newSession();
+        repoSession.setLocalRepositoryManager(new 
SimpleLocalRepositoryManagerFactory()
+                .newInstance(repoSession, new 
LocalRepository(getLocalRepoDir())));
+        return repoSession;
+    }
+
     /**
      * @throws Exception
      */
@@ -113,13 +122,11 @@ public class SiteToolTest {
         assertNotNull(tool);
 
         SiteToolMavenProjectStub project = new 
SiteToolMavenProjectStub("site-tool-test");
-        DecorationModel decorationModel = new DecorationModel();
         Skin skin = new Skin();
         skin.setGroupId("org.apache.maven.skins");
         skin.setArtifactId("maven-stylus-skin");
-        decorationModel.setSkin(skin);
-        assertNotNull(tool.getSkinArtifactFromRepository(
-                getLocalRepo(), project.getRemoteArtifactRepositories(), 
decorationModel));
+        assertNotNull(
+                tool.getSkinArtifactFromRepository(newRepoSession(), 
project.getRemoteArtifactRepositories(), skin));
     }
 
     private void checkGetRelativePathDirectory(SiteTool tool, String relative, 
String to, String from) {
@@ -330,7 +337,7 @@ public class SiteToolTest {
         assertEquals(
                 tool.getSiteDescriptorFromRepository(
                                 project,
-                                getLocalRepo(),
+                                newRepoSession(),
                                 project.getRemoteArtifactRepositories(),
                                 SiteTool.DEFAULT_LOCALE)
                         .toString(),
@@ -345,15 +352,13 @@ public class SiteToolTest {
         assertNotNull(tool);
 
         SiteToolMavenProjectStub project = new 
SiteToolMavenProjectStub("site-tool-test");
-        List<MavenProject> reactorProjects = new ArrayList<MavenProject>();
 
         // model from current local build
         DecorationModel model = tool.getDecorationModel(
                 new File(project.getBasedir(), "src/site"),
                 SiteTool.DEFAULT_LOCALE,
                 project,
-                reactorProjects,
-                getLocalRepo(),
+                newRepoSession(),
                 project.getRemoteArtifactRepositories());
         assertNotNull(model);
         assertNotNull(model.getBannerLeft());
@@ -375,12 +380,7 @@ public class SiteToolTest {
         project.setArtifactId("maven");
         project.setVersion("3.8.6");
         DecorationModel modelFromRepo = tool.getDecorationModel(
-                null,
-                SiteTool.DEFAULT_LOCALE,
-                project,
-                reactorProjects,
-                getLocalRepo(),
-                project.getRemoteArtifactRepositories());
+                null, SiteTool.DEFAULT_LOCALE, project, newRepoSession(), 
project.getRemoteArtifactRepositories());
         assertNotNull(modelFromRepo);
         assertNotNull(modelFromRepo.getBannerLeft());
         assertEquals("dummy", modelFromRepo.getBannerLeft().getName());
@@ -400,14 +400,12 @@ public class SiteToolTest {
 
         SiteToolMavenProjectStub project = new 
SiteToolMavenProjectStub("no-site-test");
         String siteDirectory = "src/site";
-        List<MavenProject> reactorProjects = new ArrayList<MavenProject>();
 
         DecorationModel model = tool.getDecorationModel(
                 new File(project.getBasedir(), siteDirectory),
                 SiteTool.DEFAULT_LOCALE,
                 project,
-                reactorProjects,
-                getLocalRepo(),
+                newRepoSession(),
                 project.getRemoteArtifactRepositories());
         assertNotNull(model);
     }
@@ -462,14 +460,11 @@ public class SiteToolTest {
         childProject.setParent(parentProject);
         
childProject.setDistgributionManagementSiteUrl("dav+https://davs.codehaus.org/site/child";);
 
-        List<MavenProject> reactorProjects = 
Collections.<MavenProject>singletonList(parentProject);
-
         DecorationModel model = tool.getDecorationModel(
                 new File(childProject.getBasedir(), "src/site"),
                 SiteTool.DEFAULT_LOCALE,
                 childProject,
-                reactorProjects,
-                getLocalRepo(),
+                newRepoSession(),
                 childProject.getRemoteArtifactRepositories());
         assertNotNull(model);
 

Reply via email to