continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r666882 - in /continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/ continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/...
Date Wed, 11 Jun 2008 23:01:23 GMT
Author: olamy
Date: Wed Jun 11 16:01:22 2008
New Revision: 666882

URL: http://svn.apache.org/viewvc?rev=666882&view=rev
Log:
[CONTINUUM-1792] svn checkout with authentification doesn't work in 1.2 (trunk rev 663360)



Added:
    continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java
  (with props)
    continuum/trunk/continuum-webapp/src/test/resources/log4j.xml   (with props)
Modified:
    continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuilder.java
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTask.java
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
    continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
    continuum/trunk/continuum-webapp/pom.xml

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=666882&r1=666881&r2=666882&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
Wed Jun 11 16:01:22 2008
@@ -67,7 +67,7 @@
 
     public List<ProjectGroup> getAllProjectGroupsWithBuildDetails();
 
-    public Collection<ProjectGroup> getAllProjectGroups();
+    public List<ProjectGroup> getAllProjectGroups();
 
     public ProjectGroup getProjectGroupByProjectId( int projectId )
         throws ContinuumException;
@@ -103,6 +103,12 @@
     void removeProject( int projectId )
         throws ContinuumException;
 
+    
+    /**
+     * @deprecated
+     * @param projectId
+     * @throws ContinuumException
+     */
     void checkoutProject( int projectId )
         throws ContinuumException;
 

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuilder.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuilder.java?rev=666882&r1=666881&r2=666882&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuilder.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuilder.java
Wed Jun 11 16:01:22 2008
@@ -21,7 +21,6 @@
 
 import java.net.URL;
 
