From continuum-commits-return-2538-apmail-maven-continuum-commits-archive=maven.apache.org@maven.apache.org Tue Nov 14 19:17:55 2006 Return-Path: Delivered-To: apmail-maven-continuum-commits-archive@www.apache.org Received: (qmail 6959 invoked from network); 14 Nov 2006 19:17:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Nov 2006 19:17:54 -0000 Received: (qmail 55162 invoked by uid 500); 14 Nov 2006 19:18:05 -0000 Delivered-To: apmail-maven-continuum-commits-archive@maven.apache.org Received: (qmail 55137 invoked by uid 500); 14 Nov 2006 19:18:05 -0000 Mailing-List: contact continuum-commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: continuum-dev@maven.apache.org Delivered-To: mailing list continuum-commits@maven.apache.org Received: (qmail 55124 invoked by uid 99); 14 Nov 2006 19:18:05 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Nov 2006 11:18:05 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Nov 2006 11:17:53 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id AE5191A9846; Tue, 14 Nov 2006 11:17:22 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r474925 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/store/ continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/ continuum-core/src/test/java/org/apache/maven/continuum/buildcontrol... Date: Tue, 14 Nov 2006 19:17:22 -0000 To: continuum-commits@maven.apache.org From: evenisse@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061114191722.AE5191A9846@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: evenisse Date: Tue Nov 14 11:17:21 2006 New Revision: 474925 URL: http://svn.apache.org/viewvc?view=rev&rev=474925 Log: [CONTINUUM-232] Build when a dependency has been changed, only for dependencies that are a continuum project Added: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java (with props) maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.xml (with props) Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildContext.java maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/SchedulesPageTest.java Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java?view=diff&rev=474925&r1=474924&r2=474925 ============================================================================== --- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java (original) +++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java Tue Nov 14 11:17:21 2006 @@ -43,9 +43,6 @@ { String ROLE = ContinuumStore.class.getName(); - Project getProjectByName( String name ) - throws ContinuumStoreException; - void removeNotifier( ProjectNotifier notifier ) throws ContinuumStoreException; @@ -57,13 +54,14 @@ /** * returns the default build definition of the project, if the project doesn't have on declared the default * of the project group will be returned - * + *

