1 package org.apache.archiva.web.test;
3 import org.apache.archiva.web.test.parent.AbstractRepositoryTest;
4 import org.testng.annotations.Test;
7 * Licensed to the Apache Software Foundation (ASF) under one
8 * or more contributor license agreements. See the NOTICE file
9 * distributed with this work for additional information
10 * regarding copyright ownership. The ASF licenses this file
11 * to you under the Apache License, Version 2.0 (the
12 * "License"); you may not use this file except in compliance
13 * with the License. You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
17 * Unless required by applicable law or agreed to in writing,
18 * software distributed under the License is distributed on an
19 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20 * KIND, either express or implied. See the License for the
21 * specific language governing permissions and limitations
25 @Test( groups = { "reposcan" }, dependsOnMethods = { "testWithCorrectUsernamePassword" }, sequential = true )
26 public class RepositoryScanningTest
27 extends AbstractRepositoryTest
29 public void testAddArtifactFileType_NullValue()
31 goToRepositoryScanningPage();
32 clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" );
33 assertTextPresent( "Unable to process blank pattern." );
36 @Test (dependsOnMethods = { "testAddArtifactFileType_NullValue" } )
37 public void testAddArtifactFileType()
39 setFieldValue( "newpattern_0" , "**/*.dll" );
40 clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" );
41 assertTextPresent( "**/*.dll" );
44 @Test (dependsOnMethods = { "testAddArtifactFileType" } )
45 public void testAddArtifactFileType_ExistingValue()
47 setFieldValue( "newpattern_0" , "**/*.zip" );
48 clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[15]/td[2]/a/img" );
49 assertTextPresent( "Not adding pattern \"**/*.zip\" to filetype artifacts as it already exists." );
52 @Test (dependsOnMethods = { "testAddArtifactFileType_ExistingValue" } )
53 public void testDeleteArtifactFileType()
55 clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" );
56 assertTextNotPresent( "dll" );
59 @Test (dependsOnMethods = { "testDeleteArtifactFileType" } )
60 public void testAddAutoRemove_NullValue()
62 setFieldValue( "newpattern_1" , "" );
63 clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
64 assertTextPresent( "Unable to process blank pattern." );
67 @Test (dependsOnMethods = { "testAddAutoRemove_NullValue" } )
68 public void testAddAutoRemove_ExistingValue()
70 setFieldValue( "newpattern_1" , "**/*-" );
71 clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
72 assertTextPresent( "Not adding pattern \"**/*-\" to filetype auto-remove as it already exists." );
75 @Test (dependsOnMethods = { "testAddAutoRemove_ExistingValue" } )
76 public void testAddAutoRemove()
78 setFieldValue( "newpattern_1" , "**/*.test" );
79 clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
80 assertTextPresent( "**/*.test" );
83 @Test (dependsOnMethods = { "testAddAutoRemove" } )
84 public void testDeleteAutoRemove()
86 clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
87 assertTextNotPresent( "test" );
90 @Test (dependsOnMethods = { "testDeleteAutoRemove" } )
91 public void testAddIgnoredArtifacts_NullValue()
93 setFieldValue( "newpattern_2" , "" );
94 clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
95 assertTextPresent( "Unable to process blank pattern." );
98 @Test (dependsOnMethods = { "testAddIgnoredArtifacts_NullValue" } )
99 public void testAddIgnoredArtifacts_ExistingValue()
101 setFieldValue( "newpattern_2" , "**/*.sh" );
102 clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
103 assertTextPresent( "Not adding pattern \"**/*.sh\" to filetype ignored as it already exists." );
106 @Test (dependsOnMethods = { "testAddIgnoredArtifacts_ExistingValue" } )
107 public void testAddIgnoredArtifacts()
109 setFieldValue( "newpattern_2" , "**/*.log" );
110 clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
111 assertTextPresent( "**/*.log" );
114 @Test (dependsOnMethods = { "testAddIgnoredArtifacts" } )
115 public void testDeleteIgnoredArtifacts()
117 clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
118 assertTextNotPresent( "log" );
122 @Test (dependsOnMethods = { "testDeleteIgnoredArtifacts" } )
123 public void testAddIndexableContent_NullValue()
125 setFieldValue( "newpattern_3" , "" );
126 clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
127 assertTextPresent( "Unable to process blank pattern." );
130 @Test (dependsOnMethods = { "testAddIndexableContent_NullValue" } )
131 public void testAddIndexableContent_ExistingValue()
133 setFieldValue( "newpattern_3" , "**/*.xml" );
134 clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
135 assertTextPresent( "Not adding pattern \"**/*.xml\" to filetype indexable-content as it already exists." );
138 @Test (dependsOnMethods = { "testAddIndexableContent_ExistingValue" } )
139 public void testAddIndexableContent()
141 setFieldValue( "newpattern_3" , "**/*.html" );
142 clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
143 assertTextPresent( "**/*.html" );
146 @Test (dependsOnMethods = { "testAddIndexableContent" } )
147 public void testDeleteIndexableContent()
149 clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
150 assertTextNotPresent( "html" );
153 @Test (dependsOnMethods = { "testDeleteIndexableContent" } )
154 public void testUpdateConsumers()
156 checkField( "enabledKnownContentConsumers" );
157 checkField( "//input[@name='enabledKnownContentConsumers' and @value='auto-rename']" );
158 clickButtonWithValue( "Update Consumers" );
159 assertPage( "Apache Archiva \\ Administration - Repository Scanning" );
162 @Test (dependsOnMethods = { "testUpdateConsumers" } )
163 public void testUpdateConsumers_UnsetAll()
165 getSelenium().uncheck( "enabledKnownContentConsumers" );
166 getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='auto-rename']" );
167 getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='create-missing-checksums']" );
168 getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='index-content']" );
169 getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='metadata-updater']" );
170 getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='repository-purge']" );
171 getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='update-db-artifact']" );
172 getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='validate-checksums']" );
173 clickButtonWithValue( "Update Consumers" );
175 // remove the ff. 2 lines if MRM-1238 will be fixed.
176 getSelenium().goBack();
179 assertPage( "Apache Archiva \\ Administration - Repository Scanning" );