]> source.dussan.org Git - archiva.git/blob
c4d5bcad92baae99c6505e6bbcd164db90d6bf7b
[archiva.git] /
1 package org.apache.archiva.web.test;
2
3 import org.apache.archiva.web.test.parent.AbstractRepositoryTest;
4 import org.testng.annotations.Test;
5
6 /*
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
14  *
15  *   http://www.apache.org/licenses/LICENSE-2.0
16  *
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
22  * under the License.
23  */
24
25 @Test( groups = { "reposcan" }, dependsOnMethods = { "testWithCorrectUsernamePassword" }, sequential = true )
26 public class RepositoryScanningTest 
27         extends AbstractRepositoryTest
28 {
29         public void testAddArtifactFileType_NullValue()
30         {
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." );
34         }
35         
36         @Test (dependsOnMethods = { "testAddArtifactFileType_NullValue" } )
37         public void testAddArtifactFileType()
38         {
39                 setFieldValue( "newpattern_0" , "**/*.dll" );
40                 clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" );
41                 assertTextPresent( "**/*.dll" );
42         }
43         
44         @Test (dependsOnMethods = { "testAddArtifactFileType" } )
45         public void testAddArtifactFileType_ExistingValue()
46         {
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." );
50         }
51         
52         @Test (dependsOnMethods = { "testAddArtifactFileType_ExistingValue" } )
53         public void testDeleteArtifactFileType()
54         {
55                 clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" );
56                 assertTextNotPresent( "dll" ); 
57         }
58         
59         @Test (dependsOnMethods = { "testDeleteArtifactFileType" } )
60         public void testAddAutoRemove_NullValue()
61         {
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." );
65         }
66         
67         @Test (dependsOnMethods = { "testAddAutoRemove_NullValue" } )
68         public void testAddAutoRemove_ExistingValue()
69         {
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." );
73         }
74         
75         @Test (dependsOnMethods = { "testAddAutoRemove_ExistingValue" } )
76         public void testAddAutoRemove()
77         {
78                 setFieldValue( "newpattern_1" , "**/*.test" );
79                 clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
80                 assertTextPresent( "**/*.test" );
81         }
82         
83         @Test (dependsOnMethods = { "testAddAutoRemove" } )
84         public void testDeleteAutoRemove()
85         {
86                 clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
87                 assertTextNotPresent( "test" );
88         }
89         
90         @Test (dependsOnMethods = { "testDeleteAutoRemove" } )
91         public void testAddIgnoredArtifacts_NullValue()
92         {
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." );
96         }
97         
98         @Test (dependsOnMethods = { "testAddIgnoredArtifacts_NullValue" } )
99         public void testAddIgnoredArtifacts_ExistingValue()
100         {
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." );
104         }
105         
106         @Test (dependsOnMethods = { "testAddIgnoredArtifacts_ExistingValue" } )
107         public void testAddIgnoredArtifacts()
108         {
109                 setFieldValue( "newpattern_2" , "**/*.log" );
110                 clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
111                 assertTextPresent( "**/*.log" );
112         }
113         
114         @Test (dependsOnMethods = { "testAddIgnoredArtifacts" } )
115         public void testDeleteIgnoredArtifacts()
116         {
117                 clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
118                 assertTextNotPresent( "log" );
119          }
120         
121         //
122         @Test (dependsOnMethods = { "testDeleteIgnoredArtifacts" } )
123         public void testAddIndexableContent_NullValue()
124         {
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." );
128         }
129         
130         @Test (dependsOnMethods = { "testAddIndexableContent_NullValue" } )
131         public void testAddIndexableContent_ExistingValue()
132         {
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." );
136         }
137         
138         @Test (dependsOnMethods = { "testAddIndexableContent_ExistingValue" } )
139         public void testAddIndexableContent()
140         {
141                 setFieldValue( "newpattern_3" , "**/*.html" );
142                 clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
143                 assertTextPresent( "**/*.html" );
144         }
145         
146         @Test (dependsOnMethods = { "testAddIndexableContent" } )
147         public void testDeleteIndexableContent()
148         {
149                 clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
150                 assertTextNotPresent( "html" );
151         }
152         
153         @Test (dependsOnMethods = { "testDeleteIndexableContent" } )
154         public void testUpdateConsumers()
155         {
156                 checkField( "enabledKnownContentConsumers" );
157                 checkField( "//input[@name='enabledKnownContentConsumers' and @value='auto-rename']" );
158                 clickButtonWithValue( "Update Consumers" );
159                 assertPage( "Apache Archiva \\ Administration - Repository Scanning" );
160         }
161         
162         @Test (dependsOnMethods = { "testUpdateConsumers" } )
163         public void testUpdateConsumers_UnsetAll()
164         {
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" );
174                 
175                 // remove the ff. 2 lines if MRM-1238 will be fixed. 
176                 getSelenium().goBack();
177                 waitPage();
178                 
179                 assertPage( "Apache Archiva \\ Administration - Repository Scanning" );
180         }
181         
182 }