1 package org.apache.archiva.web.test;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.archiva.web.test.parent.AbstractRepositoryTest;
23 import org.testng.annotations.Test;
24 import org.testng.Assert;
26 @Test( groups = { "reposcan" }, dependsOnMethods = { "testWithCorrectUsernamePassword" }, sequential = true )
27 public class RepositoryScanningTest
28 extends AbstractRepositoryTest
30 public void testAddArtifactFileType_NullValue()
32 goToRepositoryScanningPage();
33 clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" );
34 assertTextPresent( "Unable to process blank pattern." );
37 @Test (dependsOnMethods = { "testAddArtifactFileType_NullValue" } )
38 public void testAddArtifactFileType()
40 setFieldValue( "newpattern_0" , "**/*.dll" );
41 clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" );
42 Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[1]/table.13.0"), "**/*.dll" );
45 @Test (dependsOnMethods = { "testAddArtifactFileType" } )
46 public void testAddArtifactFileType_ExistingValue()
48 setFieldValue( "newpattern_0" , "**/*.zip" );
49 clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[15]/td[2]/a/img" );
50 Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.zip\" to filetype artifacts as it already exists." );
53 @Test (dependsOnMethods = { "testAddArtifactFileType_ExistingValue" } )
54 public void testDeleteArtifactFileType()
56 Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[1]/table.13.0"), "**/*.dll" );
57 clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" );
58 Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[1]/table.13.0"), "" );
61 @Test (dependsOnMethods = { "testDeleteArtifactFileType" } )
62 public void testAddAutoRemove_NullValue()
64 setFieldValue( "newpattern_1" , "" );
65 clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
66 assertTextPresent( "Unable to process blank pattern." );
69 @Test (dependsOnMethods = { "testAddAutoRemove_NullValue" } )
70 public void testAddAutoRemove_ExistingValue()
72 setFieldValue( "newpattern_1" , "**/*-" );
73 clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
74 Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*-\" to filetype auto-remove as it already exists." );
77 @Test (dependsOnMethods = { "testAddAutoRemove_ExistingValue" } )
78 public void testAddAutoRemove()
80 setFieldValue( "newpattern_1" , "**/*.test" );
81 clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
82 Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[2]/table.3.0"), "**/*.test" );
85 @Test (dependsOnMethods = { "testAddAutoRemove" } )
86 public void testDeleteAutoRemove()
88 Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[2]/table.3.0"), "**/*.test" );
89 clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
90 Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[2]/table.3.0"), "" );
93 @Test (dependsOnMethods = { "testDeleteAutoRemove" } )
94 public void testAddIgnoredArtifacts_NullValue()
96 setFieldValue( "newpattern_2" , "" );
97 clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
98 Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Unable to process blank pattern." );
101 @Test (dependsOnMethods = { "testAddIgnoredArtifacts_NullValue" } )
102 public void testAddIgnoredArtifacts_ExistingValue()
104 setFieldValue( "newpattern_2" , "**/*.sh" );
105 clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
106 Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.sh\" to filetype ignored as it already exists." );
109 @Test (dependsOnMethods = { "testAddIgnoredArtifacts_ExistingValue" } )
110 public void testAddIgnoredArtifacts()
112 setFieldValue( "newpattern_2" , "**/*.log" );
113 clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
114 Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[3]/table.6.0"), "**/*.log" );
117 @Test (dependsOnMethods = { "testAddIgnoredArtifacts" } )
118 public void testDeleteIgnoredArtifacts()
120 Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[3]/table.6.0"), "**/*.log" );
121 clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
122 Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[3]/table.6.0"), "" );
126 @Test (dependsOnMethods = { "testDeleteIgnoredArtifacts" } )
127 public void testAddIndexableContent_NullValue()
129 setFieldValue( "newpattern_3" , "" );
130 clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
131 Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Unable to process blank pattern." );
134 @Test (dependsOnMethods = { "testAddIndexableContent_NullValue" } )
135 public void testAddIndexableContent_ExistingValue()
137 setFieldValue( "newpattern_3" , "**/*.xml" );
138 clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
139 Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.xml\" to filetype indexable-content as it already exists." );
142 @Test (dependsOnMethods = { "testAddIndexableContent_ExistingValue" } )
143 public void testAddIndexableContent()
145 setFieldValue( "newpattern_3" , "**/*.html" );
146 clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
147 Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[4]/table.9.0"), "**/*.html" );
150 @Test (dependsOnMethods = { "testAddIndexableContent" } )
151 public void testDeleteIndexableContent()
153 Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[4]/table.9.0"), "**/*.html" );
154 clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
155 Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[4]/table.9.0"), "" );
158 @Test (dependsOnMethods = { "testDeleteIndexableContent" } )
159 public void testUpdateConsumers()
161 checkField( "enabledKnownContentConsumers" );
162 checkField( "//input[@name='enabledKnownContentConsumers' and @value='auto-rename']" );
163 clickButtonWithValue( "Update Consumers" );
164 assertPage( "Apache Archiva \\ Administration - Repository Scanning" );
167 @Test (dependsOnMethods = { "testUpdateConsumers" } )
168 public void testUpdateConsumers_UnsetAll()
170 getSelenium().uncheck( "enabledKnownContentConsumers" );
171 getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='auto-rename']" );
172 getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='create-missing-checksums']" );
173 getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='index-content']" );
174 getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='metadata-updater']" );
175 getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='repository-purge']" );
176 getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='update-db-artifact']" );
177 getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='validate-checksums']" );
178 clickButtonWithValue( "Update Consumers" );
180 assertPage( "Apache Archiva \\ Administration - Repository Scanning" );