Author: evenisse
Date: Mon Jun 25 06:55:58 2007
New Revision: 550503
URL: http://svn.apache.org/viewvc?view=rev&rev=550503
Log:
[CONTINUUM-44] Provides some improvements in profiles configuration/usage :
* validation of the user entry when saving installation (jdk path, M2_HOME value etc..)
* adding information on the builder use (like mvn -v) in the mail
* change edit profile screen to not display installation (Add button) in case of profile creation
* create a class ExecutorConfigurator to store configuration regarding executable informations.
Submitted by: Olivier Lamy
Added:
maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/execution/ExecutorConfigurator.java (with props)
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/validator/InstallationValidator.java (with props)
maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/InstallationAction-saveInstallation-validation.xml (with props)
maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/InstallationAction.properties (with props)
maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/ProfileAction-saveProfile-validation.xml (with props)
maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/ProfileAction.properties (with props)
Modified:
maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/installation/InstallationService.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/ant/AntBuildExecutor.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.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/resources/org/apache/maven/continuum/notification/mail/templates/common.vm
maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutorTest.java
maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/installation/DefaultInstallationServiceTest.java
maven/continuum/trunk/continuum-webapp/src/main/resources/validators.xml
maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editProfile.jsp
Added: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/execution/ExecutorConfigurator.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/execution/ExecutorConfigurator.java?view=auto&rev=550503
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/execution/ExecutorConfigurator.java (added)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/execution/ExecutorConfigurator.java Mon Jun 25 06:55:58 2007
@@ -0,0 +1,106 @@
+package org.apache.maven.continuum.execution;
+
+/*
+ * 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.
+ */
+
+/**
+ * @author olamy
+ * @version $Id$
+ * @since 19 juin 07
+ */
+public class ExecutorConfigurator
+{
+ private String executable;
+
+ private String relativePath;
+
+ private String envVar;
+
+ private String versionArgument;
+
+
+ public ExecutorConfigurator()
+ {
+ // nothing
+ }
+
+ public ExecutorConfigurator( String executable, String relativePath, String envVar, String versionArgument )
+ {
+ this.executable = executable;
+ this.relativePath = relativePath;
+ this.envVar = envVar;
+ this.versionArgument = versionArgument;
+ }
+
+ /**
+ * @return mvn for maven2 ExecutorConfigurator
+ */
+ public String getExecutable()
+ {
+ return executable;
+ }
+
+ public void setExecutable( String executable )
+ {
+ this.executable = executable;
+ }
+
+ /**
+ * @return bin for maven2 ExecutorConfigurator
+ */
+ public String getRelativePath()
+ {
+ return relativePath;
+ }
+
+ public void setRelativePath( String relativePath )
+ {
+ this.relativePath = relativePath;
+ }
+
+ /**
+ * @return M2_HOME for maven2 ExecutorConfigurator
+ */
+ public String getEnvVar()
+ {
+ return envVar;
+ }
+
+ public void setEnvVar( String envVar )
+ {
+ this.envVar = envVar;
+ }
+
+ /**
+ * @return the versionArgument
+ */
+ public String getVersionArgument()
+ {
+ return versionArgument;
+ }
+
+ /**
+ * @param versionArgument the versionArgument to set
+ */
+ public void setVersionArgument( String versionArgument )
+ {
+ this.versionArgument = versionArgument;
+ }
+
+}
Propchange: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/execution/ExecutorConfigurator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/execution/ExecutorConfigurator.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
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=550503&r1=550502&r2=550503
==============================================================================
--- 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 Mon Jun 25 06:55:58 2007
@@ -1,9 +1,5 @@
package org.apache.maven.continuum.installation;
-import org.apache.maven.continuum.model.system.Installation;
-
-import java.util.List;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -22,6 +18,12 @@
* specific language governing permissions and limitations
* under the License.
*/
+
+import org.apache.maven.continuum.execution.ExecutorConfigurator;
+import org.apache.maven.continuum.model.system.Installation;
+
+import java.util.List;
+
/**
* @author olamy
* @version $Id$
@@ -59,6 +61,13 @@
public String getEnvVar( String type );
/**
+ * @param type
+ * @return ExecutorConfigurator or null if unknown type
+ */
+ public ExecutorConfigurator getExecutorConfigurator( String type );
+
+
+ /**
* @param installation
* @return output of JAVA_HOME/bin/java -version (JAVA_HOME = installation.getVarValue()
* @throws InstallationException
@@ -71,6 +80,15 @@
* @throws InstallationException
*/
public List getDefaultJdkInformations()
+ throws InstallationException;
+
+ /**
+ * @param path
+ * @param executorConfigurator (ec)
+ * @return the cli output of $path/ec.relativePath.ec.executable ec.versionArgument
+ * @throws InstallationException
+ */
+ public List getExecutorConfiguratorVersion( String path, ExecutorConfigurator executorConfigurator )
throws InstallationException;
}
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/ant/AntBuildExecutor.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/ant/AntBuildExecutor.java?view=diff&rev=550503&r1=550502&r2=550503
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/ant/AntBuildExecutor.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/ant/AntBuildExecutor.java Mon Jun 25 06:55:58 2007
@@ -69,7 +69,8 @@
public ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput )
throws ContinuumBuildExecutorException
{
- String executable = "ant";
+ String executable = getInstallationService().getExecutorConfigurator( InstallationService.ANT_TYPE )
+ .getExecutable();
String arguments = "";
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java?view=diff&rev=550503&r1=550502&r2=550503
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java Mon Jun 25 06:55:58 2007
@@ -68,7 +68,8 @@
public ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput )
throws ContinuumBuildExecutorException
{
- String executable = "maven";
+ String executable = getInstallationService().getExecutorConfigurator( InstallationService.MAVEN1_TYPE )
+ .getExecutable();
String arguments = "";
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java?view=diff&rev=550503&r1=550502&r2=550503
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java Mon Jun 25 06:55:58 2007
@@ -100,7 +100,8 @@
public ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput )
throws ContinuumBuildExecutorException
{
- String executable = "mvn";
+ String executable = getInstallationService().getExecutorConfigurator( InstallationService.MAVEN2_TYPE )
+ .getExecutable();
String arguments = "";
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=550503&r1=550502&r2=550503
==============================================================================
--- 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 Mon Jun 25 06:55:58 2007
@@ -19,9 +19,11 @@
* under the License.
*/
+import org.apache.maven.continuum.execution.ExecutorConfigurator;
import org.apache.maven.continuum.model.system.Installation;
import org.apache.maven.continuum.store.ContinuumStore;
import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import org.codehaus.plexus.util.StringUtils;
@@ -47,15 +49,15 @@
* @since 13 juin 07
*/
public class DefaultInstallationService
+ extends AbstractLogEnabled
implements InstallationService, Initializable
{
-
/**
* @plexus.requirement role-hint="jdo"
*/
private ContinuumStore store;
- private Map typesValues;
+ private Map typesValues;
// ---------------------------------------------
// Plexus lifecycle
@@ -64,13 +66,17 @@
public void initialize()
throws InitializationException
{
- // TODO move this in a component configuration
- this.typesValues = new HashMap();
- this.typesValues.put( InstallationService.ANT_TYPE, "ANT_HOME" );
+ this.typesValues = new HashMap();
+ this.typesValues.put( InstallationService.ANT_TYPE,
+ new ExecutorConfigurator( "ant", "bin", "ANT_HOME", "-version" ) );
+
this.typesValues.put( InstallationService.ENVVAR_TYPE, null );
- this.typesValues.put( InstallationService.JDK_TYPE, "JAVA_HOME" );
- this.typesValues.put( InstallationService.MAVEN1_TYPE, "MAVEN_HOME" );
- this.typesValues.put( InstallationService.MAVEN2_TYPE, "M2_HOME" );
+ this.typesValues.put( InstallationService.JDK_TYPE,
+ new ExecutorConfigurator( "java", "bin", "JAVA_HOME", "-version" ) );
+ this.typesValues.put( InstallationService.MAVEN1_TYPE,
+ new ExecutorConfigurator( "maven", "bin", "MAVEN_HOME", "-v" ) );
+ this.typesValues
+ .put( InstallationService.MAVEN2_TYPE, new ExecutorConfigurator( "mvn", "bin", "M2_HOME", "-v" ) );
}
/**
@@ -81,7 +87,7 @@
{
try
{
- String envVarName = this.typesValues.get( installation.getType() );
+ String envVarName = this.getEnvVar( installation.getType() );
// override with the defined var name for defined types
if ( StringUtils.isNotEmpty( envVarName ) )
{
@@ -162,7 +168,7 @@
stored.setName( installation.getName() );
stored.setType( installation.getType() );
- String envVarName = this.typesValues.get( installation.getType() );
+ String envVarName = this.getEnvVar( installation.getType() );
// override with the defined var name for defined types
if ( StringUtils.isNotEmpty( envVarName ) )
{
@@ -183,11 +189,20 @@
}
/**
+ * @see org.apache.maven.continuum.installation.InstallationService#getExecutorConfigurator(java.lang.String)
+ */
+ public ExecutorConfigurator getExecutorConfigurator( String type )
+ {
+ return this.typesValues.get( type );
+ }
+
+ /**
* @see org.apache.maven.continuum.installation.InstallationService#getEnvVar(java.lang.String)
*/
public String getEnvVar( String type )
{
- return (String) this.typesValues.get( type );
+ ExecutorConfigurator executorConfigurator = this.typesValues.get( type );
+ return executorConfigurator == null ? null : executorConfigurator.getEnvVar();
}
// -------------------------------------------------------------
@@ -195,6 +210,8 @@
// -------------------------------------------------------------
/**
+ * TODO replace with calling getExecutorConfiguratorVersion
+ *
* @see org.apache.maven.continuum.installation.InstallationService#getDefaultJdkInformations()
*/
public List getDefaultJdkInformations()
@@ -218,6 +235,8 @@
}
/**
+ * TODO replace with calling getExecutorConfiguratorVersion
+ *
* @see org.apache.maven.continuum.installation.InstallationService#getJdkInformations(org.apache.maven.continuum.model.system.Installation)
*/
public List getJdkInformations( Installation installation )
@@ -237,6 +256,11 @@
}
}
+ /**
+ * @param javaHome
+ * @return
+ * @throws CommandLineException
+ */
private List getJavaHomeInformations( String javaHome )
throws CommandLineException
{
@@ -276,4 +300,61 @@
}
return cliOutput;
}
+
+ /**
+ * @see org.apache.maven.continuum.installation.InstallationService#getExecutorConfiguratorVersion(java.lang.String,org.apache.maven.continuum.execution.ExecutorConfigurator)
+ */
+ public List getExecutorConfiguratorVersion( String path, ExecutorConfigurator executorConfigurator )
+ throws InstallationException
+ {
+ if ( executorConfigurator == null )
+ {
+ return Collections.EMPTY_LIST;
+ }
+ if ( executorConfigurator.getExecutable() == null )
+ {
+ return Collections.EMPTY_LIST;
+ }
+ StringBuilder executable = new StringBuilder();
+ try
+ {
+ Commandline commandline = new Commandline();
+ if ( StringUtils.isNotEmpty( path ) )
+ {
+ executable.append( path ).append( File.separator );
+ executable.append( executorConfigurator.getRelativePath() + File.separator );
+ commandline.addEnvironment( executorConfigurator.getEnvVar(), path );
+ }
+ executable = executable.append( executorConfigurator.getExecutable() );
+ commandline.setExecutable( executable.toString() );
+ commandline.addArguments( new String[]{executorConfigurator.getVersionArgument()} );
+ final List cliOutput = new ArrayList();
+ //TODO ShellCommandHelper ?
+ int result = CommandLineUtils.executeCommandLine( commandline, new StreamConsumer()
+ {
+ public void consumeLine( String line )
+ {
+ cliOutput.add( line );
+ }
+ }, new StreamConsumer()
+ {
+ public void consumeLine( String line )
+ {
+ cliOutput.add( line );
+ }
+ } );
+ if ( result != 0 )
+ {
+ throw new InstallationException( "cli to get " + executable + " version return code " + result );
+ }
+ return cliOutput;
+ }
+ catch ( CommandLineException e )
+ {
+ getLogger().error(
+ "fail to execute " + executable + " with arg " + executorConfigurator.getVersionArgument() );
+ throw new InstallationException( e.getMessage(), e );
+ }
+ }
+
}
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=550503&r1=550502&r2=550503
==============================================================================
--- 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 Mon Jun 25 06:55:58 2007
@@ -21,11 +21,17 @@
import org.apache.maven.continuum.Continuum;
import org.apache.maven.continuum.configuration.ConfigurationService;
+import org.apache.maven.continuum.execution.ExecutorConfigurator;
+import org.apache.maven.continuum.execution.ant.AntBuildExecutor;
+import org.apache.maven.continuum.execution.maven.m1.MavenOneBuildExecutor;
+import org.apache.maven.continuum.execution.maven.m2.MavenTwoBuildExecutor;
import org.apache.maven.continuum.installation.InstallationException;
+import org.apache.maven.continuum.installation.InstallationService;
import org.apache.maven.continuum.model.project.BuildDefinition;
import org.apache.maven.continuum.model.project.BuildResult;
import org.apache.maven.continuum.model.project.Project;
import org.apache.maven.continuum.model.project.ProjectNotifier;
+import org.apache.maven.continuum.model.system.Installation;
import org.apache.maven.continuum.model.system.Profile;
import org.apache.maven.continuum.notification.AbstractContinuumNotifier;
import org.apache.maven.continuum.notification.ContinuumNotificationDispatcher;
@@ -46,6 +52,7 @@
import java.io.StringWriter;
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -300,7 +307,9 @@
// TODO only in case of a java project ?
context.put( "javaHomeInformations", getJavaHomeInformations( buildDefinition ) );
- // TODO add other informations on profile : builder version other envVars used
+ context.put( "builderVersions", getBuilderVersion( buildDefinition, project ) );
+
+ // TODO put other profile env var could be a security if they provide passwords ?
// ----------------------------------------------------------------------
// Generate
@@ -352,6 +361,53 @@
return continuum.getInstallationService().getDefaultJdkInformations();
}
return continuum.getInstallationService().getJdkInformations( profile.getJdk() );
+ }
+
+ private List getBuilderVersion( BuildDefinition buildDefinition, Project project )
+ throws InstallationException
+ {
+
+ ExecutorConfigurator executorConfigurator = null;
+ Installation builder = null;
+ if ( buildDefinition != null )
+ {
+ Profile profile = buildDefinition.getProfile();
+ if ( profile != null )
+ {
+ builder = profile.getBuilder();
+
+ }
+ }
+ if ( builder != null )
+ {
+ executorConfigurator = continuum.getInstallationService().getExecutorConfigurator( builder.getType() );
+ }
+ else
+ {
+ // depends on ExecutorId
+ if ( MavenTwoBuildExecutor.ID.equals( project.getExecutorId() ) )
+ {
+ executorConfigurator = continuum.getInstallationService()
+ .getExecutorConfigurator( InstallationService.MAVEN2_TYPE );
+ }
+ else if ( MavenOneBuildExecutor.ID.equals( project.getExecutorId() ) )
+ {
+ executorConfigurator = continuum.getInstallationService()
+ .getExecutorConfigurator( InstallationService.MAVEN1_TYPE );
+ }
+ else if ( AntBuildExecutor.ID.equals( project.getExecutorId() ) )
+ {
+ executorConfigurator = continuum.getInstallationService()
+ .getExecutorConfigurator( InstallationService.ANT_TYPE );
+ }
+ else
+ {
+ return Arrays.asList( new String[]{"No builder defined"} );
+ }
+ }
+
+ return continuum.getInstallationService().getExecutorConfiguratorVersion( builder == null ? null : builder
+ .getVarValue(), executorConfigurator );
}
private String generateSubject( Project project, BuildResult build )
Modified: maven/continuum/trunk/continuum-core/src/main/resources/org/apache/maven/continuum/notification/mail/templates/common.vm
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/resources/org/apache/maven/continuum/notification/mail/templates/common.vm?view=diff&rev=550503&r1=550502&r2=550503
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/resources/org/apache/maven/continuum/notification/mail/templates/common.vm (original)
+++ maven/continuum/trunk/continuum-core/src/main/resources/org/apache/maven/continuum/notification/mail/templates/common.vm Mon Jun 25 06:55:58 2007
@@ -34,7 +34,12 @@
Java Home version :
#foreach ( $javaHomeInformation in $javaHomeInformations )
$javaHomeInformation
- #end
+ #end
+
+ Builder version :
+ #foreach ( $builderVersion in $builderVersions )
+ $builderVersion
+ #end
#if ( $build.scmResult )
****************************************************************************
Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutorTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutorTest.java?view=diff&rev=550503&r1=550502&r2=550503
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutorTest.java (original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutorTest.java Mon Jun 25 06:55:58 2007
@@ -60,18 +60,26 @@
public void setUp()
throws Exception
{
- super.setUp();
+ try
+ {
+ super.setUp();
- projectBuilder =
- (ContinuumProjectBuilder) lookup( ContinuumProjectBuilder.ROLE, MavenTwoContinuumProjectBuilder.ID );
+ projectBuilder =
+ (ContinuumProjectBuilder) lookup( ContinuumProjectBuilder.ROLE, MavenTwoContinuumProjectBuilder.ID );
- buildQueue = (TaskQueue) lookup( TaskQueue.ROLE, "build-project" );
+ buildQueue = (TaskQueue) lookup( TaskQueue.ROLE, "build-project" );
- taskQueueExecutor = (TaskQueueExecutor) lookup( TaskQueueExecutor.ROLE, "build-project" );
+ taskQueueExecutor = (TaskQueueExecutor) lookup( TaskQueueExecutor.ROLE, "build-project" );
- continuumStore = (ContinuumStore) lookup( ContinuumStore.ROLE );
+ continuumStore = (ContinuumStore) lookup( ContinuumStore.ROLE, "jdo" );
- actionManager = (ActionManager) lookup( ActionManager.ROLE );
+ actionManager = (ActionManager) lookup( ActionManager.ROLE );
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ throw e;
+ }
}
public void testAutomaticCancellation()
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=550503&r1=550502&r2=550503
==============================================================================
--- 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 Mon Jun 25 06:55:58 2007
@@ -1,6 +1,7 @@
package org.apache.maven.continuum.installation;
import org.apache.maven.continuum.AbstractContinuumTest;
+import org.apache.maven.continuum.execution.ExecutorConfigurator;
import org.apache.maven.continuum.model.system.Installation;
import org.apache.maven.continuum.store.ContinuumStore;
@@ -153,6 +154,27 @@
installation.setVarValue( javaHome );
List infos = installationService.getJdkInformations( installation );
+ assertNotNull( infos );
+ }
+
+ public void testgetJdkInformationsWithCommonMethod()
+ throws Exception
+ {
+ InstallationService installationService = (InstallationService) lookup( InstallationService.ROLE, "default" );
+ ExecutorConfigurator java = installationService.getExecutorConfigurator( InstallationService.JDK_TYPE );
+ String javaHome = System.getProperty( "JAVA_HOME" );
+ List infos = installationService.getExecutorConfiguratorVersion( javaHome, java );
+ System.out.println( infos );
+ assertNotNull( infos );
+ }
+
+ public void testgetMvnVersionWithCommonMethod()
+ throws Exception
+ {
+ 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 );
assertNotNull( infos );
}
}
Added: 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=auto&rev=550503
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/validator/InstallationValidator.java (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/validator/InstallationValidator.java Mon Jun 25 06:55:58 2007
@@ -0,0 +1,111 @@
+package org.apache.maven.continuum.web.validator;
+
+/*
+ * 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.
+ */
+
+import com.opensymphony.xwork.validator.ValidationException;
+import com.opensymphony.xwork.validator.validators.ValidatorSupport;
+import org.apache.maven.continuum.execution.ExecutorConfigurator;
+import org.apache.maven.continuum.installation.InstallationException;
+import org.apache.maven.continuum.installation.InstallationService;
+import org.codehaus.plexus.logging.LogEnabled;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.util.List;
+
+
+/**
+ * @author olamy
+ * @version $Id$
+ * @plexus.component role="com.opensymphony.xwork.validator.Validator" role-hint="org.apache.maven.continuum.web.validator.InstallationValidator"
+ * @since 19 juin 07
+ */
+public class InstallationValidator
+ extends ValidatorSupport
+ implements LogEnabled
+{
+ private String fieldName;
+
+ private Logger logger;
+
+ /**
+ * @plexus.requirement role-hint="default"
+ */
+ private InstallationService installationService;
+
+ /**
+ * @see com.opensymphony.xwork.validator.Validator#validate(java.lang.Object)
+ */
+ public void validate( Object object )
+ throws ValidationException
+ {
+ String name = (String) this.getFieldValue( "installation.name", object );
+ if ( StringUtils.isEmpty( name ) )
+ {
+ // nothing empty name
+ return;
+ }
+
+ String varValue = (String) this.getFieldValue( "installation.varValue", object );
+
+ // TODO validating varValue != null depending on type (not null for envVar)
+
+ String type = (String) this.getFieldValue( "installation.type", object );
+
+ ExecutorConfigurator executorConfigurator = installationService.getExecutorConfigurator( type );
+ try
+ {
+ if ( executorConfigurator != null )
+ {
+ if ( executorConfigurator.getVersionArgument() != null )
+ {
+ // just try to get version infos to validate path is valid
+ List versionInfos = installationService
+ .getExecutorConfiguratorVersion( varValue, executorConfigurator );
+ }
+ }
+ }
+ catch ( InstallationException e )
+ {
+ String message = getMessage( getMessageKey() ) + e.getMessage();
+ logger.error( message );
+ addFieldError( "installation.varValue", message );
+ }
+ }
+
+
+ public String getFieldName()
+ {
+ return fieldName;
+ }
+
+ public void setFieldName( String fieldName )
+ {
+ this.fieldName = fieldName;
+ }
+
+ /**
+ * @see org.codehaus.plexus.logging.LogEnabled#enableLogging(org.codehaus.plexus.logging.Logger)
+ */
+ public void enableLogging( Logger logger )
+ {
+ this.logger = logger;
+ }
+}
Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/validator/InstallationValidator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/validator/InstallationValidator.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/InstallationAction-saveInstallation-validation.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/InstallationAction-saveInstallation-validation.xml?view=auto&rev=550503
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/InstallationAction-saveInstallation-validation.xml (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/InstallationAction-saveInstallation-validation.xml Mon Jun 25 06:55:58 2007
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/InstallationAction-saveInstallation-validation.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/InstallationAction-saveInstallation-validation.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/InstallationAction.properties
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/InstallationAction.properties?view=auto&rev=550503
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/InstallationAction.properties (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/InstallationAction.properties Mon Jun 25 06:55:58 2007
@@ -0,0 +1,21 @@
+#
+# 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.
+#
+
+installation.name.required = You must define a name.
+installation.varValue.version.failed = Failed to validate installation, check server log.
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/InstallationAction.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/InstallationAction.properties
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/ProfileAction-saveProfile-validation.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/ProfileAction-saveProfile-validation.xml?view=auto&rev=550503
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/ProfileAction-saveProfile-validation.xml (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/ProfileAction-saveProfile-validation.xml Mon Jun 25 06:55:58 2007
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/ProfileAction-saveProfile-validation.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/ProfileAction-saveProfile-validation.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/ProfileAction.properties
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/ProfileAction.properties?view=auto&rev=550503
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/ProfileAction.properties (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/ProfileAction.properties Mon Jun 25 06:55:58 2007
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+profile.name.required = You must define a name.
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/ProfileAction.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/admin/ProfileAction.properties
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/validators.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/validators.xml?view=diff&rev=550503&r1=550502&r2=550503
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/validators.xml (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/validators.xml Mon Jun 25 06:55:58 2007
@@ -33,6 +33,8 @@
+
+
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=550503&r1=550502&r2=550503
==============================================================================
--- 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 Mon Jun 25 06:55:58 2007
@@ -44,70 +44,76 @@
-
-
+
+ |
+
- |
-
-
-
-
-
-
-
-
-
-
-
- ">
-
-
- ()
-
-
-
- &installationName=">
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
-
-
-
- |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ">
+
+
+ ()
+
+
+
+ &installationName=">
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+