continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r232216 - in /maven/continuum/trunk: continuum-core-it/src/test/java/org/apache/maven/continuum/it/ continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/ continuum-core/src/main/java/org/apache/maven/continuum/core/action...
Date Fri, 12 Aug 2005 06:06:09 GMT
Author: brett
Date: Thu Aug 11 23:05:53 2005
New Revision: 232216

URL: http://svn.apache.org/viewcvs?rev=232216&view=rev
Log:
rename forced to trigger

Modified:
    maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenTwoIntegrationTest.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.java
    maven/continuum/trunk/continuum-model/src/main/java/org/apache/maven/continuum/project/ContinuumProjectState.java
    maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo

Modified: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenTwoIntegrationTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenTwoIntegrationTest.java?rev=232216&r1=232215&r2=232216&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenTwoIntegrationTest.java
(original)
+++ maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenTwoIntegrationTest.java
Thu Aug 11 23:05:53 2005
@@ -16,19 +16,19 @@
  * limitations under the License.
  */
 
-import java.io.IOException;
-import java.io.File;
-import java.util.Map;
-
-import org.apache.maven.continuum.project.ContinuumProject;
-import org.apache.maven.continuum.project.ContinuumBuild;
-import org.apache.maven.continuum.project.ContinuumNotifier;
 import org.apache.maven.continuum.Continuum;
 import org.apache.maven.continuum.execution.maven.m2.MavenTwoBuildExecutor;
-
+import org.apache.maven.continuum.project.ContinuumBuild;
+import org.apache.maven.continuum.project.ContinuumNotifier;
+import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.cli.CommandLineException;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -51,18 +51,14 @@
 
         progress( "Adding Maven 2 project" );
 
-        String projectId = getProjectId( continuum.addMavenTwoProject( "file:" + root.getAbsolutePath()
+ "/pom.xml" ) );
+        String projectId = getProjectId(
+            continuum.addMavenTwoProject( "file:" + root.getAbsolutePath() + "/pom.xml" )
);
 
         waitForSuccessfulCheckout( projectId );
 
         ContinuumProject project = continuum.getProject( projectId );
 
-        assertProject( projectId,
-                       "Maven 2 Project",
-                       "2.0-SNAPSHOT",
-                       "-N -B",
-                       MavenTwoBuildExecutor.ID,
-                       project );
+        assertProject( projectId, "Maven 2 Project", "2.0-SNAPSHOT", "-N -B", MavenTwoBuildExecutor.ID,
project );
 
         assertEquals( "project.notifiers.size", 2, project.getNotifiers().size() );
 
@@ -71,7 +67,7 @@
 
         //assertEquals( "project.notifiers.size", 1, project.getNotifiers().size() );
 
-        Map configuration = ((ContinuumNotifier) project.getNotifiers().get( 0 )).getConfiguration();
+        Map configuration = ( (ContinuumNotifier) project.getNotifiers().get( 0 ) ).getConfiguration();
 
         assertEquals( "project.notifiers[1].configuration.size", 1, configuration.size()
);
 
@@ -101,7 +97,7 @@
 
         ContinuumBuild build = assertSuccessfulMaven2Build( buildId );
 
-        assertTrue( "The 'build forced' flag wasn't true", build.isForced() );
+        assertEquals( "The 'build forced' flag wasn't true", ContinuumProjectState.TRIGGER_FORCED,
build.getTrigger() );
 
         removeProject( projectId );
     }
@@ -113,40 +109,20 @@
 
         deleteAndCreateDirectory( basedir );
 
-        FileUtils.fileWrite( new File( basedir, "pom.xml" ).getAbsolutePath(),
-            "<project>\n" +
-            "  <modelVersion>4.0.0</modelVersion>\n" +
-            "  <groupId>continuum</groupId>\n" +
-            "  <artifactId>" + artifactId + "</artifactId>\n" +
-            "  <version>2.0-SNAPSHOT</version>\n" +
-            "  <name>Maven 2 Project</name>\n" +
-            "  <ciManagement>\n" +
-            "    <notifiers>\n" +
-            "      <notifier>\n" +
-            "        <type>mail</type>\n" +
-            "        <configuration>\n" +
-            "          <address>" + getEmail() + "</address>\n" +
-            "        </configuration>\n" +
-            "      </notifier>\n" +
-            "      <notifier>\n" +
-            "        <type>irc</type>\n" +
-            "        <configuration>\n" +
-            "          <host>irc.codehaus.org</host>\n" +
-            "          <port>6667</port>\n" +
-            "          <channel>#test</channel>\n" +
-            "        </configuration>\n" +
-            "      </notifier>\n" +
-            "    </notifiers>\n" +
-            "  </ciManagement>\n" +
-            "  <scm>\n" +
-            "    <connection>" + makeScmUrl( "cvs", cvsRoot, artifactId ) + "</connection>\n"
+
-            "  </scm>\n" +
-            "</project>" );
+        FileUtils.fileWrite( new File( basedir, "pom.xml" ).getAbsolutePath(), "<project>\n"
+
+            "  <modelVersion>4.0.0</modelVersion>\n" + "  <groupId>continuum</groupId>\n"
+ "  <artifactId>" +
+            artifactId + "</artifactId>\n" + "  <version>2.0-SNAPSHOT</version>\n"
+
+            "  <name>Maven 2 Project</name>\n" + "  <ciManagement>\n" +
"    <notifiers>\n" + "      <notifier>\n" +
+            "        <type>mail</type>\n" + "        <configuration>\n"
+ "          <address>" + getEmail() +
+            "</address>\n" + "        </configuration>\n" + "      </notifier>\n"
+ "      <notifier>\n" +
+            "        <type>irc</type>\n" + "        <configuration>\n"
+ "          <host>irc.codehaus.org</host>\n" +
+            "          <port>6667</port>\n" + "          <channel>#test</channel>\n"
+ "        </configuration>\n" +
+            "      </notifier>\n" + "    </notifiers>\n" + "  </ciManagement>\n"
+ "  <scm>\n" + "    <connection>" +
+            makeScmUrl( "cvs", cvsRoot, artifactId ) + "</connection>\n" + "  </scm>\n"
+ "</project>" );
 
         assertTrue( new File( basedir + "/src/main/java" ).mkdirs() );
 
