maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r390336 - in /maven/scm/trunk/maven-scm-test/src/main/java/org/apache/maven/scm/provider: ScmProviderRepositoryStub.java ScmProviderStub.java
Date Fri, 31 Mar 2006 05:54:18 GMT
Author: carlos
Date: Thu Mar 30 21:54:16 2006
New Revision: 390336

URL: http://svn.apache.org/viewcvs?rev=390336&view=rev
Log:
Completed stub implementations

Modified:
    maven/scm/trunk/maven-scm-test/src/main/java/org/apache/maven/scm/provider/ScmProviderRepositoryStub.java
    maven/scm/trunk/maven-scm-test/src/main/java/org/apache/maven/scm/provider/ScmProviderStub.java

Modified: maven/scm/trunk/maven-scm-test/src/main/java/org/apache/maven/scm/provider/ScmProviderRepositoryStub.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-test/src/main/java/org/apache/maven/scm/provider/ScmProviderRepositoryStub.java?rev=390336&r1=390335&r2=390336&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-test/src/main/java/org/apache/maven/scm/provider/ScmProviderRepositoryStub.java
(original)
+++ maven/scm/trunk/maven-scm-test/src/main/java/org/apache/maven/scm/provider/ScmProviderRepositoryStub.java
Thu Mar 30 21:54:16 2006
@@ -1,7 +1,5 @@
 package org.apache.maven.scm.provider;
 
-import org.apache.maven.scm.provider.ScmProviderRepository;
-
 /*
  * Copyright 2001-2006 The Apache Software Foundation.
  *
@@ -19,7 +17,8 @@
  */
 
 /**
- * Stub for ScmProviderRepository
+ * Stub for ScmProviderRepository for unit testing purposes.
+ * More information about Stubs on <a href="http://martinfowler.com/bliki/TestDouble.html">Martin
Fowler's TestDouble</a>
  * 
  * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
  * @version $Id$
@@ -27,5 +26,24 @@
 public class ScmProviderRepositoryStub
     extends ScmProviderRepository
 {
+
+    private boolean persistCheckout = false;
+
+    /**
+     * Creates a ScmProviderRepositoryStub with null user and password, and persistCheckout
false
+     */
+    public ScmProviderRepositoryStub()
+    {
+    }
+
+    public boolean isPersistCheckout()
+    {
+        return persistCheckout;
+    }
+
+    public void setPersistCheckout( boolean persistCheckout )
+    {
+        this.persistCheckout = persistCheckout;
+    }
 
 }

Modified: maven/scm/trunk/maven-scm-test/src/main/java/org/apache/maven/scm/provider/ScmProviderStub.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-test/src/main/java/org/apache/maven/scm/provider/ScmProviderStub.java?rev=390336&r1=390335&r2=390336&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-test/src/main/java/org/apache/maven/scm/provider/ScmProviderStub.java
(original)
+++ maven/scm/trunk/maven-scm-test/src/main/java/org/apache/maven/scm/provider/ScmProviderStub.java
Thu Mar 30 21:54:16 2006
@@ -18,6 +18,7 @@
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 
@@ -40,9 +41,9 @@
 import org.apache.maven.scm.repository.UnknownRepositoryStructure;
 
 /**
- * Stub for ScmProvider
+ * Stub implementation of ScmProvider for unit testing purposes. It allows setting the expected
results that the different methods will return.
+ * More information about Stubs on <a href="http://martinfowler.com/bliki/TestDouble.html">Martin
Fowler's TestDouble</a>
  * 
- * @TODO make stub methods return objects provided by user instead of null
  * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
  * @version $Id$
  */
