continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r564003 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/installation/ continuum-api/src/main/java/org/apache/maven/continuum/profile/ continuum-api/src/main/java/org/apache/maven/continuum/store/ continuu...
Date Wed, 08 Aug 2007 19:57:05 GMT
Author: evenisse
Date: Wed Aug  8 12:56:50 2007
New Revision: 564003

URL: http://svn.apache.org/viewvc?view=rev&rev=564003
Log:
[CONTINUUM-1365] Allow to edit the name of an installation already created by adding an id
in installation table
Submitted by: Olivier Lamy

Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/installation/InstallationService.java
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/profile/ProfileService.java
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/installation/DefaultInstallationService.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/profile/DefaultProfileService.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/installation/DefaultInstallationServiceTest.java
    maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml
    maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
    maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/InstallationAction.java
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/ProfileAction.java
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/validator/InstallationValidator.java
    maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
    maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editInstallation.jsp
    maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editProfile.jsp
    maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/installationsList.jsp

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/installation/InstallationService.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/installation/InstallationService.java?view=diff&rev=564003&r1=564002&r2=564003
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/installation/InstallationService.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/installation/InstallationService.java
Wed Aug  8 12:56:50 2007
@@ -19,10 +19,11 @@
  * under the License.
  */
 
+import java.util.List;
+
 import org.apache.maven.continuum.execution.ExecutorConfigurator;
 import org.apache.maven.continuum.model.system.Installation;
-
-import java.util.List;
+import org.apache.maven.continuum.model.system.Profile;
 
 /**
  * @author <a href="mailto:olamy@codehaus.org">olamy</a>
@@ -47,7 +48,7 @@
         throws InstallationException;
     
     public Installation add( Installation installation )
-    throws InstallationException;
+        throws InstallationException;
 
     public void update( Installation installation )
         throws InstallationException;
@@ -55,7 +56,7 @@
     public void delete( Installation installation )
         throws InstallationException;
 
-    public Installation getInstallation( String name )
+    public Installation getInstallation( int installationId )
         throws InstallationException;
 
     public List<Installation> getAllInstallations()
@@ -91,7 +92,7 @@
      * @return the cli output of $path/ec.relativePath.ec.executable ec.versionArgument
      * @throws InstallationException
      */
-    public List<String> getExecutorConfiguratorVersion( String path, ExecutorConfigurator
executorConfigurator )
+    public List<String> getExecutorConfiguratorVersion( String path, ExecutorConfigurator
executorConfigurator, Profile profile )
         throws InstallationException;
 
 }

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/profile/ProfileService.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/profile/ProfileService.java?view=diff&rev=564003&r1=564002&r2=564003
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/profile/ProfileService.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/profile/ProfileService.java
Wed Aug  8 12:56:50 2007
@@ -63,4 +63,7 @@
 
     public void addEnvVarInProfile( Profile profile, Installation envVar )
         throws ProfileException;
+    
+    public void addInstallationInProfile( Profile profile, Installation installation )
+        throws ProfileException;
 }

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java?view=diff&rev=564003&r1=564002&r2=564003
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
Wed Aug  8 12:56:50 2007
@@ -164,7 +164,7 @@
     void updateInstallation( Installation installation )
         throws ContinuumStoreException, ContinuumObjectNotFoundException;
 
-    Installation getInstallationByName( String installationName )
+    Installation getInstallation( int installationId )
         throws ContinuumStoreException, ContinuumObjectNotFoundException;
 
     List getAllBuildsForAProjectByDate( int projectId );

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/installation/DefaultInstallationService.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/installation/DefaultInstallationService.java?view=diff&rev=564003&r1=564002&r2=564003
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/installation/DefaultInstallationService.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/installation/DefaultInstallationService.java
Wed Aug  8 12:56:50 2007
@@ -40,6 +40,7 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -124,7 +125,7 @@
                 Profile profile = new Profile();
                 profile.setName( storedOne.getName() );
                 profile = profileService.addProfile( profile );
-                profileService.addEnvVarInProfile( profile, storedOne );
+                profileService.addInstallationInProfile( profile, storedOne );
             }
         }
         catch ( ProfileException e )
@@ -154,6 +155,7 @@
     /**
      * @see org.apache.maven.continuum.installation.InstallationService#getAllInstallations()
      */
