continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r713659 - in /continuum/branches/continuum-distributed-builds: continuum-api/src/main/java/org/apache/continuum/configuration/ continuum-api/src/main/java/org/apache/maven/continuum/ continuum-api/src/main/java/org/apache/maven/continuum/co...
Date Thu, 13 Nov 2008 06:34:24 GMT
Author: ctan
Date: Wed Nov 12 22:34:23 2008
New Revision: 713659

URL: http://svn.apache.org/viewvc?rev=713659&view=rev
Log:
- added build agent configuration
- added distributed build configuration

Added:
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/configuration/BuildAgentConfiguration.java
Modified:
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/configuration/GeneralConfiguration.java
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
    continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/pom.xml
    continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java
    continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/mdo/continuum-configuration.xml
    continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/java/org/apache/continuum/configuration/TestDefaultContinuumConfiguration.java
    continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/resources/conf/continuum.xml
    continuum/branches/continuum-distributed-builds/continuum-commons/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
    continuum/branches/continuum-distributed-builds/continuum-commons/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java
    continuum/branches/continuum-distributed-builds/continuum-commons/src/test/resources/conf/continuum.xml
    continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/branches/continuum-distributed-builds/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
    continuum/branches/continuum-distributed-builds/continuum-model/src/main/mdo/continuum.xml

Added: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/configuration/BuildAgentConfiguration.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/configuration/BuildAgentConfiguration.java?rev=713659&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/configuration/BuildAgentConfiguration.java
(added)
+++ continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/configuration/BuildAgentConfiguration.java
Wed Nov 12 22:34:23 2008
@@ -0,0 +1,52 @@
+package org.apache.continuum.configuration;
+
+public class BuildAgentConfiguration
+{
+    private String url;
+
+    private String operatingSystem;
+
+    private boolean enabled;
+
+    public BuildAgentConfiguration()
+    {
+        // do nothing
+    }
+
+    public BuildAgentConfiguration( String url, String operatingSystem, boolean enabled )
+    {
+        this.url = url;
+        this.operatingSystem = operatingSystem;
+        this.enabled = enabled;
+    }
+
+    public String getUrl()
+    {
+        return url;
+    }
+
+    public void setUrl( String url )
+    {
+        this.url = url;
+    }
+
+    public String getOperatingSystem()
+    {
+        return operatingSystem;
+    }
+
+    public void setOperatingSystem( String operatingSystem )
+    {
+        this.operatingSystem = operatingSystem;
+    }
+
+    public boolean isEnabled()
+    {
+        return enabled;
+    }
+
+    public void setEnabled( boolean enabled )
+    {
+        this.enabled = enabled;
+    }
+}

Modified: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/configuration/GeneralConfiguration.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/configuration/GeneralConfiguration.java?rev=713659&r1=713658&r2=713659&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/configuration/GeneralConfiguration.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/configuration/GeneralConfiguration.java
Wed Nov 12 22:34:23 2008
@@ -22,6 +22,7 @@
 import org.apache.commons.lang.builder.ReflectionToStringBuilder;
 
 import java.io.File;
+import java.util.List;
 
 /**
  * @author <a href="mailto:olamy@apache.org">olamy</a>
@@ -42,6 +43,8 @@
     
     private File releaseOutputDirectory;
 
+    private List<BuildAgentConfiguration> buildAgents;
+
     public GeneralConfiguration()
     {
         // nothing here
@@ -113,4 +116,13 @@
         this.releaseOutputDirectory = releaseOutputDirectory;
     }
 
+    public List<BuildAgentConfiguration> getBuildAgents()
+    {
+        return buildAgents;
+    }
+
+    public void setBuildAgents( List<BuildAgentConfiguration> buildAgents )
+    {
+        this.buildAgents = buildAgents;
+    }
 }

Modified: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=713659&r1=713658&r2=713659&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
Wed Nov 12 22:34:23 2008
@@ -660,4 +660,7 @@
     
     String getReleaseOutput( int releaseResultId )
         throws ContinuumException;
+
+    void setDistributedBuildEnabled( boolean distributedBuildEnabled )
+        throws ContinuumException;
 }

Modified: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java?rev=713659&r1=713658&r2=713659&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
Wed Nov 12 22:34:23 2008
@@ -19,11 +19,13 @@
  * under the License.
  */
 
