Author: bentmann
Date: Wed Aug 13 12:35:40 2008
New Revision: 685650

URL: http://svn.apache.org/viewvc?rev=685650&view=rev
Log:
o Added IT to check for proper class loading in hook scripts

Added:
    maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/pom.xml   
(with props)
    maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/
    maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/pom.xml
   (with props)
    
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/postbuild.bsh
   (with props)
    
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/prebuild.bsh
   (with props)
    
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/pom.xml
   (with props)
    
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/postbuild.groovy
    
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/prebuild.groovy
    
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/test/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/test/java/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/test/java/org/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/test/java/org/MyUtils.java
   (with props)

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/pom.xml?rev=685650&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/pom.xml 
(added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/pom.xml 
Wed Aug 13 12:35:40 2008
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<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/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins.invoker</groupId>
+  <artifactId>script-class-loading</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <description>Test to check for proper class loading in hook scripts (i.e. 
project test class path before plugin class path)</description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <!-- NOTE: Deliberately used very old version to detect accidental 
shadowing by the plugin's newer version -->
+      <version>1.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-invoker-plugin</artifactId>
+        <version>@pom.version@</version>
+        <configuration>
+          <debug>true</debug>
+          <projectsDirectory>src/it</projectsDirectory>
+          <pomIncludes>
+            <pomInclude>*/pom.xml</pomInclude>
+          </pomIncludes>
+          <preBuildHookScript>prebuild</preBuildHookScript>
+          <postBuildHookScript>postbuild</postBuildHookScript>
+          <goals>
+            <goal>validate</goal>
+          </goals>
+          <addTestClassPath>true</addTestClassPath>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/pom.xml?rev=685650&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/pom.xml
 Wed Aug 13 12:35:40 2008
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<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/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>test</groupId>
+  <artifactId>beanshell</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+</project>

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/postbuild.bsh
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/postbuild.bsh?rev=685650&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/postbuild.bsh
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/postbuild.bsh
 Wed Aug 13 12:35:40 2008
@@ -0,0 +1,33 @@
+import java.io.*;
+import java.lang.reflect.*;
+import java.util.*;
+import java.util.regex.*;
+
+import org.codehaus.plexus.util.*;
+
+try
+{
+    System.out.println( "Invoking class from project's test class path" );
+    System.out.println( org.MyUtils.getNothing() );
+
+    System.out.println( "Trying to access method which is unavaible in old 
plexus-utils" );
+    try
+    {
+        System.out.println( FileUtils.class.getMethod( "copyFileIfModified", 
new Class[] { File.class, File.class } ) );
+        System.out.println( "FAILED!" );
+        return false;
+    }
+    catch( NoSuchMethodException e )
+    {
+        // expected
+        e.printStackTrace();
+    }
+      
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
+
+return true;

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/postbuild.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/postbuild.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/prebuild.bsh
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/prebuild.bsh?rev=685650&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/prebuild.bsh
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/prebuild.bsh
 Wed Aug 13 12:35:40 2008
@@ -0,0 +1,33 @@
+import java.io.*;
+import java.lang.reflect.*;
+import java.util.*;
+import java.util.regex.*;
+
+import org.codehaus.plexus.util.*;
+
+try
+{
+    System.out.println( "Invoking class from project's test class path" );
+    System.out.println( org.MyUtils.getNothing() );
+
+    System.out.println( "Trying to access method which is unavaible in old 
plexus-utils" );
+    try
+    {
+        System.out.println( FileUtils.class.getMethod( "copyFileIfModified", 
new Class[] { File.class, File.class } ) );
+        System.out.println( "FAILED!" );
+        return false;
+    }
+    catch( NoSuchMethodException e )
+    {
+        // expected
+        e.printStackTrace();
+    }
+      
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
+
+return true;

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/prebuild.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/beanshell/prebuild.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/pom.xml?rev=685650&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/pom.xml
 Wed Aug 13 12:35:40 2008
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<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/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>test</groupId>
+  <artifactId>groovy</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+</project>

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/postbuild.groovy
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/postbuild.groovy?rev=685650&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/postbuild.groovy
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/postbuild.groovy
 Wed Aug 13 12:35:40 2008
@@ -0,0 +1,34 @@
+import java.io.*
+import java.lang.reflect.*
+import java.util.*
+import java.util.regex.*
+
+import org.codehaus.plexus.util.*
+
+try
+{
+    println "Invoking class from project's test class path"
+    println org.MyUtils.getNothing()
+
+    println "Trying to access method which is unavaible in old plexus-utils"
+    try
+    {
+        Class[] types = [ File.class, File.class ];
+        println FileUtils.class.getMethod( "copyFileIfModified", types )
+        println "FAILED!"
+        return false
+    }
+    catch( NoSuchMethodException e )
+    {
+        // expected
+        e.printStackTrace()
+    }
+      
+}
+catch( Throwable t )
+{
+    t.printStackTrace()
+    return false
+}
+
+return true

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/prebuild.groovy
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/prebuild.groovy?rev=685650&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/prebuild.groovy
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/it/groovy/prebuild.groovy
 Wed Aug 13 12:35:40 2008
@@ -0,0 +1,34 @@
+import java.io.*
+import java.lang.reflect.*
+import java.util.*
+import java.util.regex.*
+
+import org.codehaus.plexus.util.*
+
+try
+{
+    println "Invoking class from project's test class path"
+    println org.MyUtils.getNothing()
+
+    println "Trying to access method which is unavaible in old plexus-utils"
+    try
+    {
+        Class[] types = [ File.class, File.class ];
+        println FileUtils.class.getMethod( "copyFileIfModified", types )
+        println "FAILED!"
+        return false
+    }
+    catch( NoSuchMethodException e )
+    {
+        // expected
+        e.printStackTrace()
+    }
+      
+}
+catch( Throwable t )
+{
+    t.printStackTrace()
+    return false
+}
+
+return true

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/test/java/org/MyUtils.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/test/java/org/MyUtils.java?rev=685650&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/test/java/org/MyUtils.java
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/test/java/org/MyUtils.java
 Wed Aug 13 12:35:40 2008
@@ -0,0 +1,11 @@
+package org;
+
+public class MyUtils
+{
+
+    public static String getNothing()
+    {
+        return "nothing";
+    }
+
+}

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/test/java/org/MyUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/src/test/java/org/MyUtils.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision


Reply via email to