maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject svn commit: r453978 - in /maven/plugins/trunk/maven-dependency-plugin: ./ src/main/java/org/apache/maven/plugin/dependency/utils/ src/test/java/org/apache/maven/plugin/dependency/stubs/ src/test/java/org/apache/maven/plugin/dependency/utils/ src/test/j...
Date Sat, 07 Oct 2006 18:17:12 GMT
Author: brianf
Date: Sat Oct  7 11:17:10 2006
New Revision: 453978

URL: http://svn.apache.org/viewvc?view=rev&rev=453978
Log:
more tests

Added:
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/stubs/StubDefaultFileMarkerHandler.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/stubs/StubMarkerFile.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/stubs/StubSourcesFileMarkerHandler.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyStatusSets.java
Modified:
    maven/plugins/trunk/maven-dependency-plugin/pom.xml
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyStatusSets.java
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/DependencyTestUtils.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/markers/TestDefaultMarkerFileHandler.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/markers/TestSourcesMarkerFileHandler.java

Modified: maven/plugins/trunk/maven-dependency-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/pom.xml?view=diff&rev=453978&r1=453977&r2=453978
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-dependency-plugin/pom.xml Sat Oct  7 11:17:10 2006
@@ -109,12 +109,25 @@
     </licenses>
     <build>
         <plugins>
+            <!--
             <plugin>
                 <artifactId>maven-javadoc-plugin</artifactId>
                 <configuration>
                     <source>1.4</source>
                     <destDir>${project.build.directory}/site/javadoc</destDir>
                 </configuration>
+            </plugin>-->
+            <plugin>
+              <groupId>org.codehaus.mojo</groupId>
+              <artifactId>cobertura-maven-plugin</artifactId>
+              <executions>
+                <execution>
+                    <phase>clean</phase>
+                  <goals>
+                    <goal>clean</goal>
+                  </goals>
+                </execution>
+              </executions>
             </plugin>
         </plugins>
     </build>
@@ -138,7 +151,7 @@
             <groupId>org.apache.maven.shared</groupId>
             <artifactId>maven-plugin-testing-harness</artifactId>
             <scope>test</scope>
