Modified: 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java?rev=931475&r1=931474&r2=931475&view=diff
==============================================================================
--- 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java
 (original)
+++ 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java
 Wed Apr  7 09:27:05 2010
@@ -22,353 +22,365 @@ package org.apache.archiva.web.test.pare
 import java.io.File;
 import org.testng.Assert;
 
-public abstract class AbstractRepositoryTest 
-       extends AbstractArchivaTest
+public abstract class AbstractRepositoryTest
+    extends AbstractArchivaTest
 {
-       // Repository Groups
-       public void goToRepositoryGroupsPage()
-       {
-           if( !getTitle().equals( "Apache Archiva \\ Administration - 
Repository Groups" ) )
-           {
-               clickLinkWithText( "Repository Groups" );
-           }
-               assertRepositoryGroupsPage();
-       }
-       
-       public void assertRepositoryGroupsPage()
-       {
-               assertPage( "Apache Archiva \\ Administration - Repository 
Groups" );
-               assertTextPresent( "Administration - Repository Groups" );
-               assertTextPresent( "Identifier*:" );
-               assertElementPresent( "repositoryGroup.id" );
-               assertButtonWithValuePresent( "Add Group" );
-               assertTextPresent( "Repository Groups" );
-       }
-       
-       public void assertAddedRepositoryLink( String repositoryGroupName)
-       {
-               assertPage( "Apache Archiva \\ Administration - Repository 
Groups" );
-               String repositoryGroupUrlValue = "repository/" + 
repositoryGroupName + "/";
-               String baseUrlValue = "archiva";
-               String repositoryGroupLink = baseUrl.replaceFirst( 
baseUrlValue, repositoryGroupUrlValue);
-               assertTextPresent( repositoryGroupLink );
-       }
-       
-       public void assertAddedRepositoryToRepositoryGroups( String 
repositoryName)
-       {
-               assertPage( "Apache Archiva \\ Administration - Repository 
Groups" );
-               assertTextPresent( repositoryName );
-               assertTextPresent( "Archiva Managed Internal Repository" );
-               assertAddedRepositoryLink( repositoryName );
-       }
-       
-       public void assertDeleteRepositoryGroupPage( String repositoryName)
-       {
-               assertPage( "Apache Archiva \\ Admin: Delete Repository Group" 
);
-               assertTextPresent( "WARNING: This operation can not be undone." 
);
-               assertTextPresent( "Are you sure you want to delete the 
following repository group?" );
-               assertTextPresent( "ID:" );
-               assertTextPresent( repositoryName );
-               assertButtonWithValuePresent( "Confirm" );
-               assertButtonWithValuePresent( "Cancel" );
-       }
-       
-       public void addRepositoryGroup( String repoGroupName )
-       {
-               goToRepositoryGroupsPage();
-               setFieldValue( "repositoryGroup.id", repoGroupName );
-               clickButtonWithValue( "Add Group" );
-       }
-       
-       public void addRepositoryToRepositoryGroup( String repositoryGroupName, 
String repositoryName )
-       {
-               goToRepositoryGroupsPage();
-               String s = getSelenium().getBodyText();
-               if ( s.contains( "No Repository Groups Defined." ) )
-               {
-                       setFieldValue( "repositoryGroup.id" , 
repositoryGroupName );
-                       clickButtonWithValue( "Add Group" );
-                       //assertAddedRepositoryLink( repositoryGroupName );
-                       
-                       selectValue( "addRepositoryToGroup_repoId" , 
repositoryName );
-                       clickButtonWithValue( "Add Repository" );
-                       assertAddedRepositoryToRepositoryGroups( repositoryName 
);
-               }
-               else
-               {
-                       //assertAddedRepositoryLink( repositoryGroupName );
-                       selectValue( "addRepositoryToGroup_repoId" , 
repositoryName );
-                       clickButtonWithValue( "Add Repository" );
-               }
-       }
-       
-       public void deleteRepositoryInRepositoryGroups()
-       {
-               goToRepositoryGroupsPage();
-               getSelenium().click( 
"xpath=//d...@id='contentArea']/div[2]/div/div[3]/div[1]/a/img" );
-               waitPage();
-       }
-       
-       public void deleteRepositoryGroup( String repositoryName )
-       {
-               getSelenium().click( 
"xpath=//d...@id='contentArea']/div[2]/div/div[1]/div/a/img" );
-               waitPage();
-               assertDeleteRepositoryGroupPage( repositoryName );
-               clickButtonWithValue( "Confirm" );
-       }
-       
-       ///////////////////////////////
-       // proxy connectors
-       ///////////////////////////////
-       public void goToProxyConnectorsPage()
-       {
-               clickLinkWithText( "Proxy Connectors" );
-               assertProxyConnectorsPage();
-       }
-       
-       public void assertProxyConnectorsPage()
-       {
-               assertPage( "Apache Archiva \\ Administration - Proxy 
Connectors" );
-               assertTextPresent( "Administration - Proxy Connectors" );
-               assertTextPresent( "Repository Proxy Connectors" );
-               assertTextPresent( "internal" );
-               assertTextPresent( "Archiva Managed Internal Repository" );
-               assertTextPresent( "Proxy Connector" );
-               assertTextPresent( "Central Repository" );
-               assertTextPresent( "Java.net Repository for Maven 2" );
-       }
-       
-       public void assertAddProxyConnectorPage()
-       {
-               assertPage( "Apache Archiva \\ Admin: Add Proxy Connector" );
-               assertTextPresent( "Admin: Add Proxy Connector" );
-               String proxy = "Network Proxy*:,Managed Repository*:,Remote 
Repository*:,Policies:,Return error when:,On remote 
error:,Releases:,Snapshots:,Checksum:,Cache failures:,Properties:,No properties 
have been set.,Black List:,No black list patterns have been set.,White List:,No 
white list patterns have been set.";
-               String[] arrayProxy = proxy.split( "," );
-               for ( String arrayproxy : arrayProxy )
-                       assertTextPresent( arrayproxy );
-               /*String proxyElements = 
"addProxyConnector_connector_proxyId,addProxyConnector_connector_sourceRepoId,addProxyConnector_connector_targetRepoId,policy_propagate-errors-on-update,policy_propagate-errors,policy_releases,policy_snapshots,policy_checksum,policy_cache-failures,propertiesEntry,propertiesValue,blackListEntry,whiteListEntry";
-               String[] arrayProxyElements = proxyElements.split( "," );
-               for ( String arrayproxyelements : arrayProxyElements )
-                       assertTextPresent( arrayproxyelements );*/
-               assertButtonWithValuePresent( "Add Property" );
-               assertButtonWithValuePresent( "Add Pattern" );
-               assertButtonWithValuePresent( "Add Proxy Connector" );
-       }
-       
-       // this only fills in the values of required fields in adding Proxy 
Connectors
-       public void addProxyConnector( String networkProxy, String managedRepo, 
String remoteRepo )
-       {
-               goToProxyConnectorsPage();
-               clickLinkWithText( "Add" );
-               assertAddProxyConnectorPage();
-               selectValue( "connector.proxyId" , networkProxy );
-               selectValue( "connector.sourceRepoId" , managedRepo );
-               selectValue( "connector.targetRepoId" , remoteRepo );
-       }
-       
-       public void deleteProxyConnector()
-       {
-               goToProxyConnectorsPage();
-               clickLinkWithXPath( 
"//d...@id='contentArea']/div[2]/div[1]/div[2]/div[1]/a[3]/img" );
-               assertPage( "Apache Archiva \\ Admin: Delete Proxy Connectors" 
);
-               clickButtonWithValue( "Delete" );
-               assertPage( "Apache Archiva \\ Administration - Proxy 
Connectors" );
-       }
-       
-       ///////////////////////////////
-       // network proxies
-       ///////////////////////////////
-       public void goToNetworkProxiesPage()
-       {
-               clickLinkWithText( "Network Proxies" );
-               assertNetworkProxiesPage();
-       }
-       
-       public void assertNetworkProxiesPage()
-       {
-               assertPage( "Apache Archiva \\ Administration - Network 
Proxies" );
-               assertTextPresent( "Administration - Network Proxies" );
-               assertTextPresent( "Network Proxies" );
-               assertLinkPresent( "Add Network Proxy" );
-       }
-       
-       public void assertAddNetworkProxy()
-       {
-               assertPage( "Apache Archiva \\ Admin: Add Network Proxy" );
-               assertTextPresent( "Admin: Add Network Proxy" );
-               assertTextPresent( "Add network proxy:" );
-               assertTextPresent( "Identifier*:" );
-               assertTextPresent( "Protocol*:" );
-               assertTextPresent( "Hostname*:" );
-               assertTextPresent( "Port*:" );
-               assertTextPresent( "Username:" );
-               assertTextPresent( "Password:" );
-               assertButtonWithValuePresent( "Save Network Proxy" );
-       }
-       
-       public void addNetworkProxy( String identifier, String protocol, String 
hostname, String port, String username, String password )
-       {
-               //goToNetworkProxiesPage();
-               clickLinkWithText( "Add Network Proxy" );
-               assertAddNetworkProxy();
-               setFieldValue( "proxy.id" , identifier );
-               setFieldValue( "proxy.protocol" , protocol );
-               setFieldValue( "proxy.host" , hostname );
-               setFieldValue( "proxy.port" , port );
-               setFieldValue( "proxy.username" , username );
-               setFieldValue( "proxy.password" , password );
-               clickButtonWithValue( "Save Network Proxy" );
-       }
-       
-       public void editNetworkProxies( String fieldName, String value)
-       {
-               //goToNetworkProxiesPage();
-               clickLinkWithText( "Edit Network Proxy" );
-               setFieldValue( fieldName, value);
-               clickButtonWithValue( "Save Network Proxy" );
-       }
-       
-       public void deleteNetworkProxy()
-       {
-               //goToNetworkProxiesPage();
-               clickLinkWithText( "Delete Network Proxy" );
-               assertPage( "Apache Archiva \\ Admin: Delete Network Proxy" );
-               assertTextPresent( "WARNING: This operation can not be undone." 
);
-               clickButtonWithValue( "Delete" );
-       }
-       
-       // remote repositories
-       public void assertAddRemoteRepository()
-       {
-               assertPage( "Apache Archiva \\ Admin: Add Remote Repository" );
-               String remote = 
"Identifier*:,Name*:,URL*:,Username:,Password:,Timeout in seconds:,Type:";
-               String[] arrayRemote = remote.split( "," );
-               for ( String arrayremote : arrayRemote )
-                       assertTextPresent( arrayremote );
-               String remoteElements = 
"addRemoteRepository_repository_id,addRemoteRepository_repository_name,addRemoteRepository_repository_url,addRemoteRepository_repository_username,addRemoteRepository_repository_password,addRemoteRepository_repository_timeout,addRemoteRepository_repository_layout";
-               String[] arrayRemoteElements = remoteElements.split( "," );
-               for ( String arrayremotelement : arrayRemoteElements )
-                       assertElementPresent( arrayremotelement );
-       }
-       
-       public void assertDeleteRemoteRepositoryPage()
-       {
-               assertPage( "Apache Archiva \\ Admin: Delete Remote Repository" 
);
-               assertTextPresent( "Admin: Delete Remote Repository" );
-               assertTextPresent( "WARNING: This operation can not be undone." 
);
-               assertTextPresent( "Are you sure you want to delete the 
following remote repository?" );
-               assertButtonWithValuePresent( "Confirm" );
-               assertButtonWithValuePresent( "Cancel" );
-       }
-       
-       public void addRemoteRepository( String identifier, String name, String 
url, String username, String password, String timeout, String type )
-       {
-                       //goToRepositoriesPage();
-                       assertAddRemoteRepository();
-                       setFieldValue( "addRemoteRepository_repository_id" ,  
identifier );
-                       setFieldValue( "addRemoteRepository_repository_name" , 
name );
-                       setFieldValue( "addRemoteRepository_repository_url" , 
url );
-                       setFieldValue( 
"addRemoteRepository_repository_username" , username );
-                       setFieldValue( 
"addRemoteRepository_repository_password" , password );
-                       setFieldValue( "addRemoteRepository_repository_timeout" 
, timeout );
-                       selectValue( "addRemoteRepository_repository_layout" , 
type );
-                       clickButtonWithValue( "Add Repository" );
-       }
-       
-       public void deleteRemoteRepository()
-       {
-               goToRepositoriesPage();
-               clickLinkWithXPath( 
"//d...@id='contentArea']/div/div[8]/div[1]/a[2]" );
-               assertDeleteRemoteRepositoryPage();
-               clickButtonWithValue( "Confirm" );
-       }
-       
-       public void editRemoteRepository( String fieldName, String value)
-       {
-               goToRepositoriesPage();
-               clickLinkWithXPath( 
"//d...@id='contentArea']/div/div[8]/div[1]/a[1]" );
-               setFieldValue( fieldName, value );
-               clickButtonWithValue( "Update Repository" );
-       }
-       
-       public void editManagedRepository( String fieldName, String value )
-       {           
-               goToRepositoriesPage();
-               clickLinkWithXPath( 
"//d...@id='contentArea']/div/div[5]/div[1]/a[1]/img" );
-               assertPage( "Apache Archiva \\ Admin: Edit Managed Repository" 
);
-               setFieldValue(fieldName, value);
-               //TODO
-               clickButtonWithValue( "Update Repository" );
-       }
-       
-       public void deleteManagedRepository()
-       {
-               clickLinkWithXPath( 
"//d...@id='contentArea']/div/div[5]/div[1]/a[2]" );
-               assertPage( "Apache Archiva \\ Admin: Delete Managed 
Repository" );
-               clickButtonWithValue( "Delete Configuration Only" );
-       }
-       
-       public String getRepositoryDir()
-       {
-               File f = new File( "" );
-               String artifactFilePath = f.getAbsolutePath();
-               return artifactFilePath + "/target/";
-       }
-       
-       /////////////////////////////////////////////
-       // Repository Scanning
-       /////////////////////////////////////////////
-       public void goToRepositoryScanningPage()
-       {
-               clickLinkWithText( "Repository Scanning" );
-               assertRepositoryScanningPage();
-       }
-       
-       public void assertRepositoryScanningPage()
-       {
-               assertPage( "Apache Archiva \\ Administration - Repository 
Scanning" );
-               assertTextPresent( "Administration - Repository Scanning" );
-               assertTextPresent( "Repository Scanning - File Types" );
-               String artifactsTypes = 
"**/*.pom,**/*.jar,**/*.ear,**/*.war,**/*.car,**/*.sar,**/*.mar,**/*.rar,**/*.dtd,**/*.tld,**/*.tar.gz,**/*.tar.bz2,**/*.zip";
-               String [] arrayArtifactTypes = artifactsTypes.split( "," );
-               for (int i = 0; i < arrayArtifactTypes.length; i++)
-                       
Assert.assertEquals(getSelenium().getTable("//d...@id='contentArea']/div/div[1]/table."+i+".0"),
 arrayArtifactTypes[i]);
-               
-               String autoremove = "**/*.bak,**/*~,**/*-";
-               String [] arrayAutoremove = autoremove.split( "," );
-               for (int i = 0; i < arrayAutoremove.length; i++)
-                       
Assert.assertEquals(getSelenium().getTable("//d...@id='contentArea']/div/div[2]/table."+i+".0"),
 arrayAutoremove[i]);
-               
-               String ignored = 
"**/.htaccess,**/KEYS,**/*.rb,**/*.sh,**/.svn/**,**/.DAV/**";
-               String [] arrayIgnored = ignored.split( "," );
-               for (int i = 0; i < arrayIgnored.length; i++)
-                       
Assert.assertEquals(getSelenium().getTable("//d...@id='contentArea']/div/div[3]/table."+i+".0"),
 arrayIgnored[i]);
-               
-               String indexableContent = 
"**/*.txt,**/*.TXT,**/*.block,**/*.config,**/*.pom,**/*.xml,**/*.xsd,**/*.dtd,**/*.tld";
-               String [] arrayIndexableContent = indexableContent.split( "," );
-               for (int i = 0; i < arrayIndexableContent.length; i++)
-                       
Assert.assertEquals(getSelenium().getTable("//d...@id='contentArea']/div/div[4]/table."+i+".0"),
 arrayIndexableContent[i]);
-       }
-       
-       /////////////////////////////////////////////
-       // Database
-       /////////////////////////////////////////////
-       public void goToDatabasePage()
-       {
-               clickLinkWithText( "Database" );
-               assertDatabasePage();
-       }
-       
-       public void assertDatabasePage()
-       {
-               assertPage( "Apache Archiva \\ Administration - Database" );
-               assertTextPresent( "Administration - Database" );
-               assertTextPresent( "Database - Unprocessed Artifacts Scanning" 
);
-               assertTextPresent( "Cron:" );
-               assertElementPresent( "database_cron" );
-               assertButtonWithValuePresent( "Update Cron" );
-               assertButtonWithValuePresent( "Update Database Now" );
-               assertTextPresent( "Database - Unprocessed Artifacts Scanning" 
);
-               assertTextPresent( "Database - Artifact Cleanup Scanning" );
-       }
-}
+    // Repository Groups
+    public void goToRepositoryGroupsPage()
+    {
+        if ( !getTitle().equals( "Apache Archiva \\ Administration - 
Repository Groups" ) )
+        {
+            clickLinkWithText( "Repository Groups" );
+        }
+        assertRepositoryGroupsPage();
+    }
+
+    public void assertRepositoryGroupsPage()
+    {
+        assertPage( "Apache Archiva \\ Administration - Repository Groups" );
+        assertTextPresent( "Administration - Repository Groups" );
+        assertTextPresent( "Identifier*:" );
+        assertElementPresent( "repositoryGroup.id" );
+        assertButtonWithValuePresent( "Add Group" );
+        assertTextPresent( "Repository Groups" );
+    }
+
+    public void assertAddedRepositoryLink( String repositoryGroupName )
+    {
+        assertPage( "Apache Archiva \\ Administration - Repository Groups" );
+        String repositoryGroupUrlValue = "repository/" + repositoryGroupName + 
"/";
+        String baseUrlValue = "archiva";
+        String repositoryGroupLink = baseUrl.replaceFirst( baseUrlValue, 
repositoryGroupUrlValue );
+        assertTextPresent( repositoryGroupLink );
+    }
+
+    public void assertAddedRepositoryToRepositoryGroups( String repositoryName 
)
+    {
+        assertPage( "Apache Archiva \\ Administration - Repository Groups" );
+        assertTextPresent( repositoryName );
+        assertTextPresent( "Archiva Managed Internal Repository" );
+        assertAddedRepositoryLink( repositoryName );
+    }
+
+    public void assertDeleteRepositoryGroupPage( String repositoryName )
+    {
+        assertPage( "Apache Archiva \\ Admin: Delete Repository Group" );
+        assertTextPresent( "WARNING: This operation can not be undone." );
+        assertTextPresent( "Are you sure you want to delete the following 
repository group?" );
+        assertTextPresent( "ID:" );
+        assertTextPresent( repositoryName );
+        assertButtonWithValuePresent( "Confirm" );
+        assertButtonWithValuePresent( "Cancel" );
+    }
+
+    public void addRepositoryGroup( String repoGroupName )
+    {
+        goToRepositoryGroupsPage();
+        setFieldValue( "repositoryGroup.id", repoGroupName );
+        clickButtonWithValue( "Add Group" );
+    }
+
+    public void addRepositoryToRepositoryGroup( String repositoryGroupName, 
String repositoryName )
+    {
+        goToRepositoryGroupsPage();
+        String s = getSelenium().getBodyText();
+        if ( s.contains( "No Repository Groups Defined." ) )
+        {
+            setFieldValue( "repositoryGroup.id", repositoryGroupName );
+            clickButtonWithValue( "Add Group" );
+            // assertAddedRepositoryLink( repositoryGroupName );
+
+            selectValue( "addRepositoryToGroup_repoId", repositoryName );
+            clickButtonWithValue( "Add Repository" );
+            assertAddedRepositoryToRepositoryGroups( repositoryName );
+        }
+        else
+        {
+            // assertAddedRepositoryLink( repositoryGroupName );
+            selectValue( "addRepositoryToGroup_repoId", repositoryName );
+            clickButtonWithValue( "Add Repository" );
+        }
+    }
+
+    public void deleteRepositoryInRepositoryGroups()
+    {
+        goToRepositoryGroupsPage();
+        getSelenium().click( 
"xpath=//d...@id='contentArea']/div[2]/div/div[3]/div[1]/a/img" );
+        waitPage();
+    }
+
+    public void deleteRepositoryGroup( String repositoryName )
+    {
+        getSelenium().click( 
"xpath=//d...@id='contentArea']/div[2]/div/div[1]/div/a/img" );
+        waitPage();
+        assertDeleteRepositoryGroupPage( repositoryName );
+        clickButtonWithValue( "Confirm" );
+    }
+
+    // /////////////////////////////
+    // proxy connectors
+    // /////////////////////////////
+    public void goToProxyConnectorsPage()
+    {
+        clickLinkWithText( "Proxy Connectors" );
+        assertProxyConnectorsPage();
+    }
+
+    public void assertProxyConnectorsPage()
+    {
+        assertPage( "Apache Archiva \\ Administration - Proxy Connectors" );
+        assertTextPresent( "Administration - Proxy Connectors" );
+        assertTextPresent( "Repository Proxy Connectors" );
+        assertTextPresent( "internal" );
+        assertTextPresent( "Archiva Managed Internal Repository" );
+        assertTextPresent( "Proxy Connector" );
+        assertTextPresent( "Central Repository" );
+        assertTextPresent( "Java.net Repository for Maven 2" );
+    }
+
+    public void assertAddProxyConnectorPage()
+    {
+        assertPage( "Apache Archiva \\ Admin: Add Proxy Connector" );
+        assertTextPresent( "Admin: Add Proxy Connector" );
+        String proxy =
+            "Network Proxy*:,Managed Repository*:,Remote 
Repository*:,Policies:,Return error when:,On remote 
error:,Releases:,Snapshots:,Checksum:,Cache failures:,Properties:,No properties 
have been set.,Black List:,No black list patterns have been set.,White List:,No 
white list patterns have been set.";
+        String[] arrayProxy = proxy.split( "," );
+        for ( String arrayproxy : arrayProxy )
+            assertTextPresent( arrayproxy );
+        /*
+         * String proxyElements =
+         * 
"addProxyConnector_connector_proxyId,addProxyConnector_connector_sourceRepoId,addProxyConnector_connector_targetRepoId,policy_propagate-errors-on-update,policy_propagate-errors,policy_releases,policy_snapshots,policy_checksum,policy_cache-failures,propertiesEntry,propertiesValue,blackListEntry,whiteListEntry"
+         * ; String[] arrayProxyElements = proxyElements.split( "," ); for ( 
String arrayproxyelements :
+         * arrayProxyElements ) assertTextPresent( arrayproxyelements );
+         */
+        assertButtonWithValuePresent( "Add Property" );
+        assertButtonWithValuePresent( "Add Pattern" );
+        assertButtonWithValuePresent( "Add Proxy Connector" );
+    }
+
+    // this only fills in the values of required fields in adding Proxy 
Connectors
+    public void addProxyConnector( String networkProxy, String managedRepo, 
String remoteRepo )
+    {
+        goToProxyConnectorsPage();
+        clickLinkWithText( "Add" );
+        assertAddProxyConnectorPage();
+        selectValue( "connector.proxyId", networkProxy );
+        selectValue( "connector.sourceRepoId", managedRepo );
+        selectValue( "connector.targetRepoId", remoteRepo );
+    }
+
+    public void deleteProxyConnector()
+    {
+        goToProxyConnectorsPage();
+        clickLinkWithXPath( 
"//d...@id='contentArea']/div[2]/div[1]/div[2]/div[1]/a[3]/img" );
+        assertPage( "Apache Archiva \\ Admin: Delete Proxy Connectors" );
+        clickButtonWithValue( "Delete" );
+        assertPage( "Apache Archiva \\ Administration - Proxy Connectors" );
+    }
+
+    // /////////////////////////////
+    // network proxies
+    // /////////////////////////////
+    public void goToNetworkProxiesPage()
+    {
+        clickLinkWithText( "Network Proxies" );
+        assertNetworkProxiesPage();
+    }
+
+    public void assertNetworkProxiesPage()
+    {
+        assertPage( "Apache Archiva \\ Administration - Network Proxies" );
+        assertTextPresent( "Administration - Network Proxies" );
+        assertTextPresent( "Network Proxies" );
+        assertLinkPresent( "Add Network Proxy" );
+    }
+
+    public void assertAddNetworkProxy()
+    {
+        assertPage( "Apache Archiva \\ Admin: Add Network Proxy" );
+        assertTextPresent( "Admin: Add Network Proxy" );
+        assertTextPresent( "Add network proxy:" );
+        assertTextPresent( "Identifier*:" );
+        assertTextPresent( "Protocol*:" );
+        assertTextPresent( "Hostname*:" );
+        assertTextPresent( "Port*:" );
+        assertTextPresent( "Username:" );
+        assertTextPresent( "Password:" );
+        assertButtonWithValuePresent( "Save Network Proxy" );
+    }
+
+    public void addNetworkProxy( String identifier, String protocol, String 
hostname, String port, String username,
+                                 String password )
+    {
+        // goToNetworkProxiesPage();
+        clickLinkWithText( "Add Network Proxy" );
+        assertAddNetworkProxy();
+        setFieldValue( "proxy.id", identifier );
+        setFieldValue( "proxy.protocol", protocol );
+        setFieldValue( "proxy.host", hostname );
+        setFieldValue( "proxy.port", port );
+        setFieldValue( "proxy.username", username );
+        setFieldValue( "proxy.password", password );
+        clickButtonWithValue( "Save Network Proxy" );
+    }
+
+    public void editNetworkProxies( String fieldName, String value )
+    {
+        // goToNetworkProxiesPage();
+        clickLinkWithText( "Edit Network Proxy" );
+        setFieldValue( fieldName, value );
+        clickButtonWithValue( "Save Network Proxy" );
+    }
+
+    public void deleteNetworkProxy()
+    {
+        // goToNetworkProxiesPage();
+        clickLinkWithText( "Delete Network Proxy" );
+        assertPage( "Apache Archiva \\ Admin: Delete Network Proxy" );
+        assertTextPresent( "WARNING: This operation can not be undone." );
+        clickButtonWithValue( "Delete" );
+    }
+
+    // remote repositories
+    public void assertAddRemoteRepository()
+    {
+        assertPage( "Apache Archiva \\ Admin: Add Remote Repository" );
+        String remote = "Identifier*:,Name*:,URL*:,Username:,Password:,Timeout 
in seconds:,Type:";
+        String[] arrayRemote = remote.split( "," );
+        for ( String arrayremote : arrayRemote )
+            assertTextPresent( arrayremote );
+        String remoteElements =
+            
"addRemoteRepository_repository_id,addRemoteRepository_repository_name,addRemoteRepository_repository_url,addRemoteRepository_repository_username,addRemoteRepository_repository_password,addRemoteRepository_repository_timeout,addRemoteRepository_repository_layout";
+        String[] arrayRemoteElements = remoteElements.split( "," );
+        for ( String arrayremotelement : arrayRemoteElements )
+            assertElementPresent( arrayremotelement );
+    }
+
+    public void assertDeleteRemoteRepositoryPage()
+    {
+        assertPage( "Apache Archiva \\ Admin: Delete Remote Repository" );
+        assertTextPresent( "Admin: Delete Remote Repository" );
+        assertTextPresent( "WARNING: This operation can not be undone." );
+        assertTextPresent( "Are you sure you want to delete the following 
remote repository?" );
+        assertButtonWithValuePresent( "Confirm" );
+        assertButtonWithValuePresent( "Cancel" );
+    }
+
+    public void addRemoteRepository( String identifier, String name, String 
url, String username, String password,
+                                     String timeout, String type )
+    {
+        // goToRepositoriesPage();
+        assertAddRemoteRepository();
+        setFieldValue( "addRemoteRepository_repository_id", identifier );
+        setFieldValue( "addRemoteRepository_repository_name", name );
+        setFieldValue( "addRemoteRepository_repository_url", url );
+        setFieldValue( "addRemoteRepository_repository_username", username );
+        setFieldValue( "addRemoteRepository_repository_password", password );
+        setFieldValue( "addRemoteRepository_repository_timeout", timeout );
+        selectValue( "addRemoteRepository_repository_layout", type );
+        clickButtonWithValue( "Add Repository" );
+    }
+
+    public void deleteRemoteRepository()
+    {
+        goToRepositoriesPage();
+        clickLinkWithXPath( "//d...@id='contentArea']/div/div[8]/div[1]/a[2]" 
);
+        assertDeleteRemoteRepositoryPage();
+        clickButtonWithValue( "Confirm" );
+    }
+
+    public void editRemoteRepository( String fieldName, String value )
+    {
+        goToRepositoriesPage();
+        clickLinkWithXPath( "//d...@id='contentArea']/div/div[8]/div[1]/a[1]" 
);
+        setFieldValue( fieldName, value );
+        clickButtonWithValue( "Update Repository" );
+    }
+
+    public void editManagedRepository( String fieldName, String value )
+    {
+        goToRepositoriesPage();
+        clickLinkWithXPath( 
"//d...@id='contentArea']/div/div[5]/div[1]/a[1]/img" );
+        assertPage( "Apache Archiva \\ Admin: Edit Managed Repository" );
+        setFieldValue( fieldName, value );
+        // TODO
+        clickButtonWithValue( "Update Repository" );
+    }
+
+    public void deleteManagedRepository()
+    {
+        clickLinkWithXPath( "//d...@id='contentArea']/div/div[5]/div[1]/a[2]" 
);
+        assertPage( "Apache Archiva \\ Admin: Delete Managed Repository" );
+        clickButtonWithValue( "Delete Configuration Only" );
+    }
+
+    public String getRepositoryDir()
+    {
+        File f = new File( "" );
+        String artifactFilePath = f.getAbsolutePath();
+        return artifactFilePath + "/target/";
+    }
+
+    // ///////////////////////////////////////////
+    // Repository Scanning
+    // ///////////////////////////////////////////
+    public void goToRepositoryScanningPage()
+    {
+        clickLinkWithText( "Repository Scanning" );
+        assertRepositoryScanningPage();
+    }
+
+    public void assertRepositoryScanningPage()
+    {
+        assertPage( "Apache Archiva \\ Administration - Repository Scanning" );
+        assertTextPresent( "Administration - Repository Scanning" );
+        assertTextPresent( "Repository Scanning - File Types" );
+        String artifactsTypes =
+            
"**/*.pom,**/*.jar,**/*.ear,**/*.war,**/*.car,**/*.sar,**/*.mar,**/*.rar,**/*.dtd,**/*.tld,**/*.tar.gz,**/*.tar.bz2,**/*.zip";
+        String[] arrayArtifactTypes = artifactsTypes.split( "," );
+        for ( int i = 0; i < arrayArtifactTypes.length; i++ )
+            Assert.assertEquals( getSelenium().getTable( 
"//d...@id='contentArea']/div/div[1]/table." + i + ".0" ),
+                                 arrayArtifactTypes[i] );
+
+        String autoremove = "**/*.bak,**/*~,**/*-";
+        String[] arrayAutoremove = autoremove.split( "," );
+        for ( int i = 0; i < arrayAutoremove.length; i++ )
+            Assert.assertEquals( getSelenium().getTable( 
"//d...@id='contentArea']/div/div[2]/table." + i + ".0" ),
+                                 arrayAutoremove[i] );
+
+        String ignored = 
"**/.htaccess,**/KEYS,**/*.rb,**/*.sh,**/.svn/**,**/.DAV/**";
+        String[] arrayIgnored = ignored.split( "," );
+        for ( int i = 0; i < arrayIgnored.length; i++ )
+            Assert.assertEquals( getSelenium().getTable( 
"//d...@id='contentArea']/div/div[3]/table." + i + ".0" ),
+                                 arrayIgnored[i] );
+
+        String indexableContent =
+            
"**/*.txt,**/*.TXT,**/*.block,**/*.config,**/*.pom,**/*.xml,**/*.xsd,**/*.dtd,**/*.tld";
+        String[] arrayIndexableContent = indexableContent.split( "," );
+        for ( int i = 0; i < arrayIndexableContent.length; i++ )
+            Assert.assertEquals( getSelenium().getTable( 
"//d...@id='contentArea']/div/div[4]/table." + i + ".0" ),
+                                 arrayIndexableContent[i] );
+    }
+
+    // ///////////////////////////////////////////
+    // Database
+    // ///////////////////////////////////////////
+    public void goToDatabasePage()
+    {
+        clickLinkWithText( "Database" );
+        assertDatabasePage();
+    }
+
+    public void assertDatabasePage()
+    {
+        assertPage( "Apache Archiva \\ Administration - Database" );
+        assertTextPresent( "Administration - Database" );
+        assertTextPresent( "Database - Unprocessed Artifacts Scanning" );
+        assertTextPresent( "Cron:" );
+        assertElementPresent( "database_cron" );
+        assertButtonWithValuePresent( "Update Cron" );
+        assertButtonWithValuePresent( "Update Database Now" );
+        assertTextPresent( "Database - Unprocessed Artifacts Scanning" );
+        assertTextPresent( "Database - Artifact Cleanup Scanning" );
+    }
+}
\ No newline at end of file

Modified: 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java?rev=931475&r1=931474&r2=931475&view=diff
==============================================================================
--- 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java
 (original)
+++ 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java
 Wed Apr  7 09:27:05 2010
@@ -19,12 +19,12 @@ package org.apache.archiva.web.test.pare
  * under the License.
  */
 
-public abstract class AbstractSearchTest 
-       extends AbstractArchivaTest
-{      
-       //Search
-       public void goToSearchPage()
-       {
+public abstract class AbstractSearchTest
+    extends AbstractArchivaTest
+{
+    // Search
+    public void goToSearchPage()
+    {
         if ( !"Apache Archiva \\ Quick Search".equals( getTitle() ) )
         {
             clickLinkWithText( "Search" );
@@ -32,20 +32,20 @@ public abstract class AbstractSearchTest
 
             assertPage( "Apache Archiva \\ Quick Search" );
         }
-       }
-       
-       public void assertSearchPage()
-       {
-               assertPage( "Apache Archiva \\ Quick Search" );
-               assertTextPresent( "Search for" );
-               assertElementPresent( "quickSearch_q" );
-               assertButtonWithValuePresent( "Search" );
-               //assertLinkPresent( "Advanced Search" );
-               assertTextPresent( "Enter your search terms. A variety of data 
will be searched for your keywords." );
-               //assertButtonWithDivIdPresent( "searchHint" );
-       }
-       
-       public void searchForArtifact( String artifactId )
+    }
+
+    public void assertSearchPage()
+    {
+        assertPage( "Apache Archiva \\ Quick Search" );
+        assertTextPresent( "Search for" );
+        assertElementPresent( "quickSearch_q" );
+        assertButtonWithValuePresent( "Search" );
+        // assertLinkPresent( "Advanced Search" );
+        assertTextPresent( "Enter your search terms. A variety of data will be 
searched for your keywords." );
+        // assertButtonWithDivIdPresent( "searchHint" );
+    }
+
+    public void searchForArtifact( String artifactId )
     {
         goToSearchPage();
 
@@ -53,8 +53,8 @@ public abstract class AbstractSearchTest
         clickButtonWithValue( "Search" );
     }
 
-    public void searchForArtifactAdvancedSearch( String groupId, String 
artifactId, String version, String repositoryId,
-                                                 String className, String 
rowCount )
+    public void searchForArtifactAdvancedSearch( String groupId, String 
artifactId, String version,
+                                                 String repositoryId, String 
className, String rowCount )
     {
         goToSearchPage();
 
@@ -113,4 +113,4 @@ public abstract class AbstractSearchTest
         }
         clickSubmitWithLocator( "filteredSearch_0" );
     }
-}
+}
\ No newline at end of file

Modified: 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java?rev=931475&r1=931474&r2=931475&view=diff
==============================================================================
--- 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
 (original)
+++ 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
 Wed Apr  7 09:27:05 2010
@@ -39,7 +39,8 @@ import org.testng.Assert;
  * @version $Id: AbstractSeleniumTestCase.java 761154 2009-04-02 03:31:19Z 
wsmoak $
  */
 
-public abstract class AbstractSeleniumTest {
+public abstract class AbstractSeleniumTest
+{
 
     public static String baseUrl;
 
@@ -49,19 +50,19 @@ public abstract class AbstractSeleniumTe
 
     public static Properties p;
 
-    private final static String PROPERTIES_SEPARATOR = "=";    
+    private final static String PROPERTIES_SEPARATOR = "=";
 
     public void open()
-           throws Exception
-       {
-           p = new Properties();
-           p.load( this.getClass().getClassLoader().getResourceAsStream( 
"testng.properties" ) );
-       
-           //baseUrl = getProperty( "BASE_URL" );
-           maxWaitTimeInMs = getProperty( "MAX_WAIT_TIME_IN_MS" );
-       }
-       
-       /**
+        throws Exception
+    {
+        p = new Properties();
+        p.load( this.getClass().getClassLoader().getResourceAsStream( 
"testng.properties" ) );
+
+        // baseUrl = getProperty( "BASE_URL" );
+        maxWaitTimeInMs = getProperty( "MAX_WAIT_TIME_IN_MS" );
+    }
+
+    /**
      * Initialize selenium
      */
     public void open( String baseUrl, String browser, String seleniumHost, int 
seleniumPort )
@@ -113,8 +114,7 @@ public abstract class AbstractSeleniumTe
         return value;
     }
 
-    
-           /**
+    /**
      * Close selenium session. Called from AfterSuite method of sub-class
      */
     public void close()
@@ -126,273 +126,273 @@ public abstract class AbstractSeleniumTe
             selenium.set( null );
         }
     }
-       
-       // *******************************************************
-       // Auxiliar methods. This method help us and simplify test.
-       // *******************************************************
-           
-       public void assertFieldValue( String fieldValue, String fieldName )
-       {
-                       assertElementPresent( fieldName );
-                       Assert.assertEquals( fieldValue, 
getSelenium().getValue( fieldName ) );
-       }
-       
+
+    // *******************************************************
+    // Auxiliar methods. This method help us and simplify test.
+    // *******************************************************
+
+    public void assertFieldValue( String fieldValue, String fieldName )
+    {
+        assertElementPresent( fieldName );
+        Assert.assertEquals( fieldValue, getSelenium().getValue( fieldName ) );
+    }
+
     public void assertPage( String title )
     {
         Assert.assertEquals( getTitle(), title );
     }
-       
-       public String getTitle()
-       {
-            // Collapse spaces
-            return getSelenium().getTitle().replaceAll( "[ \n\r]+", " " );
-       }
-       
-       public String getHtmlContent()
-       {
-           return getSelenium().getHtmlSource();
-       }
-       
-       public void assertTextPresent( String text )
-       {
-           Assert.assertTrue( getSelenium().isTextPresent( text ), "'" + text 
+ "' isn't present." );
-       }
-       
-       public void assertTextNotPresent( String text )
-       {
-           Assert.assertFalse( getSelenium().isTextPresent( text ), "'" + text 
+ "' is present." );
-       }
-       
-       public void assertElementPresent( String elementLocator )
-       {
-          Assert.assertTrue( isElementPresent( elementLocator ), "'" + 
elementLocator + "' isn't present." );
-       }
-       
-       public void assertElementNotPresent( String elementLocator )
-       {
-          Assert.assertFalse( isElementPresent( elementLocator ), "'" + 
elementLocator + "' is present." );
-       }
-       
-       public void assertLinkPresent( String text )
-       {
-          Assert.assertTrue( isElementPresent( "link=" + text ), "The link '" 
+ text + "' isn't present." );
-       }
-       
-       public void assertLinkNotPresent( String text )
-       {
-          Assert.assertFalse( isElementPresent( "link=" + text ), "The link('" 
+ text + "' is present." );
-       }
-       
-       public void assertImgWithAlt( String alt )
-       {
-          assertElementPresent( "/¯i...@alt='" + alt + "']" );
-       }
-       
-       public void assertImgWithAltAtRowCol( boolean isALink, String alt, int 
row, int column )
-       {
-           String locator = "//tr[" + row + "]/td[" + column + "]/";
-           locator += isALink ? "a/" : "";
-           locator += "i...@alt='" + alt + "']";
-       
-           assertElementPresent( locator );
-       }
-       
-       public void assertCellValueFromTable( String expected, String 
tableElement, int row, int column )
-       {
-           Assert.assertEquals( expected, getCellValueFromTable( tableElement, 
row, column ) );
-       }
-       
-       public boolean isTextPresent( String text )
-       {
-           return getSelenium().isTextPresent( text );
-       }
-       
-       public boolean isLinkPresent( String text )
-       {
-           return isElementPresent( "link=" + text );
-       }
-       
-       public boolean isElementPresent( String locator )
-       {
-           return getSelenium().isElementPresent( locator );
-       }
-       
-       public void waitPage()
-       {
-           getSelenium().waitForPageToLoad( maxWaitTimeInMs );
-       }
-       
-       public String getFieldValue( String fieldName )
-       {
-           return getSelenium().getValue( fieldName );
-       }
-       
-       public String getCellValueFromTable( String tableElement, int row, int 
column )
-       {
-           return getSelenium().getTable( tableElement + "." + row + "." + 
column );
-       }
-       
-       public void selectValue( String locator, String value )
-       {
-           getSelenium().select( locator, "label=" + value );
-       }
-       
-       public void assertOptionPresent( String selectField, String[] options )
-       {
-           assertElementPresent( selectField );
-           String[] optionsPresent = getSelenium().getSelectOptions( 
selectField );
-           List<String> expected = Arrays.asList( options );
+
+    public String getTitle()
+    {
+        // Collapse spaces
+        return getSelenium().getTitle().replaceAll( "[ \n\r]+", " " );
+    }
+
+    public String getHtmlContent()
+    {
+        return getSelenium().getHtmlSource();
+    }
+
+    public void assertTextPresent( String text )
+    {
+        Assert.assertTrue( getSelenium().isTextPresent( text ), "'" + text + 
"' isn't present." );
+    }
+
+    public void assertTextNotPresent( String text )
+    {
+        Assert.assertFalse( getSelenium().isTextPresent( text ), "'" + text + 
"' is present." );
+    }
+
+    public void assertElementPresent( String elementLocator )
+    {
+        Assert.assertTrue( isElementPresent( elementLocator ), "'" + 
elementLocator + "' isn't present." );
+    }
+
+    public void assertElementNotPresent( String elementLocator )
+    {
+        Assert.assertFalse( isElementPresent( elementLocator ), "'" + 
elementLocator + "' is present." );
+    }
+
+    public void assertLinkPresent( String text )
+    {
+        Assert.assertTrue( isElementPresent( "link=" + text ), "The link '" + 
text + "' isn't present." );
+    }
+
+    public void assertLinkNotPresent( String text )
+    {
+        Assert.assertFalse( isElementPresent( "link=" + text ), "The link('" + 
text + "' is present." );
+    }
+
+    public void assertImgWithAlt( String alt )
+    {
+        assertElementPresent( "/¯i...@alt='" + alt + "']" );
+    }
+
+    public void assertImgWithAltAtRowCol( boolean isALink, String alt, int 
row, int column )
+    {
+        String locator = "//tr[" + row + "]/td[" + column + "]/";
+        locator += isALink ? "a/" : "";
+        locator += "i...@alt='" + alt + "']";
+
+        assertElementPresent( locator );
+    }
+
+    public void assertCellValueFromTable( String expected, String 
tableElement, int row, int column )
+    {
+        Assert.assertEquals( expected, getCellValueFromTable( tableElement, 
row, column ) );
+    }
+
+    public boolean isTextPresent( String text )
+    {
+        return getSelenium().isTextPresent( text );
+    }
+
+    public boolean isLinkPresent( String text )
+    {
+        return isElementPresent( "link=" + text );
+    }
+
+    public boolean isElementPresent( String locator )
+    {
+        return getSelenium().isElementPresent( locator );
+    }
+
+    public void waitPage()
+    {
+        getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+    }
+
+    public String getFieldValue( String fieldName )
+    {
+        return getSelenium().getValue( fieldName );
+    }
+
+    public String getCellValueFromTable( String tableElement, int row, int 
column )
+    {
+        return getSelenium().getTable( tableElement + "." + row + "." + column 
);
+    }
+
+    public void selectValue( String locator, String value )
+    {
+        getSelenium().select( locator, "label=" + value );
+    }
+
+    public void assertOptionPresent( String selectField, String[] options )
+    {
+        assertElementPresent( selectField );
+        String[] optionsPresent = getSelenium().getSelectOptions( selectField 
);
+        List<String> expected = Arrays.asList( options );
         List<String> present = Arrays.asList( optionsPresent );
-           Assert.assertTrue( present.containsAll( expected ), "Options 
expected are not included in present options" );
-       }
-       
-       public void assertSelectedValue( String value, String fieldName )
-       {
-           assertElementPresent( fieldName );
-           String optionsPresent = getSelenium().getSelectedLabel( value );
-           Assert.assertEquals( optionsPresent, value );
-       }
-       
-       public void submit()
-       {
-           clickLinkWithXPath( "//inp...@type='submit']" );
-       }
-       
-       public void assertButtonWithValuePresent( String text )
-       {
-           Assert.assertTrue( isButtonWithValuePresent( text ), "'" + text + 
"' button isn't present" );
-       }
-       
-       public void assertButtonWithIdPresent( String id )
-       {
-           Assert.assertTrue( isButtonWithIdPresent( id ), "'Button with id =" 
+ id + "' isn't present" );
-       }
-       
-       public void assertButtonWithValueNotPresent( String text )
-       {
-          Assert.assertFalse( isButtonWithValuePresent( text ), "'" + text + 
"' button is present" );
-       }
-       
-       public boolean isButtonWithValuePresent( String text )
-       {
-           return isElementPresent( "//butt...@value='" + text + "']" )
-               || isElementPresent( "//inp...@value='" + text + "']" );
-       }
-       
-       public boolean isButtonWithIdPresent( String text )
-       {
-           return isElementPresent( "//butt...@id='" + text + "']" ) || 
isElementPresent( "//inp...@id='" + text + "']" );
-       }
-       
-       public void clickButtonWithValue( String text )
-       {
-           clickButtonWithValue( text, true );
-       }
-       
-       public void clickButtonWithValue( String text, boolean wait )
-       {
-           assertButtonWithValuePresent( text );
-       
-           if ( isElementPresent( "//butt...@value='" + text + "']" ) )
-           {
-               clickLinkWithXPath( "//butt...@value='" + text + "']", wait );
-           }
-           else
-           {
-               clickLinkWithXPath( "//inp...@value='" + text + "']", wait );
-           }
-       }
-       
-       public void clickSubmitWithLocator( String locator )
-       {
-           clickLinkWithLocator( locator );
-       }
-       
-       public void clickSubmitWithLocator( String locator, boolean wait )
-       {
-           clickLinkWithLocator( locator, wait );
-       }
-       
-       public void clickImgWithAlt( String alt )
-       {
-           clickLinkWithLocator( "//i...@alt='" + alt + "']" );
-       }
-       
-       public void clickLinkWithText( String text )
-       {
-           clickLinkWithText( text, true );
-       }
-       
-       public void clickLinkWithText( String text, boolean wait )
-       {
-           clickLinkWithLocator( "link=" + text, wait );
-       }
-       
-       public void clickLinkWithXPath( String xpath )
-       {
-           clickLinkWithXPath( xpath, true );
-       }
-       
-       public void clickLinkWithXPath( String xpath, boolean wait )
-       {
-           clickLinkWithLocator( "xpath=" + xpath, wait );
-       }
-       
-       public void clickLinkWithLocator( String locator )
-       {
-           clickLinkWithLocator( locator, true );
-       }
-       
-       public void clickLinkWithLocator( String locator, boolean wait )
-       {
-           assertElementPresent( locator );
-           getSelenium().click( locator );
-           if ( wait )
-           {
-               waitPage();
-           }
-       }
-       
-       public void setFieldValues( Map<String, String> fieldMap )
-       {
-           Map.Entry<String, String> entry;
-       
-           for ( Iterator<Entry<String, String>> entries = 
fieldMap.entrySet().iterator(); entries.hasNext(); )
-           {
-               entry = entries.next();
-       
-               getSelenium().type( entry.getKey(), entry.getValue() );
-           }
-       }
-       
-       public void setFieldValue( String fieldName, String value )
-       {
-           getSelenium().type( fieldName, value );
-       }
-       
-       public void checkField( String locator )
-       {
-           getSelenium().check( locator );
-       }
-       
-       public void uncheckField( String locator )
-       {
-           getSelenium().uncheck( locator );
-       }
-       
-       public boolean isChecked( String locator )
-       {
-           return getSelenium().isChecked( locator );
-       }
-       
-       public void assertIsChecked( String locator )
-       {
-           Assert.assertTrue( getSelenium().isChecked( locator ) );
-       }
-       
-       public void assertIsNotChecked( String locator )
-       {
-          Assert.assertFalse( getSelenium().isChecked( locator ) );
-       }
-           
-}
+        Assert.assertTrue( present.containsAll( expected ), "Options expected 
are not included in present options" );
+    }
+
+    public void assertSelectedValue( String value, String fieldName )
+    {
+        assertElementPresent( fieldName );
+        String optionsPresent = getSelenium().getSelectedLabel( value );
+        Assert.assertEquals( optionsPresent, value );
+    }
+
+    public void submit()
+    {
+        clickLinkWithXPath( "//inp...@type='submit']" );
+    }
+
+    public void assertButtonWithValuePresent( String text )
+    {
+        Assert.assertTrue( isButtonWithValuePresent( text ), "'" + text + "' 
button isn't present" );
+    }
+
+    public void assertButtonWithIdPresent( String id )
+    {
+        Assert.assertTrue( isButtonWithIdPresent( id ), "'Button with id =" + 
id + "' isn't present" );
+    }
+
+    public void assertButtonWithValueNotPresent( String text )
+    {
+        Assert.assertFalse( isButtonWithValuePresent( text ), "'" + text + "' 
button is present" );
+    }
+
+    public boolean isButtonWithValuePresent( String text )
+    {
+        return isElementPresent( "//butt...@value='" + text + "']" )
+            || isElementPresent( "//inp...@value='" + text + "']" );
+    }
+
+    public boolean isButtonWithIdPresent( String text )
+    {
+        return isElementPresent( "//butt...@id='" + text + "']" ) || 
isElementPresent( "//inp...@id='" + text + "']" );
+    }
+
+    public void clickButtonWithValue( String text )
+    {
+        clickButtonWithValue( text, true );
+    }
+
+    public void clickButtonWithValue( String text, boolean wait )
+    {
+        assertButtonWithValuePresent( text );
+
+        if ( isElementPresent( "//butt...@value='" + text + "']" ) )
+        {
+            clickLinkWithXPath( "//butt...@value='" + text + "']", wait );
+        }
+        else
+        {
+            clickLinkWithXPath( "//inp...@value='" + text + "']", wait );
+        }
+    }
+
+    public void clickSubmitWithLocator( String locator )
+    {
+        clickLinkWithLocator( locator );
+    }
+
+    public void clickSubmitWithLocator( String locator, boolean wait )
+    {
+        clickLinkWithLocator( locator, wait );
+    }
+
+    public void clickImgWithAlt( String alt )
+    {
+        clickLinkWithLocator( "//i...@alt='" + alt + "']" );
+    }
+
+    public void clickLinkWithText( String text )
+    {
+        clickLinkWithText( text, true );
+    }
+
+    public void clickLinkWithText( String text, boolean wait )
+    {
+        clickLinkWithLocator( "link=" + text, wait );
+    }
+
+    public void clickLinkWithXPath( String xpath )
+    {
+        clickLinkWithXPath( xpath, true );
+    }
+
+    public void clickLinkWithXPath( String xpath, boolean wait )
+    {
+        clickLinkWithLocator( "xpath=" + xpath, wait );
+    }
+
+    public void clickLinkWithLocator( String locator )
+    {
+        clickLinkWithLocator( locator, true );
+    }
+
+    public void clickLinkWithLocator( String locator, boolean wait )
+    {
+        assertElementPresent( locator );
+        getSelenium().click( locator );
+        if ( wait )
+        {
+            waitPage();
+        }
+    }
+
+    public void setFieldValues( Map<String, String> fieldMap )
+    {
+        Map.Entry<String, String> entry;
+
+        for ( Iterator<Entry<String, String>> entries = 
fieldMap.entrySet().iterator(); entries.hasNext(); )
+        {
+            entry = entries.next();
+
+            getSelenium().type( entry.getKey(), entry.getValue() );
+        }
+    }
+
+    public void setFieldValue( String fieldName, String value )
+    {
+        getSelenium().type( fieldName, value );
+    }
+
+    public void checkField( String locator )
+    {
+        getSelenium().check( locator );
+    }
+
+    public void uncheckField( String locator )
+    {
+        getSelenium().uncheck( locator );
+    }
+
+    public boolean isChecked( String locator )
+    {
+        return getSelenium().isChecked( locator );
+    }
+
+    public void assertIsChecked( String locator )
+    {
+        Assert.assertTrue( getSelenium().isChecked( locator ) );
+    }
+
+    public void assertIsNotChecked( String locator )
+    {
+        Assert.assertFalse( getSelenium().isChecked( locator ) );
+    }
+
+}
\ No newline at end of file


Reply via email to