+import org.apache.continuum.configuration.BuildAgentConfiguration;
 import org.apache.continuum.configuration.ContinuumConfigurationException;
 import org.apache.maven.continuum.model.project.Schedule;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 
 import java.io.File;
+import java.util.List;
 
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@@ -84,6 +86,17 @@
     String getReleaseOutput( int projectGroupId, String releaseName )
         throws ConfigurationException;
 
+    List<BuildAgentConfiguration> getBuildAgents();
+
+    void addBuildAgent( BuildAgentConfiguration buildAgent )
+        throws ConfigurationException;
+
+    void removeBuildAgent( BuildAgentConfiguration buildAgent );
+
+    boolean isDistributedBuildEnabled();
+
+    void setDistributedBuildEnabled( boolean distributedBuildEnabled );
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------

Modified: continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/pom.xml?rev=713659&r1=713658&r2=713659&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/pom.xml
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/pom.xml
Wed Nov 12 22:34:23 2008
@@ -35,7 +35,7 @@
           <models>
             <model>src/main/mdo/continuum-configuration.xml</model>
           </models>
-          <version>1.0.0</version>
+          <version>1.0.1</version>
         </configuration>
         <executions>
           <execution>

Modified: continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java?rev=713659&r1=713658&r2=713659&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java
Wed Nov 12 22:34:23 2008
@@ -24,6 +24,8 @@
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.continuum.configuration.model.ContinuumConfigurationModel;
@@ -149,6 +151,21 @@
                 this.generalConfiguration.setReleaseOutputDirectory( new File( configuration
                     .getReleaseOutputDirectory() ) );
             }
+            if ( configuration.getBuildAgents() != null )
+            {
+                List<BuildAgentConfiguration> buildAgents = new ArrayList<BuildAgentConfiguration>();
+
+                List<org.apache.continuum.configuration.model.BuildAgentConfiguration>
agents = configuration.getBuildAgents();
+                for ( org.apache.continuum.configuration.model.BuildAgentConfiguration agent
: agents )
+                {
+                    BuildAgentConfiguration buildAgent = new BuildAgentConfiguration( agent.getUrl(),

+                                                                                      agent.getOperatingSystem(),
+                                                                                      agent.isEnabled()
);
+                    buildAgents.add( buildAgent );
+                }
+                
+                this.generalConfiguration.setBuildAgents( buildAgents );
+            }
         }
         catch ( IOException e )
         {
@@ -208,6 +225,22 @@
                 configurationModel.setReleaseOutputDirectory( this.generalConfiguration.getReleaseOutputDirectory()
                     .getPath() );
             }
+            if ( this.generalConfiguration.getBuildAgents() != null )
+            {
+                List buildAgents = new ArrayList();
+
+                for ( BuildAgentConfiguration agent : this.generalConfiguration.getBuildAgents()
)
+                {
+                    org.apache.continuum.configuration.model.BuildAgentConfiguration buildAgent
= 
+                        new org.apache.continuum.configuration.model.BuildAgentConfiguration();
+                    buildAgent.setUrl( agent.getUrl() );
+                    buildAgent.setOperatingSystem( agent.getOperatingSystem() );
+                    buildAgent.setEnabled( agent.isEnabled() );
+                    
+                    buildAgents.add( buildAgent );
+                }
+                configurationModel.setBuildAgents( buildAgents );
+            }
 
             ContinuumConfigurationModelXpp3Writer writer = new ContinuumConfigurationModelXpp3Writer();
             FileWriter fileWriter = new FileWriter( file );

Modified: continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/mdo/continuum-configuration.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/mdo/continuum-configuration.xml?rev=713659&r1=713658&r2=713659&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/mdo/continuum-configuration.xml
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/mdo/continuum-configuration.xml
Wed Nov 12 22:34:23 2008
@@ -65,7 +65,15 @@
           <name>releaseOutputDirectory</name>
           <version>1.0.0+</version>
           <type>String</type>
-        </field>                
+        </field>
+        <field>
+          <name>buildAgents</name>
+          <version>1.0.1+</version>
+          <association>
+            <type>BuildAgentConfiguration</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
       </fields>
     </class>
     <class xml.tagName="proxy-configuration">
