diff options
Diffstat (limited to 'archiva-modules/archiva-web')
-rw-r--r-- | archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java | 420 |
1 files changed, 0 insertions, 420 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java index 42d9895b4..57fd5fd3e 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java @@ -87,71 +87,6 @@ public abstract class AbstractArchivaTest } // User Management - public void goToUserManagementPage() - { - getSelenium().open( "/archiva/security/userlist.action" ); - assertUserManagementPage(); - } - - public void assertUserManagementPage() - { - assertPage( "Apache Archiva \\ [Admin] User List" ); - assertTextPresent( "[Admin] List of Users in Role: Any" ); - assertTextPresent( "Navigation" ); - assertImgWithAlt( "First" ); - assertImgWithAlt( "Prev" ); - assertImgWithAlt( "Next" ); - assertImgWithAlt( "Last" ); - assertTextPresent( "Display Rows" ); - assertTextPresent( "Username" ); - assertTextPresent( "Full Name" ); - assertTextPresent( "Email" ); - assertTextPresent( "Permanent" ); - assertTextPresent( "Validated" ); - assertTextPresent( "Locked" ); - assertTextPresent( "Tasks" ); - assertTextPresent( "Tools" ); - assertTextPresent( "Tasks" ); - assertTextPresent( "The following tools are available for administrators to manipulate the user list." ); - assertButtonWithValuePresent( "Create New User" ); - assertButtonWithValuePresent( "Show Users In Role" ); - assertElementPresent( "roleName" ); - assertTextPresent( "Reports" ); - assertTextPresent( "Name" ); - assertTextPresent( "Types" ); - assertTextPresent( "User List" ); - assertTextPresent( "Roles Matrix" ); - } - - /* - * //User Role public void goToUserRolesPage() { clickLinkWithText( "User Roles" ); assertUserRolesPage(); } - */ - - public void assertUserRolesPage() - { - //assertPage( "Apache Archiva \\ [Admin] User Edit" ); - //[Admin] RĂ´les de l'utilisateur - - assertTextPresent( "[Admin] User Roles", "[Admin] R\u00F4les de l'utilisateur" ); - assertTextPresent( "Username", "Nom d'utilisateur" ); - assertTextPresent( "Full Name", "Nom complet" ); - String userRoles = - "Guest,Registered User,System Administrator,User Administrator,Global Repository Observer,Global Repository Manager,Repository Observer,Repository Manager,internal"; - String[] arrayRole = userRoles.split( "," ); - for ( String userroles : arrayRole ) - { - assertTextPresent( userroles ); - } - } - - public void assertDeleteUserPage( String username ) - { - assertTextPresent( "[Admin] User Delete", "[Admin] Suppression de l'utilisateur", - "L'utilisateur suivant va \u00EAtre supprim\u00E9:" ); - assertTextPresent( "The following user will be deleted:" ); - assertTextPresent( "Username: " + username, "Nom d'utilisateur:" + username ); - assertButtonWithIdPresent( "userDeleteSubmit" ); - } public void createUser( String userName, String fullName, String email, String password, boolean valid ) { @@ -214,40 +149,7 @@ public abstract class AbstractArchivaTest } // User Roles - public void assertUserRoleCheckBoxPresent( String value ) - { - getSelenium().isElementPresent( - "xpath=//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='" + value - + "']" ); - } - - public void assertResourceRolesCheckBoxPresent( String value ) - { - getSelenium().isElementPresent( "xpath=//input[@name='addDSelectedRoles' and @value='" + value + "']" ); - } - - public void checkUserRoleWithValue( String value ) - { - assertUserRoleCheckBoxPresent( value ); - getSelenium().click( - "xpath=//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='" + value - + "']" ); - } - - public void checkResourceRoleWithValue( String value ) - { - assertResourceRolesCheckBoxPresent( value ); - getSelenium().click( "xpath=//input[@name='addDSelectedRoles' and @value='" + value + "']" ); - } - public void changePassword( String oldPassword, String newPassword ) - { - assertPage( "Apache Archiva \\ Change Password" ); - setFieldValue( "existingPassword", oldPassword ); - setFieldValue( "newPassword", newPassword ); - setFieldValue( "newPasswordConfirm", newPassword ); - clickButtonWithValue( "Change Password" ); - } public void assertCreateUserPage() { @@ -265,333 +167,11 @@ public abstract class AbstractArchivaTest } - public void assertLeftNavMenuWithRole( String role ) - { - if ( role.equals( "Guest" ) || role.equals( "Registered User" ) || role.equals( "Global Repository Observer" ) - || role.equals( "Repository Observer - internal" ) || role.equals( "Repository Observer - snapshots" ) ) - { - assertTextPresent( "Search" ); - assertLinkPresent( "Find Artifact" ); - assertLinkPresent( "Browse" ); - assertLinkNotPresent( "Repositories" ); - } - else if ( role.equals( "User Administrator" ) ) - { - assertTextPresent( "Search" ); - assertLinkPresent( "Find Artifact" ); - assertLinkPresent( "Browse" ); - assertLinkPresent( "User Management" ); - assertLinkPresent( "User Roles" ); - assertLinkNotPresent( "Repositories" ); - } - else if ( role.equals( "Global Repository Manager" ) || role.equals( "Repository Manager - internal" ) - || role.equals( "Repository Manager - snapshots" ) ) - { - assertTextPresent( "Search" ); - assertLinkPresent( "Find Artifact" ); - assertLinkPresent( "Browse" ); - assertLinkPresent( "Upload Artifact" ); - assertLinkPresent( "Delete Artifact" ); - assertLinkNotPresent( "Repositories" ); - } - else - { - assertTextPresent( "Search" ); - String navMenu = - "Find Artifact,Browse,Reports,User Management,User Roles,Appearance,Upload Artifact,Delete Artifact,Repository Groups,Repositories,Proxy Connectors,Legacy Support,Network Proxies,Repository Scanning"; - String[] arrayMenu = navMenu.split( "," ); - for ( String navmenu : arrayMenu ) - { - assertLinkPresent( navmenu ); - } - } - } - - // Find Artifact - public void goToFindArtifactPage() - { - getSelenium().open( "/archiva/findArtifact.action" ); - assertFindArtifactPage(); - } - - public void assertFindArtifactPage() - { - //assertPage( "Apache Archiva \\ Find Artifact" ); - assertElementPresent( "searchBox" ); - //assertTextPresent( "Find Artifact" ); - //assertTextPresent( "Search for:" ); - //assertTextPresent( "Checksum:" ); - assertElementPresent( "quickSearchBox" ); - assertElementPresent( "checksumSearch" ); - //assertButtonWithValuePresent( "Search" ); - assertElementPresent( "checksumSearch_0" ); - } - - // Appearance - public void goToAppearancePage() - { - getSelenium().open( "/archiva/admin/configureAppearance.action" ); - assertAppearancePage(); - } - - public void assertAppearancePage() - { - assertPage( "Apache Archiva \\ Configure Appearance" ); - String appearance = - "Appearance,Organization Details,The logo in the top right of the screen is controlled by the following settings.,Organization Information,Name,URL,Logo URL"; - String[] arrayAppearance = appearance.split( "," ); - for ( String appear : arrayAppearance ) - { - assertTextPresent( appear ); - } - assertLinkPresent( "Edit" ); - assertLinkPresent( "Change your appearance" ); - } - - public void addEditAppearance( String name, String url, String logoUrl, boolean wait ) - { - setFieldValue( "organisationName", name ); - setFieldValue( "organisationUrl", url ); - setFieldValue( "organisationLogo", logoUrl ); - clickButtonWithValue( "Save", wait ); - } - public void goToHomePage() { getSelenium().open( baseUrl ); } - // Upload Artifact - public void goToAddArtifactPage() - { - // must be logged as admin - getSelenium().open( "/archiva/upload.action" ); - assertAddArtifactPage(); - } - - public void assertAddArtifactPage() - { - assertPage( "Apache Archiva \\ Upload Artifact" ); - assertTextPresent( "Upload Artifact" ); - - String artifact = - "Upload Artifact,Group Id*:,Artifact Id*:,Version*:,Packaging*:,Classifier:,Generate Maven 2 POM,Artifact File*:,POM File:,Repository Id:"; - String[] arrayArtifact = artifact.split( "," ); - for ( String arrayartifact : arrayArtifact ) - { - assertTextPresent( arrayartifact ); - } - - String artifactElements = - "upload_groupId,upload_artifactId,upload_version,upload_packaging,upload_classifier,upload_generatePom,upload_artifact,upload_pom,upload_repositoryId,uploadSubmit"; - String[] arrayArtifactElements = artifactElements.split( "," ); - for ( String artifactelements : arrayArtifactElements ) - { - assertElementPresent( artifactelements ); - } - } - - public void addArtifact( String groupId, String artifactId, String version, String packaging, - String artifactFilePath, String repositoryId, boolean wait ) - { - addArtifact( groupId, artifactId, version, packaging, true, artifactFilePath, repositoryId, wait ); - } - - public void addArtifact( String groupId, String artifactId, String version, String packaging, boolean generatePom, - String artifactFilePath, String repositoryId, boolean wait ) - { - login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) ); - goToAddArtifactPage(); - setFieldValue( "groupId", groupId ); - setFieldValue( "artifactId", artifactId ); - setFieldValue( "version", version ); - setFieldValue( "packaging", packaging ); - - if ( generatePom ) - { - checkField( "generatePom" ); - } - - String path; - if ( artifactFilePath != null && artifactFilePath.trim().length() > 0 ) - { - File f = new File( artifactFilePath ); - try - { - path = f.getCanonicalPath(); - } - catch ( IOException e ) - { - path = f.getAbsolutePath(); - } - } - else - { - path = artifactFilePath; - } - - setFieldValue( "artifact", path ); - selectValue( "upload_repositoryId", repositoryId ); - - //clickButtonWithValue( "Submit" ); - clickButtonWithLocator( "uploadSubmit", wait ); - } - - public void goToRepositoriesPage() - { - if ( !getTitle().equals( "Apache Archiva \\ Administration - Repositories" ) ) - { - getSelenium().open( "/archiva/admin/repositories.action" ); - } - assertRepositoriesPage(); - } - - public void assertRepositoriesPage() - { - assertPage( "Apache Archiva \\ Administration - Repositories" ); - assertTextPresent( "Administration - Repositories" ); - assertTextPresent( "Managed Repositories" ); - assertTextPresent( "Remote Repositories" ); - } - - public void addManagedRepository( String identifier, String name, String directory, String indexDirectory, - String type, String cron, String daysOlder, String retentionCount, boolean wait ) - { - // goToRepositoriesPage(); - // clickLinkWithText( "Add" ); - setFieldValue( "repository.id", identifier ); - setFieldValue( "repository.name", name ); - setFieldValue( "repository.location", directory ); - setFieldValue( "repository.indexDirectory", indexDirectory ); - selectValue( "repository.layout", type ); - setFieldValue( "repository.cronExpression", cron ); - setFieldValue( "repository.daysOlder", daysOlder ); - setFieldValue( "repository.retentionCount", retentionCount ); - // TODO - clickButtonWithValue( "Add Repository", wait ); - } - - // artifact management - public void assertDeleteArtifactPage() - { - assertPage( "Apache Archiva \\ Delete Artifact" ); - assertTextPresent( "Delete Artifact" ); - assertTextPresent( "Group Id*:" ); - assertTextPresent( "Artifact Id*:" ); - assertTextPresent( "Version*:" ); - assertTextPresent( "Repository Id:" ); - assertElementPresent( "groupId" ); - assertElementPresent( "artifactId" ); - assertElementPresent( "version" ); - assertElementPresent( "repositoryId" ); - assertButtonWithValuePresent( "Submit" ); - } - - // 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 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 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" ); - } - - // Legacy Support - public void goToLegacySupportPage() - { - getSelenium().open( "/archiva/admin/legacyArtifactPath.action" ); - assertLegacySupportPage(); - } - - public void assertLegacySupportPage() - { - assertPage( "Apache Archiva \\ Administration - Legacy Support" ); - assertTextPresent( "Administration - Legacy Artifact Path Resolution" ); - assertTextPresent( "Path Mappings" ); - assertLinkPresent( "Add" ); - } - - public void addLegacyArtifactPath( String path, String groupId, String artifactId, String version, - String classifier, String type, boolean wait ) - { - assertAddLegacyArtifactPathPage(); - setFieldValue( "legacyArtifactPath.path", path ); - setFieldValue( "groupId", groupId ); - setFieldValue( "artifactId", artifactId ); - setFieldValue( "version", version ); - setFieldValue( "classifier", classifier ); - setFieldValue( "type", type ); - clickButtonWithValue( "Add Legacy Artifact Path", wait ); - } - - public void assertAddLegacyArtifactPathPage() - { - assertPage( "Apache Archiva \\ Admin: Add Legacy Artifact Path" ); - assertTextPresent( "Admin: Add Legacy Artifact Path" ); - assertTextPresent( - "Enter the legacy path to map to a particular artifact reference, then adjust the fields as necessary." ); - String element = - "addLegacyArtifactPath_legacyArtifactPath_path,addLegacyArtifactPath_groupId,addLegacyArtifactPath_artifactId,addLegacyArtifactPath_version,addLegacyArtifactPath_classifier,addLegacyArtifactPath_type"; - String[] arrayElement = element.split( "," ); - for ( String arrayelement : arrayElement ) - { - assertElementPresent( arrayelement ); - } - assertButtonWithValuePresent( "Add Legacy Artifact Path" ); - } - - // add managed repository and its staging repository - public void addStagingRepository( String identifier, String name, String directory, String indexDirectory, - String type, String cron, String daysOlder, String retentionCount ) - { - setFieldValue( "repository.id", identifier ); - setFieldValue( "repository.name", name ); - setFieldValue( "repository.location", directory ); - setFieldValue( "repository.indexDirectory", indexDirectory ); - selectValue( "repository.layout", type ); - setFieldValue( "repository.cronExpression", cron ); - setFieldValue( "repository.daysOlder", daysOlder ); - setFieldValue( "repository.retentionCount", retentionCount ); - checkField( "stageNeeded" ); - - clickButtonWithValue( "Add Repository" ); - } - protected void logout() { clickLinkWithText( "Logout" ); |