diff options
author | Marecor M. Baclay <mbaclay@apache.org> | 2009-08-27 01:55:46 +0000 |
---|---|---|
committer | Marecor M. Baclay <mbaclay@apache.org> | 2009-08-27 01:55:46 +0000 |
commit | 9c3facccc759ae93bb80d35762e5ad056f384438 (patch) | |
tree | 0be15631f4caadf97e921cc50dfa7e969ee1751a /archiva-modules/archiva-web | |
parent | 81aa36aa0911188c54afc4bf07cf1b2dc4ca80bb (diff) | |
download | archiva-9c3facccc759ae93bb80d35762e5ad056f384438.tar.gz archiva-9c3facccc759ae93bb80d35762e5ad056f384438.zip |
[MRM-1241] Selenium Tests for Repository Scanning and Database
- added tests for repository scanning.
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@808252 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web')
4 files changed, 243 insertions, 2 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/config/testng.xml b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/config/testng.xml index 2786f8913..9eac33934 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/config/testng.xml +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/config/testng.xml @@ -29,7 +29,8 @@ under the License. <run> <include name="about" /> <include name= "login" /> - <include name= "userroles" /> + <include name= "userroles" /> + <include name= "reposcan" /> <include name= "artifactmanagement" /> <include name= "search" /> <include name= "browse" /> @@ -46,4 +47,4 @@ under the License. <package name="org.apache.archiva.web.test" /> </packages> </test> -</suite>
\ No newline at end of file +</suite> diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryScanningTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryScanningTest.java new file mode 100644 index 000000000..c4d5bcad9 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryScanningTest.java @@ -0,0 +1,182 @@ +package org.apache.archiva.web.test; + +import org.apache.archiva.web.test.parent.AbstractRepositoryTest; +import org.testng.annotations.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. + */ + +@Test( groups = { "reposcan" }, dependsOnMethods = { "testWithCorrectUsernamePassword" }, sequential = true ) +public class RepositoryScanningTest + extends AbstractRepositoryTest +{ + public void testAddArtifactFileType_NullValue() + { + goToRepositoryScanningPage(); + clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" ); + assertTextPresent( "Unable to process blank pattern." ); + } + + @Test (dependsOnMethods = { "testAddArtifactFileType_NullValue" } ) + public void testAddArtifactFileType() + { + setFieldValue( "newpattern_0" , "**/*.dll" ); + clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" ); + assertTextPresent( "**/*.dll" ); + } + + @Test (dependsOnMethods = { "testAddArtifactFileType" } ) + public void testAddArtifactFileType_ExistingValue() + { + setFieldValue( "newpattern_0" , "**/*.zip" ); + clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[15]/td[2]/a/img" ); + assertTextPresent( "Not adding pattern \"**/*.zip\" to filetype artifacts as it already exists." ); + } + + @Test (dependsOnMethods = { "testAddArtifactFileType_ExistingValue" } ) + public void testDeleteArtifactFileType() + { + clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" ); + assertTextNotPresent( "dll" ); + } + + @Test (dependsOnMethods = { "testDeleteArtifactFileType" } ) + public void testAddAutoRemove_NullValue() + { + setFieldValue( "newpattern_1" , "" ); + clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" ); + assertTextPresent( "Unable to process blank pattern." ); + } + + @Test (dependsOnMethods = { "testAddAutoRemove_NullValue" } ) + public void testAddAutoRemove_ExistingValue() + { + setFieldValue( "newpattern_1" , "**/*-" ); + clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" ); + assertTextPresent( "Not adding pattern \"**/*-\" to filetype auto-remove as it already exists." ); + } + + @Test (dependsOnMethods = { "testAddAutoRemove_ExistingValue" } ) + public void testAddAutoRemove() + { + setFieldValue( "newpattern_1" , "**/*.test" ); + clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" ); + assertTextPresent( "**/*.test" ); + } + + @Test (dependsOnMethods = { "testAddAutoRemove" } ) + public void testDeleteAutoRemove() + { + clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" ); + assertTextNotPresent( "test" ); + } + + @Test (dependsOnMethods = { "testDeleteAutoRemove" } ) + public void testAddIgnoredArtifacts_NullValue() + { + setFieldValue( "newpattern_2" , "" ); + clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" ); + assertTextPresent( "Unable to process blank pattern." ); + } + + @Test (dependsOnMethods = { "testAddIgnoredArtifacts_NullValue" } ) + public void testAddIgnoredArtifacts_ExistingValue() + { + setFieldValue( "newpattern_2" , "**/*.sh" ); + clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" ); + assertTextPresent( "Not adding pattern \"**/*.sh\" to filetype ignored as it already exists." ); + } + + @Test (dependsOnMethods = { "testAddIgnoredArtifacts_ExistingValue" } ) + public void testAddIgnoredArtifacts() + { + setFieldValue( "newpattern_2" , "**/*.log" ); + clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" ); + assertTextPresent( "**/*.log" ); + } + + @Test (dependsOnMethods = { "testAddIgnoredArtifacts" } ) + public void testDeleteIgnoredArtifacts() + { + clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" ); + assertTextNotPresent( "log" ); + } + + // + @Test (dependsOnMethods = { "testDeleteIgnoredArtifacts" } ) + public void testAddIndexableContent_NullValue() + { + setFieldValue( "newpattern_3" , "" ); + clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" ); + assertTextPresent( "Unable to process blank pattern." ); + } + + @Test (dependsOnMethods = { "testAddIndexableContent_NullValue" } ) + public void testAddIndexableContent_ExistingValue() + { + setFieldValue( "newpattern_3" , "**/*.xml" ); + clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" ); + assertTextPresent( "Not adding pattern \"**/*.xml\" to filetype indexable-content as it already exists." ); + } + + @Test (dependsOnMethods = { "testAddIndexableContent_ExistingValue" } ) + public void testAddIndexableContent() + { + setFieldValue( "newpattern_3" , "**/*.html" ); + clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" ); + assertTextPresent( "**/*.html" ); + } + + @Test (dependsOnMethods = { "testAddIndexableContent" } ) + public void testDeleteIndexableContent() + { + clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" ); + assertTextNotPresent( "html" ); + } + + @Test (dependsOnMethods = { "testDeleteIndexableContent" } ) + public void testUpdateConsumers() + { + checkField( "enabledKnownContentConsumers" ); + checkField( "//input[@name='enabledKnownContentConsumers' and @value='auto-rename']" ); + clickButtonWithValue( "Update Consumers" ); + assertPage( "Apache Archiva \\ Administration - Repository Scanning" ); + } + + @Test (dependsOnMethods = { "testUpdateConsumers" } ) + public void testUpdateConsumers_UnsetAll() + { + getSelenium().uncheck( "enabledKnownContentConsumers" ); + getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='auto-rename']" ); + getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='create-missing-checksums']" ); + getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='index-content']" ); + getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='metadata-updater']" ); + getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='repository-purge']" ); + getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='update-db-artifact']" ); + getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='validate-checksums']" ); + clickButtonWithValue( "Update Consumers" ); + + // remove the ff. 2 lines if MRM-1238 will be fixed. + getSelenium().goBack(); + waitPage(); + + assertPage( "Apache Archiva \\ Administration - Repository Scanning" ); + } + +} diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java index a18722d7b..a0ed9b0a6 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java @@ -26,6 +26,7 @@ import org.testng.annotations.Test; public class RepositoryTest extends AbstractRepositoryTest { + @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } ) public void testAddManagedRepoValidValues() { goToRepositoriesPage(); diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java index 029dc7b22..6b0cf721c 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java @@ -323,4 +323,61 @@ public abstract class AbstractRepositoryTest 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 (String artifacttypes : arrayArtifactTypes ) + assertTextPresent( artifacttypes ); + + String autoremove = "**/*.bak,**/*~,**/*-"; + String [] arrayAutoremove = autoremove.split( "," ); + for ( String arrayautoremove : arrayAutoremove ) + assertTextPresent( arrayautoremove ); + + String ignored = "**/.htaccess,**/KEYS,**/*.rb,**/*.sh,**/.svn/**,**/.DAV/**"; + String [] arrayIgnored = ignored.split( "," ); + for ( String arrayignored : arrayIgnored ) + assertTextPresent( arrayignored ); + + String indexableContent = "**/*.txt,**/*.TXT,**/*.block,**/*.config,**/*.pom,**/*.xml,**/*.xsd,**/*.dtd,**/*.tld"; + String [] arrayIndexableContent = indexableContent.split( "," ); + for ( String indexablecontent : arrayIndexableContent ) + assertTextPresent( indexablecontent ); + } + + ///////////////////////////////////////////// + // 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( "cron" ); + assertButtonWithValuePresent( "Update Cron" ); + assertButtonWithValuePresent( "Update Database Now" ); + assertTextPresent( "Database - Unprocessed Artifacts Scanning" ); + assertTextPresent( "Database - Artifact Cleanup Scanning" ); + } } |