continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r489865 - /maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/
Date Sat, 23 Dec 2006 08:01:26 GMT
Author: evenisse
Date: Sat Dec 23 00:01:25 2006
New Revision: 489865

URL: http://svn.apache.org/viewvc?view=rev&rev=489865
Log:
Fix more tests

Modified:
    maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java
    maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenOneProjectTestCase.java
    maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTest.java
    maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTestCase.java
    maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/ProjectGroupTest.java

Modified: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java?view=diff&rev=489865&r1=489864&r2=489865
==============================================================================
--- maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java
(original)
+++ maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java
Sat Dec 23 00:01:25 2006
@@ -326,7 +326,7 @@
     //////////////////////////////////////
     // Maven 2.0.x Project
     //////////////////////////////////////
-    public void goToAddMavenProjectPage()
+    public void goToAddMavenTwoProjectPage()
     {
         clickLinkWithText( "Maven 2.0.x Project" );
 
@@ -349,7 +349,7 @@
 
     public void addMavenTwoProject( String pomUrl, String username, String password, String
projectGroup, boolean validProject )
     {
-        goToAddMavenProjectPage();
+        goToAddMavenTwoProjectPage();
 
         // Enter values into Add Maven Two Project fields, and submit  
         setFieldValue( "m2PomUrl", pomUrl );
@@ -373,10 +373,13 @@
         }
     }
 
+    //TODO: problem with input type="file", selenium.type(..) does not work,
+    // TODO: refer to http://forums.openqa.org/thread.jspa?messageID=1365&#1365 for workaround
+    /*
     public void addMavenTwoProject( String pomFile, String projectGroup, boolean validProject
)
         throws Exception
     {
-        goToAddMavenProjectPage();
+        goToAddMavenTwoProjectPage();
 
         // Enter values into Add Maven Two Project fields, and submit  
         setFieldValue( "m2PomFile", pomFile );
@@ -397,6 +400,86 @@
             assertAddMavenTwoProjectPage();
         }
     }
+    */
+
+    //////////////////////////////////////
+    // Maven 1.x Project
+    //////////////////////////////////////
+    public void goToAddMavenOneProjectPage()
+    {
+        clickLinkWithText( "Maven 1.x Project" );
+
+        assertAddMavenOneProjectPage();
+    }
+
+    public void assertAddMavenOneProjectPage()
+    {
+        assertTextPresent( "POM Url" );
+        assertElementPresent( "m1PomUrl" );
+        assertTextPresent( "Username" );
+        assertElementPresent( "username" );
+        assertTextPresent( "Password" );
+        assertElementPresent( "password" );
+        assertTextPresent( "Upload POM" );
+        assertElementPresent( "m1PomFile" );
+        assertTextPresent( "Project Group" );
+        assertElementPresent( "selectedProjectGroup" );
+    }
+
+    public void addMavenOneProject( String pomUrl, String username, String password, String
projectGroup, boolean validProject )
+    {
+        goToAddMavenOneProjectPage();
+
+        // Enter values into Add Maven One Project fields, and submit  
+        setFieldValue( "m1PomUrl", pomUrl );
+        setFieldValue( "username", username );
+        setFieldValue( "password", password );
+
+        if ( projectGroup != null )
+        {
+            selectValue( "addMavenOneProject_selectedProjectGroup", projectGroup );
+        }
+
+        submit();
+
+        if ( validProject )
+        {
+            assertProjectGroupsSummaryPage();
+        }
+        else
+        {
+            assertAddMavenOneProjectPage();
+        }
+    }
+
+    //TODO: problem with input type="file", selenium.type(..) does not work,
+    // TODO: refer to http://forums.openqa.org/thread.jspa?messageID=1365&#1365 for workaround
+    /*
+    public void addMavenOneProject( String pomFile, String projectGroup, boolean validProject
)
+        throws Exception
+    {
+        goToAddMavenOneProjectPage();
+
+        // Enter values into Add Maven One Project fields, and submit  
+        setFieldValue( "m1PomFile", pomFile );
+
+        if ( projectGroup != null )
+        {
+            selectValue( "addMavenOneProject_selectedProjectGroup", projectGroup );
+        }
+
+        submit();
+
+        if ( validProject )
+        {
+            assertProjectGroupsSummaryPage();
+        }
+        else
+        {
+            assertAddMavenOneProjectPage();
+        }
+    }
+    */
 
     public void moveProjectToProjectGroup( String name, String groupId, String description,
String newProjectGroup )
         throws Exception

Modified: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenOneProjectTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenOneProjectTestCase.java?view=diff&rev=489865&r1=489864&r2=489865
==============================================================================
--- maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenOneProjectTestCase.java
(original)
+++ maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenOneProjectTestCase.java
Sat Dec 23 00:01:25 2006
@@ -38,54 +38,35 @@
         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 )