@@ -93,6 +101,27 @@
           <type>String</type>
         </field>                     
       </fields>
+    </class>
+    <class xml.tagName="buildagent-configuration">
+      <name>BuildAgentConfiguration</name>
+      <version>1.0.1+</version>
+      <fields>
+        <field>
+          <name>url</name>
+          <version>1.0.1+</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>operatingSystem</name>
+          <version>1.0.1+</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>enabled</name>
+          <version>1.0.1+</version>
+          <type>boolean</type>
+        </field>
+      </fields>
     </class>    
   </classes>
 </model>

Modified: continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/java/org/apache/continuum/configuration/TestDefaultContinuumConfiguration.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/java/org/apache/continuum/configuration/TestDefaultContinuumConfiguration.java?rev=713659&r1=713658&r2=713659&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/java/org/apache/continuum/configuration/TestDefaultContinuumConfiguration.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/java/org/apache/continuum/configuration/TestDefaultContinuumConfiguration.java
Wed Nov 12 22:34:23 2008
@@ -25,6 +25,8 @@
 import org.slf4j.LoggerFactory;
 
 import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author <a href="mailto:olamy@apache.org">olamy</a>
@@ -67,6 +69,11 @@
         assertNotNull( generalConfiguration.getBaseUrl() );
         assertEquals( "http://test", generalConfiguration.getBaseUrl() );
         assertEquals( new File( "myBuildOutputDir" ), generalConfiguration.getBuildOutputDirectory()
);
+        assertNotNull( generalConfiguration.getBuildAgents() );
+        org.apache.continuum.configuration.BuildAgentConfiguration buildAgentConfig = generalConfiguration.getBuildAgents().get(
0 );
+        assertEquals( "http://buildagent/xmlrpc", buildAgentConfig.getUrl() );
+        assertEquals( "linux", buildAgentConfig.getOperatingSystem() );
+        assertTrue( buildAgentConfig.isEnabled() );
     }
 
     public void testDefaultConfiguration()
@@ -87,6 +94,13 @@
         generalConfiguration.getProxyConfiguration().setProxyPort( 8080 );
         File targetDir = new File(getBasedir(), "target");
         generalConfiguration.setBuildOutputDirectory( targetDir );
+        BuildAgentConfiguration buildAgentConfiguration = new BuildAgentConfiguration();
+        buildAgentConfiguration.setUrl( "http://buildagent/test" );
+        buildAgentConfiguration.setOperatingSystem( "windows xp" );
+        buildAgentConfiguration.setEnabled( false );
+        List<BuildAgentConfiguration> buildAgents = new ArrayList<BuildAgentConfiguration>();
+        buildAgents.add( buildAgentConfiguration );
+        generalConfiguration.setBuildAgents( buildAgents );
         configuration.setGeneralConfiguration( generalConfiguration );
         configuration.save();
 
@@ -94,12 +108,15 @@
         assertTrue( contents.indexOf( "http://test/zloug" ) > 0 );
         assertTrue( contents.indexOf( "localhost" ) > 0 );
         assertTrue( contents.indexOf( "8080" ) > 0 );
+        assertTrue( contents.indexOf( "http://buildagent/test" ) > 0 );
+        assertTrue( contents.indexOf( "windows xp" ) > 0 );
 
         configuration.reload();
         assertEquals( "http://test/zloug", configuration.getGeneralConfiguration().getBaseUrl()
);
         assertEquals( "localhost", configuration.getGeneralConfiguration().getProxyConfiguration().getProxyHost()
);
         assertEquals( 8080, configuration.getGeneralConfiguration().getProxyConfiguration().getProxyPort()
);
         assertEquals(targetDir.getPath(), configuration.getGeneralConfiguration().getBuildOutputDirectory().getPath());
+        assertEquals( "http://buildagent/test", configuration.getGeneralConfiguration().getBuildAgents().get(
0 ).getUrl() );
         log.info( "generalConfiguration " + configuration.getGeneralConfiguration().toString()
);
     }
 }

Modified: continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/resources/conf/continuum.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/resources/conf/continuum.xml?rev=713659&r1=713658&r2=713659&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/resources/conf/continuum.xml
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/resources/conf/continuum.xml
Wed Nov 12 22:34:23 2008
@@ -2,4 +2,11 @@
 <continuum-configuration>
   <baseUrl>http://test</baseUrl>
   <buildOutputDirectory>myBuildOutputDir</buildOutputDirectory>
