Merge pull request #14 from apache/stub

remove deprecation warnings by not stubbing value class
diff --git a/src/test/java/org/apache/maven/plugins/ejb/stub/ArtifactStub.java b/src/test/java/org/apache/maven/plugins/ejb/stub/ArtifactStub.java
deleted file mode 100644
index 32e0755..0000000
--- a/src/test/java/org/apache/maven/plugins/ejb/stub/ArtifactStub.java
+++ /dev/null
@@ -1,335 +0,0 @@
-package org.apache.maven.plugins.ejb.stub;
-
-/*
- * 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.File;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.handler.DefaultArtifactHandler;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.artifact.versioning.ArtifactVersion;
-import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
-import org.apache.maven.artifact.versioning.VersionRange;
-
-/**
- * Stub
- */
-public class ArtifactStub
-    implements Artifact
-{
-
-    boolean hasClassifier;
-
-    boolean resolved;
-
-    boolean optional;
-
-    boolean release;
-
-    ArtifactHandler artifactHandler;
-
-    File file;
-
-    String baseVersion;
-
-    String type;
-
-    String classifier;
-
-    String identifier;
-
-    String dependencyConflictId;
-
-    String downloadUrl;
-
-    String selectedVersion;
-
-    String artifactId;
-
-    String groupId;
-
-    String resolvedVersion;
-
-    String scope;
-
-    String version;
-
-    VersionRange versionRange;
-
-    public ArtifactStub()
-    {
-        type = "testtype";
-        scope = "testscope";
-        classifier = "testclassifier";
-        artifactHandler = new DefaultArtifactHandler();
-    }
-
-    public void populate( MavenProjectBasicStub project )
-    {
-        groupId = project.getGroupId();
-        artifactId = project.getArtifactId();
-        version = project.getVersion();
-        versionRange = VersionRange.createFromVersion( version );
-    }
-
-    public boolean hasClassifier()
-    {
-        return true;
-    }
-
-    public String getBaseVersion()
-    {
-        return "Test Version";
-    }
-
-    public void setBaseVersion( String version )
-    {
-        baseVersion = version;
-    }
-
-    public void setFile( File _file )
-    {
-        file = _file;
-    }
-
-    public File getFile()
-    {
-        return new File( "testfile" );
-    }
-
-    public String getGroupId()
-    {
-        return groupId;
-    }
-
-    public String getArtifactId()
-    {
-        return artifactId;
-    }
-
-    public String getVersion()
-    {
-        return version;
-    }
-
-    public void setVersion( String _version )
-    {
-        version = _version;
-    }
-
-    public String getScope()
-    {
-        return scope;
-    }
-
-    public String getType()
-    {
-        return type;
-    }
-
-    public String getClassifier()
-    {
-        return classifier;
-    }
-
-    public String getId()
-    {
-        return identifier;
-    }
-
-    public String getDependencyConflictId()
-    {
-        return dependencyConflictId;
-    }
-
-    public void addMetadata( ArtifactMetadata metadata )
-    {
-        // intentionally empty
-    }
-
-    public List<ArtifactMetadata> getMetadataList()
-    {
-        return new LinkedList<ArtifactMetadata>();
-    }
-
-    public void setRepository( ArtifactRepository remoteRepository )
-    {
-        // intentionally empty
-    }
-
-    public ArtifactRepository getRepository()
-    {
-        return null;
-    }
-
-    public void updateVersion( String version, ArtifactRepository localRepository )
-    {
-        //Intentionally empty.
-    }
-
-    public String getDownloadUrl()
-    {
-        return downloadUrl;
-    }
-
-    public void setDownloadUrl( String _downloadUrl )
-    {
-        downloadUrl = _downloadUrl;
-    }
-
-    public ArtifactFilter getDependencyFilter()
-    {
-        return null;
-    }
-
-    public void setDependencyFilter( ArtifactFilter artifactFilter )
-    {
-        //Intentionally empty.
-    }
-
-    public ArtifactHandler getArtifactHandler()
-    {
-        return artifactHandler;
-    }
-
-    public List<String> getDependencyTrail()
-    {
-        return new LinkedList<String>();
-    }
-
-    public void setDependencyTrail( List<String> dependencyTrail )
-    {
-        //Intentionally empty.
-    }
-
-    public void setScope( String _scope )
-    {
-        scope = _scope;
-    }
-
-    public VersionRange getVersionRange()
-    {
-        return versionRange;
-    }
-
-    public void setVersionRange( VersionRange newRange )
-    {
-        //Intentionally empty.
-    }
-
-    public void selectVersion( String version )
-    {
-        selectedVersion = version;
-    }
-
-    public void setGroupId( String _groupId )
-    {
-        groupId = _groupId;
-    }
-
-    public void setArtifactId( String _artifactId )
-    {
-        artifactId = _artifactId;
-    }
-
-    public boolean isSnapshot()
-    {
-        return true;
-    }
-
-    public void setResolved( boolean _resolved )
-    {
-        resolved = _resolved;
-    }
-
-    public boolean isResolved()
-    {
-        return true;
-    }
-
-    public void setResolvedVersion( String version )
-    {
-        resolvedVersion = version;
-    }
-
-    public void setArtifactHandler( ArtifactHandler handler )
-    {
-        //Intentionally empty.
-    }
-
-    public boolean isRelease()
-    {
-        return true;
-    }
-
-    public void setRelease( boolean _release )
-    {
-        release = _release;
-    }
-
-    public List<ArtifactVersion>  getAvailableVersions()
-    {
-        return new LinkedList<ArtifactVersion>();
-    }
-
-    public void setAvailableVersions( List<ArtifactVersion> versions )
-    {
-        //Intentionally empty.
-    }
-
-    public boolean isOptional()
-    {
-        return true;
-    }
-
-    public void setOptional( boolean _optional )
-    {
-        optional = _optional;
-    }
-
-    public ArtifactVersion getSelectedVersion()
-        throws OverConstrainedVersionException
-    {
-        return null;
-    }
-
-    public boolean isSelectedVersionKnown()
-        throws OverConstrainedVersionException
-    {
-        return true;
-    }
-
-    public int compareTo( Artifact o )
-    {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
-    public ArtifactMetadata getMetadata( Class<?> arg0 )
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-}
diff --git a/src/test/java/org/apache/maven/plugins/ejb/stub/MavenProjectBasicStub.java b/src/test/java/org/apache/maven/plugins/ejb/stub/MavenProjectBasicStub.java
index 4218b67..6383026 100644
--- a/src/test/java/org/apache/maven/plugins/ejb/stub/MavenProjectBasicStub.java
+++ b/src/test/java/org/apache/maven/plugins/ejb/stub/MavenProjectBasicStub.java
@@ -24,6 +24,7 @@
 import java.util.Properties;
 
 import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Profile;
@@ -49,7 +50,7 @@
 
     protected File file;
 
-    protected ArtifactStub artifact;
+    protected DefaultArtifact artifact;
 
     public MavenProjectBasicStub( String id )
         throws Exception
@@ -59,9 +60,10 @@
 
         model = (ModelStub) super.getModel();
         properties = new Properties();
-        artifact = new ArtifactStub();
         identifier = id;
 
+        artifact = new DefaultArtifact(getGroupId(), getArtifactId(), getVersion(), "compile", "jar", "", null);
+
         // set isolated root directory
         testRootDir = PlexusTestCase.getBasedir() + "/target/test-classes/unit/test-dir/" + identifier;
 
@@ -70,8 +72,6 @@
             FileUtils.mkdir( testRootDir );
         }
 
-        artifact.populate( this );
-
         // this is ugly but needed to ensure that the copy constructor
         // works correctly
         initializeParentFields();