+    @SuppressWarnings ("unchecked")
     public List<Installation> getAllInstallations()
         throws InstallationException
     {
@@ -169,14 +171,14 @@
     }
 
     /**
-     * @see org.apache.maven.continuum.installation.InstallationService#getInstallation(java.lang.String)
+     * @see org.apache.maven.continuum.installation.InstallationService#getInstallation(int)
      */
-    public Installation getInstallation( String name )
+    public Installation getInstallation( int installationId )
         throws InstallationException
     {
         try
         {
-            return store.getInstallationByName( name );
+            return store.getInstallation( installationId );
         }
         catch ( ContinuumStoreException e )
         {
@@ -192,7 +194,7 @@
     {
         try
         {
-            Installation stored = getInstallation( installation.getName() );
+            Installation stored = getInstallation( installation.getInstallationId() );
             if ( stored == null )
             {
                 throw new InstallationException( "installation with name " + installation.getName()
+ " not exists" );
@@ -333,13 +335,42 @@
         }
         return cliOutput;
     }
+    
+    private Map<String, String> getEnvVars( Profile profile )
+    {
+        Map<String, String> environnments = new HashMap<String, String>();
+        if ( profile == null )
+        {
+            return environnments;
+        }
+        if ( profile.getBuilder() != null )
+        {
+            environnments.put( profile.getBuilder().getVarName(), profile.getBuilder().getVarValue()
);
+        }
+        if ( profile.getJdk() != null )
+        {
+            environnments.put( profile.getJdk().getVarName(), profile.getJdk().getVarValue()
);
+        }
+        if ( profile.getEnvironmentVariables() != null )
+        {
+            for ( Iterator iterator = profile.getEnvironmentVariables().iterator(); iterator.hasNext();
)
+            {
+                Installation installation = (Installation) iterator.next();
+                environnments.put( installation.getVarName(), installation.getVarValue()
);
+            }
+        }
+        return environnments;
+    }
 
     /**
      * @see org.apache.maven.continuum.installation.InstallationService#getExecutorConfiguratorVersion(java.lang.String,org.apache.maven.continuum.execution.ExecutorConfigurator)
      */
-    public List<String> getExecutorConfiguratorVersion( String path, ExecutorConfigurator
executorConfigurator )
+    @SuppressWarnings ("unchecked")
+    public List<String> getExecutorConfiguratorVersion( String path, ExecutorConfigurator
executorConfigurator, Profile profile )
         throws InstallationException
     {
+         
+
         if ( executorConfigurator == null )
         {
             return Collections.EMPTY_LIST;
@@ -358,6 +389,16 @@
                 executable.append( executorConfigurator.getRelativePath() + File.separator
);
                 commandline.addEnvironment( executorConfigurator.getEnvVar(), path );
             }
+            //Installations are env var they must be add if exists
+            Map<String, String> environments = getEnvVars( profile );
+            // no null check we use a private method just here
+            for ( Iterator<String> iterator = environments.keySet().iterator(); iterator.hasNext();
)
+            {
+                String key = iterator.next();
+                String value = environments.get( key );
+                commandline.addEnvironment( key, value );
+            }
+            
             executable = executable.append( executorConfigurator.getExecutable() );
             commandline.setExecutable( executable.toString() );
             commandline.addArguments( new String[]{executorConfigurator.getVersionArgument()}
);

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java?view=diff&rev=564003&r1=564002&r2=564003
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
Wed Aug  8 12:56:50 2007
@@ -369,13 +369,13 @@
 
         ExecutorConfigurator executorConfigurator = null;
         Installation builder = null;
+        Profile profile = null;
         if ( buildDefinition != null )
         {
-            Profile profile = buildDefinition.getProfile();
+            profile = buildDefinition.getProfile();
             if ( profile != null )
             {
                 builder = profile.getBuilder();
-
             }
         }
         if ( builder != null )
@@ -407,7 +407,7 @@
         }
 
         return continuum.getInstallationService().getExecutorConfiguratorVersion( builder
== null ? null : builder
-            .getVarValue(), executorConfigurator );
+            .getVarValue(), executorConfigurator, profile );
     }
 
     private String generateSubject( Project project, BuildResult build )

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/profile/DefaultProfileService.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/profile/DefaultProfileService.java?view=diff&rev=564003&r1=564002&r2=564003
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/profile/DefaultProfileService.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/profile/DefaultProfileService.java
Wed Aug  8 12:56:50 2007
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.maven.continuum.installation.InstallationService;
 import org.apache.maven.continuum.model.system.Installation;
 import org.apache.maven.continuum.model.system.Profile;
 import org.apache.maven.continuum.store.ContinuumObjectNotFoundException;
@@ -171,6 +172,26 @@
         {
             throw new ProfileException( e.getMessage(), e );
         }
+    }
+
+    public void addInstallationInProfile( Profile profile, Installation installation )
+        throws ProfileException
+    {
+        if ( InstallationService.JDK_TYPE.equals( installation.getType() ) )
+        {
+            setJdkInProfile( profile, installation );
+        }
+        else if ( InstallationService.MAVEN1_TYPE.equals( installation.getType() )
+            || InstallationService.MAVEN2_TYPE.equals( installation.getType() )
+            || InstallationService.ANT_TYPE.equals( installation.getType() ) )
+        {
+            setBuilderInProfile( profile, installation );
+        }
+        else
+        {
+            addEnvVarInProfile( profile, installation );
+        }
+
     }
 
 }

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/installation/DefaultInstallationServiceTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/installation/DefaultInstallationServiceTest.java?view=diff&rev=564003&r1=564002&r2=564003
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/installation/DefaultInstallationServiceTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/installation/DefaultInstallationServiceTest.java
Wed Aug  8 12:56:50 2007
@@ -41,22 +41,22 @@
 
     private static final String NEW_INSTALLATION_NAME = "newInstallation";
 
