Index: src/test/resources/unit/maven-two-projects/specified-notifiers-pom.xml
===================================================================
--- src/test/resources/unit/maven-two-projects/specified-notifiers-pom.xml (revision 0)
+++ src/test/resources/unit/maven-two-projects/specified-notifiers-pom.xml (revision 0)
@@ -0,0 +1,24 @@
+
+ 4.0.0
+ maven.two.notifiers.project
+ maven-two-notifiers-project
+ jar
+ Maven Two Notifiers Project
+ 1.0
+
+ scm:svn:http://svn.apache.org/repos/asf/maven/continuum/trunk/
+ scm:svn:https://svn.apache.org/repos/asf/maven/continuum/trunk/
+ http://svn.apache.org/viewcvs.cgi/maven/continuum/trunk/
+
+
+
+
+ mail
+ true
+ true
+ true
+ false
+
+
+
+
\ No newline at end of file
Index: src/test/resources/unit/maven-two-projects/missing-connection-element-pom.xml
===================================================================
--- src/test/resources/unit/maven-two-projects/missing-connection-element-pom.xml (revision 0)
+++ src/test/resources/unit/maven-two-projects/missing-connection-element-pom.xml (revision 0)
@@ -0,0 +1,12 @@
+
+ 4.0.0
+ maven.two.project
+ sample-maven-two-project
+ jar
+ Maven Two Project
+ 1.0
+
+ scm:svn:https://svn.apache.org/repos/asf/maven/continuum/trunk/
+ http://svn.apache.org/viewcvs.cgi/maven/continuum/trunk/
+
+
\ No newline at end of file
Index: src/test/resources/unit/maven-two-projects/multi-module-maven-project/maven-two-multi-module-project-module1/pom.xml
===================================================================
--- src/test/resources/unit/maven-two-projects/multi-module-maven-project/maven-two-multi-module-project-module1/pom.xml (revision 0)
+++ src/test/resources/unit/maven-two-projects/multi-module-maven-project/maven-two-multi-module-project-module1/pom.xml (revision 0)
@@ -0,0 +1,11 @@
+
+
+ maven.two.multi.module.project
+ maven-two-multi-module-project
+ 1.0
+
+ 4.0.0
+ maven-two-multi-module-project-module1
+ jar
+ Maven Two Multi-Module Project Module 1
+
\ No newline at end of file
Index: src/test/resources/unit/maven-two-projects/multi-module-maven-project/maven-two-multi-module-project-module2/pom.xml
===================================================================
--- src/test/resources/unit/maven-two-projects/multi-module-maven-project/maven-two-multi-module-project-module2/pom.xml (revision 0)
+++ src/test/resources/unit/maven-two-projects/multi-module-maven-project/maven-two-multi-module-project-module2/pom.xml (revision 0)
@@ -0,0 +1,11 @@
+
+
+ maven.two.multi.module.project
+ maven-two-multi-module-project
+ 1.0
+
+ 4.0.0
+ maven-two-multi-module-project-module2
+ jar
+ Maven Two Multi-Module Project Module 2
+
\ No newline at end of file
Index: src/test/resources/unit/maven-two-projects/multi-module-maven-project/pom.xml
===================================================================
--- src/test/resources/unit/maven-two-projects/multi-module-maven-project/pom.xml (revision 0)
+++ src/test/resources/unit/maven-two-projects/multi-module-maven-project/pom.xml (revision 0)
@@ -0,0 +1,17 @@
+
+ 4.0.0
+ maven.two.multi.module.project
+ maven-two-multi-module-project
+ pom
+ Maven Two Multi-Module Project
+ 1.0
+
+ scm:svn:http://svn.apache.org/repos/asf/maven/continuum/trunk/
+ scm:svn:https://svn.apache.org/repos/asf/maven/continuum/trunk/
+ http://svn.apache.org/viewcvs.cgi/maven/continuum/trunk/
+
+
+ maven-two-multi-module-project-module1
+ maven-two-multi-module-project-module2
+
+
\ No newline at end of file
Index: src/test/resources/unit/maven-two-projects/missing-modules-pom.xml
===================================================================
--- src/test/resources/unit/maven-two-projects/missing-modules-pom.xml (revision 0)
+++ src/test/resources/unit/maven-two-projects/missing-modules-pom.xml (revision 0)
@@ -0,0 +1,18 @@
+
+ 4.0.0
+ maven.two.project
+ sample-maven-two-project
+ jar
+ Maven Two Project
+ 1.0
+
+ scm:svn:http://svn.apache.org/repos/asf/maven/continuum/trunk/
+ scm:svn:https://svn.apache.org/repos/asf/maven/continuum/trunk/
+ http://svn.apache.org/viewcvs.cgi/maven/continuum/trunk/
+
+
+ sample-maven-two-project-module1
+ sample-maven-two-project-module2
+ sample-maven-two-project-module3
+
+
\ No newline at end of file
Index: src/test/resources/unit/maven-two-projects/missing-type-element-pom.xml
===================================================================
--- src/test/resources/unit/maven-two-projects/missing-type-element-pom.xml (revision 0)
+++ src/test/resources/unit/maven-two-projects/missing-type-element-pom.xml (revision 0)
@@ -0,0 +1,23 @@
+
+ 4.0.0
+ maven.two.project
+ sample-maven-two-project
+ jar
+ Maven Two Project
+ 1.0
+
+ scm:svn:http://svn.apache.org/repos/asf/maven/continuum/trunk/
+ scm:svn:https://svn.apache.org/repos/asf/maven/continuum/trunk/
+ http://svn.apache.org/viewcvs.cgi/maven/continuum/trunk/
+
+
+
+
+ true
+ true
+ true
+ true
+
+
+
+
\ No newline at end of file
Index: src/test/resources/unit/maven-two-projects/valid-pom.xml
===================================================================
--- src/test/resources/unit/maven-two-projects/valid-pom.xml (revision 0)
+++ src/test/resources/unit/maven-two-projects/valid-pom.xml (revision 0)
@@ -0,0 +1,13 @@
+
+ 4.0.0
+ maven.two.project
+ sample-maven-two-project
+ jar
+ Maven Two Project
+ 1.0
+
+ scm:svn:http://svn.apache.org/repos/asf/maven/continuum/trunk/
+ scm:svn:https://svn.apache.org/repos/asf/maven/continuum/trunk/
+ http://svn.apache.org/viewcvs.cgi/maven/continuum/trunk/
+
+
\ No newline at end of file
Index: src/test/resources/unit/maven-two-projects/missing-parent-pom.xml
===================================================================
--- src/test/resources/unit/maven-two-projects/missing-parent-pom.xml (revision 0)
+++ src/test/resources/unit/maven-two-projects/missing-parent-pom.xml (revision 0)
@@ -0,0 +1,16 @@
+
+
+ maven.two.project
+ maven-two-project
+ 1.0
+
+ 4.0.0
+ sample-maven-two-project
+ jar
+ Maven Two Project
+
+ scm:svn:http://svn.apache.org/repos/asf/maven/continuum/trunk/
+ scm:svn:https://svn.apache.org/repos/asf/maven/continuum/trunk/
+ http://svn.apache.org/viewcvs.cgi/maven/continuum/trunk/
+
+
\ No newline at end of file
Index: src/test/resources/unit/maven-two-projects/missing-scm-element-pom.xml
===================================================================
--- src/test/resources/unit/maven-two-projects/missing-scm-element-pom.xml (revision 0)
+++ src/test/resources/unit/maven-two-projects/missing-scm-element-pom.xml (revision 0)
@@ -0,0 +1,8 @@
+
+ 4.0.0
+ maven.two.project
+ sample-maven-two-project
+ jar
+ Maven Two Project
+ 1.0
+
\ No newline at end of file
Index: src/test/resources/unit/maven-one-projects/missing-repository-element-project.xml
===================================================================
--- src/test/resources/unit/maven-one-projects/missing-repository-element-project.xml (revision 0)
+++ src/test/resources/unit/maven-one-projects/missing-repository-element-project.xml (revision 0)
@@ -0,0 +1,23 @@
+
+
+
+ 3
+ maven-one-project
+ Maven One Project
+ 1.0
+ This is a Maven One Project used for testing. This has an invalid pom. Missing repository element.
+ This is a sample Maven One Project.
+
+
+ John Doe
+ john
+ john.doe@apache.org
+
+
+ Documentation
+ Java Developer
+
+
+
+
+
Index: src/test/resources/unit/maven-one-projects/extend-element-project.xml
===================================================================
--- src/test/resources/unit/maven-one-projects/extend-element-project.xml (revision 0)
+++ src/test/resources/unit/maven-one-projects/extend-element-project.xml (revision 0)
@@ -0,0 +1,29 @@
+
+
+
+ ../extend/project.xml
+ 3
+ maven-one-project
+ Maven One Project
+ 1.0
+ This is a sample Maven One Project used for testing.
+ This is a sample Maven One Project.
+
+
+ John Doe
+ john
+ john.doe@apache.org
+
+
+ Documentation
+ Java Developer
+
+
+
+
+ scm:svn:http://svn.dummy.org/repos/trunk/maven-one-project/
+ scm:svn:https://svn.dummy.org/repos/trunk/maven-one-project/
+ http://svn.dummy.org/viewcvs.cgi/trunk/maven-one-project/
+
+
+
Index: src/test/resources/unit/maven-one-projects/valid-project.xml
===================================================================
--- src/test/resources/unit/maven-one-projects/valid-project.xml (revision 0)
+++ src/test/resources/unit/maven-one-projects/valid-project.xml (revision 0)
@@ -0,0 +1,28 @@
+
+
+
+ 3
+ maven-one-project
+ Maven One Project
+ 1.0
+ This is a sample Maven One Project used for testing.
+ This is a sample Maven One Project.
+
+
+ John Doe
+ john
+ john.doe@apache.org
+
+
+ Documentation
+ Java Developer
+
+
+
+
+ scm:svn:http://svn.dummy.org/repos/trunk/maven-two-project/
+ scm:svn:https://svn.dummy.org/repos/trunk/maven-two-project/
+ http://svn.dummy.org/viewcvs.cgi/trunk/maven-two-project/
+
+
+
Index: src/test/resources/unit/maven-one-projects/unparseable-content-project.xml
===================================================================
--- src/test/resources/unit/maven-one-projects/unparseable-content-project.xml (revision 0)
+++ src/test/resources/unit/maven-one-projects/unparseable-content-project.xml (revision 0)
@@ -0,0 +1,3 @@
+
+
+
Index: src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java
===================================================================
--- src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java (revision 474179)
+++ src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java (working copy)
@@ -18,6 +18,8 @@
import org.apache.maven.shared.web.test.AbstractSeleniumTestCase;
+import java.io.File;
+
/**
* @author Emmanuel Venisse
* @version $Id$
@@ -42,9 +44,9 @@
{
open( "/continuum" );
waitPage();
-
+
if ( "Create Admin User".equals( getTitle() ) )
- {
+ {
assertCreateAdminUserPage();
submitCreateAdminUserPage( adminFullName, adminEmail, adminPassword, adminPassword );
assertLoginPage();
@@ -202,4 +204,17 @@
assertTextPresent( "Build Status" );
}
}
+
+ public String getBasedir()
+ {
+ String basedir = System.getProperty( "basedir" );
+
+ if ( basedir == null )
+ {
+ basedir = new File( "" ).getAbsolutePath();
+ }
+
+ return basedir;
+ }
+
}
Index: src/test/it/org/apache/continuum/web/test/AddMavenOneProjectTestCase.java
===================================================================
--- src/test/it/org/apache/continuum/web/test/AddMavenOneProjectTestCase.java (revision 0)
+++ src/test/it/org/apache/continuum/web/test/AddMavenOneProjectTestCase.java (revision 0)
@@ -0,0 +1,156 @@
+package org.apache.continuum.web.test;
+
+/*
+ * Copyright 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.
+ */
+
+import org.codehaus.plexus.util.cli.Commandline;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.DefaultConsumer;
+
+import java.io.File;
+
+/**
+ * Class for testing add maven one project UI page.
+ */
+public class AddMavenOneProjectTestCase
+ extends AbstractAuthenticatedAccessTestCase
+{
+ public String getUsername()
+ {
+ return adminUsername;
+ }
+
+ public String getPassword()
+ {
+ return adminPassword;
+ }
+
+ public void setUp()
+ throws Exception
+ {
+ super.setUp();
+ clickLinkWithText( "Maven 1.x Project" );
+ }
+
+ /**
+ * submit the page
+ *
+ * @param m1PomUrl
+ * @param m1PomFile
+ * @param validPom
+ */
+ public void submitAddMavenOneProjectPage( String m1PomUrl, String m1PomFile, boolean validPom )
+ {
+ getSelenium().type( "m1PomUrl", m1PomUrl );
+ getSelenium().type( "m1PomFile", m1PomFile );
+
+ getSelenium().click( "//input[@type='submit']" );
+ waitPage();
+
+ if( validPom )
+ {
+ assertPage( "Continuum - Group Summary" );
+ assertTextPresent( "Project Groups" );
+ //assertTextPresent( "Default Project Group" );
+ }
+ }
+
+ //TODO: problem with input type="file", selenium.type(..) does not work,
+ // TODO: refer to http://forums.openqa.org/thread.jspa?messageID=1365Օ for workaround
+ /**
+ * test with valid pom file
+ */
+ /* public void testValidPomFile()
+ {
+ File pomFile = new File( getBasedir(), "src/test/resources/unit/valid-maven-project/project.xml");
+ submitAddMavenOneProjectPage( "", pomFile.getAbsolutePath(), false );
+ assertTextPresent( "Maven One Project" );
+ }*/
+
+ /**
+ * test with valid pom url
+ */
+ public void testValidPomUrl()
+ {
+ File pomFile = new File( getBasedir(), "src/test/resources/unit/maven-one-projects/valid-project.xml");
+ submitAddMavenOneProjectPage( "file:/" + pomFile.getAbsolutePath(), "", true );
+ assertTextPresent( "Maven One Project" );
+ }
+
+ /**
+ * test with no pom file or pom url specified
+ */
+ public void testNoPomSpecified()
+ {
+ submitAddMavenOneProjectPage( "", "", false );
+ assertTextPresent( "Either POM URL or Upload POM is required." );
+ assertElementPresent( "m1PomUrl" );
+ assertElementPresent( "m1PomFile" );
+ }
+
+ /**
+ * test with missing element in the pom file
+ */
+ public void testMissingElementInPom()
+ {
+ File pomFile = new File( getBasedir(), "src/test/resources/unit/maven-one-projects/missing-repository-element-project.xml");
+ submitAddMavenOneProjectPage( "file:/" + pomFile.getAbsolutePath(), "", false );
+ assertTextPresent( "Missing repository element in the POM." );
+ }
+
+
+ /**
+ * test with element present in pom file
+ */
+ public void testWithExtendElementPom()
+ {
+ File pomFile = new File( getBasedir(), "src/test/resources/unit/maven-one-projects/extend-element-project.xml");
+ submitAddMavenOneProjectPage( "file:/" + pomFile.getAbsolutePath(), "", false );
+ assertTextPresent( "Cannot use a POM with an extend element." );
+ }
+
+ /**
+ * test with unparseable xml content for pom file
+ */
+ public void testUnparseableXmlContent()
+ {
+ File pomFile = new File( getBasedir(), "src/test/resources/unit/maven-one-projects/unparseable-content-project.xml");
+ submitAddMavenOneProjectPage( "file:/" + pomFile.getAbsolutePath(), "", false );
+ assertTextPresent( "The XML content of the POM can not be parsed." );
+ }
+
+ /**
+ * test with a malformed pom url
+ */
+ public void testMalformedPomUrl()
+ {
+ File pomFile = new File( getBasedir(), "src/test/resources/unit/maven-one-projects/valid-project.xml");
+ submitAddMavenOneProjectPage( pomFile.getAbsolutePath(), "", false );
+ assertTextPresent( "The URL provided is malformed." );
+ }
+
+ /**
+ * test wiht an inaccessible pom url
+ */
+ public void testInaccessiblePomUrl()
+ {
+ File pomFile = new File( getBasedir(), "src/test/resources/unit/maven-one-projects/valid-project.xml");
+ submitAddMavenOneProjectPage( "file://" + pomFile.getAbsolutePath(), "", false );
+ assertTextPresent( "The specified host is either unknown or inaccessible." );
+ }
+
+}
Index: src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTestCase.java
===================================================================
--- src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTestCase.java (revision 0)
+++ src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTestCase.java (revision 0)
@@ -0,0 +1,175 @@
+package org.apache.continuum.web.test;
+
+import java.io.File;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: deng
+ * Date: Nov 7, 2006
+ * Time: 10:03:06 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class AddMavenTwoProjectTestCase
+ extends AbstractAuthenticatedAccessTestCase
+{
+ public String getUsername()
+ {
+ return adminUsername;
+ }
+
+ public String getPassword()
+ {
+ return adminPassword;
+ }
+
+ public void setUp()
+ throws Exception
+ {
+ super.setUp();
+ clickLinkWithText( "Maven 2.0.x Project" );
+ }
+
+ /**
+ * submit the page
+ *
+ * @param m2PomUrl
+ * @param m2PomFile
+ * @param validPom
+ */
+ public void submitAddMavenTwoProjectPage( String m2PomUrl, String m2PomFile, boolean validPom )
+ {
+ getSelenium().type( "m2PomUrl", m2PomUrl );
+ getSelenium().type( "m2PomFile", m2PomFile );
+
+ getSelenium().click( "//input[@type='submit']" );
+ waitPage();
+
+ if( validPom )
+ {
+ assertPage( "Continuum - Group Summary" );
+ assertTextPresent( "Project Groups" );
+ assertTextPresent( "Default Project Group" );
+ }
+ }
+
+ /**
+ * Test multi module projects
+ */
+ public void testMultiModuleProject()
+ {
+ File pomFile = new File( getBasedir(), "src/test/resources/unit/maven-two-projects/multi-module-maven-project/pom.xml");
+ submitAddMavenTwoProjectPage( "file:/" + pomFile.getAbsolutePath(), "", true);
+ assertTextPresent( "Maven Two Multi-Module Project" );
+ assertTextPresent( "maven.two.multi.module.project" );
+
+ clickLinkWithText( "Maven Two Multi-Module Project" );
+ assertTextPresent( "Summary");
+ assertTextPresent( "Summary");
+ assertTextPresent( "Maven Two Multi-Module Project");
+ assertTextPresent( "Maven Two Multi-Module Project Module 1");
+ assertTextPresent( "Maven Two Multi-Module Project Module 2");
+ }
+
+ /**
+ * Test invalid pom url
+ */
+ public void testNoPomSpecified()
+ {
+ submitAddMavenTwoProjectPage( "", "", false );
+ assertTextPresent( "Either POM URL or Upload POM is required." );
+ assertElementPresent( "m2PomUrl" );
+ assertElementPresent( "m2PomFile" );
+ }
+
+ /**
+ * Test when scm element is missing from pom
+ */
+ public void testMissingScmElementPom()
+ {
+ File pomFile= new File( getBasedir(), "src/test/resources/unit/maven-two-projects/missing-scm-element-pom.xml");
+ submitAddMavenTwoProjectPage( "file:/" + pomFile.getAbsolutePath(), "", false );
+ assertTextPresent( "Missing scm element in the POM." );
+ assertElementPresent( "m2PomUrl" );
+ assertElementPresent( "m2PomFile" );
+ }
+
+ /**
+ * Test when the specified pom url is invalid
+ */
+ public void testCannotAccessResource()
+ {
+ File pomFile= new File( getBasedir(), "src/test/resources/unit/maven-two-projects/valid-pom.xml");
+ submitAddMavenTwoProjectPage( "file://" + pomFile.getAbsolutePath(), "", false );
+ assertTextPresent( "The specified resource cannot be accessed. Please try again later or contact your administrator." );
+ assertElementPresent( "m2PomUrl" );
+ assertElementPresent( "m2PomFile" );
+ }
+
+ /**
+ * Test when the connection element is missing from the scm tag
+ */
+ public void testMissingConnectionElement()
+ {
+ File pomFile= new File( getBasedir(), "src/test/resources/unit/maven-two-projects/missing-connection-element-pom.xml");
+ submitAddMavenTwoProjectPage( "file:/" + pomFile.getAbsolutePath(), "", false );
+ assertTextPresent( "Missing connection sub-element in the scm element in the POM." );
+ assertElementPresent( "m2PomUrl" );
+ assertElementPresent( "m2PomFile" );
+ }
+
+ /**
+ * Test when the parent pom is missing or not yet added in continuum
+ */
+ public void testMissingParentPom()
+ {
+ File pomFile= new File( getBasedir(), "src/test/resources/unit/maven-two-projects/missing-parent-pom.xml");
+ submitAddMavenTwoProjectPage( "file:/" + pomFile.getAbsolutePath(), "", false );
+ assertTextPresent( "Missing artifact trying to build the POM. Check that its parent POM is available or add it first in Continuum." );
+ assertElementPresent( "m2PomUrl" );
+ assertElementPresent( "m2PomFile" );
+ }
+
+ /**
+ * Test when notifier(s) are specified in the pom
+ */
+ public void testNotifiers()
+ {
+ File pomFile= new File( getBasedir(), "src/test/resources/unit/maven-two-projects/specified-notifiers-pom.xml");
+ submitAddMavenTwoProjectPage( "file:/" + pomFile.getAbsolutePath(), "", true );
+ assertTextPresent( "Maven Two Notifiers Project" );
+
+ clickLinkWithText( "Maven Two Notifiers Project" );
+ clickLinkWithText( "Notifier" );
+
+ assertTextPresent( "Project Group Notifiers" );
+ assertTextPresent( "mail" );
+ assertTextPresent( "Error" );
+ assertTextPresent( "Fail" );
+ assertTextPresent( "Success" );
+ assertTextNotPresent( "Warning" );
+ }
+
+ /**
+ * Test when the modules/subprojects specified in the pom are not found
+ */
+ public void testMissingModules()
+ {
+ File pomFile= new File( getBasedir(), "src/test/resources/unit/maven-two-projects/missing-modules-pom.xml");
+ submitAddMavenTwoProjectPage( "file:/" + pomFile.getAbsolutePath(), "", false );
+ assertTextPresent( "Unknown error trying to build POM." );
+ assertElementPresent( "m2PomUrl" );
+ assertElementPresent( "m2PomFile" );
+ }
+
+ /**
+ * Test valid pom
+ */
+ public void testValidPom()
+ {
+ File pomFile = new File( getBasedir(), "src/test/resources/unit/maven-two-projects/valid-pom.xml");
+ submitAddMavenTwoProjectPage( "file:/" + pomFile.getAbsolutePath(), "", true);
+ assertTextPresent( "Maven Two Project" );
+ assertTextPresent( "maven.two.project" );
+ }
+
+}