+  <buildAgents>
+    <buildAgent>
+      <url>http://buildagent/xmlrpc</url>
+      <operatingSystem>linux</operatingSystem>
+      <enabled>true</enabled>
+    </buildAgent>
+  </buildAgents>
 </continuum-configuration>
\ No newline at end of file

Modified: continuum/branches/continuum-distributed-builds/continuum-commons/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-commons/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java?rev=713659&r1=713658&r2=713659&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-commons/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-commons/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
Wed Nov 12 22:34:23 2008
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.continuum.configuration.BuildAgentConfiguration;
 import org.apache.continuum.configuration.ContinuumConfiguration;
 import org.apache.continuum.configuration.ContinuumConfigurationException;
 import org.apache.continuum.configuration.GeneralConfiguration;
@@ -34,6 +35,8 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@@ -275,6 +278,59 @@
         generalConfiguration.setReleaseOutputDirectory( f );
     }
 
+    public List<BuildAgentConfiguration> getBuildAgents()
+    {
+        return generalConfiguration.getBuildAgents();
+    }
+
+    public void addBuildAgent( BuildAgentConfiguration buildAgent )
+        throws ConfigurationException
+    {
+        List<BuildAgentConfiguration> buildAgents = generalConfiguration.getBuildAgents();
+        if ( buildAgents == null )
+        {
+            buildAgents = new ArrayList<BuildAgentConfiguration>();
+        }
+
+        for ( BuildAgentConfiguration agent : buildAgents )
+        {
+            if ( agent.getUrl().equals( buildAgent.getUrl() ) )
+            {
+                throw new ConfigurationException( "Unable to add build agent: build agent
already exist" );
+            }
+        }
+
+        buildAgents.add( buildAgent );
+        generalConfiguration.setBuildAgents( buildAgents );
+    }
+
+    public void removeBuildAgent( BuildAgentConfiguration buildAgent )
+    {
+        List<BuildAgentConfiguration> buildAgents = getBuildAgents();
+        if ( buildAgents != null )
+        {
+            for ( BuildAgentConfiguration agent : buildAgents )
+            {
+                if ( agent.getUrl().equals( buildAgent.getUrl() ) )
+                {
+                    buildAgents.remove( agent );
+                    break;
+                }
+            }
+            generalConfiguration.setBuildAgents( buildAgents );
+        }
+    }
+
+    public boolean isDistributedBuildEnabled()
+    {
+        return systemConf.isDistributedBuildEnabled();
+    }
+
+    public void setDistributedBuildEnabled( boolean distributedBuildEnabled )
+    {
+        systemConf.setDistributedBuildEnabled( distributedBuildEnabled );
+    }
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------

Modified: continuum/branches/continuum-distributed-builds/continuum-commons/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-commons/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java?rev=713659&r1=713658&r2=713659&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-commons/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-commons/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java
Wed Nov 12 22:34:23 2008
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.continuum.configuration.BuildAgentConfiguration;
 import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.codehaus.plexus.util.FileUtils;
 import org.slf4j.Logger;
@@ -88,9 +89,14 @@
 
 //        assertEquals( "working-directory", service.getWorkingDirectory().getName() );
 
+        assertEquals( "check # build agents", 1, service.getBuildAgents().size() );
+        
         service.setUrl( "http://test/zloug" );
         service.setBuildOutputDirectory( new File( "testBuildOutputDir" ) );
 
+        BuildAgentConfiguration buildAgent = new BuildAgentConfiguration( "http://test/xmlrpc",
"windows", false );
+        service.addBuildAgent( buildAgent );
+
         service.store();
 
         String contents = FileUtils.fileRead( conf );
@@ -99,5 +105,17 @@
         service.reload();
 
         assertEquals( "http://test/zloug", service.getUrl() );
+        assertEquals( "check # build agents", 2, service.getBuildAgents().size() );     
  
+        assertEquals( "http://test/xmlrpc", service.getBuildAgents().get( 1 ).getUrl() );
+        assertEquals( "windows", service.getBuildAgents().get( 1 ).getOperatingSystem() );
+
+        assertEquals( "http://test/xmlrpc", buildAgent.getUrl() );
+        service.removeBuildAgent( buildAgent );
+        service.store();
+        service.reload();
+
+        assertEquals( "check # build agents", 1, service.getBuildAgents().size() );
+        assertEquals( "http://buildagent/xmlrpc", service.getBuildAgents().get( 0 ).getUrl()
);
+        assertEquals( "linux", service.getBuildAgents().get( 0 ).getOperatingSystem() );
     }
 }

