continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From batkin...@apache.org
Subject svn commit: r1671478 - in /continuum/trunk/continuum-webapp-test: ./ src/test/resources/ src/test/testng/config/ src/test/testng/org/apache/continuum/web/test/ src/test/testng/org/apache/continuum/web/test/parent/
Date Mon, 06 Apr 2015 04:27:31 GMT
Author: batkinson
Date: Mon Apr  6 04:27:30 2015
New Revision: 1671478

URL: http://svn.apache.org/r1671478
Log:
Added web test for file upload of multi-module poms.

Added:
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MultiModuleUploadTest.java
Modified:
    continuum/trunk/continuum-webapp-test/pom.xml
    continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties
    continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java

Modified: continuum/trunk/continuum-webapp-test/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/pom.xml?rev=1671478&r1=1671477&r2=1671478&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/pom.xml (original)
+++ continuum/trunk/continuum-webapp-test/pom.xml Mon Apr  6 04:27:30 2015
@@ -233,7 +233,7 @@
             </deployable>
             <!-- Test resources -->
             <deployable>
-              <location>${basedir}/src/test/example-projects</location>
+              <location>${sampleProjectsDir}</location>
               <type>war</type>
               <properties>
                 <context>example-projects</context>
@@ -301,6 +301,10 @@
                   <name>seleniumPort</name>
                   <value>${seleniumPort}</value>
                 </property>
+                <property>
+                  <name>sampleProjectsDir</name>
+                  <value>${sampleProjectsDir}</value>
+                </property>
               </systemProperties>
             </configuration>
           </execution>
@@ -415,7 +419,7 @@
                 <deployables>
                   <!-- Skip all but test resources -->
                   <deployable>
-                    <location>${basedir}/src/test/example-projects</location>
+                    <location>${sampleProjectsDir}</location>
                     <type>war</type>
                     <properties>
                       <context>example-projects</context>
@@ -610,6 +614,7 @@
     <seleniumPort>4444</seleniumPort>
     <continuum.port>9595</continuum.port>
     <baseUrl>http://localhost:${continuum.port}/continuum</baseUrl>
+    <sampleProjectsDir>${basedir}/src/test/example-projects</sampleProjectsDir>
     <sampleProjectsUrl>http://localhost:${continuum.port}</sampleProjectsUrl>
     <buildAgentUrl>http://localhost:${continuum.port}/continuum-buildagent/xmlrpc</buildAgentUrl>
     <appserverBase>${project.build.directory}</appserverBase>

Modified: continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties?rev=1671478&r1=1671477&r2=1671478&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties (original)
+++ continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties Mon Apr  6
04:27:30 2015
@@ -51,6 +51,7 @@ MAVEN2_PROJECT_WITH_TAG_POM_PROJECT_GROU
 MAVEN2_PROJECT_WITH_TAG_POM_PROJECT_GROUP_DESCRIPTION=
 
 MAVEN2_MODULES_WITH_VARS_PROJECT_NAME=Multi-Module With Variables :: Parent
+MAVEN2_MODULES_WITH_VARS_PROJECT_RELPATH=continuum-2094-example/pom.xml
 MAVEN2_MODULES_WITH_VARS_PROJECT_URL=${sampleProjectsUrl}/example-projects/continuum-2094-example/pom.xml
 MAVEN2_MODULES_WITH_VARS_TAG=continuum-2094-example-1.0
 MAVEN2_MODULES_WITH_VARS_VERSION=1.0
@@ -220,6 +221,11 @@ REPORT_PROJECT_GROUP_NAME=Report Test Pr
 REPORT_PROJECT_GROUP_ID=org.apache.continuum.examples.report
 REPORT_PROJECT_GROUP_DESCRIPTION=
 
+# Multi-module upload properties
+
+UPLOAD_PROJECT_GROUP_NAME=Upload Test Project Group
+UPLOAD_PROJECT_GROUP_ID=org.apache.continuum.examples.upload
+
 # Build definition tests
 
 BUILD_DEFINITION_PROJECT_GROUP_NAME=Build Definition Test Project Group

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml?rev=1671478&r1=1671477&r2=1671478&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml Mon Apr  6 04:27:30
2015
@@ -63,6 +63,7 @@
         <include name="buildEnvironment"/>
         <include name="buildDefinitionTemplate"/>
         <include name="userroles"/>
+        <include name="upload"/>
         <include name="appearance"/>
         <include name="csrf"/>
         <include name="distributed"/>