-    public Installation defaultInstallation;
+    //public Installation defaultInstallation;
 
     protected void setUp()
         throws Exception
     {
         super.setUp();
         getStore().eraseDatabase();
-        if ( getInstallationService().getInstallation( DEFAULT_INSTALLATION_NAME ) == null
)
+        /*if ( getInstallationService().getAllInstallations().isEmpty() )
         {
             defaultInstallation = createDefault();
             ContinuumStore store = getStore();
             defaultInstallation = store.addInstallation( defaultInstallation );
-        }
+        }*/
     }
 
-    private Installation createDefault()
+    private Installation createDefaultInstallation()
     {
         Installation installation = new Installation();
         installation.setType( "description" );
@@ -89,33 +89,22 @@
     public void testAddInstallation()
         throws Exception
     {
-        this.addInstallation( NEW_INSTALLATION_NAME, null, "bar", InstallationService.JDK_TYPE
);
-        Installation getted = getInstallationService().getInstallation( NEW_INSTALLATION_NAME
);
+        Installation added = this.addInstallation( NEW_INSTALLATION_NAME, null, "bar", InstallationService.JDK_TYPE
);
+        Installation getted = getInstallationService().getInstallation( added.getInstallationId()
);
         assertNotNull( getted );
         assertEquals( getInstallationService().getEnvVar( InstallationService.JDK_TYPE ),
getted.getVarName() );
         assertEquals( "bar", getted.getVarValue() );
     }
 
-    public void testgetOne()
-        throws Exception
-    {
-        Installation getted = getInstallationService().getInstallation( DEFAULT_INSTALLATION_NAME
);
-        assertNotNull( getted );
-        assertEquals( defaultInstallation.getType(), getted.getType() );
-        assertEquals( defaultInstallation.getName(), getted.getName() );
-        assertEquals( defaultInstallation.getVarName(), getted.getVarName() );
-        assertEquals( defaultInstallation.getVarValue(), getted.getVarValue() );
-    }
-
     public void testRemove()
         throws Exception
     {
         String name = "toremove";
-        this.addInstallation( name, "foo", "bar", InstallationService.JDK_TYPE );
-        Installation getted = getInstallationService().getInstallation( name );
+        Installation added = this.addInstallation( name, "foo", "bar", InstallationService.JDK_TYPE
);
+        Installation getted = getInstallationService().getInstallation( added.getInstallationId()
);
         assertNotNull( getted );
         getInstallationService().delete( getted );
-        getted = getInstallationService().getInstallation( name );
+        getted = getInstallationService().getInstallation( added.getInstallationId() );
         assertNull( getted );
 
     }
@@ -124,15 +113,15 @@
         throws Exception
     {
         String name = "toupdate";
-        this.addInstallation( name, "foo", "bar", InstallationService.JDK_TYPE );
-        Installation getted = getInstallationService().getInstallation( name );
+        Installation added = this.addInstallation( name, "foo", "bar", InstallationService.JDK_TYPE
);
+        Installation getted = getInstallationService().getInstallation( added.getInstallationId()
);
         assertNotNull( getted );
         assertEquals( getInstallationService().getEnvVar( InstallationService.JDK_TYPE ),
getted.getVarName() );
         assertEquals( "bar", getted.getVarValue() );
         getted.setVarName( "updatefoo" );
         getted.setVarValue( "updatedbar" );
         getInstallationService().update( getted );
-        getted = getInstallationService().getInstallation( name );
+        getted = getInstallationService().getInstallation( added.getInstallationId() );
         assertNotNull( getted );
         assertEquals( getInstallationService().getEnvVar( InstallationService.JDK_TYPE ),
getted.getVarName() );
         assertEquals( "updatedbar", getted.getVarValue() );
@@ -174,7 +163,7 @@
         {
             javaHome = System.getProperty( "java.home" );
         }
-        List<String> infos = installationService.getExecutorConfiguratorVersion( javaHome,
java );
+        List<String> infos = installationService.getExecutorConfiguratorVersion( javaHome,
java, null );
         System.out.println( infos );
         assertNotNull( infos );
     }
@@ -185,7 +174,7 @@
         InstallationService installationService = (InstallationService) lookup( InstallationService.ROLE,
"default" );
         ExecutorConfigurator java = installationService.getExecutorConfigurator( InstallationService.MAVEN2_TYPE
);
         String javaHome = System.getProperty( "M2_HOME" );
-        List<String> infos = installationService.getExecutorConfiguratorVersion( javaHome,
java );
+        List<String> infos = installationService.getExecutorConfiguratorVersion( javaHome,
java, null );
         assertNotNull( infos );
     }
 
