continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r898153 - in /continuum/branches/continuum-1.3.x: continuum-core/src/main/java/org/apache/maven/continuum/ continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ continuum-webapp-test/src/test/testng/org/apache/continuum/web/t...
Date Tue, 12 Jan 2010 02:23:32 GMT
Author: ctan
Date: Tue Jan 12 02:23:31 2010
New Revision: 898153

URL: http://svn.apache.org/viewvc?rev=898153&view=rev
Log:
[CONTINUUM-2411] do not throw exception when there is no default build definition in the template.
only log a warning saying that project cannot be checked out without a build definition

Modified:
    continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenOneProjectTest.java
    continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenTwoProjectTest.java
    continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
    continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=898153&r1=898152&r2=898153&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Tue Jan 12 02:23:31 2010
@@ -1747,17 +1747,20 @@
 
                 if ( defaultBuildDefinition == null )
                 {
-                    throw new ContinuumException( "Error adding projects from modules because
no default build definition defined in the default template" );
+                    // do not throw exception
+                    // project already added so might as well continue with the rest
+                    log.warn( "No default build definition found in the template. Project
cannot be checked out." );
                 }
-
-                // used by BuildManager to determine on which build queue will the project
be put
-                AbstractContinuumAction.setBuildDefinition( context, defaultBuildDefinition
);
-
-                if ( !configurationService.isDistributedBuildEnabled() )
+                else
                 {
-                    executeAction( "add-project-to-checkout-queue", context );
+                    // used by BuildManager to determine on which build queue will the project
be put
+                    AbstractContinuumAction.setBuildDefinition( context, defaultBuildDefinition
);
+    
+                    if ( !configurationService.isDistributedBuildEnabled() )
+                    {
+                        executeAction( "add-project-to-checkout-queue", context );
+                    }
                 }
-
             }
         }
         catch ( BuildDefinitionServiceException e )