+    public void submitAddMavenOneProjectPage( String m1PomUrl, boolean validPom )
     {
-        getSelenium().type( "m1PomUrl", m1PomUrl );
-        getSelenium().type( "m1PomFile", m1PomFile );
-
-        getSelenium().click( "//input[@type='submit']" );
-        waitPage();
+        addMavenOneProject( m1PomUrl, "", "", null, validPom );
 
         if ( validPom )
         {
-            assertPage( "Continuum - Group Summary" );
-            assertTextPresent( "Project Groups" );
-            //assertTextPresent( "Default Project Group" );
+            assertTextPresent( "Default Project Group" );
+            //TODO: Add more tests
         }
     }
 
-    //TODO: problem with input type="file", selenium.type(..) does not work,
-    // TODO: refer to http://forums.openqa.org/thread.jspa?messageID=1365&#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 );
-        assertPage( "Continuum - Group Summary" );
-        clickLinkWithText( "Default Project Group" );
+        String pomUrl = "http://svn.apache.org/repos/asf/maven/continuum/trunk/continuum-webapp-test/src/test/resources/unit/maven-one-projects/valid-project.xml";
+        submitAddMavenOneProjectPage( pomUrl, true );
+        //Test the group is created
         assertTextPresent( "Maven One Project" );
+        //TODO: add more tests
     }
 
     /**
@@ -93,10 +74,8 @@
      */
     public void testNoPomSpecified()
     {
-        submitAddMavenOneProjectPage( "", "", false );
+        submitAddMavenOneProjectPage( "", false );
         assertTextPresent( "Either POM URL or Upload POM is required." );
-        assertElementPresent( "m1PomUrl" );
-        assertElementPresent( "m1PomFile" );
     }
 
     /**
@@ -104,9 +83,8 @@
      */
     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 );
+        String pomUrl = "http://svn.apache.org/repos/asf/maven/continuum/trunk/continuum-webapp-test/src/test/resources/unit/maven-one-projects/missing-repository-element-project.xml";
+        submitAddMavenOneProjectPage( pomUrl, false );
         assertTextPresent( "Missing repository element in the POM." );
     }
 
@@ -116,9 +94,8 @@
      */
     public void testWithExtendElementPom()
     {
-        File pomFile =
-            new File( getBasedir(), "src/test/resources/unit/maven-one-projects/extend-element-project.xml"
);
-        submitAddMavenOneProjectPage( "file:/" + pomFile.getAbsolutePath(), "", false );
+        String pomUrl = "http://svn.apache.org/repos/asf/maven/continuum/trunk/continuum-webapp-test/src/test/resources/unit/maven-one-projects/extend-element-project.xml";
+        submitAddMavenOneProjectPage( pomUrl, false );
         assertTextPresent( "Cannot use a POM with an extend element." );
     }
 
@@ -127,9 +104,8 @@
      */
     public void testUnparseableXmlContent()
     {
-        File pomFile =
-            new File( getBasedir(), "src/test/resources/unit/maven-one-projects/unparseable-content-project.xml"
);
-        submitAddMavenOneProjectPage( "file:/" + pomFile.getAbsolutePath(), "", false );
+        String pomUrl = "http://svn.apache.org/repos/asf/maven/continuum/trunk/continuum-webapp-test/src/test/resources/unit/maven-one-projects/unparseable-content-project.xml";
+        submitAddMavenOneProjectPage( pomUrl, false );
         assertTextPresent( "The XML content of the POM can not be parsed." );
     }
 
@@ -138,8 +114,8 @@
      */
     public void testMalformedPomUrl()
     {
-        File pomFile = new File( getBasedir(), "src/test/resources/unit/maven-one-projects/valid-project.xml"
);
-        submitAddMavenOneProjectPage( pomFile.getAbsolutePath(), "", false );
+        String pomUrl = "aaa";
+        submitAddMavenOneProjectPage( pomUrl, false );
         assertTextPresent(
             "The specified resource cannot be accessed. Please try again later or contact
your administrator." );
     }
@@ -149,9 +125,8 @@
      */
     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." );
+        String pomUrl = "http://www.google.com";
+        submitAddMavenOneProjectPage( pomUrl, false );
+        assertTextPresent( "The specified resource isn't a file or the protocol used isn't
allowed." );
     }
-
 }

Modified: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTest.java?view=diff&rev=489865&r1=489864&r2=489865
==============================================================================
--- maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTest.java
(original)
+++ maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTest.java
Sat Dec 23 00:01:25 2006
@@ -35,6 +35,6 @@
 
         addMavenTwoProject( TEST_POM_URL, TEST_POM_USERNAME, TEST_POM_PASSWORD, TEST_PROJ_GRP_NAME,
true );
 