-        FileUtils.fileWrite( new File( basedir + "/src/main/java/Foo.java" ).getAbsolutePath(),
-                             "class Foo { }" );
+        FileUtils.fileWrite( new File( basedir + "/src/main/java/Foo.java" ).getAbsolutePath(),
"class Foo { }" );
 
         cvsImport( basedir, artifactId, getCvsRoot() );
     }
@@ -157,7 +133,7 @@
         {
             getContinuum().removeNotifier( projectId, notifierType );
         }
-        catch( Exception e )
+        catch ( Exception e )
         {
             e.printStackTrace();
 

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java?rev=232216&r1=232215&r2=232216&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
Thu Aug 11 23:05:53 2005
@@ -43,16 +43,24 @@
     extends AbstractLogEnabled
     implements BuildController
 {
-    /** @plexus.requirement */
+    /**
+     * @plexus.requirement
+     */
     private ContinuumStore store;
 
-    /** @plexus.requirement */
+    /**
+     * @plexus.requirement
+     */
     private ContinuumNotificationDispatcher notifierDispatcher;
 
-    /** @plexus.requirement */
+    /**
+     * @plexus.requirement
+     */
     private ActionManager actionManager;
 
-    /** @plexus.requirement */
+    /**
+     * @plexus.requirement
+     */
     private WorkingDirectoryService workingDirectoryService;
 
     // ----------------------------------------------------------------------
@@ -107,9 +115,8 @@
             {
                 actionManager.lookup( "check-working-directory" ).execute( actionContext
);
 
-                boolean workingDirectoryExists =
-                    AbstractContinuumAction.getBoolean( actionContext,
-                                                        AbstractContinuumAction.KEY_WORKING_DIRECTORY_EXISTS
);
+                boolean workingDirectoryExists = AbstractContinuumAction.getBoolean( actionContext,
+                                                                                     AbstractContinuumAction.KEY_WORKING_DIRECTORY_EXISTS
);
 
                 if ( workingDirectoryExists )
                 {
@@ -124,17 +131,18 @@
 
                     ScmResult checkOutScmResult = AbstractContinuumAction.getCheckoutResult(
actionContext, null );
 
-                    String checkoutErrorMessage = AbstractContinuumAction.getCheckoutErrorMessage(
actionContext, null );
+                    String checkoutErrorMessage = AbstractContinuumAction.getCheckoutErrorMessage(
actionContext,
+                                                                                        
          null );
 
-                    String checkoutErrorException = AbstractContinuumAction.getCheckoutErrorException(
actionContext, null );
+                    String checkoutErrorException = AbstractContinuumAction.getCheckoutErrorException(
actionContext,
+                                                                                        
              null );
 
                     // ----------------------------------------------------------------------
                     // Check to see if there was a error while checking out the project
                     // ----------------------------------------------------------------------
 
                     if ( !StringUtils.isEmpty( checkoutErrorMessage ) ||
-                         !StringUtils.isEmpty( checkoutErrorException ) ||
-                         checkOutScmResult == null )
+                        !StringUtils.isEmpty( checkoutErrorException ) || checkOutScmResult
== null )
                     {
                         ContinuumBuild build = makeBuildResult( scmResult, startTime, forced
);
 
@@ -157,7 +165,7 @@
                         buildId = storeBuild( project, build ).getId();
 
                         return;
-                     }
+                    }
 
                     actionContext.put( AbstractContinuumAction.KEY_UPDATE_SCM_RESULT, checkOutScmResult
);
                 }
@@ -190,11 +198,15 @@
 
                     if ( result != null )
                     {
-                        error += "Provider message: " + StringUtils.clean( result.getProviderMessage()
) + System.getProperty( "line.separator" );
+                        error += "Provider message: " + StringUtils.clean( result.getProviderMessage()
) +
+                            System.getProperty( "line.separator" );
                         error += "Command output: " + System.getProperty( "line.separator"
);
-                        error += "-------------------------------------------------------------------------------"
+ System.getProperty( "line.separator" );
-                        error += StringUtils.clean( result.getCommandOutput() ) + System.getProperty(
"line.separator" );
-                        error += "-------------------------------------------------------------------------------"
+ System.getProperty( "line.separator" );
+                        error += "-------------------------------------------------------------------------------"
+
+                            System.getProperty( "line.separator" );
+                        error += StringUtils.clean( result.getCommandOutput() ) +
+                            System.getProperty( "line.separator" );
+                        error += "-------------------------------------------------------------------------------"
+
+                            System.getProperty( "line.separator" );
                     }
 
                     error += "Exception:" + System.getProperty( "line.separator" );
@@ -253,15 +265,14 @@
         return build;
     }
 