@@ -195,7 +184,7 @@
 
         Installation installation = new Installation();
         installation.setType( InstallationService.JDK_TYPE );
-        installation.setName( "automatic" );
+        installation.setName( "automaticJdk" );
         installation.setVarName( "automaticvarName" );
         installation.setVarValue( "automaticvarValue" );
         installation = getInstallationService().add( installation, true );
@@ -203,6 +192,28 @@
         List<Profile> profiles = profileService.getAllProfiles();
         assertEquals( 1, profiles.size() );
         Profile profile = (Profile) profiles.get( 0 );
-        assertEquals( "automatic", profile.getName() );
+        assertEquals( "automaticJdk", profile.getName() );
+        Installation jdk = profile.getJdk();
+        assertNotNull( jdk );
+        assertEquals("automaticJdk", jdk.getName());
+    }
+    
+    public void testUpdateName()
+        throws Exception
+    {
+        Installation installation = new Installation();
+        installation.setType( InstallationService.JDK_TYPE );
+        installation.setName( "automatic" );
+        installation.setVarName( "automaticvarName" );
+        installation.setVarValue( "automaticvarValue" );
+        installation = getInstallationService().add( installation, true );
+        
+        installation.setName( "new name here" );
+        getInstallationService().update( installation );
+        
+        Installation getted = getInstallationService().getInstallation( installation.getInstallationId()
);
+        assertEquals( "new name here", getted.getName() );
+        
+
     }
 }

Modified: maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml?view=diff&rev=564003&r1=564002&r2=564003
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml (original)
+++ maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml Wed Aug  8 12:56:50 2007
@@ -1101,7 +1101,7 @@
             <!-- org.apache.maven.continuum.model.system. -->
             <multiplicity>*</multiplicity>
           </association>
-        </field>          
+        </field>
       </fields>
     </class>
 
@@ -1124,11 +1124,16 @@
           <name>varName</name>
           <version>1.1.0+</version>
           <type>String</type>
-        </field>          
-        <field jpox.primary-key="true" jpox.value-strategy="off">
+        </field>
+        <field>
           <name>name</name>
           <version>1.1.0+</version>
           <type>String</type>
+        </field>
+        <field jpox.primary-key="true">
+          <name>installationId</name>
+          <version>1.1.0+</version>
+          <type>int</type>
           <identifier>true</identifier>
         </field>
       </fields>

