maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1719818 - in /maven/doxia/doxia-sitetools/trunk/doxia-integration-tools/src/test: java/org/apache/maven/doxia/tools/SiteToolTest.java java/org/apache/maven/doxia/tools/stubs/SiteToolMavenProjectStub.java resources/unit/interpolated-site/
Date Sun, 13 Dec 2015 19:09:15 GMT
Author: hboutemy
Date: Sun Dec 13 19:09:14 2015
New Revision: 1719818

URL: http://svn.apache.org/viewvc?rev=1719818&view=rev
Log:
moved getInterpolatedSiteDescriptorContent() unit test from maven-site-plugin

Added:
    maven/doxia/doxia-sitetools/trunk/doxia-integration-tools/src/test/resources/unit/interpolated-site/
      - copied from r1719648, maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/
Modified:
    maven/doxia/doxia-sitetools/trunk/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java
    maven/doxia/doxia-sitetools/trunk/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/stubs/SiteToolMavenProjectStub.java

Modified: maven/doxia/doxia-sitetools/trunk/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java?rev=1719818&r1=1719817&r2=1719818&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java
(original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java
Sun Dec 13 19:09:14 2015
@@ -22,6 +22,7 @@ package org.apache.maven.doxia.tools;
 import java.io.File;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
 
@@ -35,6 +36,7 @@ import org.apache.maven.doxia.tools.stub
 import org.apache.maven.project.MavenProject;
 
 import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.FileUtils;
 
 import edu.emory.mathcs.backport.java.util.Arrays;
 
@@ -292,7 +294,6 @@ public class SiteToolTest
         assertNotNull( model );
     }
 
-
     public void testGetAvailableLocales()
                     throws Exception
     {
@@ -306,4 +307,34 @@ public class SiteToolTest
         // by default, only DEFAULT_LOCALE
         assertEquals( Arrays.asList( new Locale[] { SiteTool.DEFAULT_LOCALE } ), tool.getSiteLocales(
"" ) );
     }
+
+    public void testGetInterpolatedSiteDescriptorContent()
+        throws Exception
+    {
+        SiteTool tool = (SiteTool) lookup( SiteTool.ROLE );
+        assertNotNull( tool );
+
+        File pomXmlFile = getTestFile( "src/test/resources/unit/interpolated-site/pom.xml"
);
+        assertNotNull( pomXmlFile );
+        assertTrue( pomXmlFile.exists() );
+
+        File descriptorFile = getTestFile( "src/test/resources/unit/interpolated-site/src/site/site.xml"
);
+        assertNotNull( descriptorFile );
+        assertTrue( descriptorFile.exists() );
+
+        String siteDescriptorContent = FileUtils.fileRead( descriptorFile );
+        assertNotNull( siteDescriptorContent );
+        assertTrue( siteDescriptorContent.contains( "${project.name}" ) );
+        assertFalse( siteDescriptorContent.contains( "Interpolatesite" ) );
+
+        SiteToolMavenProjectStub project = new SiteToolMavenProjectStub( "interpolated-site"
);
+
+        SiteTool siteTool = (SiteTool) lookup( SiteTool.ROLE );
+        siteDescriptorContent =
+            siteTool.getInterpolatedSiteDescriptorContent( new HashMap<String, String>(),
project,
+                                                           siteDescriptorContent );
+        assertNotNull( siteDescriptorContent );
+        assertFalse( siteDescriptorContent.contains( "${project.name}" ) );
+        assertTrue( siteDescriptorContent.contains( "Interpolatesite" ) );
+    }
 }

Modified: maven/doxia/doxia-sitetools/trunk/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/stubs/SiteToolMavenProjectStub.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/stubs/SiteToolMavenProjectStub.java?rev=1719818&r1=1719817&r2=1719818&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/stubs/SiteToolMavenProjectStub.java
(original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/stubs/SiteToolMavenProjectStub.java
Sun Dec 13 19:09:14 2015
@@ -48,12 +48,11 @@ public class SiteToolMavenProjectStub
     {
         basedir = new File( super.getBasedir() + "/src/test/resources/unit/" + projectName
);
 
-        MavenXpp3Reader pomReader = new MavenXpp3Reader();
         Model model = null;
 
         try
         {
-            model = pomReader.read( new FileReader( new File( getBasedir(), "pom.xml" ) )
);
+            model = new MavenXpp3Reader().read( new FileReader( new File( getBasedir(), "pom.xml"
) ) );
             setModel( model );
         }
         catch ( Exception e )



Mime
View raw message