-        assertCellValueFromTable( "1", "ec_table", 2, 2 );
+        assertCellValueFromTable( "1", "ec_table", 1, 2 );
     }
 }

Modified: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTestCase.java?view=diff&rev=489865&r1=489864&r2=489865
==============================================================================
--- maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTestCase.java
(original)
+++ maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTestCase.java
Sat Dec 23 00:01:25 2006
@@ -37,7 +37,7 @@
         throws Exception
     {
         super.setUp();
-        goToAddMavenProjectPage();
+        goToAddMavenTwoProjectPage();
     }
 
     /**
@@ -49,7 +49,7 @@
      */
     public void submitAddMavenTwoProjectPage( String m2PomUrl, boolean validPom )
     {
-        addMavenTwoProject( m2PomUrl, "", "", null, false );
+        addMavenTwoProject( m2PomUrl, "", "", null, validPom );
 
         if ( validPom )
         {
@@ -89,6 +89,17 @@
     }
 
     /**
+     * test with a malformed pom url
+     */
+    public void testMalformedPomUrl()
+    {
+        String pomUrl = "aaa";
+        submitAddMavenTwoProjectPage( pomUrl, false );
+        assertTextPresent(
+            "The specified resource cannot be accessed. Please try again later or contact
your administrator." );
+    }
+
+    /**
      * Test when the connection element is missing from the scm tag
      */
     public void testMissingConnectionElement()
@@ -117,5 +128,15 @@
         String pomUrl= "http://svn.apache.org/repos/asf/maven/continuum/trunk/continuum-webapp-test/src/test/resources/unit/maven-two-projects/missing-modules-pom.xml";
         submitAddMavenTwoProjectPage( pomUrl, false );
         assertTextPresent( "Unknown error trying to build POM." );
+    }
+
+    /**
+     * test wiht an inaccessible pom url
+     */
+    public void testInaccessiblePomUrl()
+    {
+        String pomUrl = "http://www.google.com";
+        submitAddMavenTwoProjectPage( pomUrl, false );
+        assertTextPresent( "The specified resource isn't a file or the protocol used isn't
allowed." );
     }
 }

Modified: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/ProjectGroupTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/ProjectGroupTest.java?view=diff&rev=489865&r1=489864&r2=489865
==============================================================================
--- maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/ProjectGroupTest.java
(original)
+++ maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/ProjectGroupTest.java
Sat Dec 23 00:01:25 2006
@@ -39,27 +39,24 @@
 
         showProjectGroup( DEFAULT_PROJ_GRP_NAME, DEFAULT_PROJ_GRP_ID, DEFAULT_PROJ_GRP_DESCRIPTION
);
 
-        assertLinkPresent( "Build Definitions" );
         clickLinkWithText( "Build Definitions" );
 
         String tableElement = "ec_table";
         assertCellValueFromTable( "Goals", tableElement, 0, 0 );
         assertCellValueFromTable( "Arguments", tableElement, 0, 1 );
         assertCellValueFromTable( "Build File", tableElement, 0, 2 );
-        assertCellValueFromTable( "Profile", tableElement, 0, 3 );
-        assertCellValueFromTable( "schedule", tableElement, 0, 4 );
-        assertCellValueFromTable( "From", tableElement, 0, 5 );
-        assertCellValueFromTable( "Default", tableElement, 0, 6 );
+        assertCellValueFromTable( "schedule", tableElement, 0, 3 );
+        assertCellValueFromTable( "From", tableElement, 0, 4 );
+        assertCellValueFromTable( "Default", tableElement, 0, 5 );
+        assertCellValueFromTable( "", tableElement, 0, 6 );
         assertCellValueFromTable( "", tableElement, 0, 7 );
-        assertCellValueFromTable( "", tableElement, 0, 8 );
 
         assertCellValueFromTable( "clean install", tableElement, 1, 0 );
         assertCellValueFromTable( "--batch-mode --non-recursive", tableElement, 1, 1 );
         assertCellValueFromTable( "pom.xml", tableElement, 1, 2 );
-        assertCellValueFromTable( "", tableElement, 1, 3 );
-        assertCellValueFromTable( "DEFAULT_SCHEDULE", tableElement, 1, 4 );
-        assertCellValueFromTable( "GROUP", tableElement, 1, 5 );
-        assertCellValueFromTable( "true", tableElement, 1, 6 );
+        assertCellValueFromTable( "DEFAULT_SCHEDULE", tableElement, 1, 3 );
+        assertCellValueFromTable( "GROUP", tableElement, 1, 4 );
+        assertCellValueFromTable( "true", tableElement, 1, 5 );
         assertImgWithAlt( "Edit" );
         assertImgWithAlt( "Delete" );
     }



Mime
View raw message