-import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildDefinitionTemplate;
 
 /**
@@ -40,7 +39,8 @@
         throws ContinuumProjectBuilderException;
 
     ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String
password,
-                                                              boolean recursiveProjects,
BuildDefinitionTemplate buildDefinitionTemplate )
+                                                              boolean recursiveProjects,
+                                                              BuildDefinitionTemplate buildDefinitionTemplate
)
         throws ContinuumProjectBuilderException;
 
     BuildDefinitionTemplate getDefaultBuildDefinitionTemplate()

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=666882&r1=666881&r2=666882&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Wed Jun 11 16:01:22 2008
@@ -346,9 +346,9 @@
 
     }
 
-    public Collection<ProjectGroup> getAllProjectGroups()
+    public List<ProjectGroup> getAllProjectGroups()
     {
-        return store.getAllProjectGroups();
+        return new ArrayList<ProjectGroup>( store.getAllProjectGroups() );
     }
 
     public ProjectGroup getProjectGroupByGroupId( String groupId )
@@ -791,6 +791,9 @@
         }
     }
 
+    /** 
+     * @see org.apache.maven.continuum.Continuum#checkoutProject(int)
+     */
     public void checkoutProject( int projectId )
         throws ContinuumException
     {
@@ -1538,6 +1541,9 @@
     // Shell projects
     // ----------------------------------------------------------------------
 
+    /** 
+     * @see org.apache.maven.continuum.Continuum#addProject(org.apache.maven.continuum.model.project.Project,
java.lang.String)
+     */
     public int addProject( Project project, String executorId )
         throws ContinuumException
     {
@@ -1550,6 +1556,9 @@
         return addProject( project, executorId, groupId, -1 );
     }
 
+    /** 
+     * @see org.apache.maven.continuum.Continuum#addProject(org.apache.maven.continuum.model.project.Project,
java.lang.String, int, int)
+     */
     public int addProject( Project project, String executorId, int groupId, int buildDefintionTemplateId
)
         throws ContinuumException
     {
@@ -1607,6 +1616,7 @@
     // Activities. These should end up as workflows in werkflow
     // ----------------------------------------------------------------------
 
+    @SuppressWarnings("unchecked")
     private int executeAddProjectFromScmActivity( Project project, int groupId )
         throws ContinuumException
     {
@@ -1625,7 +1635,7 @@
         context.put( AbstractContinuumAction.KEY_UNVALIDATED_PROJECT_GROUP, projectGroup
);
 
         context.put( AbstractContinuumAction.KEY_PROJECT_GROUP_ID, new Integer( projectGroup.getId()
) );
-
+        
         executeAction( "validate-project", context );
 
         executeAction( "store-project", context );
@@ -1637,24 +1647,6 @@
         return ( (Integer) context.get( AbstractContinuumAction.KEY_PROJECT_ID ) ).intValue();
     }
 
-    /**
-     * Add a Maven 1 / Maven 2 project to Continuum
-     *
-     * @param metadataUrl      url of the pom
-     * @param projectBuilderId {@link MavenTwoContinuumProjectBuilder#ID} for Maven 2 project
-     *                         or {@link MavenOneContinuumProjectBuilder#ID} for Maven 1
project.
-     * @return a holder with the projects, project groups and errors occurred during the
project adding
-     * @throws ContinuumException
-     */
-    /*
-    private ContinuumProjectBuildingResult executeAddProjectsFromMetadataActivity( String
metadataUrl,
-                                                                                   String
projectBuilderId,
-                                                                                   boolean
checkProtocol )
-        throws ContinuumException
-    {
-        return executeAddProjectsFromMetadataActivity( metadataUrl, projectBuilderId, -1,
checkProtocol );
-    }
-    */
     private ContinuumProjectBuildingResult executeAddProjectsFromMetadataActivity( String
metadataUrl,
                                                                                    String
projectBuilderId,
                                                                                    int projectGroupId,
@@ -1666,15 +1658,16 @@
                                                        false, false, buildDefintionTemplateId
);
     }
 
-    private ContinuumProjectBuildingResult executeAddProjectsFromMetadataActivity( String
metadataUrl,
-                                                                                   String
projectBuilderId,
-                                                                                   int projectGroupId,
-                                                                                   boolean
checkProtocol,
-                                                                                   boolean
useCredentialsCache,
-                                                                                   boolean
loadRecursiveProjects,
-                                                                                   int buildDefintionTemplateId
)
-        throws ContinuumException
-    {
+    
+    protected ContinuumProjectBuildingResult executeAddProjectsFromMetadataActivity( String
metadataUrl,
+                                                                                     String
projectBuilderId,
+                                                                                     int
projectGroupId,
+                                                                                     boolean
checkProtocol,
+                                                                                     boolean
useCredentialsCache,
+                                                                                     boolean
loadRecursiveProjects,
+                                                                                     int
buildDefintionTemplateId, boolean addAssignableRoles )
+          throws ContinuumException
+      {
         if ( checkProtocol )
         {
             try
@@ -1698,8 +1691,11 @@
 
         context.put( CreateProjectsFromMetadataAction.KEY_URL, metadataUrl );
 
-        context.put( CreateProjectsFromMetadataAction.KEY_LOAD_RECURSIVE_PROJECTS,
-                     Boolean.valueOf( loadRecursiveProjects ) );
+        context.put( CreateProjectsFromMetadataAction.KEY_LOAD_RECURSIVE_PROJECTS, Boolean
+            .valueOf( loadRecursiveProjects ) );
+
+        context.put( CreateProjectsFromMetadataAction.KEY_SCM_USE_CREDENTIALS_CACHE, Boolean
+            .valueOf( useCredentialsCache ) );
 
         context.put( AbstractContinuumAction.KEY_WORKING_DIRECTORY, getWorkingDirectory()
);
 
@@ -1811,10 +1807,23 @@
 
         List<Project> projects = result.getProjects();
 
+        String scmUserName = null;
+        String scmPassword = null;
+        
         for ( Project project : projects )
         {
             project.setScmUseCache( useCredentialsCache );
-
+            
+            // values backup for first checkout
+            scmUserName = project.getScmUsername();
+            scmPassword = project.getScmPassword();
+            // CONTINUUM-1792 : we don't store it
+            if ( useCredentialsCache )
+            {
+                project.setScmUsername( null );
+                project.setScmPassword( null );
+            }
+    
             projectGroup.addProject( project );
         }
 
@@ -1834,6 +1843,17 @@
                 //
                 context.put( AbstractContinuumAction.KEY_PROJECT_ID, new Integer( project.getId()
) );
 
+                if ( !StringUtils.isEmpty( scmUserName ) )
+                {
+                    project.setScmUsername( scmUserName );
+                    context.put( AbstractContinuumAction.KEY_SCM_USERNAME, scmUserName );
+                }
+                if ( !StringUtils.isEmpty( scmPassword ) )
+                {
+                    project.setScmPassword( scmPassword );
+                    context.put( AbstractContinuumAction.KEY_SCM_PASSWORD, scmPassword );
+                }
+                context.put( AbstractContinuumAction.KEY_PROJECT, project );
                 executeAction( "add-project-to-checkout-queue", context );
             }
         }
@@ -1844,9 +1864,25 @@
 
         context.put( AbstractContinuumAction.KEY_PROJECT_GROUP_ID, new Integer( projectGroup.getId()
) );
         // add the relevent security administration roles for this project
-        executeAction( "add-assignable-roles", context );
-
+        if ( addAssignableRoles )
+        {
+            executeAction( "add-assignable-roles", context );
+        }
         return result;
+      }
+    
+    protected ContinuumProjectBuildingResult executeAddProjectsFromMetadataActivity( String
metadataUrl,
+                                                                                   String
projectBuilderId,
+                                                                                   int projectGroupId,
+                                                                                   boolean
checkProtocol,
+                                                                                   boolean
useCredentialsCache,
+                                                                                   boolean
loadRecursiveProjects,
+                                                                                   int buildDefintionTemplateId
)
+        throws ContinuumException
+    {
+        return executeAddProjectsFromMetadataActivity( metadataUrl, projectBuilderId, projectGroupId,
checkProtocol,
+                                                       useCredentialsCache, loadRecursiveProjects,
+                                                       buildDefintionTemplateId, true );
     }
 
     // ----------------------------------------------------------------------

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java?rev=666882&r1=666881&r2=666882&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
Wed Jun 11 16:01:22 2008
@@ -75,6 +75,12 @@
     public static final String KEY_FIRST_RUN = "first-run";
 
     public static final String KEY_PROJECT_RELATIVE_PATH = "project-relative-path";
+    
+    public static final String KEY_SCM_USE_CREDENTIALS_CACHE = "useCredentialsCache";
+    
+    public static final String KEY_SCM_USERNAME = "scmUserName";
+    
+    public static final String KEY_SCM_PASSWORD = "scmUserPassword";
 
     // ----------------------------------------------------------------------
     // Utils
@@ -192,6 +198,11 @@
     {
         return ( (Boolean) getObject( context, key ) ).booleanValue();
     }
+    
+    public static boolean getBoolean( Map context, String key, boolean defaultValue )
+    {
+        return ( (Boolean) getObject( context, key, Boolean.valueOf( defaultValue ) ) ).booleanValue();
+    }    
 
     protected static int getInteger( Map context, String key )
     {

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java?rev=666882&r1=666881&r2=666882&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
Wed Jun 11 16:01:22 2008
@@ -19,14 +19,14 @@
  * under the License.
  */
 
+import java.util.Map;
+
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.scm.queue.CheckOutTask;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.utils.WorkingDirectoryService;
 import org.codehaus.plexus.taskqueue.TaskQueue;
 
-import java.util.Map;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -50,14 +50,20 @@
      * @plexus.requirement role-hint="jdo"
      */
     private ContinuumStore store;
-
+    
+    @SuppressWarnings("unchecked")
     public void execute( Map context )
         throws Exception
     {
-        Project project = store.getProject( getProjectId( context ) );
+        
+        Project project = (Project) getObject( context, KEY_PROJECT, null );
+        if (project == null)
+        {
+            project = store.getProject( getProjectId( context ) );
+        }
 
-        CheckOutTask checkOutTask =
-            new CheckOutTask( project.getId(), workingDirectoryService.getWorkingDirectory(
project ), project.getName() );
+        CheckOutTask checkOutTask = new CheckOutTask( project.getId(), workingDirectoryService
+            .getWorkingDirectory( project ), project.getName(), project.getScmUsername(),
project.getScmPassword() );
 
         checkOutQueue.put( checkOutTask );
     }

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java?rev=666882&r1=666881&r2=666882&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
Wed Jun 11 16:01:22 2008
@@ -90,7 +90,9 @@
 
         try
         {
-            ContinuumScmConfiguration config = createScmConfiguration( project, workingDirectory
);
+            String scmUserName = getString( context, KEY_SCM_USERNAME );
+            String scmPassword = getString( context, KEY_SCM_PASSWORD );
+            ContinuumScmConfiguration config = createScmConfiguration( project, workingDirectory,
scmUserName, scmPassword );
 
             String tag = config.getTag();
             getLogger().info(
@@ -181,12 +183,13 @@
         context.put( KEY_CHECKOUT_SCM_RESULT, result );
     }
 
-    private ContinuumScmConfiguration createScmConfiguration( Project project, File workingDirectory
)
+    private ContinuumScmConfiguration createScmConfiguration( Project project, File workingDirectory,
+                                                              String scmUserName, String
scmPassword )
     {
         ContinuumScmConfiguration config = new ContinuumScmConfiguration();
         config.setUrl( project.getScmUrl() );
-        config.setUsername( project.getScmUsername() );
-        config.setPassword( project.getScmPassword() );
+        config.setUsername( scmUserName );
+        config.setPassword( scmPassword );
         config.setUseCredentialsCache( project.isScmUseCache() );
         config.setWorkingDirectory( workingDirectory );
         config.setTag( project.getScmTag() );

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java?rev=666882&r1=666881&r2=666882&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
Wed Jun 11 16:01:22 2008
@@ -53,6 +53,15 @@
         //
         // ----------------------------------------------------------------------
 
+        boolean useCredentialsCache = getBoolean( context, KEY_SCM_USE_CREDENTIALS_CACHE,
false );
+        // CONTINUUM-1605 don't store username/password
+        if ( !useCredentialsCache )
+        {
+            project.setScmUsername( null );
+            project.setScmPassword( null );
+            project.setScmUseCache( false );
+        }
+        
         projectGroup.addProject( project );
 
         store.updateProjectGroup( projectGroup );

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java?rev=666882&r1=666881&r2=666882&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
Wed Jun 11 16:01:22 2008
@@ -241,8 +241,6 @@
             We are interested in having the scm username and password being passed into this
method be taken into
             account during project mapping so make sure we set it to the continuum project
instance.
              */
-            /* 
-            CONTINUUM-1605 don't store username/password
             if ( username != null && StringUtils.isNotEmpty( username ) )
             {
                 continuumProject.setScmUsername( username );
@@ -252,7 +250,6 @@
                     continuumProject.setScmPassword( password );
                 }
             }
-            */
 
             builderHelper.mapMavenProjectToContinuumProject( result, mavenProject, continuumProject,
groupPom );
 

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTask.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTask.java?rev=666882&r1=666881&r2=666882&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTask.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTask.java
Wed Jun 11 16:01:22 2008
@@ -35,14 +35,22 @@
     private File workingDirectory;
     
     private String projectName;
+    
+    private String scmUserName;
+
+    private String scmPassword;
 
-    public CheckOutTask( int projectId, File workingDirectory, String projectName )
+    public CheckOutTask( int projectId, File workingDirectory, String projectName, String
scmUserName, String scmPassword )
     {
         this.projectId = projectId;
 
         this.workingDirectory = workingDirectory;
         
         this.projectName = projectName;
+        
+        this.scmUserName = scmUserName;
+        
+        this.scmPassword = scmPassword;
     }
 
     public int getProjectId()
@@ -65,6 +73,18 @@
         return projectName;
     }
     
+    
+    public String getScmUserName()
+    {
+        return scmUserName;
+    }
+
+    public String getScmPassword()
+    {
+        return scmPassword;
+    }
+    
+    
     public int getHashCode()
     {
         return this.hashCode();

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java?rev=666882&r1=666881&r2=666882&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
Wed Jun 11 16:01:22 2008
@@ -85,6 +85,11 @@
         context.put( AbstractContinuumAction.KEY_PROJECT, project );
 
         context.put( AbstractContinuumAction.KEY_WORKING_DIRECTORY, workingDirectory );
+        
+        context.put( AbstractContinuumAction.KEY_SCM_USERNAME, task.getScmUserName() );
+        
+        context.put( AbstractContinuumAction.KEY_SCM_PASSWORD, task.getScmPassword() );
+        
 
         try
         {

Added: continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java?rev=666882&view=auto
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java
(added)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java
Wed Jun 11 16:01:22 2008
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+package org.apache.maven.continuum;
+
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
+import org.apache.maven.continuum.project.builder.maven.MavenTwoContinuumProjectBuilder;
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 12 juin 2008
+ * @version $Id$
+ */
+public class AddProjectTest
+    extends AbstractContinuumTest
+{
+    public void testScmUserNamePasswordNotStoring()
+        throws Exception
+    {
+        String metadataUrl = "http://test:;password@svn.apache.org/repos/asf/continuum/tags/continuum-1.1/continuum-api/pom.xml";
+        DefaultContinuum continuum = (DefaultContinuum) lookup( Continuum.ROLE );
+        
+        ContinuumProjectBuildingResult result = continuum
+            .executeAddProjectsFromMetadataActivity( metadataUrl, MavenTwoContinuumProjectBuilder.ID,
+                                                     getDefaultProjectGroup().getId(), false,
true, false, -1, false );
+        assertEquals( 1, result.getProjects().size() );
+        
+        // read the project from store
+        Project project = continuum.getProject( result.getProjects().get( 0 ).getId());
+        assertNull(  project.getScmUsername() );
+        assertNull( project.getScmPassword() );
+        assertTrue( project.isScmUseCache() );
+    }
+
+    public void testScmUserNamePasswordStoring()
+        throws Exception
+    {
+        String metadataUrl = "http://test:;password@svn.apache.org/repos/asf/continuum/tags/continuum-1.1/continuum-api/pom.xml";
+        DefaultContinuum continuum = (DefaultContinuum) lookup( Continuum.ROLE );
+
+        ContinuumProjectBuildingResult result = continuum
+            .executeAddProjectsFromMetadataActivity( metadataUrl, MavenTwoContinuumProjectBuilder.ID,
+                                                     getDefaultProjectGroup().getId(), false,
false, false, -1, false );
+        assertEquals( 1, result.getProjects().size() );
+
+        // read the project from store
+        Project project = continuum.getProject( result.getProjects().get( 0 ).getId() );
+        assertEquals( "test", project.getScmUsername() );
+        assertEquals( ";password", project.getScmPassword() );
+        assertFalse( project.isScmUseCache() );
+    }    
+}

Propchange: continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id

Modified: continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java?rev=666882&r1=666881&r2=666882&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
(original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
Wed Jun 11 16:01:22 2008
@@ -386,4 +386,6 @@
     {
         return (Continuum) lookup( Continuum.ROLE );
     }
+    
+
 }

Modified: continuum/trunk/continuum-webapp/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/pom.xml?rev=666882&r1=666881&r2=666882&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/pom.xml (original)
+++ continuum/trunk/continuum-webapp/pom.xml Wed Jun 11 16:01:22 2008
@@ -583,5 +583,30 @@
         </plugins>
       </build>
     </profile>
+    <profile>
+      <!-- profile for dev an log output in the console -->
+      <id>dev</id>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-antrun-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>override-log4j-with-console-output</id>
+                <phase>process-resources</phase>
+                <goals>
+                  <goal>run</goal>
+                </goals>
+                <configuration>
+                  <tasks>
+                    <copy overwrite="true" file="${basedir}/src/test/resources/log4j.xml"
todir="${basedir}/src/main/webapp/WEB-INF/classes" />
+                  </tasks>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>  
   </profiles>
 </project>

Added: continuum/trunk/continuum-webapp/src/test/resources/log4j.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/test/resources/log4j.xml?rev=666882&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/test/resources/log4j.xml (added)
+++ continuum/trunk/continuum-webapp/src/test/resources/log4j.xml Wed Jun 11 16:01:22 2008
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+  <appender name="console" class="org.apache.log4j.ConsoleAppender">
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="Target" value="System.out"/>
+      <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/>
+    </layout>
+  </appender>
+
+  <!-- Help identify bugs during testing -->
+  <logger name="org.apache.maven">
+    <level value="info"/>
+  </logger>
+
+  <logger name="org.apache.maven.continuum">
+    <level value="info" />
+  </logger>
+
+  <logger name="org.apache.maven.scm">
+    <level value="info" />
+  </logger>
+
+  <logger name="org.codehaus.plexus.redback">
+    <level value="info"/>
+  </logger>
+
+  <!-- squelch noisy objects (for now) -->
+  <logger name="org.apache.commons">
+    <level value="warn"/>
+  </logger>
+
+  <logger name="net.sf.ehcache">
+    <level value="warn"/>
+  </logger>
+
+  <logger name="org.codehaus.plexus.mailsender.MailSender">
+    <level value="info"/>
+  </logger>
+
+  <logger name="org.codehaus.plexus.velocity">
+    <level value="error"/>
+  </logger>
+
+  <logger name="org.quartz">
+    <level value="info"/>
+  </logger>
+
+  <logger name="org.apache.jasper">
+    <level value="info"/>
+  </logger>
+
+  <logger name="com.opensymphony.xwork">
+    <level value="info"/>
+  </logger>
+
+  <!-- CONTINUUM-1228 -->
+  <logger name="com.opensymphony.xwork.util.OgnlUtil">
+    <level value="error"/>
+  </logger>
+
+  <logger name="com.opensymphony.webwork">
+    <level value="info"/>
+  </logger>
+
+  <logger name="org.codehaus.plexus.PlexusContainer">
+    <level value="info"/>
+  </logger>
+
+  <logger name="JPOX">
+    <level value="warn"/>
+  </logger>
+
+  <logger name="JPOX.MetaData">
+    <level value="error"/>
+  </logger>
+
+  <logger name="JPOX.RDBMS.SQL">
+    <level value="error"/>
+  </logger>
+
+  <logger name="SQL">
+    <level value="error"/>
+  </logger>
+
+  <logger name="freemarker">
+    <level value="warn"/>
+  </logger>
+
+  <logger name="org.codehaus.plexus.component.manager.ClassicSingletonComponentManager">
+    <level value="error"/>
+  </logger>
+  
+  <logger name="org.springframework.beans.factory.xml.XmlBeanDefinitionReader">
+    <level value="error"/>
+  </logger>
+  <logger name="org.springframework.beans.factory.support.DefaultListableBeanFactory">
+    <level value="error"/>
+  </logger>
+
+  <root>
+    <priority value="info" />
+    <appender-ref ref="console" />
+  </root>
+
+</log4j:configuration>

Propchange: continuum/trunk/continuum-webapp/src/test/resources/log4j.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/test/resources/log4j.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-webapp/src/test/resources/log4j.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message