summaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorMarecor M. Baclay <mbaclay@apache.org>2009-12-04 07:06:37 +0000
committerMarecor M. Baclay <mbaclay@apache.org>2009-12-04 07:06:37 +0000
commitf640a09b4f9e9929fbae11be0ddab55c619c2d82 (patch)
treec8b2d0e86d1b81bfc2b62ba90edccd280e0a6b71 /archiva-modules
parent6c1cd8d63fa27f895307363e7630d2f4b7ac3126 (diff)
downloadarchiva-f640a09b4f9e9929fbae11be0ddab55c619c2d82.tar.gz
archiva-f640a09b4f9e9929fbae11be0ddab55c619c2d82.zip
[MRM-1241] Selenium Tests for Repository Scanning and Database
- adding test scripts for Database git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@887086 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/config/testng.xml1
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/DatabaseTest.java95
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java3
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/VirtualRepositoryTest.java1
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java2
5 files changed, 100 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 9eac33934..c107bda61 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
@@ -41,6 +41,7 @@ under the License.
<include name= "appearance" />
<include name= "findartifact" />
<include name= "legacysupport" />
+ <include name= "database" />
</run>
</groups>
<packages>
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/DatabaseTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/DatabaseTest.java
new file mode 100644
index 000000000..1734ad477
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/DatabaseTest.java
@@ -0,0 +1,95 @@
+package org.apache.archiva.web.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.web.test.parent.AbstractRepositoryTest;
+import org.testng.annotations.Test;
+
+@Test( groups = { "database" }, dependsOnMethods = { "testWithCorrectUsernamePassword" }, sequential = true )
+public class DatabaseTest
+ extends AbstractRepositoryTest
+{
+ public void testUpdateCron_NullValue()
+ {
+ goToDatabasePage();
+ setFieldValue( "database_cron" , "");
+ clickButtonWithValue( "Update Cron" );
+ assertTextPresent( "Invalid cron expression value(s)" );
+ assertTextPresent( "You must enter a cron expression." );
+ }
+
+ @Test (dependsOnMethods = { "testUpdateCron_NullValue" } )
+ public void testUpdateCron_InvalidValue()
+ {
+ setFieldValue( "database_cron" , "asdf" );
+ clickButtonWithValue( "Update Cron" );
+ assertTextPresent( "Invalid cron expression value(s)" );
+ }
+
+ @Test (dependsOnMethods = { "testUpdateCron_InvalidValue" } )
+ public void testUpdateCron_ValidValue()
+ {
+ setFieldValue( "database_cron" , "0 0 * * * ?" );
+ clickButtonWithValue( "Update Cron" );
+ assertPage( "Apache Archiva \\ Administration - Database" );
+ }
+
+ @Test (dependsOnMethods = { "testUpdateCron_ValidValue" } )
+ public void testUpdateConsumersUnprocessedArtifactsScanning_UnsetAll()
+ {
+ getSelenium().uncheck( "enabledUnprocessedConsumers" );
+ clickSubmitWithLocator( "//input[@id='database_0' and @value='Update Consumers']" );
+
+ assertPage( "Apache Archiva \\ Administration - Database" );
+ }
+
+ @Test (dependsOnMethods = { "testUpdateConsumersUnprocessedArtifactsScanning_UnsetAll" } )
+ public void testUpdateConsumersUnprocessedArtifactsScanning()
+ {
+ checkField( "enabledUnprocessedConsumers" );
+ clickSubmitWithLocator( "//input[@id='database_0' and @value='Update Consumers']" );
+ assertPage( "Apache Archiva \\ Administration - Database" );
+ }
+
+ @Test (dependsOnMethods = { "testUpdateConsumersUnprocessedArtifactsScanning" } )
+ public void testUpdateConsumersArtifactCleanupScanning_UnsetAll()
+ {
+ getSelenium().uncheck( "enabledCleanupConsumers" );
+ getSelenium().uncheck( "//input[@name='enabledCleanupConsumers' and @value='not-present-remove-db-project']" );
+ getSelenium().uncheck( "//input[@name='enabledCleanupConsumers' and @value='not-present-remove-indexed']" );
+ clickSubmitWithLocator( "//form[@id='database']/table/tbody/tr[5]/td/input" );
+ assertPage( "Apache Archiva \\ Administration - Database" );
+ }
+
+ @Test (dependsOnMethods = { "testUpdateConsumersArtifactCleanupScanning_UnsetAll" } )
+ public void testUpdateConsumersArtifactCleanupScanning()
+ {
+ checkField( "enabledCleanupConsumers" );
+ clickSubmitWithLocator( "//form[@id='database']/table/tbody/tr[5]/td/input" );
+ assertPage( "Apache Archiva \\ Administration - Database" );
+ }
+
+ @Test (dependsOnMethods = { "testUpdateConsumersArtifactCleanupScanning" } )
+ public void testUpdateDatabaseNow()
+ {
+ clickButtonWithValue( "Update Database Now" );
+ assertPage( "Apache Archiva \\ Administration - Database" );
+ }
+}
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 a6d2fd122..e23e6bf93 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
@@ -39,7 +39,8 @@ public class RepositoryTest
@Test(dependsOnMethods = { "testAddManagedRepoValidValues" } )
public void testAddManagedRepoInvalidValues()
- {
+ {
+ goToRepositoriesPage();
assertRepositoriesPage();
clickLinkWithLocator( "//div[@id='contentArea']/div/div/a[@href='/archiva/admin/addRepository.action']" );
addManagedRepository( "", "" , "" , "", "Maven 2.x Repository", "", "", "" );
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/VirtualRepositoryTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/VirtualRepositoryTest.java
index 7fc155b8a..081320fb8 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/VirtualRepositoryTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/VirtualRepositoryTest.java
@@ -52,6 +52,7 @@ public class VirtualRepositoryTest
@Test(dependsOnMethods = { "testAddRepositoryToRepositoryGroup" } )
public void testDeleteRepositoryOfRepositoryGroup()
{
+ goToRepositoryGroupsPage();
deleteRepositoryInRepositoryGroups();
assertTextPresent( "Repository Groups" );
assertTextNotPresent( "No Repository Groups Defined." );
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 cd651e967..b6237b8ef 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
@@ -340,7 +340,7 @@ public abstract class AbstractRepositoryTest
assertTextPresent( "Administration - Database" );
assertTextPresent( "Database - Unprocessed Artifacts Scanning" );
assertTextPresent( "Cron:" );
- assertElementPresent( "cron" );
+ assertElementPresent( "database_cron" );
assertButtonWithValuePresent( "Update Cron" );
assertButtonWithValuePresent( "Update Database Now" );
assertTextPresent( "Database - Unprocessed Artifacts Scanning" );