-            <version>1.0-beta-2-SNAPSHOT</version>
+            <version>1.0-beta-1</version>
         </dependency>
         <dependency>
             <groupId>org.codehaus.plexus</groupId>

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyStatusSets.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyStatusSets.java?view=diff&rev=453978&r1=453977&r2=453978
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyStatusSets.java
(original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyStatusSets.java
Sat Oct  7 11:17:10 2006
@@ -25,6 +25,7 @@
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.CollectionUtils;
 
 /**
  * @author brianf
@@ -106,7 +107,7 @@
     {
         log.info( "" );
         log.info( "The following files have been resolved: " );
-        if ( this.resolvedDependencies.isEmpty() )
+        if ( this.resolvedDependencies == null || this.resolvedDependencies.isEmpty() )
         {
             log.info( "   none" );
         }
@@ -122,7 +123,7 @@
                 {
                     try
                     {
-                        artifact.getFile().getAbsoluteFile();
+                        artifactFilename = artifact.getFile().getAbsoluteFile().getName();
                     }
                     catch ( NullPointerException e )
                     {

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java?view=diff&rev=453978&r1=453977&r2=453978
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java
(original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java
Sat Oct  7 11:17:10 2006
@@ -256,61 +256,7 @@
 
     }
 
-    /**
-     * Log the results
-     * 
-     * @param resolvedArtifacts
-     *            set of artifacts that where resolved.
-     * @param missingArtifacts
-     *            set of artifacts that where not resolved.
-     * @param existingArtifacts
-     *            set of artifacts that already existed.
-     */
-    private static void logResults( Set resolvedArtifacts, Set missingArtifacts, HashSet
existingArtifacts,
-                                   boolean silent, Log log )
-    {
-        if ( !silent )
-        {
-            log.info( "" );
-            log.info( "The following files have been resolved: " );
-            if ( resolvedArtifacts.isEmpty() )
-            {
-                log.info( "   none" );
-            }
-            else
-            {
-                for ( Iterator i = resolvedArtifacts.iterator(); i.hasNext(); )
-                {
-                    log.info( "   " + ( (Artifact) i.next() ).getId() );
-                }
-            }
-
-            if ( existingArtifacts != null && !existingArtifacts.isEmpty() )
-            {
-                log.info( "" );
-                log.info( "The following files where skipped: " );
-                for ( Iterator i = existingArtifacts.iterator(); i.hasNext(); )
-                {
-                    log.info( "   " + ( (Artifact) i.next() ).getId() );
-                }
-            }
-            log.info( "" );
-            log.info( "The following files have NOT been resolved: " );
-            if ( missingArtifacts.isEmpty() )
-            {
-                log.info( "   none" );
-            }
-            else
-            {
-                for ( Iterator i = missingArtifacts.iterator(); i.hasNext(); )
-                {
-                    log.info( "   " + ( (Artifact) i.next() ).getId() );
-                }
-            }
-            log.info( "" );
-        }
-    }
-
+   
     /**
      * This method resolves the plugin artifacts from the project.
      * 

Added: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/stubs/StubDefaultFileMarkerHandler.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/stubs/StubDefaultFileMarkerHandler.java?view=auto&rev=453978
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/stubs/StubDefaultFileMarkerHandler.java
(added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/stubs/StubDefaultFileMarkerHandler.java
Sat Oct  7 11:17:10 2006
@@ -0,0 +1,21 @@
+package org.apache.maven.plugin.dependency.stubs;
+
+import java.io.File;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.dependency.utils.markers.DefaultFileMarkerHandler;
+
+public class StubDefaultFileMarkerHandler
+extends DefaultFileMarkerHandler
+{
+
+    public StubDefaultFileMarkerHandler( Artifact artifact, File markerFilesDirectory )
+    { 
+        super(artifact,markerFilesDirectory);
+        // TODO Auto-generated constructor stub
+    }
+    
+    protected File getMarkerFile()
+    {
+        return new StubMarkerFile( this.markerFilesDirectory, this.artifact.getId().replace(
':', '-' ) + ".marker" );
+    }}

Added: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/stubs/StubMarkerFile.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/stubs/StubMarkerFile.java?view=auto&rev=453978
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/stubs/StubMarkerFile.java
(added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/stubs/StubMarkerFile.java
Sat Oct  7 11:17:10 2006
@@ -0,0 +1,45 @@
+package org.apache.maven.plugin.dependency.stubs;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+
+public class StubMarkerFile
+    extends File
+{
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 1L;
+
+    public StubMarkerFile( String pathname )
+    {
+        super( pathname );
+        // TODO Auto-generated constructor stub
+    }
+
+    public StubMarkerFile( URI uri )
+    {
+        super( uri );
+        // TODO Auto-generated constructor stub
+    }
+
+    public StubMarkerFile( File parent, String child )
+    {
+        super( parent, child );
+        // TODO Auto-generated constructor stub
+    }
+
+    public StubMarkerFile( String parent, String child )
+    {
+        super( parent, child );
+        // TODO Auto-generated constructor stub
+    }
+
+    public boolean createNewFile()
+        throws IOException
+    {
+        throw new IOException( "Intended Error" );
+    }
+}

Added: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/stubs/StubSourcesFileMarkerHandler.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/stubs/StubSourcesFileMarkerHandler.java?view=auto&rev=453978
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/stubs/StubSourcesFileMarkerHandler.java
(added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/stubs/StubSourcesFileMarkerHandler.java
Sat Oct  7 11:17:10 2006
@@ -0,0 +1,36 @@
+package org.apache.maven.plugin.dependency.stubs;
+
+import java.io.File;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.dependency.utils.markers.SourcesFileMarkerHandler;
+
+
+public class StubSourcesFileMarkerHandler
+extends SourcesFileMarkerHandler
+{
+
+    public StubSourcesFileMarkerHandler( Artifact artifact, File markerFilesDirectory, boolean
resolved )
+    {
+        super( artifact, markerFilesDirectory, resolved );
+        // TODO Auto-generated constructor stub
+    }
+
+    protected File getMarkerFile( boolean res )
+    {
+        String suffix;
+        if ( res )
+        {
+            suffix = ".resolved";
+        }
+        else
+        {
+            suffix = ".unresolved";
+        }
+
+        return new StubMarkerFile( this.markerFilesDirectory, this.artifact.getId().replace(
':', '-' ) + suffix );
+    }
+
+
+
+}

Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/DependencyTestUtils.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/DependencyTestUtils.java?view=diff&rev=453978&r1=453977&r2=453978
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/DependencyTestUtils.java
(original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/DependencyTestUtils.java
Sat Oct  7 11:17:10 2006
@@ -5,14 +5,10 @@
 import java.lang.reflect.Field;
 import java.util.HashMap;
 
-import org.apache.maven.artifact.DefaultArtifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.factory.DefaultArtifactFactory;
 import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
 import org.apache.maven.artifact.handler.manager.DefaultArtifactHandlerManager;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
-import org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory;
-import org.apache.maven.artifact.resolver.DefaultArtifactResolver;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.shared.model.fileset.FileSet;
 import org.apache.maven.shared.model.fileset.util.FileSetManager;

Added: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyStatusSets.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyStatusSets.java?view=auto&rev=453978
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyStatusSets.java
(added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyStatusSets.java
Sat Oct  7 11:17:10 2006
@@ -0,0 +1,115 @@
+package org.apache.maven.plugin.dependency.utils;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.maven.monitor.logging.DefaultLog;
+import org.apache.maven.plugin.dependency.AbstractDependencyMojoTestCase;
+import org.apache.maven.plugin.logging.Log;
+
+public class TestDependencyStatusSets
+    extends AbstractDependencyMojoTestCase
+{
+
+    protected void setUp()
+        throws Exception
+    {
+        // required for mojo lookups to work
+        super.setUp( "dss", true );
+    }
+
+    public void testDependencyStatusSettersGetters()
+    {
+        DependencyStatusSets dss = new DependencyStatusSets();
+
+        Set set = new HashSet();
+
+        dss.setResolvedDependencies( set );
+        assertSame( set, dss.getResolvedDependencies() );
+
+        set = new HashSet();
+
+        dss.setUnResolvedDependencies( set );
+        assertSame( set, dss.getUnResolvedDependencies() );
+
+        set = new HashSet();
+
+        dss.setSkippedDependencies( set );
+        assertSame( set, dss.getSkippedDependencies() );
+
+        assertNotSame( dss.getResolvedDependencies(), dss.getSkippedDependencies() );
+        assertNotSame( dss.getResolvedDependencies(), dss.getUnResolvedDependencies() );
+        assertNotSame( dss.getSkippedDependencies(), dss.getUnResolvedDependencies() );
+    }
+
+    public void testDependencyStatusConstructor()
+    {
+        Set r = new HashSet();
+        Set u = new HashSet();
+        Set s = new HashSet();
+
+        DependencyStatusSets dss = new DependencyStatusSets( r, u, s );
+
+        assertSame( r, dss.getResolvedDependencies() );
+        assertSame( u, dss.getUnResolvedDependencies() );
+        assertSame( s, dss.getSkippedDependencies() );
+    }
+
+    public void testDependencyStatusLog()
+    {
+        Set artifacts = this.stubFactory.getMixedArtifacts();
+        doTestDependencyStatusLog( artifacts );
+    }
+
+    public void testDependencyStatusLogNullFiles()
+    {
+        this.stubFactory.createFiles = false;
+        Set artifacts = this.stubFactory.getMixedArtifacts();
+        doTestDependencyStatusLog( artifacts );
+    }
+    
+    public void testDependencyStatusEmptySet()
+    {
+        doTestDependencyStatusLog( new HashSet() );
+    }
+
+    public void doTestDependencyStatusLog( Set artifacts )
+    {
+        // TODO: implement logger to check correct output
+        // this test is just looking for unexpected exceptions.
+        Log log = new SilentLog();
+
+        DependencyStatusSets dss = new DependencyStatusSets();
+        dss.logStatus( log, false );
+        dss.logStatus( log, true );
+
+        dss = new DependencyStatusSets( artifacts, null, null );
+        dss.logStatus( log, false );
+        dss.logStatus( log, true );
+
+        dss = new DependencyStatusSets( null, artifacts, null );
+        dss.logStatus( log, false );
+        dss.logStatus( log, true );
+
+        dss = new DependencyStatusSets( null, null, artifacts );
+        dss.logStatus( log, false );
+        dss.logStatus( log, true );
+
+        dss = new DependencyStatusSets( artifacts, artifacts, null );
+        dss.logStatus( log, false );
+        dss.logStatus( log, true );
+
+        dss = new DependencyStatusSets( null, artifacts, artifacts );
+        dss.logStatus( log, false );
+        dss.logStatus( log, true );
+
+        dss = new DependencyStatusSets( artifacts, null, artifacts );
+        dss.logStatus( log, false );
+        dss.logStatus( log, true );
+
+        dss = new DependencyStatusSets( artifacts, artifacts, artifacts );
+        dss.logStatus( log, false );
+        dss.logStatus( log, true );
+
+    }
+}

Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/markers/TestDefaultMarkerFileHandler.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/markers/TestDefaultMarkerFileHandler.java?view=diff&rev=453978&r1=453977&r2=453978
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/markers/TestDefaultMarkerFileHandler.java
(original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/markers/TestDefaultMarkerFileHandler.java
Sat Oct  7 11:17:10 2006
@@ -22,7 +22,6 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Random;
 
 import junit.framework.TestCase;
 
@@ -31,8 +30,8 @@
 import org.apache.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.artifact.handler.DefaultArtifactHandler;
 import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.model.Dependency;
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.dependency.stubs.StubDefaultFileMarkerHandler;
 import org.apache.maven.plugin.dependency.utils.DependencyTestUtils;
 import org.apache.maven.plugin.dependency.utils.SilentLog;
 import org.apache.maven.plugin.logging.Log;
@@ -123,32 +122,6 @@
         assertFalse( handle.exists() );
     }
 
-    /*
-    public void testMarkerFileException()
-        throws IOException, MojoExecutionException
-    {
-        DefaultFileMarkerHandler handler = new DefaultFileMarkerHandler( (Artifact) artifacts.get(
0 ),
-                                                                         this.outputFolder
);
-
-        File handle = handler.getMarkerFile();
-        assertFalse( handle.exists() );
-        assertFalse( handler.isMarkerSet() );
-
-        handle.getParentFile().mkdirs();
-        handle.getParentFile().setReadOnly();
-        handle.
-        
-        try
-        {
-            handler.setMarker();
-            fail( "Expected an Exception" );
-        }
-        catch ( MojoExecutionException e )
-        {
-
-        }
-    }
-*/
     public void testMarkerTimeStamp()
         throws MojoExecutionException, IOException, InterruptedException
     {
@@ -171,5 +144,21 @@
         theFile.delete();
         handler.clearMarker();
         assertFalse( handler.isMarkerSet() );
+    }
+
+    public void testMarkerFileException()
+    {
+        // this stub wraps the file with an object to throw exceptions
+        StubDefaultFileMarkerHandler handler = new StubDefaultFileMarkerHandler( (Artifact)
artifacts.get( 0 ),
+                                                                                 this.outputFolder
);
+        try
+        {
+            handler.setMarker();
+            fail( "Expected an Exception here" );
+        }
+        catch ( MojoExecutionException e )
+        {
+
+        }
     }
 }

Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/markers/TestSourcesMarkerFileHandler.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/markers/TestSourcesMarkerFileHandler.java?view=diff&rev=453978&r1=453977&r2=453978
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/markers/TestSourcesMarkerFileHandler.java
(original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/markers/TestSourcesMarkerFileHandler.java
Sat Oct  7 11:17:10 2006
@@ -32,6 +32,8 @@
 import org.apache.maven.artifact.handler.DefaultArtifactHandler;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.dependency.stubs.StubDefaultFileMarkerHandler;
+import org.apache.maven.plugin.dependency.stubs.StubSourcesFileMarkerHandler;
 import org.apache.maven.plugin.dependency.utils.SilentLog;
 import org.apache.maven.plugin.logging.Log;
 
@@ -216,20 +218,46 @@
         theFile.createNewFile();
         Artifact theArtifact = (Artifact) artifacts.get( 0 );
         theArtifact.setFile( theFile );
-        SourcesFileMarkerHandler handler = new SourcesFileMarkerHandler( (Artifact) artifacts.get(
0 ),
+        SourcesFileMarkerHandler resolvedHandler = new SourcesFileMarkerHandler( (Artifact)
artifacts.get( 0 ),
                                                                          this.outputFolder,
resolved );
-        assertFalse( handler.isMarkerSet() );
+        SourcesFileMarkerHandler unResolvedHandler = new SourcesFileMarkerHandler( (Artifact)
artifacts.get( 0 ),
+                                                                                 this.outputFolder,
!resolved );
+             
+        assertFalse( resolvedHandler.isMarkerSet() );
+        assertFalse( unResolvedHandler.isMarkerSet() );
         // if the marker is not set, assume it is infinately older than the
         // artifact.
-        assertTrue( handler.isMarkerOlder( theArtifact ) );
-        handler.setMarker();
-        assertFalse( handler.isMarkerOlder( theArtifact ) );
-
+        assertTrue( resolvedHandler.isMarkerOlder( theArtifact ) );
+        assertTrue( unResolvedHandler.isMarkerOlder( theArtifact ) );
+        resolvedHandler.setMarker();
+        assertFalse( resolvedHandler.isMarkerOlder( theArtifact ) );
+        assertFalse( unResolvedHandler.isMarkerOlder( theArtifact ) );
+
+        resolvedHandler.clearMarker();
+        unResolvedHandler.setMarker();
+        assertFalse( resolvedHandler.isMarkerOlder( theArtifact ) );
+        assertFalse( unResolvedHandler.isMarkerOlder( theArtifact ) );
+        
         theFile.setLastModified( theFile.lastModified() + 222 );
-        assertTrue( handler.isMarkerOlder( theArtifact ) );
+        assertTrue( resolvedHandler.isMarkerOlder( theArtifact ) );
+        assertTrue( unResolvedHandler.isMarkerOlder( theArtifact ) );
 
         theFile.delete();
-        handler.clearMarker();
-        assertFalse( handler.isMarkerSet() );
+        resolvedHandler.clearMarker();
+        assertFalse( resolvedHandler.isMarkerSet() );
+    }
+    public void testMarkerFileException()
+    {
+        // this stub wraps the file with an object to throw exceptions
+        StubSourcesFileMarkerHandler handler = new StubSourcesFileMarkerHandler( (Artifact)
artifacts.get( 0 ),
+                                                                                 this.outputFolder,
true );
+        try
+        {
+            handler.setMarker();
+            fail( "Expected an Exception here" );
+        }
+        catch ( MojoExecutionException e )
+        {
+        }
     }
 }



Mime
View raw message