Modified: maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?view=diff&rev=564003&r1=564002&r2=564003
==============================================================================
--- maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
Wed Aug  8 12:56:50 2007
@@ -1135,7 +1135,7 @@
         updateObject( installation );
     }
 
-    public Installation getInstallationByName( String name )
+    public Installation getInstallation( int installationId )
         throws ContinuumStoreException, ContinuumObjectNotFoundException
     {
         PersistenceManager pm = getPersistenceManager();
@@ -1152,11 +1152,11 @@
 
             query.declareImports( "import java.lang.String" );
 
-            query.declareParameters( "String name" );
+            query.declareParameters( "int installationId" );
 
-            query.setFilter( "this.name == name" );
+            query.setFilter( "this.installationId == installationId" );
 
-            Collection result = (Collection) query.execute( name );
+            Collection result = (Collection) query.execute( installationId );
 
             if ( result.size() == 0 )
             {

Modified: maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java?view=diff&rev=564003&r1=564002&r2=564003
==============================================================================
--- maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
(original)
+++ maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
Wed Aug  8 12:56:50 2007
@@ -438,14 +438,14 @@
         Installation testOne = createTestInstallation( name, InstallationService.JDK_TYPE,
"varName", "varValue" );
         testOne = store.addInstallation( testOne );
 
-        Installation fromStore = store.getInstallationByName( name );
+        Installation fromStore = store.getInstallation( testOne.getInstallationId() );
         assertInstallationEquals( testOne, fromStore );
 
         fromStore.setVarName( "JAVA_HOME" );
         fromStore.setVarValue( "/usr/local/jdk1.5.0_08" );
         store.updateInstallation( fromStore );
 
-        Installation updatedFromStore = store.getInstallationByName( name );
+        Installation updatedFromStore = store.getInstallation( testOne.getInstallationId()
);
 
         assertInstallationEquals( fromStore, updatedFromStore );
     }
@@ -458,7 +458,7 @@
         testOne = store.addInstallation( testOne );
 
         store.removeInstallation( testOne );
-        Installation fromStore = store.getInstallationByName( name );
+        Installation fromStore = store.getInstallation( testOne.getInstallationId() );
         assertNull( fromStore );
     }
 
@@ -520,7 +520,7 @@
 
         store.removeInstallation( testOne );
 
