Author: ltheussl
Date: Tue May 24 08:12:30 2011
New Revision: 1126918

URL: http://svn.apache.org/viewvc?rev=1126918&view=rev
Log:
add an IT to check the order of items in modules menu (MSITE-458)

Added:
    maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/
    maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/first/
    maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/first/pom.xml
    maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/pom.xml
    maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/second/
    maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/second/pom.xml
    maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/src/
    maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/src/site/
    maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/src/site/site.xml
    maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/verify.bsh

Added: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/first/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/first/pom.xml?rev=1126918&view=auto
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/first/pom.xml (added)
+++ maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/first/pom.xml Tue 
May 24 08:12:30 2011
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd"; 
xmlns="http://maven.apache.org/POM/4.0.0";
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>aggregator</artifactId>
+    <groupId>org.example</groupId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+  <artifactId>first</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <name>Should be first in Modules list</name>
+  
+    <dependencies>
+    <dependency>
+      <groupId>org.example</groupId>
+      <artifactId>second</artifactId>
+      <version>0.0.1-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+  
+</project>

Added: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/pom.xml?rev=1126918&view=auto
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/pom.xml (added)
+++ maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/pom.xml Tue May 24 
08:12:30 2011
@@ -0,0 +1,47 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.example</groupId>
+  <artifactId>aggregator</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  <name>Has modules list</name>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <modules>
+    <module>first</module>
+    <module>second</module>
+  </modules>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-site-plugin</artifactId>
+          <version>@project.version@</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+        <version>2.4</version>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>index</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
+    </plugins>
+  </reporting>
+
+</project>

Added: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/second/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/second/pom.xml?rev=1126918&view=auto
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/second/pom.xml 
(added)
+++ maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/second/pom.xml Tue 
May 24 08:12:30 2011
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd"; 
xmlns="http://maven.apache.org/POM/4.0.0";
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>aggregator</artifactId>
+    <groupId>org.example</groupId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+  <artifactId>second</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <name>Should be second in Modules list</name>
+</project>

Added: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/src/site/site.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/src/site/site.xml?rev=1126918&view=auto
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/src/site/site.xml 
(added)
+++ maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/src/site/site.xml 
Tue May 24 08:12:30 2011
@@ -0,0 +1,5 @@
+<project xmlns="http://maven.apache.org/DECORATION/1.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 
http://maven.apache.org/xsd/decoration-1.0.0.xsd";>
+  <body>
+    <menu ref="modules"/>
+  </body>
+</project>

Added: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/verify.bsh
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/verify.bsh?rev=1126918&view=auto
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/verify.bsh (added)
+++ maven/plugins/trunk/maven-site-plugin/src/it/MSITE-458/verify.bsh Tue May 
24 08:12:30 2011
@@ -0,0 +1,64 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.*;
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+    final File siteDirectory = new File( basedir, "target/site" );
+    if ( !siteDirectory.exists() || !siteDirectory.isDirectory() )
+    {
+        System.err.println( "site is missing or not a directory." );
+        result = false;
+    }
+
+    File index = new File( siteDirectory, "index.html" );
+    if ( !index.exists() || index.isDirectory() )
+    {
+        System.err.println( "no index.html!" );
+        result = false;
+    }
+
+    String content = FileUtils.fileRead( index, "UTF-8" );
+    int index1 = content.indexOf( "Should be first in Modules list" );
+    int index2 = content.indexOf( "Should be second in Modules list" );
+
+    if ( index1 < 0 || index2 < 0 )
+    {
+        System.err.println( "index.html is missing module links!" );
+        result = false;
+    }
+
+    if ( index1 > index2 )
+    {
+        System.err.println( "wrong order of module links!" );
+        result = false;
+    }
+}
+catch( IOException e )
+{
+    e.printStackTrace();
+    result = false;
+}
+
+return result;


Reply via email to