-    private ContinuumBuild makeBuildResult( ScmResult scmResult,
-                                            long startTime,
-                                            boolean forced )
+    private ContinuumBuild makeBuildResult( ScmResult scmResult, long startTime, boolean
forced )
     {
         ContinuumBuild build = new ContinuumBuild();
 
         build.setState( ContinuumProjectState.ERROR );
 
-        build.setForced( forced );
+        // TODO: set trigger properly
+        build.setTrigger( forced ? ContinuumProjectState.TRIGGER_FORCED : ContinuumProjectState.TRIGGER_UNKNOWN
);
 
         build.setStartTime( startTime );
 

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java?rev=232216&r1=232215&r2=232216&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
Thu Aug 11 23:05:53 2005
@@ -65,9 +65,7 @@
         // This is really a precondition for this action to execute
         // ----------------------------------------------------------------------
 
-        if ( scmResult.getFiles().size() == 0 &&
-             !forced &&
-             !isNew( project ) )
+        if ( scmResult.getFiles().size() == 0 && !forced && !isNew( project
) )
         {
             getLogger().info( "No files updated, not building. Project id '" + project.getId()
+ "'." );
 
@@ -84,7 +82,8 @@
 
         build.setState( ContinuumProjectState.BUILDING );
 
-        build.setForced( forced );
+        // TODO: set trigger properly
+        build.setTrigger( forced ? ContinuumProjectState.TRIGGER_FORCED : ContinuumProjectState.TRIGGER_UNKNOWN
);
 
         build.setScmResult( scmResult );
 
@@ -106,12 +105,11 @@
 
             ContinuumBuildExecutionResult result = buildExecutor.build( project, buildOutputFile
);
 
-            build.setState( result.getExitCode() == 0 ?
-                            ContinuumProjectState.OK : ContinuumProjectState.FAILED );
+            build.setState( result.getExitCode() == 0 ? ContinuumProjectState.OK : ContinuumProjectState.FAILED
);
 
             build.setExitCode( result.getExitCode() );
         }
-        catch( Throwable e )
+        catch ( Throwable e )
         {
             build.setState( ContinuumProjectState.ERROR );
 

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.java?rev=232216&r1=232215&r2=232216&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.java
Thu Aug 11 23:05:53 2005
@@ -20,6 +20,7 @@
 import org.apache.maven.continuum.notification.ContinuumNotificationDispatcher;
 import org.apache.maven.continuum.project.ContinuumBuild;
 import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.scm.ScmFile;
 import org.apache.maven.continuum.scm.ScmResult;
 import org.codehaus.plexus.mailsender.MailMessage;
@@ -172,7 +173,7 @@
 
         build.setState( state );
 
-        build.setForced( true );
+        build.setTrigger( ContinuumProjectState.TRIGGER_FORCED );
 
         build.setExitCode( 10 );
 

Modified: maven/continuum/trunk/continuum-model/src/main/java/org/apache/maven/continuum/project/ContinuumProjectState.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/src/main/java/org/apache/maven/continuum/project/ContinuumProjectState.java?rev=232216&r1=232215&r2=232216&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/java/org/apache/maven/continuum/project/ContinuumProjectState.java
(original)
+++ maven/continuum/trunk/continuum-model/src/main/java/org/apache/maven/continuum/project/ContinuumProjectState.java
Thu Aug 11 23:05:53 2005
@@ -68,6 +68,9 @@
     // TODO: maybe move these to another class
     public static final int TRIGGER_FORCED = 1;
 
+    // TODO: remove
+    public static final int TRIGGER_UNKNOWN = 0;
+
     protected ContinuumProjectState( String name )
     {
         this.name = name;

Modified: maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo?rev=232216&r1=232215&r2=232216&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo Thu Aug 11 23:05:53
2005
@@ -363,6 +363,7 @@
         </field>
         <field>
           <name>id</name>
+          <!--buildnumber?-->
           <version>1.0.0</version>
           <type>String</type>
           <identifier>true</identifier>
@@ -378,9 +379,9 @@
           -->
         </field>
         <field>
-          <name>forced</name>
+          <name>trigger</name>
           <version>1.0.0</version>
-          <type>boolean</type>
+          <type>int</type>
         </field>
         <field>
           <name>startTime</name>



Mime
View raw message