-        Installation fromStore = store.getInstallationByName( nameFirstInst );
+        Installation fromStore = store.getInstallation( testOne.getInstallationId() );
         assertNull( fromStore );
 
         firstGetted = store.getProfile( firstProfile.getId() );

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/InstallationAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/InstallationAction.java?view=diff&rev=564003&r1=564002&r2=564003
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/InstallationAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/InstallationAction.java
Wed Aug  8 12:56:50 2007
@@ -84,7 +84,7 @@
     public String edit()
         throws Exception
     {
-        this.installation = installationService.getInstallation( installation.getName() );
+        this.installation = installationService.getInstallation( installation.getInstallationId()
);
 
         if ( this.installation != null )
         {
@@ -107,26 +107,23 @@
     public String save()
         throws Exception
     {
-        Installation installationToSave = installationService.getInstallation( this.installation.getName()
);
-        if ( installationToSave == null )
+        if ( installation.getInstallationId() == 0 )
         {
             installationService.add( installation, this.automaticProfile );
         }
         else
         {
-            installationToSave.setName( installation.getName() );
-            installationToSave.setVarName( installation.getVarName() );
-            installationToSave.setVarValue( installation.getVarValue() );
-            installationService.update( installationToSave );
+            installationService.update( installation );
+            return "edit";
         }
-        this.installations = installationService.getAllInstallations();
+        //this.installations = installationService.getAllInstallations();
         return SUCCESS;
     }
 
     public String delete()
         throws Exception
     {
-        Installation installationToDelete = installationService.getInstallation( installation.getName()
);
+        Installation installationToDelete = installationService.getInstallation( installation.getInstallationId()
);
         installationService.delete( installationToDelete );
         this.installations = installationService.getAllInstallations();
         return SUCCESS;

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/ProfileAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/ProfileAction.java?view=diff&rev=564003&r1=564002&r2=564003
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/ProfileAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/ProfileAction.java
Wed Aug  8 12:56:50 2007
@@ -81,7 +81,7 @@
 
     private Profile profile;
 
-    private String installationName;
+    private int installationId;
 
     private List<Installation> allInstallations;
 
@@ -130,7 +130,7 @@
         {
             // olamy : the only this to change here is the profile
             // but in the UI maybe some installations has been we retrieve it
-            // and only set the name
+            // and only set the name related to CONTINUUM-1361
             String name = profile.getName();
             profile = profileService.getProfile( profile.getId() );
             profile.setName( name );
@@ -151,21 +151,9 @@
     public String addInstallation()
         throws Exception
     {
-        Installation installation = installationService.getInstallation( this.installationName
);
-        if ( InstallationService.JDK_TYPE.equals( installation.getType() ) )
-        {
-            profileService.setJdkInProfile( profile, installation );
-        }
-        else if ( InstallationService.MAVEN1_TYPE.equals( installation.getType() ) ||
-            InstallationService.MAVEN2_TYPE.equals( installation.getType() ) ||
-            InstallationService.ANT_TYPE.equals( installation.getType() ) )
-        {
-            profileService.setBuilderInProfile( profile, installation );
-        }
-        else
-        {
-            profileService.addEnvVarInProfile( profile, installation );
-        }
+        Installation installation = installationService.getInstallation( this.getInstallationId()
);
+        profileService.addInstallationInProfile( profile, installation );
+        // read again
         this.profile = profileService.getProfile( profile.getId() );
         return SUCCESS;
     }
@@ -174,7 +162,7 @@
         throws Exception
     {
 
-        Installation installation = installationService.getInstallation( this.installationName
);
+        Installation installation = installationService.getInstallation( this.getInstallationId()
);
         Profile stored = profileService.getProfile( profile.getId() );
         if ( InstallationService.JDK_TYPE.equals( installation.getType() ) )
         {
@@ -192,9 +180,8 @@
             // TODO move this in ProfileService
             List<Installation> storedEnvVars = stored.getEnvironmentVariables();
             List<Installation> newEnvVars = new ArrayList<Installation>();
-            for ( Iterator<Installation> iterator = storedEnvVars.iterator(); iterator.hasNext();
)
+            for ( Installation storedInstallation : storedEnvVars )
             {
-                Installation storedInstallation = iterator.next();
                 if ( !StringUtils.equals( storedInstallation.getName(), installation.getName()
) )
                 {
                     newEnvVars.add( storedInstallation );
@@ -291,13 +278,13 @@
         this.profileInstallations = profileInstallations;
     }
 
-    public String getInstallationName()
+    public int getInstallationId()
     {
-        return installationName;
+        return installationId;
     }
 
-    public void setInstallationName( String installationName )
+    public void setInstallationId( int installationId )
     {
-        this.installationName = installationName;
+        this.installationId = installationId;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/validator/InstallationValidator.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/validator/InstallationValidator.java?view=diff&rev=564003&r1=564002&r2=564003
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/validator/InstallationValidator.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/validator/InstallationValidator.java
Wed Aug  8 12:56:50 2007
@@ -78,7 +78,7 @@
                 {
                     // just try to get version infos to validate path is valid
                     List<String> versionInfos = installationService
-                        .getExecutorConfiguratorVersion( varValue, executorConfigurator );
+                        .getExecutorConfiguratorVersion( varValue, executorConfigurator,
null );
                 }
             }
         }

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml?view=diff&rev=564003&r1=564002&r2=564003
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml Wed Aug  8 12:56:50
2007
@@ -564,7 +564,8 @@
       
     <action name="saveInstallation" class="installation" method="save">
       <result name="input">/WEB-INF/jsp/admin/editInstallation.jsp</result>
-      <result name="success">/WEB-INF/jsp/admin/installationsList.jsp</result>
+      <result name="edit">/WEB-INF/jsp/admin/editInstallation.jsp</result>
+      <result name="success" type="redirect-action">installationsList</result>
     </action> 
     <action name="deleteInstallation" class="installation" method="delete">
       <result name="input">/WEB-INF/jsp/admin/installationsList.jsp</result>

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editInstallation.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editInstallation.jsp?view=diff&rev=564003&r1=564002&r2=564003
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editInstallation.jsp
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editInstallation.jsp
Wed Aug  8 12:56:50 2007
@@ -46,17 +46,10 @@
 
         <table>
           <tbody>
-            <ww:if test="nameUpdatable">
-          
-              <ww:textfield label="%{getText('installation.name.label')}" name="installation.name"
+            <ww:hidden name="installation.installationId" />         
+            <ww:textfield label="%{getText('installation.name.label')}" name="installation.name"
                             required="true"/>
-
-            </ww:if>
-            <ww:else>
-              <ww:textfield label="%{getText('installation.name.label')}" name="installation.name"
-                            required="true" readonly="true"/>            
-            </ww:else>
-           
+          
             <ww:select label="%{getText('installation.type.label')}" name="installation.type"
list="typesLabels" />
 
             <ww:if test="varNameUpdatable">

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editProfile.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editProfile.jsp?view=diff&rev=564003&r1=564002&r2=564003
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editProfile.jsp
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editProfile.jsp
Wed Aug  8 12:56:50 2007
@@ -65,7 +65,7 @@
           </ww:form>
           </td>
         </tr>
-        <ww:if test="profile.id != '' && ${not empty allInstallations} ">
+        <ww:if test="profile.id != 0">
           <tr>
             <td>
               <div class="axial">
@@ -84,14 +84,14 @@
                                   autoIncludeParameters="false">
                           <ec:row highlightRow="true">
                             <ec:column property="nameEdit" title="Name" style="white-space:
nowrap" width="50%">
-                              <a href="editInstallation!edit.action?installation.name=<c:out
value="${profileInstallation.name}"/>">
+                              <a href="editInstallation!edit.action?installation.installationId=<c:out
value="${profileInstallation.installationId}"/>">
                                 <c:out value="${profileInstallation.name}"/>
                               </a>
                                (<c:out value="${profileInstallation.varValue}"/>)
                             </ec:column>
                             <ec:column property="type" title="Type" style="white-space:
nowrap" width="49%"/>
                             <ec:column property="id" title="&nbsp;" width="1%">
-                              <a href="removeProfileInstallation!removeInstallation.action?profile.id=<c:out
value="${profile.id}"/>&installationName=<c:out value="${profileInstallation.name}"/>">
+                              <a href="removeProfileInstallation!removeInstallation.action?profile.id=<c:out
value="${profile.id}"/>&installationId=<c:out value="${profileInstallation.installationId}"/>">
                                 <img src="<ww:url value='/images/delete.gif'/>"
alt="<ww:text name='delete'/>" title="<ww:text name='delete'/>" border="0" />
                               </a>                    
                             </ec:column>        
@@ -105,12 +105,11 @@
                   <ww:hidden name="profile.id" />
                   <div class="functnbar3">
                     <!-- can't use default profile to display this select -->
-                    <ww:select theme="profile" name="installationName" list="allInstallations"
listKey="name" listValue="name" />
+                    <ww:select theme="profile" name="installationId" list="allInstallations"
listKey="installationId" listValue="name" />
                     <ww:submit value="%{getText('add')}"/>
                   </div>
                 </ww:form>
               </div>              
-
             </td>
           </tr>
         </ww:if>

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/installationsList.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/installationsList.jsp?view=diff&rev=564003&r1=564002&r2=564003
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/installationsList.jsp
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/installationsList.jsp
Wed Aug  8 12:56:50 2007
@@ -48,12 +48,12 @@
         <ec:column property="varValue" title="Value/Path" style="white-space: nowrap"
/>
         
         <ec:column property="id" title="&nbsp;" width="1%">
-          <a href="editInstallation!edit.action?installation.name=<c:out value="${installation.name}"/>">
+          <a href="editInstallation!edit.action?installation.installationId=<c:out
value="${installation.installationId}"/>">
             <img src="<ww:url value='/images/edit.gif'/>" alt="<ww:text name='edit'/>"
title="<ww:text name='edit'/>" border="0" />
           </a>  
         </ec:column>   
         <ec:column property="id" title="&nbsp;" width="1%">
-          <a href="deleteInstallation!delete.action?installation.name=<c:out value="${installation.name}"/>">
+          <a href="deleteInstallation!delete.action?installation.installationId=<c:out
value="${installation.installationId}"/>">
             <img src="<ww:url value='/images/delete.gif'/>" alt="<ww:text name='delete'/>"
title="<ww:text name='delete'/>" border="0" />
           </a>  
         </ec:column>             



Mime
View raw message