Added: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MultiModuleUploadTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MultiModuleUploadTest.java?rev=1671478&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MultiModuleUploadTest.java
(added)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MultiModuleUploadTest.java
Mon Apr  6 04:27:30 2015
@@ -0,0 +1,109 @@
+package org.apache.continuum.web.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.continuum.web.test.parent.AbstractAdminTest;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Optional;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.io.IOException;
+
+import static org.testng.Assert.assertTrue;
+
+/**
+ * This tests functionality relating to file upload for multi-module maven2+ projects.
+ */
+@Test( groups = { "upload" } )
+public class MultiModuleUploadTest
+    extends AbstractAdminTest
+{
+
+    public static final String BAD_IMPORT_TYPE_MSG = "requires single multi-module project
import type";
+
+    private String projectGroupName;
+
+    private String projectName;
+
+    private String projectGroupId;
+
+    private File projectPom;
+
+    @BeforeClass( alwaysRun = true )
+    @Parameters( { "sampleProjectsDir" } )
+    public void initialize( @Optional( "src/test/example-projects" ) String projectsDir )
+    {
+        File dir = new File( projectsDir );
+        assertTrue( dir.exists() && dir.isDirectory() );
+
+        projectPom = new File( dir, getProperty( "MAVEN2_MODULES_WITH_VARS_PROJECT_RELPATH"
) );
+        assertTrue( projectPom.exists() && projectPom.isFile() && projectPom.canRead()
);
+
+        projectGroupName = getProperty( "UPLOAD_PROJECT_GROUP_NAME" );
+        projectGroupId = getProperty( "UPLOAD_PROJECT_GROUP_ID" );
+        projectName = getProperty( "MAVEN2_MODULES_WITH_VARS_PROJECT_NAME" );
+
+        loginAsAdmin();
+    }
+
+    @BeforeMethod
+    public void setUp()
+        throws IOException
+    {
+        addProjectGroup( projectGroupName, projectGroupId, "Upload test projects", true,
false );
+    }
+
+    @AfterMethod
+    public void tearDown()
+    {
+        removeProjectGroup( projectGroupName, false );
+    }
+
+    public void testMultiModuleUpload()
+        throws Exception
+    {
+        clickLinkWithText( projectGroupName );
+        assertLinkNotPresent( projectName );
+        uploadMavenTwoProject( projectPom, projectGroupName, "SINGLE_MULTI_MODULE", true
);
+        buildProjectGroup( projectGroupName, projectGroupId, "", projectName, true );
+    }
+
+    public void testMultiModuleUploadFailsWithSeparateScm()
+        throws Exception
+    {
+        clickLinkWithText( projectGroupName );
+        assertLinkNotPresent( projectName );
+        uploadMavenTwoProject( projectPom, projectGroupName, "SEPARATE_SCM", false );
+        assertTextPresent( BAD_IMPORT_TYPE_MSG );
+    }
+
+    public void testMultiModuleUploadFailsWithSingleScm()
+        throws Exception
+    {
+        clickLinkWithText( projectGroupName );
+        assertLinkNotPresent( projectName );
+        uploadMavenTwoProject( projectPom, projectGroupName, "SINGLE_SCM", false );
+        assertTextPresent( BAD_IMPORT_TYPE_MSG );
+    }
+}

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java?rev=1671478&r1=1671477&r2=1671478&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
Mon Apr  6 04:27:30 2015
@@ -24,6 +24,8 @@ import org.testng.annotations.BeforeSuit
 import org.testng.annotations.Optional;
 import org.testng.annotations.Parameters;
 
+import java.io.File;
+
 import static org.testng.Assert.assertEquals;
 
 /**
@@ -365,11 +367,12 @@ public abstract class AbstractContinuumT
         waitForElementPresent( "link=Builds" );
         clickLinkWithText( "Builds" );
 
-        if (success)
+        if ( success )
         {
             clickAndWait( "css=img[alt=\"Success\"]" );
         }
-        else {
+        else
+        {
             clickAndWait( "css=img[alt=\"Failed\"]" );
         }
 
@@ -596,6 +599,25 @@ public abstract class AbstractContinuumT
         assertElementPresent( "selectedProjectGroup" );
     }
 
+    protected void uploadMavenTwoProject( File pomFile, String projectGroup, String importType,
+                                          boolean success )
+    {
+        goToAddMavenTwoProjectPage();
+
+        setFieldValue( "m2PomFile", pomFile.getAbsolutePath() );
+
+        if ( projectGroup != null )
+        {
+            selectValue( "addMavenTwoProject_selectedProjectGroup", projectGroup );
+        }
+
+        String typeRadioId = "addMavenTwoProject_importType" + importType;
+        click( typeRadioId );
+
+        submit();
+        waitForAddProjectResult( success );
+    }
+
     protected void addMavenTwoProject( String pomUrl, String username, String password, String
projectGroup,
                                        boolean success )
     {
@@ -611,6 +633,11 @@ public abstract class AbstractContinuumT
             selectValue( "addMavenTwoProject_selectedProjectGroup", projectGroup );
         }
         submit();
+        waitForAddProjectResult( success );
+    }
+
+    private void waitForAddProjectResult( boolean success )
+    {
         String title;
         if ( success )
         {



Mime
View raw message