* this should be the most common usage of the default build definition accessing methods * * @param projectId * @return * @throws ContinuumStoreException * @throws ContinuumObjectNotFoundException + * */ BuildDefinition getDefaultBuildDefinition( int projectId ) throws ContinuumStoreException, ContinuumObjectNotFoundException; @@ -75,17 +73,19 @@ * @return * @throws ContinuumStoreException * @throws ContinuumObjectNotFoundException + * */ BuildDefinition getDefaultBuildDefinitionForProject( int projectId ) throws ContinuumStoreException, ContinuumObjectNotFoundException; /** * returns the default build definition for the project group and there should always be one declared - * + * * @param projectGroupId * @return * @throws ContinuumStoreException * @throws ContinuumObjectNotFoundException + * */ BuildDefinition getDefaultBuildDefinitionForProjectGroup( int projectGroupId ) throws ContinuumStoreException, ContinuumObjectNotFoundException; @@ -143,6 +143,12 @@ Project getProject( int projectId ) throws ContinuumStoreException, ContinuumObjectNotFoundException; + Project getProject( String groupId, String artifactId, String version ) + throws ContinuumStoreException; + + Project getProjectByName( String name ) + throws ContinuumStoreException; + Map getProjectIdsAndBuildDefinitionsIdsBySchedule( int scheduleId ) throws ContinuumStoreException; @@ -201,6 +207,8 @@ throws ContinuumStoreException, ContinuumObjectNotFoundException; BuildResult getLatestBuildResultForProject( int projectId ); + + List getBuildResultsInSuccessForProject( int projectId, long fromDate ); List getBuildResultsForProject( int projectId, long fromDate ); Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildContext.java URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildContext.java?view=diff&rev=474925&r1=474924&r2=474925 ============================================================================== --- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildContext.java (original) +++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildContext.java Tue Nov 14 11:17:21 2006 @@ -16,21 +16,20 @@ * limitations under the License. */ -import org.apache.maven.continuum.core.action.AbstractContinuumAction; 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.scm.ScmResult; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; /** - * * This class holds build context information. * * @author Kenney Westerhof - * */ public class BuildContext { @@ -52,6 +51,8 @@ private BuildResult buildResult; + private List modifiedDependencies; + public void setStartTime( long startTime ) { this.startTime = startTime; @@ -139,5 +140,19 @@ public void setTrigger( int trigger ) { this.trigger = trigger; + } + + public List getModifiedDependencies() + { + if ( modifiedDependencies == null ) + { + modifiedDependencies = new ArrayList(); + } + return modifiedDependencies; + } + + public void setModifiedDependencies( List modifiedDependencies ) + { + this.modifiedDependencies = modifiedDependencies; } } Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java?view=diff&rev=474925&r1=474924&r2=474925 ============================================================================== --- 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 Tue Nov 14 11:17:21 2006 @@ -20,6 +20,7 @@ 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.ProjectDependency; import org.apache.maven.continuum.model.scm.ChangeFile; import org.apache.maven.continuum.model.scm.ChangeSet; import org.apache.maven.continuum.model.scm.ScmResult; @@ -37,6 +38,7 @@ import org.codehaus.plexus.taskqueue.execution.TaskExecutionException; import org.codehaus.plexus.util.StringUtils; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -85,13 +87,13 @@ getLogger().info( "Initializing build" ); BuildContext context = initializeBuildContext( projectId, buildDefinitionId, trigger ); - getLogger().info( "Starting build" ); + getLogger().info( "Starting build of " + context.getProject().getName() ); startBuild( context ); try { // check if build definition requires smoking the existing checkout and rechecking out project - if ( context.getBuildDefinition().isBuildFresh()) + if ( context.getBuildDefinition().isBuildFresh() ) { getLogger().info( "Purging exiting working copy" ); cleanWorkingDirectory( context ); @@ -114,6 +116,8 @@ return; } + checkProjectDependencies( context ); + if ( !shouldBuild( context ) ) { getLogger().info( "No changes, not building" ); @@ -171,9 +175,10 @@ try { - if ( project.getState() != ContinuumProjectState.NEW && project.getState() != ContinuumProjectState.CHECKEDOUT - && project.getState() != ContinuumProjectState.OK && project.getState() != ContinuumProjectState.FAILED - && project.getState() != ContinuumProjectState.ERROR ) + if ( project.getState() != ContinuumProjectState.NEW && + project.getState() != ContinuumProjectState.CHECKEDOUT && + project.getState() != ContinuumProjectState.OK && project.getState() != ContinuumProjectState.FAILED && + project.getState() != ContinuumProjectState.ERROR ) { try { @@ -273,7 +278,7 @@ * @return * @throws TaskExecutionException */ - private BuildContext initializeBuildContext( int projectId, int buildDefinitionId, int trigger ) + protected BuildContext initializeBuildContext( int projectId, int buildDefinitionId, int trigger ) throws TaskExecutionException { BuildContext context = new BuildContext(); @@ -321,32 +326,33 @@ actionContext.put( AbstractContinuumAction.KEY_TRIGGER, new Integer( trigger ) ); - actionContext.put( AbstractContinuumAction.KEY_FIRST_RUN, Boolean.valueOf( context.getOldBuildResult() == null ) ); + actionContext.put( AbstractContinuumAction.KEY_FIRST_RUN, + Boolean.valueOf( context.getOldBuildResult() == null ) ); return context; } - private void cleanWorkingDirectory( BuildContext buildContext ) + private void cleanWorkingDirectory( BuildContext context ) throws TaskExecutionException { - performAction( "clean-working-directory", buildContext ); + performAction( "clean-working-directory", context ); } - private void updateWorkingDirectory( BuildContext buildContext ) + private void updateWorkingDirectory( BuildContext context ) throws TaskExecutionException { - Map actionContext = buildContext.getActionContext(); + Map actionContext = context.getActionContext(); - performAction( "check-working-directory", buildContext ); + performAction( "check-working-directory", context ); - boolean workingDirectoryExists = AbstractContinuumAction.getBoolean( actionContext, - AbstractContinuumAction.KEY_WORKING_DIRECTORY_EXISTS ); + boolean workingDirectoryExists = + AbstractContinuumAction.getBoolean( actionContext, AbstractContinuumAction.KEY_WORKING_DIRECTORY_EXISTS ); ScmResult scmResult; if ( workingDirectoryExists ) { - performAction( "update-working-directory-from-scm", buildContext ); + performAction( "update-working-directory-from-scm", context ); scmResult = AbstractContinuumAction.getUpdateScmResult( actionContext, null ); } @@ -357,12 +363,12 @@ actionContext.put( AbstractContinuumAction.KEY_WORKING_DIRECTORY, workingDirectoryService.getWorkingDirectory( project ).getAbsolutePath() ); - performAction( "checkout-project", buildContext ); + performAction( "checkout-project", context ); scmResult = AbstractContinuumAction.getCheckoutResult( actionContext, null ); } - buildContext.setScmResult( scmResult ); + context.setScmResult( scmResult ); } private void performAction( String actionName, BuildContext context ) @@ -422,24 +428,22 @@ throw exception; } - private boolean shouldBuild( BuildContext context ) + protected boolean shouldBuild( BuildContext context ) throws TaskExecutionException { - // oldBuildResult != null && - // List changes, Project project, int trigger ) - // scmResult.getChanges(), project, trigger ) ) - - boolean allChangesUnknown = checkAllChangesUnknown( context.getScmResult().getChanges() ); + boolean shouldBuild = true; Project project = context.getProject(); - if ( allChangesUnknown && project.getOldState() != ContinuumProjectState.NEW - && project.getOldState() != ContinuumProjectState.CHECKEDOUT - && context.getTrigger() != ContinuumProjectState.TRIGGER_FORCED - && project.getState() != ContinuumProjectState.NEW - && project.getState() != ContinuumProjectState.CHECKEDOUT ) + // Check SCM changes + boolean allChangesUnknown = checkAllChangesUnknown( context.getScmResult().getChanges() ); + + if ( allChangesUnknown && project.getOldState() != ContinuumProjectState.NEW && + project.getOldState() != ContinuumProjectState.CHECKEDOUT && + context.getTrigger() != ContinuumProjectState.TRIGGER_FORCED && + project.getState() != ContinuumProjectState.NEW && project.getState() != ContinuumProjectState.CHECKEDOUT ) { - if ( context.getScmResult().getChanges().size() > 0 ) + if ( !context.getScmResult().getChanges().isEmpty() ) { getLogger().info( "The project was not built because all changes are unknown." ); } @@ -461,10 +465,28 @@ throw new TaskExecutionException( "Error storing project", e ); } - return false; + shouldBuild = false; + + // Check dependencies changes + if ( context.getModifiedDependencies() != null && !context.getModifiedDependencies().isEmpty() ) + { + shouldBuild = true; + } + } + else + { + // Check dependencies changes + if ( context.getModifiedDependencies() != null && !context.getModifiedDependencies().isEmpty() ) + { + shouldBuild = true; + } + else + { + shouldBuild = false; + } } - return true; + return shouldBuild; } private boolean checkAllChangesUnknown( List changes ) @@ -491,6 +513,55 @@ return true; } + protected void checkProjectDependencies( BuildContext context ) + { + if ( context.getOldBuildResult() == null ) + { + return; + } + + try + { + Project project = store.getProjectWithAllDetails( context.getProject().getId() ); + List dependencies = project.getDependencies(); + + if ( dependencies == null ) + { + return; + } + List modifiedDependencies = new ArrayList(); + + for ( Iterator i = dependencies.iterator(); i.hasNext(); ) + { + ProjectDependency dep = (ProjectDependency) i.next(); + Project dependencyProject = store.getProject( dep.getGroupId(), dep.getArtifactId(), dep.getVersion() ); + + if ( dependencyProject != null ) + { + List buildResults = store.getBuildResultsInSuccessForProject( dependencyProject.getId(), + context.getOldBuildResult().getEndTime() ); + if ( buildResults != null && !buildResults.isEmpty() ) + { + getLogger().debug( "Dependency changed: " + dep.getGroupId() + ":" + dep.getArtifactId() + ":" + + dep.getVersion() ); + modifiedDependencies.add( dep ); + } + } + else + { + getLogger().debug( "Skip non Continuum project: " + dep.getGroupId() + ":" + dep.getArtifactId() + + ":" + dep.getVersion() ); + } + } + + context.setModifiedDependencies( modifiedDependencies ); + } + catch ( ContinuumStoreException e ) + { + getLogger().warn( "Can't get the project dependencies", e ); + } + } + private String convertScmResultToError( ScmResult result ) { String error = ""; @@ -503,24 +574,24 @@ { if ( result.getCommandLine() != null ) { - error = "Command line: " + StringUtils.clean( result.getCommandLine() ) - + System.getProperty( "line.separator" ); + error = "Command line: " + StringUtils.clean( result.getCommandLine() ) + + System.getProperty( "line.separator" ); } if ( result.getProviderMessage() != null ) { - error = "Provider message: " + StringUtils.clean( result.getProviderMessage() ) - + System.getProperty( "line.separator" ); + error = "Provider message: " + StringUtils.clean( result.getProviderMessage() ) + + System.getProperty( "line.separator" ); } if ( result.getCommandOutput() != null ) { error += "Command output: " + 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 += "-------------------------------------------------------------------------------" + + System.getProperty( "line.separator" ); } if ( result.getException() != null ) @@ -555,6 +626,18 @@ build.setScmResult( context.getScmResult() ); + List dependencies = context.getModifiedDependencies(); + if ( dependencies != null && !dependencies.isEmpty() ) + { + List modifiedDependencies = new ArrayList(); + for ( Iterator i = dependencies.iterator(); i.hasNext(); ) + { + ProjectDependency dep = (ProjectDependency) i.next(); + modifiedDependencies.add( dep.getGroupId() + ":" + dep.getArtifactId() + ":" + dep.getVersion() ); + } + build.setModifiedDependencies( modifiedDependencies ); + } + if ( error != null ) { build.setError( error ); @@ -649,7 +732,6 @@ } newScmResult.setChanges( oldChanges ); - } } } Added: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java?view=auto&rev=474925 ============================================================================== --- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java (added) +++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java Tue Nov 14 11:17:21 2006 @@ -0,0 +1,132 @@ +package org.apache.maven.continuum.buildcontroller; + +import org.apache.maven.continuum.AbstractContinuumTest; +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.ProjectDependency; +import org.apache.maven.continuum.model.scm.ScmResult; +import org.apache.maven.continuum.project.ContinuumProjectState; + +import java.util.Calendar; + +/* + * Copyright 2004-2006 The Apache Software Foundation. + * + * Licensed 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. + */ + +public class DefaultBuildControllerTest + extends AbstractContinuumTest +{ + private DefaultBuildController controller; + + int projectId1; + + int projectId2; + + int buildDefinitionId1; + + int buildDefinitionId2; + + public void setUp() + throws Exception + { + super.setUp(); + + Project project1 = createProject( "project1" ); + BuildDefinition bd1 = createBuildDefinition(); + project1.addBuildDefinition( bd1 ); + projectId1 = addProject( getStore(), project1 ).getId(); + buildDefinitionId1 = getStore().getDefaultBuildDefinition( projectId1 ).getId(); + project1 = getStore().getProject( projectId1 ); + BuildResult buildResult1 = new BuildResult(); + buildResult1.setStartTime( Calendar.getInstance().getTimeInMillis() ); + buildResult1.setEndTime( Calendar.getInstance().getTimeInMillis() ); + buildResult1.setSuccess( true ); + getStore().addBuildResult( project1, buildResult1 ); + BuildResult buildResult2 = new BuildResult(); + buildResult2.setStartTime( Calendar.getInstance().getTimeInMillis() - 7200000 ); + buildResult2.setEndTime( Calendar.getInstance().getTimeInMillis() - 7200000 ); + buildResult2.setSuccess( true ); + getStore().addBuildResult( project1, buildResult2 ); + + Project project2 = createProject( "project2" ); + ProjectDependency dep1 = new ProjectDependency(); + dep1.setGroupId( "org.apache.maven.testproject" ); + dep1.setArtifactId( "project1" ); + dep1.setVersion( "1.0-SNAPSHOT" ); + project2.addDependency( dep1 ); + ProjectDependency dep2 = new ProjectDependency(); + dep2.setGroupId( "junit" ); + dep2.setArtifactId( "junit" ); + dep2.setVersion( "3.8.1" ); + project2.addDependency( dep2 ); + BuildDefinition bd2 = createBuildDefinition(); + project2.addBuildDefinition( bd2 ); + projectId2 = addProject( getStore(), project2 ).getId(); + buildDefinitionId2 = getStore().getDefaultBuildDefinition( projectId2 ).getId(); + + controller = (DefaultBuildController) lookup( BuildController.ROLE ); + } + + private Project createProject( String artifactId ) + { + Project project = new Project(); + project.setExecutorId( "maven2" ); + project.setName( artifactId ); + project.setGroupId( "org.apache.maven.testproject" ); + project.setArtifactId( artifactId ); + project.setVersion( "1.0-SNAPSHOT" ); + return project; + } + + private BuildDefinition createBuildDefinition() + { + BuildDefinition builddef = new BuildDefinition(); + builddef.setBuildFile( "pom.xml" ); + builddef.setGoals( "clean" ); + builddef.setDefaultForProject( true ); + return builddef; + } + + private BuildContext getContext( int hourOfLastExecution ) + throws Exception + { + BuildContext context = controller.initializeBuildContext( projectId2, buildDefinitionId2, + ContinuumProjectState.TRIGGER_SCHEDULED ); + BuildResult oldBuildResult = new BuildResult(); + oldBuildResult.setEndTime( Calendar.getInstance().getTimeInMillis() + ( hourOfLastExecution * 3600000 ) ); + context.setOldBuildResult( oldBuildResult ); + context.setScmResult( new ScmResult() ); + return context; + } + + public void testWithoutDependencyChanges() + throws Exception + { + BuildContext context = getContext( +1 ); + controller.checkProjectDependencies( context ); + assertEquals( 0, context.getModifiedDependencies().size() ); + assertFalse( controller.shouldBuild( context ) ); + } + + public void testWithDependencyChanges() + throws Exception + { + BuildContext context = getContext( -1 ); + controller.checkProjectDependencies( context ); + assertEquals( 1, context.getModifiedDependencies().size() ); + assertTrue( controller.shouldBuild( context ) ); + } +} \ No newline at end of file Propchange: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.xml URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.xml?view=auto&rev=474925 ============================================================================== --- maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.xml (added) +++ maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.xml Tue Nov 14 11:17:21 2006 @@ -0,0 +1,11 @@ + + + + org.codehaus.plexus.notification.RecipientSource + org.apache.maven.continuum.notification.ContinuumRecipientSource + + nobody@localhost + + + + Propchange: maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Modified: maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml?view=diff&rev=474925&r1=474924&r2=474925 ============================================================================== --- maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml (original) +++ maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml Tue Nov 14 11:17:21 2006 @@ -449,6 +449,14 @@ TestResult + + modifiedDependencies + 1.0.0+ + + String + * + + Modified: maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?view=diff&rev=474925&r1=474924&r2=474925 ============================================================================== --- maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java (original) +++ maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java Tue Nov 14 11:17:21 2006 @@ -153,6 +153,53 @@ } } + public Project getProject( String groupId, String artifactId, String version ) + throws ContinuumStoreException + { + PersistenceManager pm = getPersistenceManager(); + + Transaction tx = pm.currentTransaction(); + + try + { + tx.begin(); + + Extent extent = pm.getExtent( Project.class, true ); + + Query query = pm.newQuery( extent ); + + query.declareImports( "import java.lang.String" ); + + query.declareParameters( "String groupId, String artifactId, String version" ); + + query.setFilter( "this.groupId == groupId && this.artifactId == artifactId && this.version == version" ); + + Object[] params = new Object[3]; + params[0] = groupId; + params[1]=artifactId; + params[2]=version; + + Collection result = (Collection) query.executeWithArray( params ); + + if ( result.size() == 0 ) + { + tx.commit(); + + return null; + } + + Object object = pm.detachCopy( result.iterator().next() ); + + tx.commit(); + + return (Project) object; + } + finally + { + rollback( tx ); + } + } + public Map getProjectIdsAndBuildDefinitionsIdsBySchedule( int scheduleId ) throws ContinuumStoreException { @@ -510,7 +557,7 @@ for ( Iterator i = projectGroup.getBuildDefinitions().iterator(); i.hasNext(); ) { - BuildDefinition bd = (BuildDefinition)i.next(); + BuildDefinition bd = (BuildDefinition) i.next(); // also applies to project group membership if ( bd.isDefaultForProject() ) @@ -698,11 +745,11 @@ List groupProjects = new ArrayList(); - for (Iterator i = allProjects.iterator(); i.hasNext(); ) + for ( Iterator i = allProjects.iterator(); i.hasNext(); ) { - Project project = (Project)i.next(); + Project project = (Project) i.next(); - if (project.getProjectGroup().getId() == projectGroupId ) + if ( project.getProjectGroup().getId() == projectGroupId ) { groupProjects.add( project ); } @@ -950,6 +997,27 @@ } } + public List getBuildResultsInSuccessForProject( int projectId, long fromDate ) + { + List buildResults = getBuildResultsForProject( projectId, fromDate ); + + List results = new ArrayList(); + + if ( buildResults != null ) + { + for ( Iterator i = buildResults.iterator(); i.hasNext(); ) + { + BuildResult res = (BuildResult) i.next(); + if ( res.isSuccess() ) + { + results.add( res ); + } + } + } + + return results; + } + public Map getBuildResultsInSuccess() { PersistenceManager pm = getPersistenceManager(); @@ -1152,7 +1220,8 @@ } } - throw new ContinuumObjectNotFoundException( "unable to find project group containing project with id: " + projectId ); + throw new ContinuumObjectNotFoundException( + "unable to find project group containing project with id: " + projectId ); } public SystemConfiguration addSystemConfiguration( SystemConfiguration systemConf ) Modified: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/SchedulesPageTest.java URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/SchedulesPageTest.java?view=diff&rev=474925&r1=474924&r2=474925 ============================================================================== --- maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/SchedulesPageTest.java (original) +++ maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/SchedulesPageTest.java Tue Nov 14 11:17:21 2006 @@ -98,6 +98,8 @@ super.setUp(); clickLinkWithText( "Schedules" ); + + assertSchedulesPage(); } public String getUsername() @@ -110,18 +112,14 @@ return this.adminPassword; } - public void testInitialSchedulesPage() - throws Exception - { - assertInitialSchedulesPage(); - } - public void testBasicScheduleAddAndDelete() throws Exception { // add schedule clickButtonWithValue( "Add" ); + assertEditSchedulePage(); + inputSchedule( SCHEDULE_NAME, SCHEDULE_DESCRIPTION, SECOND, MINUTE, HOUR, DAYOFMONTH, MONTH, DAYOFWEEK, YEAR, MAXJOBEXECUTIONTIME, DELAY, true ); @@ -150,6 +148,8 @@ { clickButtonWithValue( "Add" ); + assertEditSchedulePage(); + inputSchedule( SCHEDULE_NAME_EDIT, SCHEDULE_DESCRIPTION, SECOND, MINUTE, HOUR, DAYOFMONTH, MONTH, DAYOFWEEK, YEAR, MAXJOBEXECUTIONTIME, DELAY, true ); @@ -170,9 +170,6 @@ inputSchedule( SCHEDULE_NAME_EDIT + "modified", SCHEDULE_DESCRIPTION + "updated", "2", "3", "4", "?", "6", "7", "2021", "8", "9", false ); - // after we save the schedule we should be brought back to the schedules page - assertInitialSchedulesPage(); - cronSchedule = "2 3 4 ? 6 7 2021"; String[] editedColumnValues = @@ -196,6 +193,8 @@ { clickButtonWithValue( "Add" ); + assertEditSchedulePage(); + HashMap fields = new HashMap(); boolean valid = false; boolean wait = false; @@ -203,8 +202,6 @@ // test saving without editing anything from the initial edit page inputSchedule( fields, wait, valid ); - assertEditSchedulePage(); - assertTrue( "Name field not validated", getSelenium().isElementPresent( "//tr/td[span='schedule.name.required']" ) ); assertTrue( "Description field not validated", @@ -237,7 +234,7 @@ } - public void assertInitialSchedulesPage() + public void assertSchedulesPage() { assertPage( SCHEDULES_PAGE_TITLE ); @@ -297,7 +294,7 @@ public void deleteSchedule( String scheduleName ) { // after we save the schedule we should be brought back to the schedules page - assertInitialSchedulesPage(); + assertSchedulesPage(); String[] columnValues = {scheduleName}; @@ -312,7 +309,7 @@ clickButtonWithValue( "Delete" ); // after we confirm the deletion we should be brought back to the schedules page - assertInitialSchedulesPage(); + assertSchedulesPage(); } @@ -367,7 +364,7 @@ if ( valid ) { // after we save the schedule we should be brought back to the schedules page - assertInitialSchedulesPage(); + assertSchedulesPage(); } else {