@@ -50,21 +51,67 @@
     implements ScmProvider
 {
 
-    private String scmType;
+    private String scmType, scmSpecificFilename;
 
     private List loggers = new ArrayList();
-    
+
     private boolean requiresEditmode;
 
     private ScmProviderRepository scmProviderRepository = new ScmProviderRepositoryStub();
-    
+
     private List errors = new ArrayList();
 
+    private AddScmResult addScmResult;
+
+    private CheckInScmResult checkInScmResult;
+
+    private CheckOutScmResult checkOutScmResult;
+
+    private ChangeLogScmResult changeLogScmResult;
+
+    private DiffScmResult diffScmResult;
+
+    private RemoveScmResult removeScmResult;
+
+    private StatusScmResult statusScmResult;
+
+    private TagScmResult tagScmResult;
+
+    private UpdateScmResult updateScmResult;
+
+    private EditScmResult editScmResult;
+
+    private UnEditScmResult unEditScmResult;
+
+    /**
+     * Create a new ScmProviderStub with bogus (not null) attributes
+     */
+    public ScmProviderStub()
+    {
+        setScmSpecificFilename( "" );
+        setAddScmResult( new AddScmResult( "", Collections.EMPTY_LIST ) );
+        setChangeLogScmResult( new ChangeLogScmResult( "", "", "", true ) );
+        setCheckInScmResult( new CheckInScmResult( "", "", "", true ) );
+        setCheckOutScmResult( new CheckOutScmResult( "", "", "", true ) );
+        setDiffScmResult( new DiffScmResult( "", "", "", true ) );
+        setEditScmResult( new EditScmResult( "", "", "", true ) );
+        setRemoveScmResult( new RemoveScmResult( "", "", "", true ) );
+        setStatusScmResult( new StatusScmResult( "", "", "", true ) );
+        setTagScmResult( new TagScmResult( "", "", "", true ) );
+        setUnEditScmResult( new UnEditScmResult( "", "", "", true ) );
+        setUpdateScmResult( new UpdateScmResult( "", "", "", true ) );
+    }
+
     public String getScmType()
     {
         return scmType;
     }
 
+    public void setScmSpecificFilename( String scmSpecificFilename )
+    {
+        this.scmSpecificFilename = scmSpecificFilename;
+    }
+
     public void addListener( ScmLogger logger )
     {
         loggers.add( logger );
@@ -75,6 +122,116 @@
         return requiresEditmode;
     }
 
+    public void setAddScmResult( AddScmResult addScmResult )
+    {
+        this.addScmResult = addScmResult;
+    }
+
+    public AddScmResult getAddScmResult()
+    {
+        return addScmResult;
+    }
+
+    public void setCheckInScmResult( CheckInScmResult checkInScmResult )
+    {
+        this.checkInScmResult = checkInScmResult;
+    }
+
+    public CheckInScmResult getCheckInScmResult()
+    {
+        return checkInScmResult;
+    }
+
+    public void setCheckOutScmResult( CheckOutScmResult checkOutScmResult )
+    {
+        this.checkOutScmResult = checkOutScmResult;
+    }
+
+    public CheckOutScmResult getCheckOutScmResult()
+    {
+        return checkOutScmResult;
+    }
+
+    public void setChangeLogScmResult( ChangeLogScmResult changeLogScmResult )
+    {
+        this.changeLogScmResult = changeLogScmResult;
+    }
+
+    public ChangeLogScmResult getChangeLogScmResult()
+    {
+        return changeLogScmResult;
+    }
+
+    public void setDiffScmResult( DiffScmResult diffScmResult )
+    {
+        this.diffScmResult = diffScmResult;
+    }
+
+    public DiffScmResult getDiffScmResult()
+    {
+        return diffScmResult;
+    }
+
+    public void setTagScmResult( TagScmResult tagScmResult )
+    {
+        this.tagScmResult = tagScmResult;
+    }
+
+    public TagScmResult getTagScmResult()
+    {
+        return tagScmResult;
+    }
+
+    public void setRemoveScmResult( RemoveScmResult removeScmResult )
+    {
+        this.removeScmResult = removeScmResult;
+    }
+
+    public RemoveScmResult getRemoveScmResult()
+    {
+        return removeScmResult;
+    }
+
+    public void setStatusScmResult( StatusScmResult statusScmResult )
+    {
+        this.statusScmResult = statusScmResult;
+    }
+
+    public StatusScmResult getStatusScmResult()
+    {
+        return statusScmResult;
+    }
+
+    public void setUpdateScmResult( UpdateScmResult updateScmResult )
+    {
+        this.updateScmResult = updateScmResult;
+    }
+
+    public UpdateScmResult getUpdateScmResult()
+    {
+        return updateScmResult;
+    }
+
+    public void setEditScmResult( EditScmResult editScmResult )
+    {
+        this.editScmResult = editScmResult;
+    }
+
+    public EditScmResult getEditScmResult()
+    {
+        return editScmResult;
+    }
+
+    public void setUnEditScmResult( UnEditScmResult unEditScmResult )
+    {
+        this.unEditScmResult = unEditScmResult;
+    }
+
+    public UnEditScmResult getUnEditScmResult()
+    {
+        return unEditScmResult;
+    }
+
     /**
      * @return scmProviderRepository always
      */
@@ -101,133 +258,169 @@
         return errors;
     }
 
