]> source.dussan.org Git - archiva.git/blob
74480e810801a71c44fc851fcdf2753277b334d4
[archiva.git] /
1 package org.apache.archiva.web.test;
2
3 /*
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
11  *
12  *   http://www.apache.org/licenses/LICENSE-2.0
13  *
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
19  * under the License.
20  */
21
22 import org.apache.archiva.web.test.parent.AbstractRepositoryTest;
23 import org.testng.Assert;
24 import org.testng.annotations.Test;
25
26 @Test( groups = { "reposcan" }, dependsOnMethods = { "testWithCorrectUsernamePassword" }, sequential = true )
27 public class RepositoryScanningTest 
28         extends AbstractRepositoryTest
29 {
30         public void testAddArtifactFileType_NullValue()
31         {
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." );
35         }
36         
37         @Test (dependsOnMethods = { "testAddArtifactFileType_NullValue" } )
38         public void testAddArtifactFileType()
39         {
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" );
43         }
44         
45         @Test (dependsOnMethods = { "testAddArtifactFileType" } )
46         public void testAddArtifactFileType_ExistingValue()
47         {
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." );
51         }
52         
53         @Test (dependsOnMethods = { "testAddArtifactFileType_ExistingValue" } )
54         public void testDeleteArtifactFileType()
55         {
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"), "" );
59         }
60         
61         @Test (dependsOnMethods = { "testDeleteArtifactFileType" } )
62         public void testAddAutoRemove_NullValue()
63         {
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." );
67         }
68         
69         @Test (dependsOnMethods = { "testAddAutoRemove_NullValue" } )
70         public void testAddAutoRemove_ExistingValue()
71         {
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." );
75         }
76         
77         @Test (dependsOnMethods = { "testAddAutoRemove_ExistingValue" } )
78         public void testAddAutoRemove()
79         {
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" );
83         }
84         
85         @Test (dependsOnMethods = { "testAddAutoRemove" } )
86         public void testDeleteAutoRemove()
87         {
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"), "" );
91         }
92         
93         @Test (dependsOnMethods = { "testDeleteAutoRemove" } )
94         public void testAddIgnoredArtifacts_NullValue()
95         {
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." );
99         }
100         
101         @Test (dependsOnMethods = { "testAddIgnoredArtifacts_NullValue" } )
102         public void testAddIgnoredArtifacts_ExistingValue()
103         {
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." );
107         }
108         
109         @Test (dependsOnMethods = { "testAddIgnoredArtifacts_ExistingValue" } )
110         public void testAddIgnoredArtifacts()
111         {
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" );
115         }
116         
117         @Test (dependsOnMethods = { "testAddIgnoredArtifacts" } )
118         public void testDeleteIgnoredArtifacts()
119         {
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"), "" );
123          }
124         
125         //
126         @Test (dependsOnMethods = { "testDeleteIgnoredArtifacts" } )
127         public void testAddIndexableContent_NullValue()
128         {
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." );
132         }
133         
134         @Test (dependsOnMethods = { "testAddIndexableContent_NullValue" } )
135         public void testAddIndexableContent_ExistingValue()
136         {
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." );
140         }
141         
142         @Test (dependsOnMethods = { "testAddIndexableContent_ExistingValue" } )
143         public void testAddIndexableContent()
144         {
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" );
148         }
149         
150         @Test (dependsOnMethods = { "testAddIndexableContent" } )
151         public void testDeleteIndexableContent()
152         {
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"), "" );
156         }
157         
158         @Test (dependsOnMethods = { "testDeleteIndexableContent" } )
159         public void testUpdateConsumers()
160         {
161                 checkField( "enabledKnownContentConsumers" );
162                 checkField( "//input[@name='enabledKnownContentConsumers' and @value='auto-rename']" );
163                 clickButtonWithValue( "Update Consumers" );
164                 assertPage( "Apache Archiva \\ Administration - Repository Scanning" );
165         }
166         
167         @Test (dependsOnMethods = { "testUpdateConsumers" } )
168         public void testUpdateConsumers_UnsetAll()
169         {
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='validate-checksums']" );
177                 clickButtonWithValue( "Update Consumers" );
178                 
179                 assertPage( "Apache Archiva \\ Administration - Repository Scanning" );
180         }
181         
182 }