Return-Path: Delivered-To: apmail-maven-continuum-commits-archive@www.apache.org Received: (qmail 78443 invoked from network); 8 Aug 2007 19:57:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Aug 2007 19:57:39 -0000 Received: (qmail 31444 invoked by uid 500); 8 Aug 2007 19:57:37 -0000 Delivered-To: apmail-maven-continuum-commits-archive@maven.apache.org Received: (qmail 31422 invoked by uid 500); 8 Aug 2007 19:57:37 -0000 Mailing-List: contact continuum-commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: continuum-dev@maven.apache.org Delivered-To: mailing list continuum-commits@maven.apache.org Received: (qmail 31368 invoked by uid 99); 8 Aug 2007 19:57:37 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Aug 2007 12:57:37 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Aug 2007 19:57:29 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 08C961A981A; Wed, 8 Aug 2007 12:57:09 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: continuum-commits@maven.apache.org From: evenisse@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070808195710.08C961A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 olamy @@ -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 getAllInstallations() @@ -91,7 +92,7 @@ * @return the cli output of $path/ec.relativePath.ec.executable ec.versionArgument * @throws InstallationException */ - public List getExecutorConfiguratorVersion( String path, ExecutorConfigurator executorConfigurator ) + public List 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 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 getEnvVars( Profile profile ) + { + Map environnments = new HashMap(); + 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 getExecutorConfiguratorVersion( String path, ExecutorConfigurator executorConfigurator ) + @SuppressWarnings ("unchecked") + public List 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 environments = getEnvVars( profile ); + // no null check we use a private method just here + for ( Iterator 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 infos = installationService.getExecutorConfiguratorVersion( javaHome, java ); + List 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 infos = installationService.getExecutorConfiguratorVersion( javaHome, java ); + List 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 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 @@ * - + @@ -1124,11 +1124,16 @@ varName 1.1.0+ String - - + + name 1.1.0+ String + + + installationId + 1.1.0+ + int true 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 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 storedEnvVars = stored.getEnvironmentVariables(); List newEnvVars = new ArrayList(); - for ( Iterator 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 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 @@ /WEB-INF/jsp/admin/editInstallation.jsp - /WEB-INF/jsp/admin/installationsList.jsp + /WEB-INF/jsp/admin/editInstallation.jsp + installationsList /WEB-INF/jsp/admin/installationsList.jsp 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 @@ - - - + - - - - - - + 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 @@ - + 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 @@ - "> + "> <ww:text name='edit'/> - "> + "> <ww:text name='delete'/>
@@ -84,14 +84,14 @@ autoIncludeParameters="false"> - "> + "> () - &installationName="> + &installationId="> <ww:text name='delete'/> @@ -105,12 +105,11 @@
- +
-