Author: carlos
Date: Mon Feb  5 16:51:46 2007
New Revision: 503941

URL: http://svn.apache.org/viewvc?view=rev&rev=503941
Log:
Implement stub methods and add toString

Modified:
    
maven/shared/trunk/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/ArtifactStub.java

Modified: 
maven/shared/trunk/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/ArtifactStub.java
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/ArtifactStub.java?view=diff&rev=503941&r1=503940&r2=503941
==============================================================================
--- 
maven/shared/trunk/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/ArtifactStub.java
 (original)
+++ 
maven/shared/trunk/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/ArtifactStub.java
 Mon Feb  5 16:51:46 2007
@@ -34,13 +34,28 @@
 
 /**
  * Stub class for [EMAIL PROTECTED] Artifact} testing.
- *
+ * 
  * @author jesse
  * @version $Id$
  */
-public class ArtifactStub implements Artifact
+public class ArtifactStub
+    implements Artifact
 {
 
+    private String groupId;
+
+    private String artifactId;
+
+    private String version;
+
+    private String scope;
+
+    private String type;
+
+    private String classifier;
+
+    private File file;
+
     public int compareTo( Object object )
     {
         return 0;
@@ -48,51 +63,57 @@
 
     public String getGroupId()
     {
-        return null;
+        return groupId;
     }
 
     public String getArtifactId()
     {
-        return null;
+        return artifactId;
     }
 
     public String getVersion()
     {
-        return null;
+        return version;
     }
 
-    public void setVersion( String string )
+    public void setVersion( String version )
     {
+        this.version = version;
     }
 
     public String getScope()
     {
-        return null;
+        return scope;
     }
 
     public String getType()
     {
-        return null;
+        return type;
+    }
+
+    public void setType( String type )
+    {
+        this.type = type;
     }
 
     public String getClassifier()
     {
-        return null;
+        return classifier;
     }
 
     public boolean hasClassifier()
     {
-        return false;
+        return classifier != null;
     }
 
     public File getFile()
     {
-        return null;
+        return file;
     }
 
     public void setFile( File file )
     {
-
+        this.file = file;
     }
 
     public String getBaseVersion()
@@ -168,8 +189,9 @@
     {
     }
 
-    public void setScope( String string )
+    public void setScope( String scope )
     {
+        this.scope = scope;
     }
 
     public VersionRange getVersionRange()
@@ -185,12 +207,14 @@
     {
     }
 
-    public void setGroupId( String string )
+    public void setGroupId( String groupId )
     {
+        this.groupId = groupId;
     }
 
-    public void setArtifactId( String string )
+    public void setArtifactId( String artifactId )
     {
+        this.artifactId = artifactId;
     }
 
     public boolean isSnapshot()
@@ -252,6 +276,40 @@
         throws OverConstrainedVersionException
     {
         return false;
+    }
+
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+        if ( getGroupId() != null )
+        {
+            sb.append( getGroupId() );
+            sb.append( ":" );
+        }
+        appendArtifactTypeClassifierString( sb );
+        if ( version != null )
+        {
+            sb.append( ":" );
+            sb.append( getVersion() );
+        }
+        if ( scope != null )
+        {
+            sb.append( ":" );
+            sb.append( scope );
+        }
+        return sb.toString();
+    }
+
+    private void appendArtifactTypeClassifierString( StringBuffer sb )
+    {
+        sb.append( getArtifactId() );
+        sb.append( ":" );
+        sb.append( getType() );
+        if ( hasClassifier() )
+        {
+            sb.append( ":" );
+            sb.append( getClassifier() );
+        }
     }
 
 }


Reply via email to