You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2009/08/23 01:29:07 UTC
svn commit: r806906 - in
/maven/plugins/trunk/maven-site-plugin/src/it/site-jar: ./ goals.txt
pom.xml verify.bsh
Author: olamy
Date: Sat Aug 22 23:29:07 2009
New Revision: 806906
URL: http://svn.apache.org/viewvc?rev=806906&view=rev
Log:
add it for mojo site:jar
Added:
maven/plugins/trunk/maven-site-plugin/src/it/site-jar/
- copied from r806903, maven/plugins/trunk/maven-site-plugin/src/it/site-deploy/
Modified:
maven/plugins/trunk/maven-site-plugin/src/it/site-jar/goals.txt
maven/plugins/trunk/maven-site-plugin/src/it/site-jar/pom.xml
maven/plugins/trunk/maven-site-plugin/src/it/site-jar/verify.bsh
Modified: maven/plugins/trunk/maven-site-plugin/src/it/site-jar/goals.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/site-jar/goals.txt?rev=806906&r1=806903&r2=806906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/it/site-jar/goals.txt (original)
+++ maven/plugins/trunk/maven-site-plugin/src/it/site-jar/goals.txt Sat Aug 22 23:29:07 2009
@@ -1 +1 @@
-clean site:site site:deploy
\ No newline at end of file
+clean site:site site:jar
\ No newline at end of file
Modified: maven/plugins/trunk/maven-site-plugin/src/it/site-jar/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/site-jar/pom.xml?rev=806906&r1=806903&r2=806906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/it/site-jar/pom.xml (original)
+++ maven/plugins/trunk/maven-site-plugin/src/it/site-jar/pom.xml Sat Aug 22 23:29:07 2009
@@ -22,10 +22,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
- <artifactId>site-deploy</artifactId>
+ <artifactId>site-jar</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
- <name>site-deploy It</name>
+ <name>site-jar It</name>
<properties>
<currentVersion>2.0.7</currentVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Modified: maven/plugins/trunk/maven-site-plugin/src/it/site-jar/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/site-jar/verify.bsh?rev=806906&r1=806903&r2=806906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/it/site-jar/verify.bsh (original)
+++ maven/plugins/trunk/maven-site-plugin/src/it/site-jar/verify.bsh Sat Aug 22 23:29:07 2009
@@ -19,6 +19,8 @@
*/
import java.io.*;
+import java.util.*;
+import java.util.jar.*;
import org.codehaus.plexus.util.*;
boolean result = true;
@@ -32,47 +34,38 @@
return false;
}
- File siteDirectory = new File ( target, "site-deployed" );
- if ( !siteDirectory.exists() || !siteDirectory.isDirectory() )
+ File siteJar = new File ( target, "site-jar-1.0-SNAPSHOT-site.jar" );
+ if ( !siteJar.exists() || siteJar.isDirectory() )
{
- System.err.println( "site file is missing or not a directory." );
+ System.err.println( "siteJar file is missing or a directory." );
return false;
}
- File releaseDirectory = new File ( siteDirectory, "releases" );
- if ( !releaseDirectory.exists() || !releaseDirectory.isDirectory() )
- {
- System.err.println( "releaseDirectory file is missing or not a directory." );
- return false;
- }
- File release163 = new File ( releaseDirectory, "release1.6.3.html" );
- if ( !release163.exists() || release163.isDirectory() )
- {
- System.err.println( "release163 file is missing or a directory." );
- return false;
- }
- File release16 = new File ( releaseDirectory, "release1.6.html" );
- if ( !release16.exists() || release16.isDirectory() )
- {
- System.err.println( "release16 file is missing or a directory." );
- return false;
- }
+ String[] fileNames = new String[] { "images/h3.jpg", "download.html", "index.html", "releases/release1.6.html" };
+
+ Set contents = new HashSet();
- File download = new File ( siteDirectory, "download.html" );
- if ( !download.exists() || download.isDirectory() )
- {
- System.err.println( "download.html file is missing or a directory." );
- return false;
+ JarFile jar = new JarFile( siteJar );
+ Enumeration jarEntries = jar.entries();
+ while ( jarEntries.hasMoreElements() )
+ {
+ JarEntry entry = (JarEntry) jarEntries.nextElement();
+ if ( !entry.isDirectory() )
+ {
+ // Only compare files
+ contents.add( entry.getName() );
+ }
+ }
+
+ for ( int i = 0; i < fileNames.length; i++ )
+ {
+ String fileName = fileNames[i];
+ if ( !contents.contains( fileName ) )
+ {
+ System.err.println( "File[" + fileName + "] not found in jar archive" );
+ return false;
+ }
}
- FileInputStream fis = new FileInputStream ( download );
- String downloadContent = IOUtil.toString ( fis, "UTF-8" );
- int indexOf = downloadContent.indexOf( "Download Maven 2.0.7" );
- if ( indexOf < 0)
- {
- System.err.println( "download.html doesn't contain Download Maven 2.0.7" );
- return false;
- }
-
}
catch( IOException e )