+    /**
+     * @return scmSpecificFilename 
+     */
     public String getScmSpecificFilename()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return scmSpecificFilename;
     }
 
+    /**
+     * @return getAddScmResult() always 
+     */
     public AddScmResult add( ScmRepository repository, ScmFileSet fileSet )
         throws ScmException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getAddScmResult();
     }
 
+    /**
+     * @return getChangeLogScmResult() always 
+     */
     public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, Date
startDate, Date endDate,
                                         int numDays, String branch )
         throws ScmException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getChangeLogScmResult();
     }
 
+    /**
+     * @return getChangeLogScmResult() always 
+     */
     public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, Date
startDate, Date endDate,
                                         int numDays, String branch, String datePattern )
         throws ScmException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getChangeLogScmResult();
     }
 
+    /**
+     * @return getChangeLogScmResult() always 
+     */
     public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, String
startTag, String endTag )
         throws ScmException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getChangeLogScmResult();
     }
 
+    /**
+     * @return getChangeLogScmResult() always 
+     */
     public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, String
startTag, String endTag,
                                         String datePattern )
         throws ScmException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getChangeLogScmResult();
     }
 
+    /**
+     * @return getCheckInScmResult() always 
+     */
     public CheckInScmResult checkIn( ScmRepository repository, ScmFileSet fileSet, String
tag, String message )
         throws ScmException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getCheckInScmResult();
     }
 
+    /**
+     * @return getCheckOutScmResult() always 
+     */
     public CheckOutScmResult checkOut( ScmRepository repository, ScmFileSet fileSet, String
tag )
         throws ScmException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getCheckOutScmResult();
     }
 
+    /**
+     * @return getDiffScmResult() always 
+     */
     public DiffScmResult diff( ScmRepository repository, ScmFileSet fileSet, String startRevision,
String endRevision )
         throws ScmException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getDiffScmResult();
     }
 
+    /**
+     * @return getRemoveScmResult() always 
+     */
     public RemoveScmResult remove( ScmRepository repository, ScmFileSet fileSet, String message
)
         throws ScmException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getRemoveScmResult();
     }
 
+    /**
+     * @return getStatusScmResult() always 
+     */
     public StatusScmResult status( ScmRepository repository, ScmFileSet fileSet )
         throws ScmException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getStatusScmResult();
     }
 
+    /**
+     * @return getTagScmResult() always 
+     */
     public TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, String tag )
         throws ScmException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getTagScmResult();
     }
 
+    /**
+     * @return getUpdateScmResult() always 
+     */
     public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String tag
)
         throws ScmException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getUpdateScmResult();
     }
 
+    /**
+     * @return getUpdateScmResult() always 
+     */
     public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String tag,
String datePattern )
         throws ScmException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getUpdateScmResult();
     }
 
+    /**
+     * @return getUpdateScmResult() always 
+     */
     public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String tag,
Date lastUpdate )
         throws ScmException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getUpdateScmResult();
     }
 
+    /**
+     * @return getUpdateScmResult() always 
+     */
     public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String tag,
Date lastUpdate,
                                   String datePattern )
         throws ScmException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getUpdateScmResult();
     }
 
+    /**
+     * @return getEditScmResult() always 
+     */
     public EditScmResult edit( ScmRepository repository, ScmFileSet fileSet )
         throws ScmException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getEditScmResult();
     }
 
+    /**
+     * @return getUnEditScmResult() always 
+     */
     public UnEditScmResult unedit( ScmRepository repository, ScmFileSet fileSet )
         throws ScmException
     {
-        // TODO Auto-generated method stub
-        return null;
+        return getUnEditScmResult();
     }
 
 }



Mime
View raw message