]> source.dussan.org Git - archiva.git/blob
1d2f7ad5f59c5fa61136badd4521c5e498b8987c
[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.AbstractArchivaTest;
23 import org.testng.Assert;
24 import org.testng.annotations.Test;
25
26 @Test( groups = { "appearance" }, dependsOnMethods = { "testWithCorrectUsernamePassword" }, sequential = true )
27 public class AppearanceTest
28     extends AbstractArchivaTest
29 {
30     public void testAddAppearanceEmptyValues()
31     {
32         goToAppearancePage();
33         clickLinkWithText( "Edit" );
34         addEditAppearance( "", "", "", false );
35         assertTextPresent( "You must enter a name" );
36     }
37
38     @Test( dependsOnMethods = { "testAddAppearanceEmptyValues" } )
39     public void testAddAppearanceInvalidValues()
40     {
41         goToAppearancePage();
42         clickLinkWithText( "Edit" );
43         addEditAppearance( "<>~+[ ]'\"", "/home/user/abcXYZ0129._/\\~:?!&=-<> ~+[ ]'\"",
44                            "/home/user/abcXYZ0129._/\\~:?!&=-<> ~+[ ]'\"", false );
45         assertTextPresent(
46             "Organisation name must only contain alphanumeric characters, white-spaces(' '), equals(=), question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-)." );
47         assertTextPresent( "You must enter a URL" );
48         assertTextPresent( "You must enter a URL for your logo" );
49     }
50
51     @Test( dependsOnMethods = { "testAddAppearanceInvalidValues" } )
52     public void testAddAppearanceInvalidOrganisationName()
53     {
54         goToAppearancePage();
55         clickLinkWithText( "Edit" );
56         addEditAppearance( "<>~+[ ]'\"", "http://www.apache.org/", "http://www.apache.org/images/asf_logo_wide.gifs",
57                            false );
58         assertTextPresent(
59             "Organisation name must only contain alphanumeric characters, white-spaces(' '), equals(=), question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-)." );
60     }
61
62     public void testAddAppearanceInvalidOrganisationUrl()
63     {
64         goToAppearancePage();
65         clickLinkWithText( "Edit" );
66         addEditAppearance( "The Apache Software Foundation", "/home/user/abcXYZ0129._/\\~:?!&=-<> ~+[ ]'\"",
67                            "http://www.apache.org/images/asf_logo_wide.gifs", false );
68         assertTextPresent( "You must enter a URL." );
69     }
70
71     @Test
72     public void testAddAppearanceInvalidOrganisationLogo()
73     {
74         goToAppearancePage();
75         clickLinkWithText( "Edit" );
76         addEditAppearance( "The Apache Software Foundation", "http://www.apache.org/",
77                            "/home/user/abcXYZ0129._/\\~:?!&=-<> ~+[ ]'\"", false );
78         assertTextPresent( "You must enter a URL for your logo." );
79     }
80
81     @Test(enabled = false)
82     public void testAddAppearanceValidValues()
83     {
84         goToAppearancePage();
85         clickLinkWithText( "Edit" );
86         // FIXME: not allowed this URL for the logo?!
87         addEditAppearance( "The Apache Software Foundation", "http://www.apache.org/",
88                            "http://www.apache.org/images/asf_logo_wide.gifs", true );
89         assertTextPresent( "The Apache Software Foundation" );
90     }
91
92     @Test( dependsOnMethods = { "testAddAppearanceValidValues" }, enabled = false)
93     public void testEditAppearance()
94     {
95         goToAppearancePage();
96
97         clickLinkWithText( "Edit" );
98         // FIXME: not allowed this URL for the logo?!
99         addEditAppearance( "Apache Software Foundation", "http://www.apache.org/",
100                            "http://www.apache.org/images/asf_logo_wide.gifs", true );
101         assertTextPresent( "Apache Software Foundation" );
102     }
103
104 }