Modified: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenOneProjectTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenOneProjectTest.java?rev=898153&r1=898152&r2=898153&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenOneProjectTest.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenOneProjectTest.java
Tue Jan 12 02:23:31 2010
@@ -32,9 +32,33 @@
 public class MavenOneProjectTest
     extends AbstractContinuumTest
 {
+    public void testAddMavenOneProjectWithNoDefaultBuildDefinitionFromTemplate()
+        throws Exception
+    {
+        String M1_POM_URL = getProperty( "M1_POM_URL" );
+        String M1_POM_USERNAME = getProperty( "M1_POM_USERNAME" );
+        String M1_POM_PASSWORD = getProperty( "M1_POM_PASSWORD" );
+        String M1_PROJ_GRP_NAME = getProperty( "M1_PROJ_GRP_NAME" );
+        String M1_PROJ_GRP_ID = getProperty( "M1_PROJ_GRP_ID" );
+        String M1_PROJ_GRP_DESCRIPTION = getProperty( "M1_PROJ_GRP_DESCRIPTION" );
+
+        removeDefaultBuildDefinitionFromTemplate( "maven1" );
+        
+        goToAddMavenOneProjectPage();
+        addMavenOneProject( M1_POM_URL, M1_POM_USERNAME, M1_POM_PASSWORD, null, null, true
);
+        assertProjectGroupSummaryPage( M1_PROJ_GRP_NAME, M1_PROJ_GRP_ID, M1_PROJ_GRP_DESCRIPTION
);
+
+        // Delete project group
+        removeProjectGroup( M1_PROJ_GRP_NAME );
+
+        // Re-add default build definition of template
+        addDefaultBuildDefinitionFromTemplate( "maven1" );
+    }
+
     /**
      * test with valid pom url
      */
+    @Test( dependsOnMethods = { "testAddMavenOneProjectWithNoDefaultBuildDefinitionFromTemplate"
} )
     public void testValidPomUrl()
         throws Exception
     {

Modified: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenTwoProjectTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenTwoProjectTest.java?rev=898153&r1=898152&r2=898153&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenTwoProjectTest.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenTwoProjectTest.java
Tue Jan 12 02:23:31 2010
@@ -33,6 +33,34 @@
     extends AbstractContinuumTest
 {
 
+    public void testAddMavenTwoProjectWithNoDefaultBuildDefinitionInTemplate()
+        throws Exception
+    {
+        String M2_POM_URL = getProperty( "M2_POM_URL" );
+        String M2_POM_USERNAME = getProperty( "M2_POM_USERNAME" );
+        String M2_POM_PASSWORD = getProperty( "M2_POM_PASSWORD" );
+
+        String M2_PROJ_GRP_NAME = getProperty( "M2_PROJ_GRP_NAME" );
+        String M2_PROJ_GRP_ID = getProperty( "M2_PROJ_GRP_ID" );
+        String M2_PROJ_GRP_DESCRIPTION = getProperty( "M2_PROJ_GRP_DESCRIPTION" );
+        String M2_PROJ_GRP_SCM_ROOT_URL = getProperty( "M2_PROJ_GRP_SCM_ROOT_URL" );
+
+        removeDefaultBuildDefinitionFromTemplate( "maven2" );
+
+        addMavenTwoProject( M2_POM_URL, M2_POM_USERNAME, M2_POM_PASSWORD, null, true );
+
+        assertProjectGroupSummaryPage( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, M2_PROJ_GRP_DESCRIPTION
);
+
+        assertTextPresent( M2_PROJ_GRP_SCM_ROOT_URL );
+
+        // Delete project group
+        removeProjectGroup( M2_PROJ_GRP_NAME );
+
+        // Re-add default build definition of template
+        addDefaultBuildDefinitionFromTemplate( "maven2" );
+    }
+
+    @Test( dependsOnMethods = { "testAddMavenTwoProjectWithNoDefaultBuildDefinitionInTemplate"
} )
     public void testAddMavenTwoProject()
         throws Exception
     {

Modified: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java?rev=898153&r1=898152&r2=898153&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
Tue Jan 12 02:23:31 2010
@@ -901,4 +901,76 @@
         assertLinkPresent( "admin" );
         assertLinkPresent( "guest" );
     }
+
+    public void removeDefaultBuildDefinitionFromTemplate( String type )
+    {
+        goToEditBuildDefinitionTemplate( type );
+        clickLinkWithXPath( "//input[@value='<-']", false );
+        submit();
+    }
+
+    public void addDefaultBuildDefinitionFromTemplate( String type )
+    {
+        goToEditBuildDefinitionTemplate( type );
+
+        if ( "maven2".equals( type ) )
+        {
+            selectForOption( "saveBuildDefinitionTemplate_buildDefinitionIds", "Default Maven
2 Build Definition" );
+        }
+        else if ( "maven1".equals( type ) )
+        {
+            
+        }
+        else if ( "ant".equals( type ) )
+        {
+            
+        }
+        else
+        {
+            
+        }
+
+        clickLinkWithXPath( "//input[@value='->']", false );
+        submit();
+    }
+
+    public void goToEditBuildDefinitionTemplate( String type )
+    {
+        clickLinkWithText( "Build Definition Templates" );
+
+        assertBuildDefinitionTemplatesPage();
+
+        if ( "maven2".equals( type ) )
+        {
+            clickLinkWithXPath( "//table[@id='ec_table']/tbody/tr[3]/td[2]/a/img", true );
+        }
+        else if ( "maven1".equals( type ) )
+        {
+            clickLinkWithXPath( "//table[@id='ec_table']/tbody/tr[2]/td[2]/a/img", true );
+        }
+        else if ( "ant".equals( type ) )
+        {
+            clickLinkWithXPath( "//img[@alt='Edit']", true );
+        }
+        else
+        {
+            clickLinkWithXPath( "//table[@id='ec_table']/tbody/tr[4]/td[2]/a/img", true );
+        }
+
+        assertPage( "Continuum - Build Definition Template" );
+    }
+
+    public void assertBuildDefinitionTemplatesPage()
+    {
+        assertPage( "Continuum - Build Definition Templates" );
+        assertTextPresent( "Default Ant Template" );
+        assertTextPresent( "Default Maven 1 Template" );
+        assertTextPresent( "Default Maven 2 Template" );
+        assertTextPresent( "Default Shell Template" );
+        assertTextPresent( "Available Build Definitions" );
+        assertTextPresent( "Default Ant Build Definition" );
+        assertTextPresent( "Default Maven 1 Build Definition" );
+        assertTextPresent( "Default Maven 2 Build Definition" );
+        assertTextPresent( "Default Shell Build Definition" );
+    }
 }

Modified: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java?rev=898153&r1=898152&r2=898153&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java
Tue Jan 12 02:23:31 2010
@@ -444,4 +444,14 @@
             Thread.sleep( 1000 );
         }
     }
+
+    public void selectForOption( String locator, String text )
+    {
+        getSelenium().addSelection( locator, "label=" + text );
+    }
+
+    public void unselectForOption( String locator, String text )
+    {
+        getSelenium().removeSelection( locator, "label=" + text );
+    }
 }



Mime
View raw message