Modified: continuum/branches/continuum-distributed-builds/continuum-commons/src/test/resources/conf/continuum.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-commons/src/test/resources/conf/continuum.xml?rev=713659&r1=713658&r2=713659&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-commons/src/test/resources/conf/continuum.xml
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-commons/src/test/resources/conf/continuum.xml
Wed Nov 12 22:34:23 2008
@@ -2,4 +2,12 @@
 <continuum-configuration>
   <baseUrl>http://test</baseUrl>
   <buildOutputDirectory>target/myBuildOutputDir</buildOutputDirectory>
+  <buildAgents>
+    <buildAgent>
+      <url>http://buildagent/xmlrpc</url>
+      <operatingSystem>linux</operatingSystem>
+      <enabled>true</enabled>
+    </buildAgent>
+  </buildAgents>
+  <distributedBuildEnabled>true</distributedBuildEnabled>
 </continuum-configuration>
\ No newline at end of file

Modified: continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=713659&r1=713658&r2=713659&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Wed Nov 12 22:34:23 2008
@@ -3380,6 +3380,26 @@
         }
     }
 
+    public void setDistributedBuildEnabled( boolean distributedBuildEnabled )
+        throws ContinuumException
+    {
+        configurationService.setDistributedBuildEnabled( distributedBuildEnabled );
+
+        for ( ProjectGroup projectGroup : getAllProjectGroups() )
+        {
+            try
+            {
+                projectGroup.setDistributedBuildEnabled( distributedBuildEnabled );
+                projectGroupDao.updateProjectGroup( projectGroup );
+            }
+            catch ( ContinuumStoreException e )
+            {
+                throw new ContinuumException( "Error while enabling/disabling distributed
build of project group " +
+                                              projectGroup.getName() );
+            }
+        }
+    }
+
     private void createProjectScmRootForProjectGroup( ProjectGroup projectGroup )
         throws ContinuumException
     {

Modified: continuum/branches/continuum-distributed-builds/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java?rev=713659&r1=713658&r2=713659&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
Wed Nov 12 22:34:23 2008
@@ -475,6 +475,22 @@
         assertEquals( defaultProjectGroup, continuum.getProjectGroupByGroupId( Continuum.DEFAULT_PROJECT_GROUP_GROUP_ID
) );
     }
 
+    public void testDistributedBuild()
+        throws Exception
+    {
+        for ( ProjectGroup group : getContinuum().getAllProjectGroups() )
+        {
+            assertFalse( group.isDistributedBuildEnabled() );
+        }
+
+        getContinuum().setDistributedBuildEnabled( true );
+
+        for ( ProjectGroup group : getContinuum().getAllProjectGroups() )
+        {
+            assertTrue( group.isDistributedBuildEnabled() );
+        }
+    }
+
     private Continuum getContinuum()
         throws Exception
     {

Modified: continuum/branches/continuum-distributed-builds/continuum-model/src/main/mdo/continuum.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-model/src/main/mdo/continuum.xml?rev=713659&r1=713658&r2=713659&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-model/src/main/mdo/continuum.xml
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-model/src/main/mdo/continuum.xml
Wed Nov 12 22:34:23 2008
@@ -167,6 +167,11 @@
             <type>LocalRepository</type>
           </association>
         </field>
+        <field>
+          <name>distributedBuildEnabled</name>
+          <version>1.1.3+</version>
+          <type>boolean</type>
+        </field>
       </fields>
     </class>
 
@@ -1244,6 +1249,11 @@
           <type>String</type>
           <defaultValue>release-output-directory</defaultValue>
         </field>
+        <field>
+          <name>distributedBuildEnabled</name>
+          <version>1.1.3+</version>
+          <type>boolean</type>
+        </field>
       </fields>
     </class>
 



Mime
View raw message