continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r485307 - in /maven/continuum/trunk/continuum-webapp/src: main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java test/java/org/apache/maven/continuum/web/action/ReleasePrepareActionTest.java
Date Sun, 10 Dec 2006 23:23:40 GMT
Author: carlos
Date: Sun Dec 10 15:23:39 2006
New Revision: 485307

URL: http://svn.apache.org/viewvc?view=rev&rev=485307
Log:
Fix population of tag base in prepare release page

Added:
    maven/continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/ReleasePrepareActionTest.java
  (with props)
Modified:
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java?view=diff&rev=485307&r1=485306&r2=485307
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
Sun Dec 10 15:23:39 2006
@@ -49,6 +49,8 @@
 public class ReleasePrepareAction
     extends ContinuumActionSupport
 {
+    private static final String SCM_SVN_PROTOCOL_PREFIX = "scm:svn:";
+
     private int projectId;
 
     private String releaseId;
@@ -86,9 +88,11 @@
         scmTag = project.getScmTag();
 
         String scmUrl = project.getScmUrl();
-        if ( scmUrl.startsWith( "scm:svn:" ) )
+        if ( scmUrl.startsWith( SCM_SVN_PROTOCOL_PREFIX ) )
         {
             scmTagBase = new SvnScmProviderRepository( scmUrl, scmUsername, scmPassword ).getTagBase();
+            // strip the Maven scm protocol prefix
+            scmTagBase = scmTagBase.substring( SCM_SVN_PROTOCOL_PREFIX.length() );
         }
         else
         {

Added: maven/continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/ReleasePrepareActionTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/ReleasePrepareActionTest.java?view=auto&rev=485307
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/ReleasePrepareActionTest.java
(added)
+++ maven/continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/ReleasePrepareActionTest.java
Sun Dec 10 15:23:39 2006
@@ -0,0 +1,78 @@
+package org.apache.maven.continuum.web.action;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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 org.apache.maven.continuum.Continuum;
+import org.apache.maven.continuum.model.project.Project;
+import org.jmock.Mock;
+import org.jmock.MockObjectTestCase;
+
+/**
+ * Test for {@link ReleasePrepareAction}
+ * 
+ * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
+ * @version $Id$
+ */
+public class ReleasePrepareActionTest
+    extends MockObjectTestCase
+{
+
+    private ReleasePrepareAction action;
+
+    private Mock continuumMock;
+
+    public ReleasePrepareActionTest()
+    {
+        action = new ReleasePrepareAction();
+        continuumMock = new Mock( Continuum.class );
+        action.setContinuum( (Continuum) continuumMock.proxy() );
+    }
+
+    /**
+     * Test that the tag base url for Subversion is correctly constructed
+     * 
+     * @throws Exception
+     */
+    public void testScmTagBaseSvn()
+        throws Exception
+    {
+        String svnUrl = "https://svn.apache.org/repos/asf/maven/continuum";
+        String scmUrl = "scm:svn:" + svnUrl + "/trunk/";
+        Project project = new Project();
+        project.setScmUrl( scmUrl );
+        continuumMock.expects( once() ).method( "getProject" ).will( returnValue( project
) );
+        action.input();
+        assertEquals( svnUrl + "/tags", action.getScmTagBase() );
+        continuumMock.verify();
+    }
+
+    /**
+     * Test that tag base url for non Subverson SCMs is empty
+     * 
+     * @throws Exception
+     */
+    public void testScmTagBaseNonSvn()
+        throws Exception
+    {
+        Project project = new Project();
+        project.setScmUrl( "scm:cvs:xxx" );
+        continuumMock.expects( once() ).method( "getProject" ).will( returnValue( project
) );
+        action.input();
+        assertEquals( "", action.getScmTagBase() );
+        continuumMock.verify();
+    }
+}
\ No newline at end of file

Propchange: maven/continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/ReleasePrepareActionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/ReleasePrepareActionTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message