continuum-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deng Ching <och...@apache.org>
Subject Re: svn commit: r924833 - in /continuum/trunk: continuum-buildagent/continuum-buildagent-api/ continuum-buildagent/continuum-buildagent-api/src/main/mdo/ continuum-buildagent/continuum-buildagent-core/ continuum-buildagent/continuum-buildagent-core/s
Date Wed, 07 Apr 2010 08:43:14 GMT
Upgrade docs updated in -r931464.

On Tue, Apr 6, 2010 at 1:58 PM, Deng Ching <oching@apache.org> wrote:

> Although it is just a change in the build agent config file, I guess it
> does need to be noted down in the upgrade docs too :)
>
> Thanks,
> Deng
>
> On Tue, Apr 6, 2010 at 1:25 PM, Brett Porter <brett@apache.org> wrote:
>
>> Does this need upgrade instructions for 1.3.x users?
>>
>> On 19/03/2010, at 1:36 AM, oching@apache.org wrote:
>>
>> > Author: oching
>> > Date: Thu Mar 18 14:36:07 2010
>> > New Revision: 924833
>> >
>> > URL: http://svn.apache.org/viewvc?rev=924833&view=rev
>> > Log:
>> > [CONTINUUM-2391] Master should not pass full path to local repository to
>> the agent
>> > o pass repo name to build agent instead of full path
>> > o added support for local repos in build agent config file + tests
>> >
>> > Added:
>> >
>>  continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/java/org/apache/continuum/buildagent/
>> >
>>  continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/java/org/apache/continuum/buildagent/configuration/
>> >
>>  continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/java/org/apache/continuum/buildagent/configuration/BuildAgentConfigurationTest.java
>> >
>>  continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/resources/
>> >
>>  continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/resources/buildagent-config/
>> >
>>  continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/resources/buildagent-config/continuum-buildagent-edit.xml
>> >
>>  continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/resources/buildagent-config/continuum-buildagent.xml
>> > Modified:
>> >    continuum/trunk/continuum-buildagent/continuum-buildagent-api/pom.xml
>> >
>>  continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/mdo/continuum-buildagent.xml
>> >
>>  continuum/trunk/continuum-buildagent/continuum-buildagent-core/pom.xml
>> >
>>  continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/BuildAgentConfigurationService.java
>> >
>>  continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/DefaultBuildAgentConfiguration.java
>> >
>>  continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/DefaultBuildAgentConfigurationService.java
>> >
>>  continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/GeneralBuildAgentConfiguration.java
>> >
>>  continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
>> >
>>  continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java
>> >
>> > Modified:
>> continuum/trunk/continuum-buildagent/continuum-buildagent-api/pom.xml
>> > URL:
>> http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-api/pom.xml?rev=924833&r1=924832&r2=924833&view=diff
>> >
>> ==============================================================================
>> > ---
>> continuum/trunk/continuum-buildagent/continuum-buildagent-api/pom.xml
>> (original)
>> > +++
>> continuum/trunk/continuum-buildagent/continuum-buildagent-api/pom.xml Thu
>> Mar 18 14:36:07 2010
>> > @@ -38,7 +38,7 @@ under the License.
>> >             <model>src/main/mdo/continuum-buildagent.xml</model>
>> >           </models>
>> >           <useJava5>true</useJava5>
>> > -          <version>1.0.0</version>
>> > +          <version>1.1.0</version>
>> >         </configuration>
>> >         <executions>
>> >           <execution>
>> >
>> > Modified:
>> continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/mdo/continuum-buildagent.xml
>> > URL:
>> http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/mdo/continuum-buildagent.xml?rev=924833&r1=924832&r2=924833&view=diff
>> >
>> ==============================================================================
>> > ---
>> continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/mdo/continuum-buildagent.xml
>> (original)
>> > +++
>> continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/mdo/continuum-buildagent.xml
>> Thu Mar 18 14:36:07 2010
>> > @@ -55,6 +55,14 @@
>> >             <multiplicity>*</multiplicity>
>> >           </association>
>> >         </field>
>> > +        <field>
>> > +          <name>localRepositories</name>
>> > +          <version>1.1.0+</version>
>> > +          <association>
>> > +            <type>LocalRepository</type>
>> > +            <multiplicity>*</multiplicity>
>> > +          </association>
>> > +        </field>
>> >       </fields>
>> >     </class>
>> >     <class xml.tagName="buildagent-installation">
>> > @@ -83,5 +91,35 @@
>> >         </field>
>> >       </fields>
>> >     </class>
>> > +    <class>
>> > +      <name>LocalRepository</name>
>> > +      <version>1.1.0+</version>
>> > +      <fields>
>> > +        <field>
>> > +          <name>name</name>
>> > +          <version>1.1.0+</version>
>> > +          <type>String</type>
>> > +          <required>true</required>
>> > +        </field>
>> > +        <field>
>> > +          <name>location</name>
>> > +          <version>1.1.0+</version>
>> > +          <type>String</type>
>> > +          <required>true</required>
>> > +          <description>
>> > +          The file system location for this repository
>> > +          </description>
>> > +        </field>
>> > +        <field>
>> > +          <name>layout</name>
>> > +          <version>1.1.0+</version>
>> > +          <type>String</type>
>> > +          <defaultValue>default</defaultValue>
>> > +          <description>
>> > +          The layout of the repository. Valid values are "default" and
>> "legacy"
>> > +          </description>
>> > +        </field>
>> > +      </fields>
>> > +    </class>
>> >   </classes>
>> > </model>
>> > \ No newline at end of file
>> >
>> > Modified:
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/pom.xml
>> > URL:
>> http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/pom.xml?rev=924833&r1=924832&r2=924833&view=diff
>> >
>> ==============================================================================
>> > ---
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/pom.xml
>> (original)
>> > +++
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/pom.xml Thu
>> Mar 18 14:36:07 2010
>> > @@ -125,7 +125,12 @@ under the License.
>> >     <dependency>
>> >       <groupId>javax.annotation</groupId>
>> >       <artifactId>jsr250-api</artifactId>
>> > -    </dependency>
>> > +    </dependency>
>> > +    <dependency>
>> > +      <groupId>org.slf4j</groupId>
>> > +      <artifactId>slf4j-simple</artifactId>
>> > +      <scope>test</scope>
>> > +    </dependency>
>> >   </dependencies>
>> >   <build>
>> >     <plugins>
>> >
>> > Modified:
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/BuildAgentConfigurationService.java
>> > URL:
>> http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/BuildAgentConfigurationService.java?rev=924833&r1=924832&r2=924833&view=diff
>> >
>> ==============================================================================
>> > ---
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/BuildAgentConfigurationService.java
>> (original)
>> > +++
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/BuildAgentConfigurationService.java
>> Thu Mar 18 14:36:07 2010
>> > @@ -23,6 +23,7 @@ import java.io.File;
>> > import java.util.List;
>> >
>> > import org.apache.continuum.buildagent.model.Installation;
>> > +import org.apache.continuum.buildagent.model.LocalRepository;
>> >
>> > public interface BuildAgentConfigurationService
>> > {
>> > @@ -45,4 +46,6 @@ public interface BuildAgentConfiguration
>> >         throws BuildAgentConfigurationException;
>> >
>> >     List<Installation> getAvailableInstallations();
>> > +
>> > +    List<LocalRepository> getLocalRepositories();
>> > }
>> >
>> > Modified:
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/DefaultBuildAgentConfiguration.java
>> > URL:
>> http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/DefaultBuildAgentConfiguration.java?rev=924833&r1=924832&r2=924833&view=diff
>> >
>> ==============================================================================
>> > ---
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/DefaultBuildAgentConfiguration.java
>> (original)
>> > +++
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/DefaultBuildAgentConfiguration.java
>> Thu Mar 18 14:36:07 2010
>> > @@ -105,6 +105,7 @@ public class DefaultBuildAgentConfigurat
>> >             }
>> >             this.generalBuildAgentConfiguration.setContinuumServerUrl(
>> configuration.getContinuumServerUrl() );
>> >             this.generalBuildAgentConfiguration.setInstallations(
>> configuration.getInstallations() );
>> > +            this.generalBuildAgentConfiguration.setLocalRepositories(
>> configuration.getLocalRepositories() );
>> >         }
>> >         catch ( IOException e )
>> >         {
>> > @@ -153,6 +154,7 @@ public class DefaultBuildAgentConfigurat
>> >             }
>> >             configurationModel.setContinuumServerUrl(
>> this.generalBuildAgentConfiguration.getContinuumServerUrl() );
>> >             configurationModel.setInstallations(
>> this.generalBuildAgentConfiguration.getInstallations() );
>> > +            configurationModel.setLocalRepositories(
>> this.generalBuildAgentConfiguration.getLocalRepositories() );
>> >
>> >             ContinuumBuildAgentConfigurationModelXpp3Writer writer =
>> >                 new ContinuumBuildAgentConfigurationModelXpp3Writer();
>> >
>> > Modified:
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/DefaultBuildAgentConfigurationService.java
>> > URL:
>> http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/DefaultBuildAgentConfigurationService.java?rev=924833&r1=924832&r2=924833&view=diff
>> >
>> ==============================================================================
>> > ---
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/DefaultBuildAgentConfigurationService.java
>> (original)
>> > +++
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/DefaultBuildAgentConfigurationService.java
>> Thu Mar 18 14:36:07 2010
>> > @@ -26,6 +26,7 @@ import java.util.List;
>> > import javax.annotation.Resource;
>> >
>> > import org.apache.continuum.buildagent.model.Installation;
>> > +import org.apache.continuum.buildagent.model.LocalRepository;
>> > import org.codehaus.plexus.util.FileUtils;
>> > import org.slf4j.Logger;
>> > import org.slf4j.LoggerFactory;
>> > @@ -144,6 +145,11 @@ public class DefaultBuildAgentConfigurat
>> >         return generalBuildAgentConfiguration.getInstallations();
>> >     }
>> >
>> > +    public List<LocalRepository> getLocalRepositories()
>> > +    {
>> > +        return generalBuildAgentConfiguration.getLocalRepositories();
>> > +    }
>> > +
>> >     private void loadData()
>> >         throws BuildAgentConfigurationException
>> >     {
>> >
>> > Modified:
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/GeneralBuildAgentConfiguration.java
>> > URL:
>> http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/GeneralBuildAgentConfiguration.java?rev=924833&r1=924832&r2=924833&view=diff
>> >
>> ==============================================================================
>> > ---
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/GeneralBuildAgentConfiguration.java
>> (original)
>> > +++
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/GeneralBuildAgentConfiguration.java
>> Thu Mar 18 14:36:07 2010
>> > @@ -23,6 +23,7 @@ import java.io.File;
>> > import java.util.List;
>> >
>> > import org.apache.continuum.buildagent.model.Installation;
>> > +import org.apache.continuum.buildagent.model.LocalRepository;
>> >
>> > public class GeneralBuildAgentConfiguration
>> > {
>> > @@ -33,6 +34,8 @@ public class GeneralBuildAgentConfigurat
>> >     private String continuumServerUrl;
>> >
>> >     private List<Installation> installations;
>> > +
>> > +    private List<LocalRepository> localRepositories;
>> >
>> >     public File getWorkingDirectory()
>> >     {
>> > @@ -73,4 +76,14 @@ public class GeneralBuildAgentConfigurat
>> >     {
>> >         this.installations = installations;
>> >     }
>> > +
>> > +    public List<LocalRepository> getLocalRepositories()
>> > +    {
>> > +        return localRepositories;
>> > +    }
>> > +
>> > +    public void setLocalRepositories( List<LocalRepository>
>> localRepositories )
>> > +    {
>> > +        this.localRepositories = localRepositories;
>> > +    }
>> > }
>> >
>> > Modified:
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
>> > URL:
>> http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java?rev=924833&r1=924832&r2=924833&view=diff
>> >
>> ==============================================================================
>> > ---
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
>> (original)
>> > +++
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
>> Thu Mar 18 14:36:07 2010
>> > @@ -35,6 +35,7 @@ import org.apache.continuum.buildagent.b
>> > import
>> org.apache.continuum.buildagent.configuration.BuildAgentConfigurationService;
>> > import
>> org.apache.continuum.buildagent.installation.BuildAgentInstallationService;
>> > import org.apache.continuum.buildagent.manager.BuildAgentManager;
>> > +import org.apache.continuum.buildagent.model.LocalRepository;
>> > import
>> org.apache.continuum.buildagent.utils.BuildContextToBuildDefinition;
>> > import org.apache.continuum.buildagent.utils.BuildContextToProject;
>> > import org.apache.continuum.buildagent.utils.ContinuumBuildAgentUtil;
>> > @@ -168,7 +169,20 @@ public class BuildProjectTaskExecutor
>> >         actionContext.put( ContinuumBuildAgentUtil.KEY_ENVIRONMENTS,
>> >                            getEnvironments(
>> buildContext.getBuildDefinitionId(),
>> >                                             getInstallationType(
>> buildContext ) ) );
>> > -        actionContext.put(
>> ContinuumBuildAgentUtil.KEY_LOCAL_REPOSITORY,
>> buildContext.getLocalRepository() );
>> > +        // CONTINUUM-2391
>> > +        if( buildContext.getLocalRepository() != null )
>> > +        {
>> > +            List<LocalRepository> localRepos =
>> buildAgentConfigurationService.getLocalRepositories();
>> > +            for( LocalRepository local : localRepos )
>> > +            {
>> > +                if( local.getName().equalsIgnoreCase(
>> buildContext.getLocalRepository() ) )
>> > +                {
>> > +                    actionContext.put(
>> ContinuumBuildAgentUtil.KEY_LOCAL_REPOSITORY, local.getLocation() );
>> > +                    break;
>> > +                }
>> > +            }
>> > +        }
>> > +
>> >         actionContext.put( ContinuumBuildAgentUtil.KEY_SCM_RESULT,
>> buildContext.getScmResult() );
>> >         buildContext.setActionContext( actionContext );
>> >
>> >
>> > Added:
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/java/org/apache/continuum/buildagent/configuration/BuildAgentConfigurationTest.java
>> > URL:
>> http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/java/org/apache/continuum/buildagent/configuration/BuildAgentConfigurationTest.java?rev=924833&view=auto
>> >
>> ==============================================================================
>> > ---
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/java/org/apache/continuum/buildagent/configuration/BuildAgentConfigurationTest.java
>> (added)
>> > +++
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/java/org/apache/continuum/buildagent/configuration/BuildAgentConfigurationTest.java
>> Thu Mar 18 14:36:07 2010
>> > @@ -0,0 +1,187 @@
>> > +package org.apache.continuum.buildagent.configuration;
>> > +
>> > +/*
>> > + * 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 java.io.File;
>> > +import java.util.ArrayList;
>> > +import java.util.List;
>> > +
>> > +import org.apache.continuum.buildagent.model.Installation;
>> > +import org.apache.continuum.buildagent.model.LocalRepository;
>> > +import org.codehaus.plexus.spring.PlexusInSpringTestCase;
>> > +
>> > +public class BuildAgentConfigurationTest
>> > +    extends PlexusInSpringTestCase
>> > +{
>> > +    public void testInitialize()
>> > +        throws Exception
>> > +    {
>> > +        DefaultBuildAgentConfiguration config =
>> (DefaultBuildAgentConfiguration) lookup( BuildAgentConfiguration.class );
>> > +
>> > +        config.setConfigurationFile( new File( getBasedir(),
>> "target/test-classes/buildagent-config/continuum-buildagent.xml" ) );
>> > +
>> > +        config.initialize();
>> > +
>> > +        GeneralBuildAgentConfiguration generalConfig =
>> config.getContinuumBuildAgentConfiguration();
>> > +        assertEquals( "http://localhost:9595/continuum/master-xmlrpc",
>> generalConfig.getContinuumServerUrl() );
>> > +        assertEquals( "/tmp/data/build-output-directory",
>> generalConfig.getBuildOutputDirectory().getPath() );
>> > +        assertEquals( "/tmp/data/working-directory",
>> generalConfig.getWorkingDirectory().getPath() );
>> > +        assertEquals( 1, generalConfig.getInstallations().size() );
>> > +
>> > +        Installation installation =
>> generalConfig.getInstallations().get( 0 );
>> > +        assertEquals( "Tool", installation.getType() );
>> > +        assertEquals( "Maven 2.2.1 Installation",
>> installation.getName() );
>> > +        assertEquals( "M2_HOME", installation.getVarName() );
>> > +        assertEquals( "/tmp/apache-maven-2.2.1",
>> installation.getVarValue() );
>> > +
>> > +        LocalRepository localRepo =
>> generalConfig.getLocalRepositories().get( 0 );
>> > +        assertLocalRepository( getExpectedLocalRepo(), localRepo );
>> > +    }
>> > +
>> > +    public void testSaveExistingConfiguration()
>> > +        throws Exception
>> > +    {
>> > +        DefaultBuildAgentConfiguration config =
>> (DefaultBuildAgentConfiguration) lookup( BuildAgentConfiguration.class );
>> > +
>> > +        config.setConfigurationFile( new File( getBasedir(),
>> "target/test-classes/buildagent-config/continuum-buildagent-edit.xml" ) );
>> > +
>> > +        config.initialize();
>> > +
>> > +        String expected = "
>> http://192.165.240.12:8080/continuum/master-xmlrpc";
>> > +
>> > +        GeneralBuildAgentConfiguration generalConfig =
>> config.getContinuumBuildAgentConfiguration();
>> > +
>> > +        assertEquals( "http://localhost:9595/continuum/master-xmlrpc",
>> generalConfig.getContinuumServerUrl() );
>> > +        assertEquals( 1, generalConfig.getInstallations().size() );
>> > +
>> > +        generalConfig.setContinuumServerUrl( expected );
>> > +
>> > +        Installation expectedInstallation = getExpectedInstallation();
>> > +        generalConfig.getInstallations().add( expectedInstallation );
>> > +
>> > +        LocalRepository expectedLocalRepo = getExpectedLocalRepo();
>> > +
>> > +        List<LocalRepository> localRepos = new
>> ArrayList<LocalRepository>();
>> > +        localRepos.add( expectedLocalRepo );
>> > +
>> > +        generalConfig.setLocalRepositories( localRepos );
>> > +
>> > +        config.save();
>> > +
>> > +        config.reload();
>> > +
>> > +        assertEquals( expected,
>> config.getContinuumBuildAgentConfiguration().getContinuumServerUrl() );
>> > +        assertEquals( 2,
>> config.getContinuumBuildAgentConfiguration().getInstallations().size() );
>> > +
>> > +        Installation installation =
>> generalConfig.getInstallations().get( 1 );
>> > +        assertInstallation( expectedInstallation, installation );
>> > +
>> > +        LocalRepository localRepo =
>> generalConfig.getLocalRepositories().get( 0 );
>> > +        assertLocalRepository( expectedLocalRepo, localRepo );
>> > +    }
>> > +
>> > +    public void testSaveNewConfiguration()
>> > +        throws Exception
>> > +    {
>> > +        File configFile = new File( getBasedir(),
>> "target/test-classes/buildagent-config/continuum-buildagent-new.xml" );
>> > +        DefaultBuildAgentConfiguration config =
>> (DefaultBuildAgentConfiguration) lookup( BuildAgentConfiguration.class );
>> > +
>> > +        config.setConfigurationFile( configFile );
>> > +
>> > +        config.initialize();
>> > +
>> > +        String expectedUrl = "
>> http://localhost:8080/continuum/master-xmlrpc";
>> > +        String expectedBuildOutputDir =
>> "/tmp/data/build-output-directory";
>> > +        String expectedWorkingDir = "/tmp/data/working-directory";
>> > +
>> > +        GeneralBuildAgentConfiguration generalConfig =
>> config.getContinuumBuildAgentConfiguration();
>> > +
>> > +        assertNull( generalConfig.getContinuumServerUrl() );
>> > +        assertNull( generalConfig.getBuildOutputDirectory() );
>> > +        assertNull( generalConfig.getWorkingDirectory() );
>> > +        assertNull( generalConfig.getInstallations() );
>> > +
>> > +        Installation expectedInstallation = getExpectedInstallation();
>> > +
>> > +        List<Installation> installations = new
>> ArrayList<Installation>();
>> > +        installations.add( expectedInstallation );
>> > +
>> > +        LocalRepository expectedLocalRepo = getExpectedLocalRepo();
>> > +
>> > +        List<LocalRepository> localRepos = new
>> ArrayList<LocalRepository>();
>> > +        localRepos.add( expectedLocalRepo );
>> > +
>> > +        generalConfig.setContinuumServerUrl( expectedUrl );
>> > +        generalConfig.setBuildOutputDirectory( new File(
>> expectedBuildOutputDir ) );
>> > +        generalConfig.setWorkingDirectory( new File( expectedWorkingDir
>> ) );
>> > +        generalConfig.setInstallations( installations );
>> > +        generalConfig.setLocalRepositories( localRepos );
>> > +
>> > +        config.save();
>> > +
>> > +        config.reload();
>> > +
>> > +        assertTrue( configFile.exists() );
>> > +        assertEquals( expectedUrl,
>> config.getContinuumBuildAgentConfiguration().getContinuumServerUrl() );
>> > +        assertEquals( expectedBuildOutputDir,
>> config.getContinuumBuildAgentConfiguration().getBuildOutputDirectory().getPath()
>> );
>> > +        assertEquals( expectedWorkingDir,
>> config.getContinuumBuildAgentConfiguration().getWorkingDirectory().getPath()
>> );
>> > +        assertEquals( 1,
>> config.getContinuumBuildAgentConfiguration().getInstallations().size() );
>> > +
>> > +        Installation installation =
>> generalConfig.getInstallations().get( 0 );
>> > +        assertInstallation( expectedInstallation, installation );
>> > +
>> > +        LocalRepository localRepo =
>> generalConfig.getLocalRepositories().get( 0 );
>> > +        assertLocalRepository( expectedLocalRepo, localRepo );
>> > +    }
>> > +
>> > +    private Installation getExpectedInstallation()
>> > +    {
>> > +        Installation expectedInstallation = new Installation();
>> > +        expectedInstallation.setName( "Maven 2.0.10 Installation" );
>> > +        expectedInstallation.setType( "Tool" );
>> > +        expectedInstallation.setVarName( "M2_HOME" );
>> > +        expectedInstallation.setVarValue( "/tmp/apache-maven-2.1.10" );
>> > +        return expectedInstallation;
>> > +    }
>> > +
>> > +    private LocalRepository getExpectedLocalRepo()
>> > +    {
>> > +        LocalRepository expectedLocalRepo = new LocalRepository();
>> > +        expectedLocalRepo.setName( "default" );
>> > +        expectedLocalRepo.setLayout( "default" );
>> > +        expectedLocalRepo.setLocation( "/tmp/.m2/repository" );
>> > +        return expectedLocalRepo;
>> > +    }
>> > +
>> > +    private void assertLocalRepository( LocalRepository
>> expectedLocalRepo, LocalRepository localRepo )
>> > +    {
>> > +        assertEquals( expectedLocalRepo.getName(), localRepo.getName()
>> );
>> > +        assertEquals( expectedLocalRepo.getLayout(),
>> localRepo.getLayout() );
>> > +        assertEquals( expectedLocalRepo.getLocation(),
>> localRepo.getLocation() );
>> > +    }
>> > +
>> > +    private void assertInstallation( Installation expectedInstallation,
>> Installation installation )
>> > +    {
>> > +        assertEquals( expectedInstallation.getType(),
>> installation.getType() );
>> > +        assertEquals( expectedInstallation.getName(),
>> installation.getName() );
>> > +        assertEquals( expectedInstallation.getVarName(),
>> installation.getVarName() );
>> > +        assertEquals( expectedInstallation.getVarValue(),
>> installation.getVarValue() );
>> > +    }
>> > +}
>> >
>> > Added:
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/resources/buildagent-config/continuum-buildagent-edit.xml
>> > URL:
>> http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/resources/buildagent-config/continuum-buildagent-edit.xml?rev=924833&view=auto
>> >
>> ==============================================================================
>> > ---
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/resources/buildagent-config/continuum-buildagent-edit.xml
>> (added)
>> > +++
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/resources/buildagent-config/continuum-buildagent-edit.xml
>> Thu Mar 18 14:36:07 2010
>> > @@ -0,0 +1,33 @@
>> > +<?xml version='1.0' encoding='UTF-8'?>
>> > +<!--
>> > +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.
>> > +-->
>> > +
>> > +<continuum-buildagent-configuration>
>> > +  <continuumServerUrl>http://localhost:9595/continuum/master-xmlrpc
>> </continuumServerUrl>
>> > +
>>  <buildOutputDirectory>/tmp/data/build-output-directory</buildOutputDirectory>
>> > +  <workingDirectory>/tmp/data/working-directory</workingDirectory>
>> > +  <installations>
>> > +    <installation>
>> > +      <name>Maven 2.2.1 Installation</name>
>> > +      <type>Tool</type>
>> > +      <varName>M2_HOME</varName>
>> > +      <varValue>/tmp/apache-maven-2.2.1</varValue>
>> > +    </installation>
>> > +  </installations>
>> > +</continuum-buildagent-configuration>
>> > \ No newline at end of file
>> >
>> > Added:
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/resources/buildagent-config/continuum-buildagent.xml
>> > URL:
>> http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/resources/buildagent-config/continuum-buildagent.xml?rev=924833&view=auto
>> >
>> ==============================================================================
>> > ---
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/resources/buildagent-config/continuum-buildagent.xml
>> (added)
>> > +++
>> continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/resources/buildagent-config/continuum-buildagent.xml
>> Thu Mar 18 14:36:07 2010
>> > @@ -0,0 +1,40 @@
>> > +<?xml version='1.0' encoding='UTF-8'?>
>> > +<!--
>> > +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.
>> > +-->
>> > +
>> > +<continuum-buildagent-configuration>
>> > +  <continuumServerUrl>http://localhost:9595/continuum/master-xmlrpc
>> </continuumServerUrl>
>> > +
>>  <buildOutputDirectory>/tmp/data/build-output-directory</buildOutputDirectory>
>> > +  <workingDirectory>/tmp/data/working-directory</workingDirectory>
>> > +  <installations>
>> > +    <installation>
>> > +      <name>Maven 2.2.1 Installation</name>
>> > +      <type>Tool</type>
>> > +      <varName>M2_HOME</varName>
>> > +      <varValue>/tmp/apache-maven-2.2.1</varValue>
>> > +    </installation>
>> > +  </installations>
>> > +  <localRepositories>
>> > +    <localRepository>
>> > +      <name>default</name>
>> > +      <location>/tmp/.m2/repository</location>
>> > +      <layout>default</layout>
>> > +    </localRepository>
>> > +  </localRepositories>
>> > +</continuum-buildagent-configuration>
>> >
>> > Modified:
>> continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java
>> > URL:
>> http://svn.apache.org/viewvc/continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java?rev=924833&r1=924832&r2=924833&view=diff
>> >
>> ==============================================================================
>> > ---
>> continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java
>> (original)
>> > +++
>> continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java
>> Thu Mar 18 14:36:07 2010
>> > @@ -170,11 +170,12 @@ public class DistributedBuildProjectTask
>> >                                  new Date( buildResult.getStartTime() )
>> );
>> >                 }
>> >
>> > -                LocalRepository localRepo =
>> project.getProjectGroup().getLocalRepository();
>> > +                LocalRepository localRepo =
>> project.getProjectGroup().getLocalRepository();
>> >
>> >                 if ( localRepo != null )
>> >                 {
>> > -                    context.put(
>> ContinuumBuildConstant.KEY_LOCAL_REPOSITORY, localRepo.getLocation() );
>> > +                    // CONTINUUM-2391
>> > +                     context.put(
>> ContinuumBuildConstant.KEY_LOCAL_REPOSITORY, localRepo.getName() );
>> >                 }
>> >                 else
>> >                 {
>> >
>> >
>>
>> --
>> Brett Porter
>> brett@apache.org
>> http://brettporter.wordpress.com/
>>
>>
>>
>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message