]> source.dussan.org Git - archiva.git/commitdiff
use more standard layout src/test/java for sources
authorOlivier Lamy <olamy@apache.org>
Wed, 29 Feb 2012 22:18:43 +0000 (22:18 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 29 Feb 2012 22:18:43 +0000 (22:18 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1295318 13f79535-47bb-0310-9956-ffa450edef68

30 files changed:
archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/ArchivaAdminTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/LoginTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/RolesManagementTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/UserManagementTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/XPathExpressionUtil.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractArtifactReportsTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractBrowseTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractMergingRepositoriesTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractSearchTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/resources/test.properties [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/LoginTest.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/RolesManagementTest.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/UserManagementTest.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/XPathExpressionUtil.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactReportsTest.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractBrowseTest.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractMergingRepositoriesTest.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java [deleted file]

index d774fe92bfb629385b69fa533c8ec7510981c160..dc2c0724fe0509233ce753937a97656c6d90da94 100644 (file)
   </dependencies>
 
   <build>
-    <testSourceDirectory>src/test/testng</testSourceDirectory>
     <testResources>
       <testResource>
         <directory>src/test/resources</directory>
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/ArchivaAdminTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/ArchivaAdminTest.java
new file mode 100644 (file)
index 0000000..721d8ba
--- /dev/null
@@ -0,0 +1,35 @@
+package org.apache.archiva.web.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.web.test.parent.AbstractArchivaTest;
+import org.testng.annotations.Test;
+
+public class ArchivaAdminTest
+    extends AbstractArchivaTest
+{
+
+    @Test( groups = { "about" }, alwaysRun = true )
+    public void testHome()
+    {
+        getSelenium().open( baseUrl );
+        assertPage( "Apache Archiva" );
+    }
+}
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/LoginTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/LoginTest.java
new file mode 100644 (file)
index 0000000..29ba5ef
--- /dev/null
@@ -0,0 +1,101 @@
+package org.apache.archiva.web.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.web.test.parent.AbstractArchivaTest;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+/**
+ * Based on LoginTest of Emmanuel Venisse test.
+ *
+ * @author José Morales Martínez
+ * @version $Id$
+ */
+
+@Test( groups = { "login" }, dependsOnGroups = { "about" } )
+public class LoginTest
+    extends AbstractArchivaTest
+{
+    @Test
+    public void testWithBadUsername()
+    {
+        goToLoginPage();
+        setFieldValue( "user-login-form-username", "badUsername" );
+        clickLinkWithLocator( "modal-login-ok", true );
+        assertTextPresent( "This field is required." );
+
+    }
+
+    @Test
+    public void testWithBadPassword()
+    {
+        goToLoginPage();
+        setFieldValue( "user-login-form-username", getProperty( "ADMIN_USERNAME" ) );
+        setFieldValue( "user-login-form-password", "badPassword" );
+        clickLinkWithLocator( "modal-login-ok", true );
+        assertTextPresent( "You have entered an incorrect username and/or password" );
+    }
+
+    @Test
+    public void testWithEmptyUsername()
+    {
+        goToLoginPage();
+        setFieldValue( "user-login-form-password", "password" );
+        clickLinkWithLocator( "modal-login-ok", true );
+        assertTextPresent( "This field is required." );
+    }
+
+    @Test( alwaysRun = true )
+    public void testWithEmptyPassword()
+    {
+        goToLoginPage();
+        setFieldValue( "user-login-form-username", getProperty( "ADMIN_USERNAME" ) );
+        clickLinkWithLocator( "modal-login-ok", true );
+        assertTextPresent( "This field is required." );
+    }
+
+    @Test
+    public void testWithCorrectUsernamePassword()
+    {
+        goToLoginPage();
+        setFieldValue( "user-login-form-username", getProperty( "ADMIN_USERNAME" ) );
+        setFieldValue( "user-login-form-password", getProperty( "ADMIN_PASSWORD" ) );
+        clickLinkWithLocator( "modal-login-ok", true );
+
+        assertUserLoggedIn( getProperty( "ADMIN_USERNAME" ) );
+    }
+
+    @BeforeTest
+    public void open()
+        throws Exception
+    {
+        super.open();
+    }
+
+    @Override
+    @AfterTest
+    public void close()
+        throws Exception
+    {
+        super.close();
+    }
+}
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/RolesManagementTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/RolesManagementTest.java
new file mode 100644 (file)
index 0000000..388eb5f
--- /dev/null
@@ -0,0 +1,48 @@
+package org.apache.archiva.web.test;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.web.test.parent.AbstractArchivaTest;
+import org.apache.commons.lang.StringUtils;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * @author Olivier Lamy
+ */
+@Test( groups = { "usermanagement" }, dependsOnGroups = "about" )
+public class RolesManagementTest
+    extends AbstractArchivaTest
+{
+    @Test
+    public void testReadRolesAndUpdateDescription()
+        throws Exception
+    {
+        login( getAdminUsername(), getAdminPassword() );
+        clickLinkWithLocator( "menu-roles-list-a", true );
+        assertTextPresent( "Archiva System Administrator " );
+        Assert.assertTrue( StringUtils.isEmpty( getText( "role-description-Guest" ) ) );
+        clickLinkWithLocator( "edit-role-Guest" );
+        String desc = "The guest description";
+        setFieldValue( "role-edit-description", desc );
+        clickButtonWithLocator( "role-edit-description-save" );
+        clickLinkWithLocator( "roles-view-tabs-a-roles-grid" );
+        Assert.assertTrue( StringUtils.equals( desc, getText( "role-description-Guest" ) ) );
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/UserManagementTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/UserManagementTest.java
new file mode 100644 (file)
index 0000000..3478c13
--- /dev/null
@@ -0,0 +1,41 @@
+package org.apache.archiva.web.test;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.web.test.parent.AbstractArchivaTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author Olivier Lamy
+ */
+@Test( groups = { "usermanagement" }, dependsOnGroups = { "about" } )
+public class UserManagementTest
+    extends AbstractArchivaTest
+{
+    public void testBasicAddDeleteUser()
+    {
+        username = getProperty( "GUEST_USERNAME" );
+        fullname = getProperty( "GUEST_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        deleteUser( username, fullname, getUserEmail() );
+        logout();
+        login( getAdminUsername(), getAdminPassword() );
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/XPathExpressionUtil.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/XPathExpressionUtil.java
new file mode 100644 (file)
index 0000000..5dd77ca
--- /dev/null
@@ -0,0 +1,242 @@
+package org.apache.archiva.web.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Utility class for creating xpath expressions
+ */
+public class XPathExpressionUtil
+{
+    public static final String CONTAINS = "contains";
+
+    public static final String AND = " and ";
+
+    public static final String CURRENT_NODE = "./";
+
+    public static final String PARENT_NODE = "../";
+
+    public static final String GRANDPARENT_NODE = "../../";
+
+    public static final String ELEMENT_ANY_LEVEL = "//";
+
+    public static final String TABLE_COLUMN = "td";
+
+    public static final String TABLE_ROW = "tr";
+
+    public static final String START_NODE_TEST = "[";
+
+    public static final String END_NODE_TEST = "]";
+
+    public static final String ANCHOR = "a";
+
+    public static final String IMG = "img";
+
+    public static final String LIST = "ul";
+
+    public static final String LINE = "li";
+
+    public static String getList( String[] values )
+    {
+        String xpathExpression = "";
+
+        if ( values.length > 0 )
+        {
+            xpathExpression += ELEMENT_ANY_LEVEL;
+            xpathExpression += LIST;
+            xpathExpression += START_NODE_TEST;
+
+            for ( int nIndex = 0; nIndex < values.length; nIndex++ )
+            {
+                xpathExpression += ( ( nIndex > 0 ) ? AND : "" );
+                xpathExpression += contains( LINE + position( nIndex + 1 ), values[nIndex] );
+            }
+
+            xpathExpression += END_NODE_TEST;
+        }
+
+        return xpathExpression;
+    }
+
+    /**
+     * expression for acquiring an element in one of the table columns
+     * 
+     * @param element the node element
+     * @param elementIndex column index of the element, used for skipping
+     * @param columnValues the values to be matched in each column, element column is included
+     * @return
+     */
+    public static String getColumnElement( String element, int elementIndex, String[] columnValues )
+    {
+        return getColumnElement( element, elementIndex, null, columnValues );
+    }
+
+    /**
+     * expression for acquiring an element in one of the table columns
+     * 
+     * @param element the node element
+     * @param elementIndex column index of the element, used for skipping
+     * @param elementValue the matched element value
+     * @param columnValues the values to be matched in each column, element column is included
+     * @return
+     */
+    public static String getColumnElement( String element, int elementIndex, String elementValue, String[] columnValues )
+    {
+        return getColumnElement( element, elementIndex, elementValue, "TEXT", columnValues );
+    }
+
+    /**
+     * expression for acquiring an element in one of the table columns
+     * 
+     * @param element the node element
+     * @param elementIndex column index of the element, used for skipping
+     * @param imageName the matched image name
+     * @param columnValues the values to be matched in each column, element column is included
+     * @return
+     */
+    public static String getImgColumnElement( String element, int elementIndex, String imageName, String[] columnValues )
+    {
+        return getColumnElement( element, elementIndex, imageName, IMG, columnValues );
+    }
+
+    /**
+     * expression for acquiring an element in one of the table columns
+     * 
+     * @param element the node element
+     * @param elementIndex column index of the element, used for skipping
+     * @param imageName the matched image name
+     * @param columnValues the values to be matched in each column, element column is included
+     * @return
+     */
+    private static String getColumnElement( String element, int elementIndex, String elementValue,
+                                            String elementValueType, String[] columnValues )
+    {
+        String xpathExpression = null;
+
+        if ( ( columnValues != null ) && ( columnValues.length > 0 ) )
+        {
+            xpathExpression = ELEMENT_ANY_LEVEL + element;
+            xpathExpression += START_NODE_TEST;
+
+            if ( elementValue != null )
+            {
+                if ( "TEXT".equals( elementValueType ) )
+                {
+                    xpathExpression += contains( elementValue );
+                    xpathExpression += ( columnValues.length > 0 ) ? AND : "";
+                }
+            }
+
+            // we are two levels below the table row element ( tr/td/<element> )
+            xpathExpression += matchColumns( GRANDPARENT_NODE, columnValues, elementIndex );
+
+            xpathExpression += END_NODE_TEST;
+        }
+
+        if ( IMG.equals( elementValueType ) )
+        {
+            xpathExpression += "/img[contains(@src, '" + elementValue + "')]";
+        }
+
+        return xpathExpression;
+    }
+
+    /**
+     * expression for acquiring the table row that matches all column values with the same order as the list
+     * 
+     * @param columnValues the matched list of columnValues
+     * @return
+     */
+    public static String getTableRow( String[] columnValues )
+    {
+        String xpathExpression = null;
+
+        if ( ( columnValues != null ) && ( columnValues.length > 0 ) )
+        {
+            xpathExpression = new String( ELEMENT_ANY_LEVEL + TABLE_ROW + START_NODE_TEST );
+            xpathExpression += matchColumns( columnValues );
+            xpathExpression += END_NODE_TEST;
+        }
+
+        return xpathExpression;
+    }
+
+    private static String matchColumns( String[] columnValues )
+    {
+        return matchColumns( columnValues, -1 );
+    }
+
+    private static String matchColumns( String[] columnValues, int skipIndex )
+    {
+        return matchColumns( null, columnValues, skipIndex );
+    }
+
+    private static String matchColumns( String parent, String[] columnValues, int skipIndex )
+    {
+        String xpathExpression = "";
+
+        for ( int nIndex = 0; nIndex < columnValues.length; nIndex++ )
+        {
+            if ( ( skipIndex != nIndex ) || ( skipIndex == -1 ) )
+            {
+                // prepend "and" if index > 0
+                xpathExpression += ( ( nIndex > 0 ) ? AND : "" );
+                xpathExpression += contains( parent, TABLE_COLUMN + position( nIndex + 1 ), columnValues[nIndex] );
+            }
+        }
+
+        return xpathExpression;
+    }
+
+    private static String position( int nIndex )
+    {
+        return new String( "[" + nIndex + "]" );
+    }
+
+    private static String contains( String parent, String element, String matchedString )
+    {
+        String finalElement = ( parent != null ) ? parent : "";
+        finalElement += element;
+
+        return contains( finalElement, matchedString );
+    }
+
+    private static String contains( String matchedString )
+    {
+        return contains( ".", matchedString );
+    }
+
+    private static String contains( String axis, String matchedString )
+    {
+        return new String( CONTAINS + "(" + axis + "," + "'" + matchedString + "')" );
+    }
+
+    private static String equals( String parent, String element, String matchedString )
+    {
+        String finalElement = ( parent != null ) ? parent : "";
+        finalElement += element;
+
+        return equals( finalElement, matchedString );
+    }
+
+    private static String equals( String axis, String matchedString )
+    {
+        return new String( axis + "==" + "'" + matchedString + "'" );
+    }
+}
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java
new file mode 100644 (file)
index 0000000..1cc89ed
--- /dev/null
@@ -0,0 +1,109 @@
+package org.apache.archiva.web.test.listener;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.thoughtworks.selenium.Selenium;
+import org.apache.archiva.web.test.parent.AbstractSeleniumTest;
+import org.apache.commons.io.FileUtils;
+import org.testng.ITestResult;
+import org.testng.TestListenerAdapter;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.regex.Pattern;
+
+public class CaptureScreenShotsListener
+    extends TestListenerAdapter
+{
+    @Override
+    public void onTestSkipped( ITestResult tr )
+    {
+        System.out.println( "Test " + tr.getName() + " -> Skipped" );
+        super.onTestSkipped( tr );
+    }
+
+    @Override
+    public void onTestFailure( ITestResult tr )
+    {
+        captureError( tr );
+        System.out.println( "Test " + tr.getName() + " -> Failed" );
+        super.onTestFailure( tr );
+    }
+
+    @Override
+    public void onTestSuccess( ITestResult tr )
+    {
+        System.out.println( "Test " + tr.getName() + " -> Success" );
+        super.onTestFailure( tr );
+    }
+
+    private void captureError( ITestResult tr )
+    {
+        SimpleDateFormat sdf = new SimpleDateFormat( "yyyy.MM.dd-HH_mm_ss" );
+        String time = sdf.format( new Date() );
+        File targetPath = new File( "target", "screenshots" );
+        StackTraceElement stackTrace[] = tr.getThrowable().getStackTrace();
+        String cName = tr.getTestClass().getName();
+        int index = getStackTraceIndexOfCallingClass( cName, stackTrace );
+        String methodName = stackTrace[index].getMethodName();
+        int lNumber = stackTrace[index].getLineNumber();
+        String lineNumber = Integer.toString( lNumber );
+        String className = cName.substring( cName.lastIndexOf( '.' ) + 1 );
+        targetPath.mkdirs();
+        Selenium selenium = AbstractSeleniumTest.getSelenium();
+        String fileBaseName = methodName + "_" + className + ".java_" + lineNumber + "-" + time;
+        try
+        {
+            selenium.windowMaximize();
+            File fileName = new File( targetPath, fileBaseName + ".png" );
+            selenium.captureEntirePageScreenshot( fileName.getAbsolutePath(), "background=#FFFFFF" );
+        }
+        catch ( RuntimeException e )
+        {
+            System.out.println( "Error when take screenshot for test " + tr.getName() + ": " + e.getMessage() );
+        }
+        try
+        {
+            File fileName = new File( targetPath, fileBaseName + ".html" );
+            FileUtils.writeStringToFile( fileName, selenium.getHtmlSource() );
+        }
+        catch ( IOException ioe )
+        {
+            System.out.println( ioe.getMessage() );
+        }
+    }
+
+    private int getStackTraceIndexOfCallingClass( String nameOfClass, StackTraceElement stackTrace[] )
+    {
+        boolean match = false;
+        int i = 0;
+        do
+        {
+            String className = stackTrace[i].getClassName();
+            match = Pattern.matches( nameOfClass, className );
+            i++;
+        }
+        while ( match == false );
+        i--;
+        return i;
+    }
+}
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
new file mode 100644 (file)
index 0000000..5cfc89a
--- /dev/null
@@ -0,0 +1,803 @@
+package org.apache.archiva.web.test.parent;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Optional;
+import org.testng.annotations.Parameters;
+
+import java.io.File;
+import java.io.IOException;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public abstract class AbstractArchivaTest
+    extends AbstractSeleniumTest
+{
+    protected String username;
+
+    protected String fullname;
+
+    @Override
+    @AfterTest
+    public void close()
+        throws Exception
+    {
+        super.close();
+    }
+
+    @Override
+    @BeforeSuite
+    public void open()
+        throws Exception
+    {
+        super.open();
+    }
+
+    public void assertAdminCreated()
+        throws Exception
+    {
+        initializeArchiva( System.getProperty( "baseUrl" ), System.getProperty( "browser" ),
+                           Integer.getInteger( "maxWaitTimeInMs" ), System.getProperty( "seleniumHost" ),
+                           Integer.getInteger( "seleniumPort" ) );
+    }
+
+    @BeforeTest
+    @Parameters( { "baseUrl", "browser", "maxWaitTimeInMs", "seleniumHost", "seleniumPort" } )
+    public void initializeArchiva( String baseUrl, String browser, int maxWaitTimeInMs,
+                                   @Optional( "localhost" ) String seleniumHost, @Optional( "4444" ) int seleniumPort )
+        throws Exception
+    {
+
+        super.open( baseUrl, browser, seleniumHost, seleniumPort, Integer.toString( maxWaitTimeInMs ) );
+
+        getSelenium().open( baseUrl );
+
+        waitPage();
+
+        // if not admin user created create one
+        if ( isElementVisible( "create-admin-link" ) )
+        {
+            Assert.assertFalse( getSelenium().isVisible( "login-link-a" ) );
+            Assert.assertFalse( getSelenium().isVisible( "register-link-a" ) );
+            clickLinkWithLocator( "create-admin-link-a", false );
+            assertCreateAdmin();
+            String fullname = getProperty( "ADMIN_FULLNAME" );
+            String username = getAdminUsername();
+            String mail = getProperty( "ADMIN_EMAIL" );
+            String password = getProperty( "ADMIN_PASSWORD" );
+            submitAdminData( fullname, mail, password );
+            assertUserLoggedIn( username );
+            clickLinkWithLocator( "logout-link-a" );
+        }
+        else
+        {
+            Assert.assertTrue( getSelenium().isVisible( "login-link-a" ) );
+            Assert.assertTrue( getSelenium().isVisible( "register-link-a" ) );
+            login( getAdminUsername(), getAdminPassword() );
+        }
+
+    }
+
+    protected static String getErrorMessageText()
+    {
+        return getSelenium().getText( "//ul[@class='errorMessage']/li/span" );
+    }
+
+    public String getUserEmail()
+    {
+        String email = getProperty( "USERROLE_EMAIL" );
+        return email;
+    }
+
+    public String getUserRolePassword()
+    {
+        String password = getProperty( "USERROLE_PASSWORD" );
+        return password;
+    }
+
+    public String getUserRoleNewPassword()
+    {
+        String password_new = getProperty( "NEW_USERROLE_PASSWORD" );
+        return password_new;
+    }
+
+    public String getBasedir()
+    {
+        String basedir = System.getProperty( "basedir" );
+
+        if ( basedir == null )
+        {
+            basedir = new File( "" ).getAbsolutePath();
+        }
+
+        return basedir;
+    }
+
+    public String getAdminUsername()
+    {
+        String adminUsername = getProperty( "ADMIN_USERNAME" );
+        return adminUsername;
+    }
+
+    public String getAdminPassword()
+    {
+        String adminPassword = getProperty( "ADMIN_PASSWORD" );
+        return adminPassword;
+    }
+
+    public void assertCreateAdmin()
+    {
+        assertElementPresent( "user-create" );
+        assertFieldValue( "admin", "username" );
+        assertElementPresent( "fullname" );
+        assertElementPresent( "password" );
+        assertElementPresent( "confirmPassword" );
+        assertElementPresent( "email" );
+    }
+
+    public void submitAdminData( String fullname, String email, String password )
+    {
+        setFieldValue( "fullname", fullname );
+        setFieldValue( "email", email );
+        setFieldValue( "password", password );
+        setFieldValue( "confirmPassword", password );
+        clickButtonWithLocator( "user-create-form-register-button" );
+        //submit();
+    }
+
+    // Go to Login Page
+    public void goToLoginPage()
+    {
+        getSelenium().open( baseUrl );
+        waitPage();
+        // are we already logged in ?
+        if ( isElementVisible( "logout-link" ) ) //isElementPresent( "logoutLink" ) )
+        {
+            // so logout
+            clickLinkWithLocator( "logout-link-a", false );
+            clickLinkWithLocator( "login-link-a" );
+        }
+        else if ( isElementVisible( "login-link-a" ) )
+        {
+            clickLinkWithLocator( "login-link-a" );
+        }
+        assertLoginModal();
+    }
+
+    public void submitUserData( String username, String password, boolean rememberme, boolean success )
+    {
+
+        setFieldValue( "username", username );
+        setFieldValue( "password", password );
+        if ( rememberme )
+        {
+            checkField( "rememberMe" );
+        }
+
+        submit();
+        if ( success )
+        {
+            assertUserLoggedIn( username );
+        }
+        else
+        {
+            assertLoginModal();
+        }
+    }
+
+    public void assertLoginModal()
+    {
+        assertElementPresent( "user-login-form" );
+        Assert.assertTrue( isElementVisible( "register-link" ) );
+        assertElementPresent( "user-login-form-username" );
+        assertElementPresent( "user-login-form-password" );
+        assertButtonWithIdPresent( "modal-login-ok" );
+    }
+
+    // User Management
+    public void goToUserManagementPage()
+    {
+        getSelenium().open( "/archiva/security/userlist.action" );
+        assertUserManagementPage();
+    }
+
+    public void assertUserManagementPage()
+    {
+        assertPage( "Apache Archiva \\ [Admin] User List" );
+        assertTextPresent( "[Admin] List of Users in Role: Any" );
+        assertTextPresent( "Navigation" );
+        assertImgWithAlt( "First" );
+        assertImgWithAlt( "Prev" );
+        assertImgWithAlt( "Next" );
+        assertImgWithAlt( "Last" );
+        assertTextPresent( "Display Rows" );
+        assertTextPresent( "Username" );
+        assertTextPresent( "Full Name" );
+        assertTextPresent( "Email" );
+        assertTextPresent( "Permanent" );
+        assertTextPresent( "Validated" );
+        assertTextPresent( "Locked" );
+        assertTextPresent( "Tasks" );
+        assertTextPresent( "Tools" );
+        assertTextPresent( "Tasks" );
+        assertTextPresent( "The following tools are available for administrators to manipulate the user list." );
+        assertButtonWithValuePresent( "Create New User" );
+        assertButtonWithValuePresent( "Show Users In Role" );
+        assertElementPresent( "roleName" );
+        assertTextPresent( "Reports" );
+        assertTextPresent( "Name" );
+        assertTextPresent( "Types" );
+        assertTextPresent( "User List" );
+        assertTextPresent( "Roles Matrix" );
+    }
+
+    /*
+     * //User Role public void goToUserRolesPage() { clickLinkWithText( "User Roles" ); assertUserRolesPage(); }
+     */
+
+    public void assertUserRolesPage()
+    {
+        //assertPage( "Apache Archiva \\ [Admin] User Edit" );
+        //[Admin] Rôles de l'utilisateur
+
+        assertTextPresent( "[Admin] User Roles", "[Admin] R\u00F4les de l'utilisateur" );
+        assertTextPresent( "Username", "Nom d'utilisateur" );
+        assertTextPresent( "Full Name", "Nom complet" );
+        String userRoles =
+            "Guest,Registered User,System Administrator,User Administrator,Global Repository Observer,Global Repository Manager,Repository Observer,Repository Manager,internal";
+        String[] arrayRole = userRoles.split( "," );
+        for ( String userroles : arrayRole )
+        {
+            assertTextPresent( userroles );
+        }
+    }
+
+    public void assertDeleteUserPage( String username )
+    {
+        assertTextPresent( "[Admin] User Delete", "[Admin] Suppression de l'utilisateur",
+                           "L'utilisateur suivant va \u00EAtre supprim\u00E9:" );
+        assertTextPresent( "The following user will be deleted:" );
+        assertTextPresent( "Username: " + username, "Nom d'utilisateur:" + username );
+        assertButtonWithIdPresent( "userDeleteSubmit" );
+    }
+
+    public void createUser( String userName, String fullName, String email, String password, boolean valid )
+    {
+        createUser( userName, fullName, email, password, password, valid );
+    }
+
+    private void createUser( String userName, String fullName, String emailAd, String password, String confirmPassword,
+                             boolean valid )
+    {
+
+        clickLinkWithLocator( "menu-users-list-a", true );
+        clickLinkWithLocator( "users-view-tabs-li-user-edit-a", true );
+
+        assertCreateUserPage();
+        setFieldValue( "username", userName );
+        setFieldValue( "fullname", fullName );
+        setFieldValue( "email", emailAd );
+        setFieldValue( "password", password );
+        setFieldValue( "confirmPassword", confirmPassword );
+
+        clickLinkWithLocator( "user-create-form-register-button", true );
+
+        assertTextPresent( "User " + userName + " created." );
+        assertElementPresent( "users-grid-user-id-" + userName );
+
+        if ( valid )
+        {
+            //String[] columnValues = { userName, fullName, emailAd };
+            //assertElementPresent( XPathExpressionUtil.getTableRow( columnValues ) );
+
+        }
+        else
+        {
+            assertCreateUserPage();
+        }
+    }
+
+    public void deleteUser( String userName, String fullName, String emailAdd )
+    {
+        deleteUser( userName, fullName, emailAdd, false, false );
+    }
+
+    public void deleteUser( String userName, String fullName, String emailAd, boolean validated, boolean locked )
+    {
+        clickLinkWithLocator( "menu-users-list-a", true );
+        assertTextPresent( userName );
+        assertTextPresent( fullName );
+
+        clickLinkWithLocator( "users-grid-delete-" + userName );
+
+        clickLinkWithLocator( "dialog-confirm-modal-ok" );
+        assertTextPresent( "User " + userName + " deleted." );
+
+        clickLinkWithLocator( "alert-message-success-close-a" );
+
+        assertElementNotPresent( "users-grid-user-id-" + userName );
+        assertTextNotPresent( fullName );
+
+
+    }
+
+    public void login( String username, String password )
+    {
+        login( username, password, true, "Login Page" );
+    }
+
+    public void login( String username, String password, boolean valid, String assertReturnPage )
+    {
+        if ( isElementVisible( "login-link-a" ) )//isElementPresent( "loginLink" ) )
+        {
+            goToLoginPage();
+
+            submitLoginPage( username, password, false, valid, assertReturnPage );
+        }
+        if ( valid )
+        {
+            assertUserLoggedIn( username );
+        }
+    }
+
+    public void submitLoginPage( String username, String password )
+    {
+        submitLoginPage( username, password, false, true, "Login Page" );
+    }
+
+    public void submitLoginPage( String username, String password, boolean validUsernamePassword )
+    {
+        submitLoginPage( username, password, false, validUsernamePassword, "Login Page" );
+    }
+
+    public void submitLoginPage( String username, String password, boolean rememberMe, boolean validUsernamePassword,
+                                 String assertReturnPage )
+    {
+        clickLinkWithLocator( "login-link-a", false );
+        setFieldValue( "user-login-form-username", username );
+        setFieldValue( "user-login-form-password", password );
+        /*
+        if ( rememberMe )
+        {
+            checkField( "rememberMe" );
+        }*/
+
+        clickButtonWithLocator( "modal-login-ok" );
+        if ( validUsernamePassword )
+        {
+            assertUserLoggedIn( username );
+        }
+        /*
+        else
+        {
+            if ( "Login Page".equals( assertReturnPage ) )
+            {
+                assertLoginPage();
+            }
+            else
+            {
+                assertPage( assertReturnPage );
+            }
+        }*/
+    }
+
+    protected void assertUserLoggedIn( String username )
+    {
+        Assert.assertFalse( isElementVisible( "login-link" ) );
+        Assert.assertTrue( isElementVisible( "logout-link" ) );
+        Assert.assertFalse( isElementVisible( "register-link" ) );
+        Assert.assertFalse( isElementVisible( "create-admin-link" ) );
+    }
+
+    // User Roles
+    public void assertUserRoleCheckBoxPresent( String value )
+    {
+        getSelenium().isElementPresent(
+            "xpath=//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='" + value
+                + "']" );
+    }
+
+    public void assertResourceRolesCheckBoxPresent( String value )
+    {
+        getSelenium().isElementPresent( "xpath=//input[@name='addDSelectedRoles' and @value='" + value + "']" );
+    }
+
+    public void checkUserRoleWithValue( String value )
+    {
+        assertUserRoleCheckBoxPresent( value );
+        getSelenium().click(
+            "xpath=//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='" + value
+                + "']" );
+    }
+
+    public void checkResourceRoleWithValue( String value )
+    {
+        assertResourceRolesCheckBoxPresent( value );
+        getSelenium().click( "xpath=//input[@name='addDSelectedRoles' and @value='" + value + "']" );
+    }
+
+    public void changePassword( String oldPassword, String newPassword )
+    {
+        assertPage( "Apache Archiva \\ Change Password" );
+        setFieldValue( "existingPassword", oldPassword );
+        setFieldValue( "newPassword", newPassword );
+        setFieldValue( "newPasswordConfirm", newPassword );
+        clickButtonWithValue( "Change Password" );
+    }
+
+    public void assertCreateUserPage()
+    {
+        assertTextPresent( "Username" );
+        assertElementPresent( "username" );
+        assertTextPresent( "Full Name" );
+        assertElementPresent( "fullname" );
+        assertTextPresent( "Email Address" );
+        assertElementPresent( "email" );
+        assertTextPresent( "Password" );
+        assertElementPresent( "password" );
+        assertTextPresent( "Confirm Password" );
+        assertElementPresent( "confirmPassword" );
+        assertButtonWithIdPresent( "user-create-form-register-button" );
+
+    }
+
+    public void assertLeftNavMenuWithRole( String role )
+    {
+        if ( role.equals( "Guest" ) || role.equals( "Registered User" ) || role.equals( "Global Repository Observer" )
+            || role.equals( "Repository Observer - internal" ) || role.equals( "Repository Observer - snapshots" ) )
+        {
+            assertTextPresent( "Search" );
+            assertLinkPresent( "Find Artifact" );
+            assertLinkPresent( "Browse" );
+            assertLinkNotPresent( "Repositories" );
+        }
+        else if ( role.equals( "User Administrator" ) )
+        {
+            assertTextPresent( "Search" );
+            assertLinkPresent( "Find Artifact" );
+            assertLinkPresent( "Browse" );
+            assertLinkPresent( "User Management" );
+            assertLinkPresent( "User Roles" );
+            assertLinkNotPresent( "Repositories" );
+        }
+        else if ( role.equals( "Global Repository Manager" ) || role.equals( "Repository Manager - internal" )
+            || role.equals( "Repository Manager - snapshots" ) )
+        {
+            assertTextPresent( "Search" );
+            assertLinkPresent( "Find Artifact" );
+            assertLinkPresent( "Browse" );
+            assertLinkPresent( "Upload Artifact" );
+            assertLinkPresent( "Delete Artifact" );
+            assertLinkNotPresent( "Repositories" );
+        }
+        else
+        {
+            assertTextPresent( "Search" );
+            String navMenu =
+                "Find Artifact,Browse,Reports,User Management,User Roles,Appearance,Upload Artifact,Delete Artifact,Repository Groups,Repositories,Proxy Connectors,Legacy Support,Network Proxies,Repository Scanning";
+            String[] arrayMenu = navMenu.split( "," );
+            for ( String navmenu : arrayMenu )
+            {
+                assertLinkPresent( navmenu );
+            }
+        }
+    }
+
+    // Find Artifact
+    public void goToFindArtifactPage()
+    {
+        getSelenium().open( "/archiva/findArtifact.action" );
+        assertFindArtifactPage();
+    }
+
+    public void assertFindArtifactPage()
+    {
+        //assertPage( "Apache Archiva \\ Find Artifact" );
+        assertElementPresent( "searchBox" );
+        //assertTextPresent( "Find Artifact" );
+        //assertTextPresent( "Search for:" );
+        //assertTextPresent( "Checksum:" );
+        assertElementPresent( "quickSearchBox" );
+        assertElementPresent( "checksumSearch" );
+        //assertButtonWithValuePresent( "Search" );
+        assertElementPresent( "checksumSearch_0" );
+    }
+
+    // Appearance
+    public void goToAppearancePage()
+    {
+        getSelenium().open( "/archiva/admin/configureAppearance.action" );
+        assertAppearancePage();
+    }
+
+    public void assertAppearancePage()
+    {
+        assertPage( "Apache Archiva \\ Configure Appearance" );
+        String appearance =
+            "Appearance,Organization Details,The logo in the top right of the screen is controlled by the following settings.,Organization Information,Name,URL,Logo URL";
+        String[] arrayAppearance = appearance.split( "," );
+        for ( String appear : arrayAppearance )
+        {
+            assertTextPresent( appear );
+        }
+        assertLinkPresent( "Edit" );
+        assertLinkPresent( "Change your appearance" );
+    }
+
+    public void addEditAppearance( String name, String url, String logoUrl, boolean wait )
+    {
+        setFieldValue( "organisationName", name );
+        setFieldValue( "organisationUrl", url );
+        setFieldValue( "organisationLogo", logoUrl );
+        clickButtonWithValue( "Save", wait );
+    }
+
+    public void goToHomePage()
+    {
+        getSelenium().open( baseUrl );
+    }
+
+    // Upload Artifact
+    public void goToAddArtifactPage()
+    {
+        // must be logged as admin
+        getSelenium().open( "/archiva/upload.action" );
+        assertAddArtifactPage();
+    }
+
+    public void assertAddArtifactPage()
+    {
+        assertPage( "Apache Archiva \\ Upload Artifact" );
+        assertTextPresent( "Upload Artifact" );
+
+        String artifact =
+            "Upload Artifact,Group Id*:,Artifact Id*:,Version*:,Packaging*:,Classifier:,Generate Maven 2 POM,Artifact File*:,POM File:,Repository Id:";
+        String[] arrayArtifact = artifact.split( "," );
+        for ( String arrayartifact : arrayArtifact )
+        {
+            assertTextPresent( arrayartifact );
+        }
+
+        String artifactElements =
+            "upload_groupId,upload_artifactId,upload_version,upload_packaging,upload_classifier,upload_generatePom,upload_artifact,upload_pom,upload_repositoryId,uploadSubmit";
+        String[] arrayArtifactElements = artifactElements.split( "," );
+        for ( String artifactelements : arrayArtifactElements )
+        {
+            assertElementPresent( artifactelements );
+        }
+    }
+
+    public void addArtifact( String groupId, String artifactId, String version, String packaging,
+                             String artifactFilePath, String repositoryId, boolean wait )
+    {
+        addArtifact( groupId, artifactId, version, packaging, true, artifactFilePath, repositoryId, wait );
+    }
+
+    public void addArtifact( String groupId, String artifactId, String version, String packaging, boolean generatePom,
+                             String artifactFilePath, String repositoryId, boolean wait )
+    {
+        login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) );
+        goToAddArtifactPage();
+        setFieldValue( "groupId", groupId );
+        setFieldValue( "artifactId", artifactId );
+        setFieldValue( "version", version );
+        setFieldValue( "packaging", packaging );
+
+        if ( generatePom )
+        {
+            checkField( "generatePom" );
+        }
+
+        String path;
+        if ( artifactFilePath != null && artifactFilePath.trim().length() > 0 )
+        {
+            File f = new File( artifactFilePath );
+            try
+            {
+                path = f.getCanonicalPath();
+            }
+            catch ( IOException e )
+            {
+                path = f.getAbsolutePath();
+            }
+        }
+        else
+        {
+            path = artifactFilePath;
+        }
+
+        setFieldValue( "artifact", path );
+        selectValue( "upload_repositoryId", repositoryId );
+
+        //clickButtonWithValue( "Submit" );
+        clickButtonWithLocator( "uploadSubmit", wait );
+    }
+
+    public void goToRepositoriesPage()
+    {
+        if ( !getTitle().equals( "Apache Archiva \\ Administration - Repositories" ) )
+        {
+            getSelenium().open( "/archiva/admin/repositories.action" );
+        }
+        assertRepositoriesPage();
+    }
+
+    public void assertRepositoriesPage()
+    {
+        assertPage( "Apache Archiva \\ Administration - Repositories" );
+        assertTextPresent( "Administration - Repositories" );
+        assertTextPresent( "Managed Repositories" );
+        assertTextPresent( "Remote Repositories" );
+    }
+
+    public void addManagedRepository( String identifier, String name, String directory, String indexDirectory,
+                                      String type, String cron, String daysOlder, String retentionCount, boolean wait )
+    {
+        // goToRepositoriesPage();
+        // clickLinkWithText( "Add" );
+        setFieldValue( "repository.id", identifier );
+        setFieldValue( "repository.name", name );
+        setFieldValue( "repository.location", directory );
+        setFieldValue( "repository.indexDirectory", indexDirectory );
+        selectValue( "repository.layout", type );
+        setFieldValue( "repository.cronExpression", cron );
+        setFieldValue( "repository.daysOlder", daysOlder );
+        setFieldValue( "repository.retentionCount", retentionCount );
+        // TODO
+        clickButtonWithValue( "Add Repository", wait );
+    }
+
+    // artifact management
+    public void assertDeleteArtifactPage()
+    {
+        assertPage( "Apache Archiva \\ Delete Artifact" );
+        assertTextPresent( "Delete Artifact" );
+        assertTextPresent( "Group Id*:" );
+        assertTextPresent( "Artifact Id*:" );
+        assertTextPresent( "Version*:" );
+        assertTextPresent( "Repository Id:" );
+        assertElementPresent( "groupId" );
+        assertElementPresent( "artifactId" );
+        assertElementPresent( "version" );
+        assertElementPresent( "repositoryId" );
+        assertButtonWithValuePresent( "Submit" );
+    }
+
+    // network proxies
+    public void goToNetworkProxiesPage()
+    {
+        clickLinkWithText( "Network Proxies" );
+        assertNetworkProxiesPage();
+    }
+
+    public void assertNetworkProxiesPage()
+    {
+        assertPage( "Apache Archiva \\ Administration - Network Proxies" );
+        assertTextPresent( "Administration - Network Proxies" );
+        assertTextPresent( "Network Proxies" );
+        assertLinkPresent( "Add Network Proxy" );
+    }
+
+    public void addNetworkProxy( String identifier, String protocol, String hostname, String port, String username,
+                                 String password )
+    {
+        //goToNetworkProxiesPage();
+        clickLinkWithText( "Add Network Proxy" );
+        assertAddNetworkProxy();
+        setFieldValue( "proxy.id", identifier );
+        setFieldValue( "proxy.protocol", protocol );
+        setFieldValue( "proxy.host", hostname );
+        setFieldValue( "proxy.port", port );
+        setFieldValue( "proxy.username", username );
+        setFieldValue( "proxy.password", password );
+        clickButtonWithValue( "Save Network Proxy" );
+    }
+
+    public void assertAddNetworkProxy()
+    {
+        assertPage( "Apache Archiva \\ Admin: Add Network Proxy" );
+        assertTextPresent( "Admin: Add Network Proxy" );
+        assertTextPresent( "Add network proxy:" );
+        assertTextPresent( "Identifier*:" );
+        assertTextPresent( "Protocol*:" );
+        assertTextPresent( "Hostname*:" );
+        assertTextPresent( "Port*:" );
+        assertTextPresent( "Username:" );
+        assertTextPresent( "Password:" );
+        assertButtonWithValuePresent( "Save Network Proxy" );
+    }
+
+    // Legacy Support
+    public void goToLegacySupportPage()
+    {
+        getSelenium().open( "/archiva/admin/legacyArtifactPath.action" );
+        assertLegacySupportPage();
+    }
+
+    public void assertLegacySupportPage()
+    {
+        assertPage( "Apache Archiva \\ Administration - Legacy Support" );
+        assertTextPresent( "Administration - Legacy Artifact Path Resolution" );
+        assertTextPresent( "Path Mappings" );
+        assertLinkPresent( "Add" );
+    }
+
+    public void addLegacyArtifactPath( String path, String groupId, String artifactId, String version,
+                                       String classifier, String type, boolean wait )
+    {
+        assertAddLegacyArtifactPathPage();
+        setFieldValue( "legacyArtifactPath.path", path );
+        setFieldValue( "groupId", groupId );
+        setFieldValue( "artifactId", artifactId );
+        setFieldValue( "version", version );
+        setFieldValue( "classifier", classifier );
+        setFieldValue( "type", type );
+        clickButtonWithValue( "Add Legacy Artifact Path", wait );
+    }
+
+    public void assertAddLegacyArtifactPathPage()
+    {
+        assertPage( "Apache Archiva \\ Admin: Add Legacy Artifact Path" );
+        assertTextPresent( "Admin: Add Legacy Artifact Path" );
+        assertTextPresent(
+            "Enter the legacy path to map to a particular artifact reference, then adjust the fields as necessary." );
+        String element =
+            "addLegacyArtifactPath_legacyArtifactPath_path,addLegacyArtifactPath_groupId,addLegacyArtifactPath_artifactId,addLegacyArtifactPath_version,addLegacyArtifactPath_classifier,addLegacyArtifactPath_type";
+        String[] arrayElement = element.split( "," );
+        for ( String arrayelement : arrayElement )
+        {
+            assertElementPresent( arrayelement );
+        }
+        assertButtonWithValuePresent( "Add Legacy Artifact Path" );
+    }
+
+    // add managed repository and its staging repository
+    public void addStagingRepository( String identifier, String name, String directory, String indexDirectory,
+                                      String type, String cron, String daysOlder, String retentionCount )
+    {
+        setFieldValue( "repository.id", identifier );
+        setFieldValue( "repository.name", name );
+        setFieldValue( "repository.location", directory );
+        setFieldValue( "repository.indexDirectory", indexDirectory );
+        selectValue( "repository.layout", type );
+        setFieldValue( "repository.cronExpression", cron );
+        setFieldValue( "repository.daysOlder", daysOlder );
+        setFieldValue( "repository.retentionCount", retentionCount );
+        checkField( "stageNeeded" );
+
+        clickButtonWithValue( "Add Repository" );
+    }
+
+    protected void logout()
+    {
+        clickLinkWithText( "Logout" );
+        assertTextNotPresent( "Current User:" );
+        assertLinkNotVisible( "Edit Details" );
+        assertLinkNotVisible( "Logout" );
+        assertLinkVisible( "Login" );
+    }
+
+    protected String getAdminUserName()
+    {
+        return getProperty( "ADMIN_FULLNAME" );
+    }
+}
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java
new file mode 100644 (file)
index 0000000..5869a06
--- /dev/null
@@ -0,0 +1,82 @@
+package org.apache.archiva.web.test.parent;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public abstract class AbstractArtifactManagementTest
+    extends AbstractArchivaTest
+{
+
+    public String getGroupId()
+    {
+        String groupId = getProperty( "GROUPID" );
+        return groupId;
+    }
+
+    public String getArtifactId()
+    {
+        String artifactId = getProperty( "ARTIFACTID" );
+        return artifactId;
+    }
+
+    public String getVersion()
+    {
+        String version = getProperty( "VERSION" );
+        return version;
+    }
+
+    public String getPackaging()
+    {
+        String packaging = getProperty( "PACKAGING" );
+        return packaging;
+    }
+
+    public String getArtifactFilePath()
+    {
+        return "src/test/resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar";
+    }
+
+    public String getRepositoryId()
+    {
+        String repositoryId = getProperty( "REPOSITORYID" );
+        return repositoryId;
+    }
+
+    public void goToDeleteArtifactPage()
+    {
+        login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) );
+        getSelenium().open( "/archiva/deleteArtifact.action" );
+        assertDeleteArtifactPage();
+    }
+
+    public void deleteArtifact( String groupId, String artifactId, String version, String repositoryId )
+    {
+        deleteArtifact( groupId, artifactId, version, repositoryId, false );
+    }
+
+    public void deleteArtifact( String groupId, String artifactId, String version, String repositoryId, boolean wait )
+    {
+        goToDeleteArtifactPage();
+        setFieldValue( "groupId", groupId );
+        setFieldValue( "artifactId", artifactId );
+        setFieldValue( "version", version );
+        selectValue( "repositoryId", repositoryId );
+        clickButtonWithValue( "Submit", wait );
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractArtifactReportsTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractArtifactReportsTest.java
new file mode 100644 (file)
index 0000000..e026f78
--- /dev/null
@@ -0,0 +1,80 @@
+package org.apache.archiva.web.test.parent;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public abstract class AbstractArtifactReportsTest
+    extends AbstractArchivaTest
+{
+
+    // Reports
+    public void goToReportsPage()
+    {
+        getSelenium().open( "/archiva/report/pickReport.action" );
+        assertReportsPage();
+    }
+
+    public void assertReportsPage()
+    {
+        assertPage( "Apache Archiva \\ Reports" );
+        assertTextPresent( "Reports" );
+        assertTextPresent( "Repository Statistics" );
+        assertTextPresent( "Repositories To Be Compared" );
+        assertElementPresent( "availableRepositories" );
+        assertButtonWithValuePresent( "v" );
+        assertButtonWithValuePresent( "^" );
+        assertButtonWithValuePresent( "<-" );
+        assertButtonWithValuePresent( "->" );
+        assertButtonWithValuePresent( "<<--" );
+        assertButtonWithValuePresent( "-->>" );
+        assertButtonWithValuePresent( "<*>" );
+        assertElementPresent( "selectedRepositories" );
+        assertButtonWithValuePresent( "v" );
+        assertButtonWithValuePresent( "^" );
+        assertTextPresent( "Row Count" );
+        assertElementPresent( "rowCount" );
+        assertTextPresent( "Start Date" );
+        assertElementPresent( "startDate" );
+        assertTextPresent( "End Date" );
+        assertElementPresent( "endDate" );
+        assertButtonWithValuePresent( "View Statistics" );
+        assertTextPresent( "Repository Health" );
+        assertTextPresent( "Row Count" );
+        assertElementPresent( "rowCount" );
+        assertTextPresent( "Group ID" );
+        assertElementPresent( "groupId" );
+        assertTextPresent( "Repository ID" );
+        assertElementPresent( "repositoryId" );
+        assertButtonWithValuePresent( "Show Report" );
+    }
+
+    public void compareRepositories( String labelSelected, String startDate, String endDate )
+    {
+        goToReportsPage();
+        getSelenium().removeSelection( "generateStatisticsReport_availableRepositories", labelSelected );
+        clickButtonWithValue( "->", false );
+        getSelenium().type( "startDate", startDate );
+        // clickLinkWithLocator( "1" , false );
+        // getSelenium().click( "endDate" );
+        getSelenium().type( "endDate", endDate );
+        // clickLinkWithLocator( "30" , false );
+        clickButtonWithValue( "View Statistics" );
+    }
+
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractBrowseTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractBrowseTest.java
new file mode 100644 (file)
index 0000000..2b4fc11
--- /dev/null
@@ -0,0 +1,40 @@
+package org.apache.archiva.web.test.parent;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public abstract class AbstractBrowseTest
+    extends AbstractArchivaTest
+{
+
+    // Browse
+    public void goToBrowsePage()
+    {
+        getSelenium().open( "/archiva/browse" );
+        assertBrowsePage();
+    }
+
+    public void assertBrowsePage()
+    {
+        assertPage( "Apache Archiva \\ Browse Repository" );
+        assertTextPresent( "Browse Repository" );
+        assertTextPresent( "Groups" );
+    }
+
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractMergingRepositoriesTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractMergingRepositoriesTest.java
new file mode 100644 (file)
index 0000000..91af2cf
--- /dev/null
@@ -0,0 +1,74 @@
+package org.apache.archiva.web.test.parent;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+
+public class AbstractMergingRepositoriesTest
+    extends AbstractArchivaTest
+{
+
+    public void goToAuditLogReports()
+    {
+        getSelenium().open( "/archiva/report/queryAuditLogReport.action" );
+    }
+
+    public String getRepositoryDir()
+    {
+        File f = new File( "" );
+        String artifactFilePath = f.getAbsolutePath();
+        return artifactFilePath + "/target/";
+    }
+
+    public void editManagedRepository()
+    {
+        goToRepositoriesPage();
+        clickLinkWithXPath( "//div[@id='contentArea']/div/div[5]/div[1]/a[1]/img" );
+        assertPage( "Apache Archiva \\ Admin: Edit Managed Repository" );
+        checkField( "repository.blockRedeployments" );
+        clickButtonWithValue( "Update Repository" );
+    }
+
+    public String getGroupId()
+    {
+        return getProperty( "VALIDARTIFACT_GROUPID" );
+    }
+
+    public String getArtifactId()
+    {
+        return getProperty( "VALIDARTIFACT_ARTIFACTID" );
+    }
+
+    public String getVersion()
+    {
+        return getProperty( "VERSION" );
+    }
+
+    public String getPackaging()
+    {
+        return getProperty( "PACKAGING" );
+    }
+
+    public String getValidArtifactFilePath()
+    {
+        return "src/test/resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar";
+    }
+
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java
new file mode 100644 (file)
index 0000000..a1214ac
--- /dev/null
@@ -0,0 +1,358 @@
+package org.apache.archiva.web.test.parent;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import org.testng.Assert;
+
+public abstract class AbstractRepositoryTest
+    extends AbstractArchivaTest
+{
+    // Repository Groups
+    public void goToRepositoryGroupsPage()
+    {
+        if ( !getTitle().equals( "Apache Archiva \\ Administration - Repository Groups" ) )
+        {
+            getSelenium().open( "/archiva/admin/repositoryGroups.action" );
+        }
+        assertRepositoryGroupsPage();
+    }
+
+    public void assertRepositoryGroupsPage()
+    {
+        assertPage( "Apache Archiva \\ Administration - Repository Groups" );
+        assertTextPresent( "Administration - Repository Groups" );
+        assertTextPresent( "Identifier*:" );
+        assertElementPresent( "repositoryGroup.id" );
+        assertButtonWithValuePresent( "Add Group" );
+        assertTextPresent( "Repository Groups" );
+    }
+
+    public void assertAddedRepositoryLink( String repositoryGroupName )
+    {
+        assertPage( "Apache Archiva \\ Administration - Repository Groups" );
+        String repositoryGroupUrlValue = "repository/" + repositoryGroupName + "/";
+        String baseUrlValue = "archiva";
+        String repositoryGroupLink = baseUrl.replaceFirst( baseUrlValue, repositoryGroupUrlValue );
+        assertTextPresent( repositoryGroupLink );
+    }
+
+    public void assertAddedRepositoryToRepositoryGroups( String repositoryName )
+    {
+        assertPage( "Apache Archiva \\ Administration - Repository Groups" );
+        assertTextPresent( repositoryName );
+        assertTextPresent( "Archiva Managed Internal Repository" );
+        assertAddedRepositoryLink( repositoryName );
+    }
+
+    public void assertDeleteRepositoryGroupPage( String repositoryName )
+    {
+        assertPage( "Apache Archiva \\ Admin: Delete Repository Group" );
+        assertTextPresent( "WARNING: This operation can not be undone." );
+        assertTextPresent( "Are you sure you want to delete the following repository group?" );
+        assertTextPresent( "ID:" );
+        assertTextPresent( repositoryName );
+        assertButtonWithValuePresent( "Confirm" );
+        assertButtonWithValuePresent( "Cancel" );
+    }
+
+    public void addRepositoryGroup( String repoGroupName, boolean wait )
+    {
+        goToRepositoryGroupsPage();
+        setFieldValue( "repositoryGroup.id", repoGroupName );
+        clickButtonWithValue( "Add Group", wait );
+    }
+
+    public void addRepositoryToRepositoryGroup( String repositoryGroupName, String repositoryName )
+    {
+        goToRepositoryGroupsPage();
+        String s = getSelenium().getBodyText();
+        if ( s.contains( "No Repository Groups Defined." ) )
+        {
+            setFieldValue( "repositoryGroup.id", repositoryGroupName );
+            clickButtonWithValue( "Add Group" );
+            // assertAddedRepositoryLink( repositoryGroupName );
+
+            selectValue( "addRepositoryToGroup_repoId", repositoryName );
+            clickButtonWithValue( "Add Repository" );
+            assertAddedRepositoryToRepositoryGroups( repositoryName );
+        }
+        else
+        {
+            // assertAddedRepositoryLink( repositoryGroupName );
+            selectValue( "addRepositoryToGroup_repoId", repositoryName );
+            clickButtonWithValue( "Add Repository" );
+        }
+    }
+
+    public void deleteRepositoryInRepositoryGroups()
+    {
+        goToRepositoryGroupsPage();
+        getSelenium().click( "xpath=//div[@id='contentArea']/div[2]/div/div[3]/div[1]/a/img" );
+        waitPage();
+    }
+
+    public void deleteRepositoryGroup( String repositoryName )
+    {
+        getSelenium().click( "xpath=//div[@id='contentArea']/div[2]/div/div[1]/div/a/img" );
+        waitPage();
+        assertDeleteRepositoryGroupPage( repositoryName );
+        clickButtonWithValue( "Confirm" );
+    }
+
+    // /////////////////////////////
+    // proxy connectors
+    // /////////////////////////////
+    public void goToProxyConnectorsPage()
+    {
+        clickLinkWithText( "Proxy Connectors" );
+        assertProxyConnectorsPage();
+    }
+
+    public void assertProxyConnectorsPage()
+    {
+        assertPage( "Apache Archiva \\ Administration - Proxy Connectors" );
+        assertTextPresent( "Administration - Proxy Connectors" );
+        assertTextPresent( "Repository Proxy Connectors" );
+        assertTextPresent( "internal" );
+        assertTextPresent( "Archiva Managed Internal Repository" );
+        assertTextPresent( "Proxy Connector" );
+        assertTextPresent( "Central Repository" );
+    }
+
+    public void assertAddProxyConnectorPage()
+    {
+        assertPage( "Apache Archiva \\ Admin: Add Proxy Connector" );
+        assertTextPresent( "Admin: Add Proxy Connector" );
+        String proxy =
+            "Network Proxy*:,Managed Repository*:,Remote Repository*:,Policies:,Return error when:,On remote error:,Releases:,Snapshots:,Checksum:,Cache failures:,Properties:,No properties have been set.,Black List:,No black list patterns have been set.,White List:,No white list patterns have been set.";
+        String[] arrayProxy = proxy.split( "," );
+        for ( String arrayproxy : arrayProxy )
+            assertTextPresent( arrayproxy );
+        /*
+         * String proxyElements =
+         * "addProxyConnector_connector_proxyId,addProxyConnector_connector_sourceRepoId,addProxyConnector_connector_targetRepoId,policy_propagate-errors-on-update,policy_propagate-errors,policy_releases,policy_snapshots,policy_checksum,policy_cache-failures,propertiesEntry,propertiesValue,blackListEntry,whiteListEntry"
+         * ; String[] arrayProxyElements = proxyElements.split( "," ); for ( String arrayproxyelements :
+         * arrayProxyElements ) assertTextPresent( arrayproxyelements );
+         */
+        assertButtonWithValuePresent( "Add Property" );
+        assertButtonWithValuePresent( "Add Pattern" );
+        assertButtonWithValuePresent( "Add Proxy Connector" );
+    }
+
+    // this only fills in the values of required fields in adding Proxy Connectors
+    public void addProxyConnector( String networkProxy, String managedRepo, String remoteRepo )
+    {
+        goToProxyConnectorsPage();
+        clickLinkWithText( "Add" );
+        assertAddProxyConnectorPage();
+        selectValue( "connector.proxyId", networkProxy );
+        selectValue( "connector.sourceRepoId", managedRepo );
+        selectValue( "connector.targetRepoId", remoteRepo );
+        clickButtonWithValue( "Add Proxy Connector" );
+    }
+
+    public void deleteProxyConnector()
+    {
+        goToProxyConnectorsPage();
+        clickLinkWithXPath( "//div[@id='contentArea']/div[2]/div[1]/div[2]/div[1]/a[3]/img" );
+        assertPage( "Apache Archiva \\ Admin: Delete Proxy Connectors" );
+        clickButtonWithValue( "Delete" );
+        assertPage( "Apache Archiva \\ Administration - Proxy Connectors" );
+    }
+
+    // /////////////////////////////
+    // network proxies
+    // /////////////////////////////
+
+    public void editNetworkProxies( String fieldName, String value )
+    {
+        // goToNetworkProxiesPage();
+        clickLinkWithText( "Edit Network Proxy" );
+        setFieldValue( fieldName, value );
+        clickButtonWithValue( "Save Network Proxy" );
+    }
+
+    public void deleteNetworkProxy()
+    {
+        // goToNetworkProxiesPage();
+        clickLinkWithText( "Delete Network Proxy" );
+        assertPage( "Apache Archiva \\ Admin: Delete Network Proxy" );
+        assertTextPresent( "WARNING: This operation can not be undone." );
+        clickButtonWithValue( "Delete" );
+    }
+
+    // remote repositories
+    public void assertAddRemoteRepository()
+    {
+        assertPage( "Apache Archiva \\ Admin: Add Remote Repository" );
+        String remote = "Identifier*:,Name*:,URL*:,Username:,Password:,Timeout in seconds:,Type:";
+        String[] arrayRemote = remote.split( "," );
+        for ( String arrayremote : arrayRemote )
+            assertTextPresent( arrayremote );
+        String remoteElements =
+            "addRemoteRepository_repository_id,addRemoteRepository_repository_name,addRemoteRepository_repository_url,addRemoteRepository_repository_userName,addRemoteRepository_repository_password,addRemoteRepository_repository_timeout,addRemoteRepository_repository_layout";
+        String[] arrayRemoteElements = remoteElements.split( "," );
+        for ( String arrayremotelement : arrayRemoteElements )
+            assertElementPresent( arrayremotelement );
+    }
+
+    public void assertDeleteRemoteRepositoryPage()
+    {
+        assertPage( "Apache Archiva \\ Admin: Delete Remote Repository" );
+        assertTextPresent( "Admin: Delete Remote Repository" );
+        assertTextPresent( "WARNING: This operation can not be undone." );
+        assertTextPresent( "Are you sure you want to delete the following remote repository?" );
+        assertButtonWithValuePresent( "Confirm" );
+        assertButtonWithValuePresent( "Cancel" );
+    }
+
+    public void addRemoteRepository( String identifier, String name, String url, String username, String password,
+                                     String timeout, String type, boolean wait )
+    {
+        assertAddRemoteRepository();
+        setFieldValue( "addRemoteRepository_repository_id", identifier );
+        setFieldValue( "addRemoteRepository_repository_name", name );
+        setFieldValue( "addRemoteRepository_repository_url", url );
+        setFieldValue( "addRemoteRepository_repository_userName", username );
+        setFieldValue( "addRemoteRepository_repository_password", password );
+        setFieldValue( "addRemoteRepository_repository_timeout", timeout );
+        selectValue( "addRemoteRepository_repository_layout", type );
+        clickButtonWithValue( "Add Repository", wait );
+    }
+
+    public void deleteRemoteRepository()
+    {
+        goToRepositoriesPage();
+        clickLinkWithXPath( "//div[@id='contentArea']/div/div[8]/div[1]/a[2]" );
+        assertDeleteRemoteRepositoryPage();
+        clickButtonWithValue( "Confirm" );
+    }
+
+    public void editRemoteRepository( String fieldName, String value )
+    {
+        goToRepositoriesPage();
+        clickLinkWithXPath( "//div[@id='contentArea']/div/div[8]/div[1]/a[1]" );
+        setFieldValue( fieldName, value );
+        clickButtonWithValue( "Update Repository" );
+    }
+
+    public void editManagedRepository( String fieldName, String value )
+    {
+        goToRepositoriesPage();
+        clickLinkWithXPath( "//div[@id='contentArea']/div/div[5]/div[1]/a[1]/img" );
+        assertPage( "Apache Archiva \\ Admin: Edit Managed Repository" );
+        setFieldValue( fieldName, value );
+        // TODO
+        clickButtonWithValue( "Update Repository" );
+    }
+
+    public void editManagedRepository(String name, String directory, String indexDirectory, String type, String cron, String daysOlder, String retentionCount)
+    {
+        goToRepositoriesPage();
+        clickLinkWithXPath( "//div[@id='contentArea']/div/div[5]/div[1]/a[1]/img" );
+        assertPage( "Apache Archiva \\ Admin: Edit Managed Repository" );
+        setFieldValue( "repository.name" , name );
+        setFieldValue( "repository.location" , directory );
+        setFieldValue( "repository.indexDirectory" , indexDirectory );
+        selectValue( "repository.layout", type );
+        setFieldValue( "repository.cronExpression" , cron );
+        setFieldValue( "repository.daysOlder" , daysOlder );
+        setFieldValue( "repository.retentionCount" , retentionCount );
+        clickButtonWithValue( "Update Repository" );
+    }
+
+    public void deleteManagedRepository()
+    {
+        clickLinkWithXPath( "//div[@id='contentArea']/div/div[5]/div[1]/a[2]" );
+        assertPage( "Apache Archiva \\ Admin: Delete Managed Repository" );
+        clickButtonWithValue( "Delete Configuration Only" );
+    }
+
+    public String getRepositoryDir()
+    {
+        File f = new File( "" );
+        String artifactFilePath = f.getAbsolutePath();
+        return artifactFilePath + "/target/";
+    }
+
+    // ///////////////////////////////////////////
+    // Repository Scanning
+    // ///////////////////////////////////////////
+    public void goToRepositoryScanningPage()
+    {
+        getSelenium().open( "/archiva/admin/repositoryScanning.action" );
+        assertRepositoryScanningPage();
+    }
+
+    public void assertRepositoryScanningPage()
+    {
+        assertPage( "Apache Archiva \\ Administration - Repository Scanning" );
+        assertTextPresent( "Administration - Repository Scanning" );
+        assertTextPresent( "Repository Scanning - File Types" );
+        String artifactsTypes =
+            "**/*.pom,**/*.jar,**/*.ear,**/*.war,**/*.car,**/*.sar,**/*.mar,**/*.rar,**/*.dtd,**/*.tld,**/*.tar.gz,**/*.tar.bz2,**/*.zip";
+        String[] arrayArtifactTypes = artifactsTypes.split( "," );
+        for ( int i = 0; i < arrayArtifactTypes.length; i++ )
+            Assert.assertEquals( getSelenium().getTable( "//div[@id='contentArea']/div/div[1]/table." + i + ".0" ),
+                                 arrayArtifactTypes[i] );
+
+        String autoremove = "**/*.bak,**/*~,**/*-";
+        String[] arrayAutoremove = autoremove.split( "," );
+        for ( int i = 0; i < arrayAutoremove.length; i++ )
+            Assert.assertEquals( getSelenium().getTable( "//div[@id='contentArea']/div/div[2]/table." + i + ".0" ),
+                                 arrayAutoremove[i] );
+
+        String ignored = "**/.htaccess,**/KEYS,**/*.rb,**/*.sh,**/.svn/**,**/.DAV/**";
+        String[] arrayIgnored = ignored.split( "," );
+        for ( int i = 0; i < arrayIgnored.length; i++ )
+            Assert.assertEquals( getSelenium().getTable( "//div[@id='contentArea']/div/div[3]/table." + i + ".0" ),
+                                 arrayIgnored[i] );
+
+        String indexableContent =
+            "**/*.txt,**/*.TXT,**/*.block,**/*.config,**/*.pom,**/*.xml,**/*.xsd,**/*.dtd,**/*.tld";
+        String[] arrayIndexableContent = indexableContent.split( "," );
+        for ( int i = 0; i < arrayIndexableContent.length; i++ )
+            Assert.assertEquals( getSelenium().getTable( "//div[@id='contentArea']/div/div[4]/table." + i + ".0" ),
+                                 arrayIndexableContent[i] );
+    }
+
+    // ///////////////////////////////////////////
+    // Database
+    // ///////////////////////////////////////////
+    public void goToDatabasePage()
+    {
+        clickLinkWithText( "Database" );
+        assertDatabasePage();
+    }
+
+    public void assertDatabasePage()
+    {
+        assertPage( "Apache Archiva \\ Administration - Database" );
+        assertTextPresent( "Administration - Database" );
+        assertTextPresent( "Database - Unprocessed Artifacts Scanning" );
+        assertTextPresent( "Cron:" );
+        assertElementPresent( "database_cron" );
+        assertButtonWithValuePresent( "Update Cron" );
+        assertButtonWithValuePresent( "Update Database Now" );
+        assertTextPresent( "Database - Unprocessed Artifacts Scanning" );
+        assertTextPresent( "Database - Artifact Cleanup Scanning" );
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractSearchTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractSearchTest.java
new file mode 100644 (file)
index 0000000..33b12be
--- /dev/null
@@ -0,0 +1,117 @@
+package org.apache.archiva.web.test.parent;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public abstract class AbstractSearchTest
+    extends AbstractArchivaTest
+{
+    // Search
+    public void goToSearchPage()
+    {
+        goToHomePage();
+        if (!isElementPresent( "quickSearchBox" ) )
+        {
+            getSelenium().open( "/index.action");
+            //getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+            waitPage();
+            assertElementPresent( "quickSearchSubmit" );
+        }
+    }
+
+    public void assertSearchPage()
+    {
+        assertPage( "Apache Archiva \\ Quick Search" );
+        assertTextPresent( "Search for" );
+        assertElementPresent( "quickSearchSubmit" );
+        assertButtonWithValuePresent( "Search" );
+        // assertLinkPresent( "Advanced Search" );
+        assertTextPresent( "Enter your search terms. A variety of data will be searched for your keywords." );
+        // assertButtonWithDivIdPresent( "searchHint" );
+    }
+
+    public void searchForArtifact( String artifactId )
+    {
+        goToSearchPage();
+
+        setFieldValue( "quickSearchValue", artifactId );
+        clickButtonWithLocator( "quickSearchSubmit" );
+    }
+
+    public void searchForArtifactAdvancedSearch( String groupId, String artifactId, String version, String repositoryId,
+                                                 String className, String rowCount )
+    {
+        goToSearchPage();
+
+        clickLinkWithXPath( "//div[@id='contentArea']/div[1]/a[1]/strong", false );
+        assertElementPresent( "filteredSearch_searchField" );
+        assertElementPresent( "filteredSearch_repositoryId" );
+
+        if ( groupId != null )
+        {
+            selectValue( "filteredSearch_searchField", "Group ID" );
+            clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
+
+            assertElementPresent( "groupId" );
+            setFieldValue( "groupId", groupId );
+        }
+
+        if ( artifactId != null )
+        {
+            selectValue( "filteredSearch_searchField", "Artifact ID" );
+            clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
+
+            assertElementPresent( "artifactId" );
+            setFieldValue( "artifactId", artifactId );
+        }
+
+        if ( version != null )
+        {
+            selectValue( "filteredSearch_searchField", "Version" );
+            clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
+
+            assertElementPresent( "version" );
+            setFieldValue( "version", version );
+        }
+
+        if ( className != null )
+        {
+            selectValue( "filteredSearch_searchField", "Class/Package Name" );
+            clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
+
+            assertElementPresent( "className" );
+            setFieldValue( "className", className );
+        }
+
+        if ( rowCount != null )
+        {
+            selectValue( "filteredSearch_searchField", "Row Count" );
+            clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
+
+            assertElementPresent( "rowCount" );
+            setFieldValue( "rowCount", rowCount );
+        }
+
+        if ( repositoryId != null )
+        {
+            selectValue( "filteredSearch_repositoryId", repositoryId );
+        }
+        clickSubmitWithLocator( "filteredSearch_0" );
+    }
+}
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
new file mode 100644 (file)
index 0000000..a394b59
--- /dev/null
@@ -0,0 +1,499 @@
+package org.apache.archiva.web.test.parent;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.Selenium;
+import org.apache.commons.io.IOUtils;
+import org.testng.Assert;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id: AbstractSeleniumTestCase.java 761154 2009-04-02 03:31:19Z wsmoak $
+ */
+
+public abstract class AbstractSeleniumTest
+{
+
+    public static String baseUrl;
+
+    public static String maxWaitTimeInMs;
+
+    private static ThreadLocal<Selenium> selenium = new ThreadLocal<Selenium>();
+
+    public static Properties p;
+
+    private final static String PROPERTIES_SEPARATOR = "=";
+
+    public void open()
+        throws Exception
+    {
+        p = new Properties();
+        p.load( this.getClass().getClassLoader().getResourceAsStream( "test.properties" ) );
+    }
+
+    /**
+     * Initialize selenium
+     */
+    public void open( String baseUrl, String browser, String seleniumHost, int seleniumPort, String maxWaitTimeInMs )
+        throws Exception
+    {
+        try
+        {
+            AbstractSeleniumTest.baseUrl = baseUrl;
+            AbstractSeleniumTest.maxWaitTimeInMs = maxWaitTimeInMs;
+
+            if ( getSelenium() == null )
+            {
+                DefaultSelenium s = new DefaultSelenium( seleniumHost, seleniumPort, browser, baseUrl );
+
+                s.start();
+                s.setTimeout( maxWaitTimeInMs );
+                selenium.set( s );
+            }
+        }
+        catch ( Exception e )
+        {
+            // yes
+            System.out.print( e.getMessage() );
+            e.printStackTrace();
+        }
+    }
+
+    public static Selenium getSelenium()
+    {
+        return selenium == null ? null : selenium.get();
+    }
+
+    protected String getProperty( String key )
+    {
+        return p.getProperty( key );
+    }
+
+    protected String getEscapeProperty( String key )
+    {
+        InputStream input = this.getClass().getClassLoader().getResourceAsStream( "test.properties" );
+        String value = null;
+        List<String> lines;
+        try
+        {
+            lines = IOUtils.readLines( input );
+        }
+        catch ( IOException e )
+        {
+            lines = new ArrayList<String>();
+        }
+        for ( String l : lines )
+        {
+            if ( l != null && l.startsWith( key ) )
+            {
+                int indexSeparator = l.indexOf( PROPERTIES_SEPARATOR );
+                value = l.substring( indexSeparator + 1 ).trim();
+                break;
+            }
+        }
+        return value;
+    }
+
+    /**
+     * Close selenium session. Called from AfterSuite method of sub-class
+     */
+    public void close()
+        throws Exception
+    {
+        if ( getSelenium() != null )
+        {
+            getSelenium().stop();
+            selenium.set( null );
+        }
+    }
+
+    // *******************************************************
+    // Auxiliar methods. This method help us and simplify test.
+    // *******************************************************
+
+    public void assertFieldValue( String fieldValue, String fieldName )
+    {
+        assertElementPresent( fieldName );
+        Assert.assertEquals( fieldValue, getSelenium().getValue( fieldName ) );
+    }
+
+    public void assertPage( String title )
+    {
+        Assert.assertEquals( getTitle(), title );
+    }
+
+    public String getTitle()
+    {
+        // Collapse spaces
+        return getSelenium().getTitle().replaceAll( "[ \n\r]+", " " );
+    }
+
+    public String getHtmlContent()
+    {
+        return getSelenium().getHtmlSource();
+    }
+
+    public String getText( String locator )
+    {
+        return getSelenium().getText( locator );
+    }
+
+    public void assertTextPresent( String text )
+    {
+        Assert.assertTrue( getSelenium().isTextPresent( text ), "'" + text + "' isn't present." );
+    }
+
+    /**
+     * one of text args must be in the page so use en and fr text (olamy use en locale :-) )
+     *
+     * @param texts
+     */
+    public void assertTextPresent( String... texts )
+    {
+        boolean present = false;
+        StringBuilder sb = new StringBuilder();
+        for ( String text : texts )
+        {
+            present = present || getSelenium().isTextPresent( text );
+            sb.append( " " + text + " " );
+        }
+        Assert.assertTrue( present, "'one of the following test " + sb.toString() + "' isn't present." );
+    }
+
+    public void assertTextNotPresent( String text )
+    {
+        Assert.assertFalse( getSelenium().isTextPresent( text ), "'" + text + "' is present." );
+    }
+
+    public void assertElementPresent( String elementLocator )
+    {
+        Assert.assertTrue( isElementPresent( elementLocator ), "'" + elementLocator + "' isn't present." );
+    }
+
+    public void assertElementNotPresent( String elementLocator )
+    {
+        Assert.assertFalse( isElementPresent( elementLocator ), "'" + elementLocator + "' is present." );
+    }
+
+    public void assertLinkPresent( String text )
+    {
+        Assert.assertTrue( isElementPresent( "link=" + text ), "The link '" + text + "' isn't present." );
+    }
+
+    public void assertLinkNotPresent( String text )
+    {
+        Assert.assertFalse( isElementPresent( "link=" + text ), "The link('" + text + "' is present." );
+    }
+
+    public void assertLinkNotVisible( String text )
+    {
+        Assert.assertFalse( isElementVisible( "link=" + text ), "The link('" + text + "' is visible." );
+    }
+
+    public void assertLinkVisible( String text )
+    {
+        Assert.assertTrue( isElementVisible( "link=" + text ), "The link('" + text + "' is not visible." );
+    }
+
+    public void assertImgWithAlt( String alt )
+    {
+        assertElementPresent( "/¯img[@alt='" + alt + "']" );
+    }
+
+    public void assertImgWithAltAtRowCol( boolean isALink, String alt, int row, int column )
+    {
+        String locator = "//tr[" + row + "]/td[" + column + "]/";
+        locator += isALink ? "a/" : "";
+        locator += "img[@alt='" + alt + "']";
+
+        assertElementPresent( locator );
+    }
+
+    public void assertImgWithAltNotPresent( String alt )
+    {
+        assertElementNotPresent( "/¯img[@alt='" + alt + "']" );
+    }
+
+    public void assertCellValueFromTable( String expected, String tableElement, int row, int column )
+    {
+        Assert.assertEquals( expected, getCellValueFromTable( tableElement, row, column ) );
+    }
+
+    public boolean isTextPresent( String text )
+    {
+        return getSelenium().isTextPresent( text );
+    }
+
+    public boolean isLinkPresent( String text )
+    {
+        return isElementPresent( "link=" + text );
+    }
+
+    public boolean isElementPresent( String locator )
+    {
+        return getSelenium().isElementPresent( locator );
+    }
+
+    public boolean isElementVisible( String locator )
+    {
+        return getSelenium().isVisible( locator );
+    }
+
+
+    public void waitPage()
+    {
+        // TODO define a smaller maxWaitTimeJsInMs for wait javascript response for browser side validation
+        //getSelenium().w .wait( Long.parseLong( maxWaitTimeInMs ) );
+        //getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+        // http://jira.openqa.org/browse/SRC-302
+        // those hack looks to break some tests :-(
+        // getSelenium().waitForCondition( "selenium.isElementPresent('document.body');", maxWaitTimeInMs );
+        //getSelenium().waitForCondition( "selenium.isElementPresent('footer');", maxWaitTimeInMs );
+        //getSelenium().waitForCondition( "selenium.browserbot.getCurrentWindow().document.getElementById('footer')",
+        //                                maxWaitTimeInMs );
+        // so the only hack is to not use a too small wait time
+
+        try
+        {
+            Thread.sleep( Long.parseLong( maxWaitTimeInMs ) );
+        }
+        catch ( InterruptedException e )
+        {
+            throw new RuntimeException( "issue on Thread.sleep : " + e.getMessage(), e );
+        }
+    }
+
+    public String getFieldValue( String fieldName )
+    {
+        return getSelenium().getValue( fieldName );
+    }
+
+    public String getCellValueFromTable( String tableElement, int row, int column )
+    {
+        return getSelenium().getTable( tableElement + "." + row + "." + column );
+    }
+
+    public void selectValue( String locator, String value )
+    {
+        getSelenium().select( locator, "label=" + value );
+    }
+
+
+    public void assertOptionPresent( String selectField, String[] options )
+    {
+        assertElementPresent( selectField );
+        String[] optionsPresent = getSelenium().getSelectOptions( selectField );
+        List<String> expected = Arrays.asList( options );
+        List<String> present = Arrays.asList( optionsPresent );
+        Assert.assertTrue( present.containsAll( expected ), "Options expected are not included in present options" );
+    }
+
+    public void assertSelectedValue( String value, String fieldName )
+    {
+        assertElementPresent( fieldName );
+        String optionsPresent = getSelenium().getSelectedLabel( value );
+        Assert.assertEquals( optionsPresent, value );
+    }
+
+    public void submit()
+    {
+        clickLinkWithXPath( "//input[@type='submit']" );
+    }
+
+    public void assertButtonWithValuePresent( String text )
+    {
+        Assert.assertTrue( isButtonWithValuePresent( text ), "'" + text + "' button isn't present" );
+    }
+
+    public void assertButtonWithIdPresent( String id )
+    {
+        Assert.assertTrue( isButtonWithIdPresent( id ), "'Button with id =" + id + "' isn't present" );
+    }
+
+    public void assertButtonWithValueNotPresent( String text )
+    {
+        Assert.assertFalse( isButtonWithValuePresent( text ), "'" + text + "' button is present" );
+    }
+
+    public boolean isButtonWithValuePresent( String text )
+    {
+        return isElementPresent( "//button[@value='" + text + "']" ) || isElementPresent(
+            "//input[@value='" + text + "']" );
+    }
+
+    public boolean isButtonWithIdPresent( String text )
+    {
+        return isElementPresent( "//button[@id='" + text + "']" ) || isElementPresent( "//input[@id='" + text + "']" );
+    }
+
+    public void clickButtonWithName( String text, boolean wait )
+    {
+        clickLinkWithXPath( "//input[@name='" + text + "']", wait );
+    }
+
+    public void clickButtonWithValue( String text )
+    {
+        clickButtonWithValue( text, true );
+    }
+
+    public void clickButtonWithValue( String text, boolean wait )
+    {
+        assertButtonWithValuePresent( text );
+
+        if ( isElementPresent( "//button[@value='" + text + "']" ) )
+        {
+            clickLinkWithXPath( "//button[@value='" + text + "']", wait );
+        }
+        else
+        {
+            clickLinkWithXPath( "//input[@value='" + text + "']", wait );
+        }
+    }
+
+    public void clickSubmitWithLocator( String locator )
+    {
+        clickLinkWithLocator( locator );
+    }
+
+    public void clickSubmitWithLocator( String locator, boolean wait )
+    {
+        clickLinkWithLocator( locator, wait );
+    }
+
+    public void clickImgWithAlt( String alt )
+    {
+        clickLinkWithLocator( "//img[@alt='" + alt + "']" );
+    }
+
+    public void clickLinkWithText( String text )
+    {
+        clickLinkWithText( text, true );
+    }
+
+    public void clickLinkWithText( String text, boolean wait )
+    {
+        clickLinkWithLocator( "link=" + text, wait );
+    }
+
+    public void clickLinkWithXPath( String xpath )
+    {
+        clickLinkWithXPath( xpath, true );
+    }
+
+    public void clickLinkWithXPath( String xpath, boolean wait )
+    {
+        clickLinkWithLocator( "xpath=" + xpath, wait );
+    }
+
+    public void clickLinkWithLocator( String locator )
+    {
+        clickLinkWithLocator( locator, true );
+    }
+
+    public void clickLinkWithLocator( String locator, boolean wait )
+    {
+        assertElementPresent( locator );
+        getSelenium().click( locator );
+        if ( wait )
+        {
+            waitPage();
+        }
+    }
+
+    public void clickButtonWithLocator( String locator )
+    {
+        clickButtonWithLocator( locator, true );
+    }
+
+    public void clickButtonWithLocator( String locator, boolean wait )
+    {
+        assertElementPresent( locator );
+        getSelenium().click( locator );
+        if ( wait )
+        {
+            waitPage();
+        }
+    }
+
+    public void setFieldValues( Map<String, String> fieldMap )
+    {
+        Map.Entry<String, String> entry;
+
+        for ( Iterator<Entry<String, String>> entries = fieldMap.entrySet().iterator(); entries.hasNext(); )
+        {
+            entry = entries.next();
+
+            getSelenium().type( entry.getKey(), entry.getValue() );
+        }
+    }
+
+    public void setFieldValue( String fieldName, String value )
+    {
+        getSelenium().type( fieldName, value );
+    }
+
+    public void checkField( String locator )
+    {
+        getSelenium().check( locator );
+    }
+
+    public void uncheckField( String locator )
+    {
+        getSelenium().uncheck( locator );
+    }
+
+    public boolean isChecked( String locator )
+    {
+        return getSelenium().isChecked( locator );
+    }
+
+    public void assertIsChecked( String locator )
+    {
+        Assert.assertTrue( getSelenium().isChecked( locator ) );
+    }
+
+    public void assertIsNotChecked( String locator )
+    {
+        Assert.assertFalse( getSelenium().isChecked( locator ) );
+    }
+
+    public void assertXpathCount( String locator, int expectedCount )
+    {
+        int count = getSelenium().getXpathCount( locator ).intValue();
+        Assert.assertEquals( count, expectedCount );
+    }
+
+    public void assertElementValue( String locator, String expectedValue )
+    {
+        Assert.assertEquals( getSelenium().getValue( locator ), expectedValue );
+    }
+
+}
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/resources/test.properties b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/resources/test.properties
new file mode 100644 (file)
index 0000000..1913b03
--- /dev/null
@@ -0,0 +1,143 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# properties for integration tests
+
+ADMIN_USERNAME=admin
+ADMIN_FULLNAME=Administrator
+ADMIN_EMAIL=admin@localhost.fr
+ADMIN_PASSWORD=admin1
+
+SELENIUM_HOST=localhost
+SELENIUM_PORT=4444
+SELENIUM_BROWSER=*firefox
+
+# Search, Artifact Management
+SEARCH_BAD_ARTIFACT=asdf
+# Existing Artifact
+ARTIFACT_GROUPID=test
+ARTIFACT_ARTIFACTID=test
+ARTIFACT_VERSION=1.0
+ARTIFACT_PACKAGING=jar
+ARTIFACT_CLASSNAME=test.App
+
+# Artifact for testing add artifact with valid values
+VALIDARTIFACT_GROUPID=addArtifactValidValues
+VALIDARTIFACT_ARTIFACTID=addArtifactValidValues-artifact
+
+# Artifact for upload action in audit log report - MRM-1304
+AUDITLOGARTIFACT_GROUPID=group.auditLogUpload
+AUDITLOGARTIFACT_ARTIFACTID=auditLogUpload-artifact
+AUDITLOG_EXPECTED_ARTIFACT=group/auditLogUpload/auditLogUpload-artifact/1.0/auditLogUpload-artifact-1.0.jar
+
+# Reports
+REPOSITORY_NAME=internal
+START_DATE=05/01/2009
+END_DATE=05/30/2009
+
+# User Management
+# For password and new password
+USERROLE_EMAIL=admin@localhost.fr
+USERROLE_PASSWORD=password1
+NEW_USERROLE_PASSWORD=password123
+
+# Guest Role
+GUEST_USERNAME=guest_user
+GUEST_FULLNAME=The Test Guest
+# Registered User Role
+REGISTERED_USERNAME=reg_user
+REGISTERED_FULLNAME=Registered User
+# System Administrator
+SYSAD_USERNAME=sys_admin
+SYSAD_FULLNAME=System Administrator
+# User Administrator
+USERADMIN_USERNAME=user_admin
+USERADMIN_FULLNAME=User Administrator
+# Global Repository Manager
+GLOBALREPOMANAGER_USERNAME=globalrepo_manager
+GLOBALREPOMANAGER_FULLNAME=Global Repository Manager
+# Global Repository Observer
+GLOBALREPOOBSERVER_USERNAME=globalrepo_observer
+GLOBALREPOOBSERVER_FULLNAME=Global Repository Observer
+# Repository Manager - internal
+REPOMANAGER_INTERNAL_USERNAME=repomanager_internal
+REPOMANAGER_INTERNAL_FULLNAME=Repository Manager - internal
+# Repository Manager - snapshots
+REPOMANAGER_SNAPSHOTS_USERNAME=repomanager_snapshots
+REPOMANAGER_SNAPSHOTS_FULLNAME=Repository Manager - snapshots
+# Repository Observer - internal
+REPOOBSERVER_INTERNAL_USERNAME=repoobserver_internal
+REPOOBSERVER_INTERNAL_FULLNAME=Repository Observer - internal
+# Repository Observer - snapshots
+REPOOBSERVER_SNAPSHOTS_USERNAME=repoobserver_snapshots
+REPOOBSERVER_SNAPSHOTS_FULLNAME=Repository Observer - snapshots
+
+# Add Artifact
+GROUPID=test
+ARTIFACTID=test
+VERSION=1.0
+PACKAGING=jar
+ARTIFACTFILEPATH=test
+REPOSITORYID=internal
+
+GROUPID1=delete
+ARTIFACTID1=delete
+VERSION1=1.0
+PACKAGING1=jar
+ARTIFACTFILEPATH1=test
+REPOSITORYID1=internal
+
+GROUPID_DOTNETARTIFACT=dotNetTypes
+ARTIFACTID_DOTNETARTIFACT=dotNetTypes
+PACKAGING_DOTNETARTIFACT=library
+
+SNAPSHOT_GROUPID=org.apache.archiva
+SNAPSHOT_ARTIFACTID=archiva-test
+SNAPSHOT_VERSION=1.0-SNAPSHOT
+SNAPSHOT_PACKAGING=jar
+SNAPSHOT_ARTIFACTFILEPATH=src/test/resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar
+SNAPSHOT_REPOSITORYID=snapshots
+
+ADD_REMOVE_GROUPID=artifact.dummy
+ADD_REMOVE_ARTIFACTID=artifact-dummy
+
+# REPOSITORIES
+# Manage Repositories
+MANAGED_IDENTIFIER=testing1
+MANAGED_NAME=Testing Managed Repository
+MANAGED_DIRECTORY=
+MANAGED_INDEX_DIRECTORY=
+MANAGED_TYPE=
+MANAGED_CRON=
+MANAGED_REPOPURGE_DAYSOLDERTHAN=
+MANAGED_REPOPURGE_RETENTIONCOUNT=
+
+# Network Proxies
+NETWORKPROXY_IDENTIFIER=networkproxytest
+NETWORKPROXY_PROTOCOL=http
+NETWORKPROXY_HOSTNAME=
+NETWORKPROXY_PORT=8080
+NETWORKPROXY_USERNAME=admin
+NETWORKPROXY_PASSWORD=admin123
+
+# Browse - MRM-1278 test
+SNAPSHOTS_REPOSITORY=snapshots
+RELEASES_REPOSITORY=releases
+
+
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java
deleted file mode 100644 (file)
index 721d8ba..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.apache.archiva.web.test;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.web.test.parent.AbstractArchivaTest;
-import org.testng.annotations.Test;
-
-public class ArchivaAdminTest
-    extends AbstractArchivaTest
-{
-
-    @Test( groups = { "about" }, alwaysRun = true )
-    public void testHome()
-    {
-        getSelenium().open( baseUrl );
-        assertPage( "Apache Archiva" );
-    }
-}
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/LoginTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/LoginTest.java
deleted file mode 100644 (file)
index 29ba5ef..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.apache.archiva.web.test;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.web.test.parent.AbstractArchivaTest;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-
-/**
- * Based on LoginTest of Emmanuel Venisse test.
- *
- * @author José Morales Martínez
- * @version $Id$
- */
-
-@Test( groups = { "login" }, dependsOnGroups = { "about" } )
-public class LoginTest
-    extends AbstractArchivaTest
-{
-    @Test
-    public void testWithBadUsername()
-    {
-        goToLoginPage();
-        setFieldValue( "user-login-form-username", "badUsername" );
-        clickLinkWithLocator( "modal-login-ok", true );
-        assertTextPresent( "This field is required." );
-
-    }
-
-    @Test
-    public void testWithBadPassword()
-    {
-        goToLoginPage();
-        setFieldValue( "user-login-form-username", getProperty( "ADMIN_USERNAME" ) );
-        setFieldValue( "user-login-form-password", "badPassword" );
-        clickLinkWithLocator( "modal-login-ok", true );
-        assertTextPresent( "You have entered an incorrect username and/or password" );
-    }
-
-    @Test
-    public void testWithEmptyUsername()
-    {
-        goToLoginPage();
-        setFieldValue( "user-login-form-password", "password" );
-        clickLinkWithLocator( "modal-login-ok", true );
-        assertTextPresent( "This field is required." );
-    }
-
-    @Test( alwaysRun = true )
-    public void testWithEmptyPassword()
-    {
-        goToLoginPage();
-        setFieldValue( "user-login-form-username", getProperty( "ADMIN_USERNAME" ) );
-        clickLinkWithLocator( "modal-login-ok", true );
-        assertTextPresent( "This field is required." );
-    }
-
-    @Test
-    public void testWithCorrectUsernamePassword()
-    {
-        goToLoginPage();
-        setFieldValue( "user-login-form-username", getProperty( "ADMIN_USERNAME" ) );
-        setFieldValue( "user-login-form-password", getProperty( "ADMIN_PASSWORD" ) );
-        clickLinkWithLocator( "modal-login-ok", true );
-
-        assertUserLoggedIn( getProperty( "ADMIN_USERNAME" ) );
-    }
-
-    @BeforeTest
-    public void open()
-        throws Exception
-    {
-        super.open();
-    }
-
-    @Override
-    @AfterTest
-    public void close()
-        throws Exception
-    {
-        super.close();
-    }
-}
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/RolesManagementTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/RolesManagementTest.java
deleted file mode 100644 (file)
index 388eb5f..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.apache.archiva.web.test;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.web.test.parent.AbstractArchivaTest;
-import org.apache.commons.lang.StringUtils;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-/**
- * @author Olivier Lamy
- */
-@Test( groups = { "usermanagement" }, dependsOnGroups = "about" )
-public class RolesManagementTest
-    extends AbstractArchivaTest
-{
-    @Test
-    public void testReadRolesAndUpdateDescription()
-        throws Exception
-    {
-        login( getAdminUsername(), getAdminPassword() );
-        clickLinkWithLocator( "menu-roles-list-a", true );
-        assertTextPresent( "Archiva System Administrator " );
-        Assert.assertTrue( StringUtils.isEmpty( getText( "role-description-Guest" ) ) );
-        clickLinkWithLocator( "edit-role-Guest" );
-        String desc = "The guest description";
-        setFieldValue( "role-edit-description", desc );
-        clickButtonWithLocator( "role-edit-description-save" );
-        clickLinkWithLocator( "roles-view-tabs-a-roles-grid" );
-        Assert.assertTrue( StringUtils.equals( desc, getText( "role-description-Guest" ) ) );
-    }
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/UserManagementTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/UserManagementTest.java
deleted file mode 100644 (file)
index 3478c13..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.apache.archiva.web.test;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.web.test.parent.AbstractArchivaTest;
-import org.testng.annotations.Test;
-
-/**
- * @author Olivier Lamy
- */
-@Test( groups = { "usermanagement" }, dependsOnGroups = { "about" } )
-public class UserManagementTest
-    extends AbstractArchivaTest
-{
-    public void testBasicAddDeleteUser()
-    {
-        username = getProperty( "GUEST_USERNAME" );
-        fullname = getProperty( "GUEST_FULLNAME" );
-
-        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
-        deleteUser( username, fullname, getUserEmail() );
-        logout();
-        login( getAdminUsername(), getAdminPassword() );
-    }
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/XPathExpressionUtil.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/XPathExpressionUtil.java
deleted file mode 100644 (file)
index 5dd77ca..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-package org.apache.archiva.web.test;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Utility class for creating xpath expressions
- */
-public class XPathExpressionUtil
-{
-    public static final String CONTAINS = "contains";
-
-    public static final String AND = " and ";
-
-    public static final String CURRENT_NODE = "./";
-
-    public static final String PARENT_NODE = "../";
-
-    public static final String GRANDPARENT_NODE = "../../";
-
-    public static final String ELEMENT_ANY_LEVEL = "//";
-
-    public static final String TABLE_COLUMN = "td";
-
-    public static final String TABLE_ROW = "tr";
-
-    public static final String START_NODE_TEST = "[";
-
-    public static final String END_NODE_TEST = "]";
-
-    public static final String ANCHOR = "a";
-
-    public static final String IMG = "img";
-
-    public static final String LIST = "ul";
-
-    public static final String LINE = "li";
-
-    public static String getList( String[] values )
-    {
-        String xpathExpression = "";
-
-        if ( values.length > 0 )
-        {
-            xpathExpression += ELEMENT_ANY_LEVEL;
-            xpathExpression += LIST;
-            xpathExpression += START_NODE_TEST;
-
-            for ( int nIndex = 0; nIndex < values.length; nIndex++ )
-            {
-                xpathExpression += ( ( nIndex > 0 ) ? AND : "" );
-                xpathExpression += contains( LINE + position( nIndex + 1 ), values[nIndex] );
-            }
-
-            xpathExpression += END_NODE_TEST;
-        }
-
-        return xpathExpression;
-    }
-
-    /**
-     * expression for acquiring an element in one of the table columns
-     * 
-     * @param element the node element
-     * @param elementIndex column index of the element, used for skipping
-     * @param columnValues the values to be matched in each column, element column is included
-     * @return
-     */
-    public static String getColumnElement( String element, int elementIndex, String[] columnValues )
-    {
-        return getColumnElement( element, elementIndex, null, columnValues );
-    }
-
-    /**
-     * expression for acquiring an element in one of the table columns
-     * 
-     * @param element the node element
-     * @param elementIndex column index of the element, used for skipping
-     * @param elementValue the matched element value
-     * @param columnValues the values to be matched in each column, element column is included
-     * @return
-     */
-    public static String getColumnElement( String element, int elementIndex, String elementValue, String[] columnValues )
-    {
-        return getColumnElement( element, elementIndex, elementValue, "TEXT", columnValues );
-    }
-
-    /**
-     * expression for acquiring an element in one of the table columns
-     * 
-     * @param element the node element
-     * @param elementIndex column index of the element, used for skipping
-     * @param imageName the matched image name
-     * @param columnValues the values to be matched in each column, element column is included
-     * @return
-     */
-    public static String getImgColumnElement( String element, int elementIndex, String imageName, String[] columnValues )
-    {
-        return getColumnElement( element, elementIndex, imageName, IMG, columnValues );
-    }
-
-    /**
-     * expression for acquiring an element in one of the table columns
-     * 
-     * @param element the node element
-     * @param elementIndex column index of the element, used for skipping
-     * @param imageName the matched image name
-     * @param columnValues the values to be matched in each column, element column is included
-     * @return
-     */
-    private static String getColumnElement( String element, int elementIndex, String elementValue,
-                                            String elementValueType, String[] columnValues )
-    {
-        String xpathExpression = null;
-
-        if ( ( columnValues != null ) && ( columnValues.length > 0 ) )
-        {
-            xpathExpression = ELEMENT_ANY_LEVEL + element;
-            xpathExpression += START_NODE_TEST;
-
-            if ( elementValue != null )
-            {
-                if ( "TEXT".equals( elementValueType ) )
-                {
-                    xpathExpression += contains( elementValue );
-                    xpathExpression += ( columnValues.length > 0 ) ? AND : "";
-                }
-            }
-
-            // we are two levels below the table row element ( tr/td/<element> )
-            xpathExpression += matchColumns( GRANDPARENT_NODE, columnValues, elementIndex );
-
-            xpathExpression += END_NODE_TEST;
-        }
-
-        if ( IMG.equals( elementValueType ) )
-        {
-            xpathExpression += "/img[contains(@src, '" + elementValue + "')]";
-        }
-
-        return xpathExpression;
-    }
-
-    /**
-     * expression for acquiring the table row that matches all column values with the same order as the list
-     * 
-     * @param columnValues the matched list of columnValues
-     * @return
-     */
-    public static String getTableRow( String[] columnValues )
-    {
-        String xpathExpression = null;
-
-        if ( ( columnValues != null ) && ( columnValues.length > 0 ) )
-        {
-            xpathExpression = new String( ELEMENT_ANY_LEVEL + TABLE_ROW + START_NODE_TEST );
-            xpathExpression += matchColumns( columnValues );
-            xpathExpression += END_NODE_TEST;
-        }
-
-        return xpathExpression;
-    }
-
-    private static String matchColumns( String[] columnValues )
-    {
-        return matchColumns( columnValues, -1 );
-    }
-
-    private static String matchColumns( String[] columnValues, int skipIndex )
-    {
-        return matchColumns( null, columnValues, skipIndex );
-    }
-
-    private static String matchColumns( String parent, String[] columnValues, int skipIndex )
-    {
-        String xpathExpression = "";
-
-        for ( int nIndex = 0; nIndex < columnValues.length; nIndex++ )
-        {
-            if ( ( skipIndex != nIndex ) || ( skipIndex == -1 ) )
-            {
-                // prepend "and" if index > 0
-                xpathExpression += ( ( nIndex > 0 ) ? AND : "" );
-                xpathExpression += contains( parent, TABLE_COLUMN + position( nIndex + 1 ), columnValues[nIndex] );
-            }
-        }
-
-        return xpathExpression;
-    }
-
-    private static String position( int nIndex )
-    {
-        return new String( "[" + nIndex + "]" );
-    }
-
-    private static String contains( String parent, String element, String matchedString )
-    {
-        String finalElement = ( parent != null ) ? parent : "";
-        finalElement += element;
-
-        return contains( finalElement, matchedString );
-    }
-
-    private static String contains( String matchedString )
-    {
-        return contains( ".", matchedString );
-    }
-
-    private static String contains( String axis, String matchedString )
-    {
-        return new String( CONTAINS + "(" + axis + "," + "'" + matchedString + "')" );
-    }
-
-    private static String equals( String parent, String element, String matchedString )
-    {
-        String finalElement = ( parent != null ) ? parent : "";
-        finalElement += element;
-
-        return equals( finalElement, matchedString );
-    }
-
-    private static String equals( String axis, String matchedString )
-    {
-        return new String( axis + "==" + "'" + matchedString + "'" );
-    }
-}
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java
deleted file mode 100644 (file)
index 1cc89ed..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.apache.archiva.web.test.listener;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import com.thoughtworks.selenium.Selenium;
-import org.apache.archiva.web.test.parent.AbstractSeleniumTest;
-import org.apache.commons.io.FileUtils;
-import org.testng.ITestResult;
-import org.testng.TestListenerAdapter;
-
-import java.io.File;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.regex.Pattern;
-
-public class CaptureScreenShotsListener
-    extends TestListenerAdapter
-{
-    @Override
-    public void onTestSkipped( ITestResult tr )
-    {
-        System.out.println( "Test " + tr.getName() + " -> Skipped" );
-        super.onTestSkipped( tr );
-    }
-
-    @Override
-    public void onTestFailure( ITestResult tr )
-    {
-        captureError( tr );
-        System.out.println( "Test " + tr.getName() + " -> Failed" );
-        super.onTestFailure( tr );
-    }
-
-    @Override
-    public void onTestSuccess( ITestResult tr )
-    {
-        System.out.println( "Test " + tr.getName() + " -> Success" );
-        super.onTestFailure( tr );
-    }
-
-    private void captureError( ITestResult tr )
-    {
-        SimpleDateFormat sdf = new SimpleDateFormat( "yyyy.MM.dd-HH_mm_ss" );
-        String time = sdf.format( new Date() );
-        File targetPath = new File( "target", "screenshots" );
-        StackTraceElement stackTrace[] = tr.getThrowable().getStackTrace();
-        String cName = tr.getTestClass().getName();
-        int index = getStackTraceIndexOfCallingClass( cName, stackTrace );
-        String methodName = stackTrace[index].getMethodName();
-        int lNumber = stackTrace[index].getLineNumber();
-        String lineNumber = Integer.toString( lNumber );
-        String className = cName.substring( cName.lastIndexOf( '.' ) + 1 );
-        targetPath.mkdirs();
-        Selenium selenium = AbstractSeleniumTest.getSelenium();
-        String fileBaseName = methodName + "_" + className + ".java_" + lineNumber + "-" + time;
-        try
-        {
-            selenium.windowMaximize();
-            File fileName = new File( targetPath, fileBaseName + ".png" );
-            selenium.captureEntirePageScreenshot( fileName.getAbsolutePath(), "background=#FFFFFF" );
-        }
-        catch ( RuntimeException e )
-        {
-            System.out.println( "Error when take screenshot for test " + tr.getName() + ": " + e.getMessage() );
-        }
-        try
-        {
-            File fileName = new File( targetPath, fileBaseName + ".html" );
-            FileUtils.writeStringToFile( fileName, selenium.getHtmlSource() );
-        }
-        catch ( IOException ioe )
-        {
-            System.out.println( ioe.getMessage() );
-        }
-    }
-
-    private int getStackTraceIndexOfCallingClass( String nameOfClass, StackTraceElement stackTrace[] )
-    {
-        boolean match = false;
-        int i = 0;
-        do
-        {
-            String className = stackTrace[i].getClassName();
-            match = Pattern.matches( nameOfClass, className );
-            i++;
-        }
-        while ( match == false );
-        i--;
-        return i;
-    }
-}
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
deleted file mode 100644 (file)
index 5cfc89a..0000000
+++ /dev/null
@@ -1,803 +0,0 @@
-package org.apache.archiva.web.test.parent;
-
-import org.testng.Assert;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeSuite;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Optional;
-import org.testng.annotations.Parameters;
-
-import java.io.File;
-import java.io.IOException;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-public abstract class AbstractArchivaTest
-    extends AbstractSeleniumTest
-{
-    protected String username;
-
-    protected String fullname;
-
-    @Override
-    @AfterTest
-    public void close()
-        throws Exception
-    {
-        super.close();
-    }
-
-    @Override
-    @BeforeSuite
-    public void open()
-        throws Exception
-    {
-        super.open();
-    }
-
-    public void assertAdminCreated()
-        throws Exception
-    {
-        initializeArchiva( System.getProperty( "baseUrl" ), System.getProperty( "browser" ),
-                           Integer.getInteger( "maxWaitTimeInMs" ), System.getProperty( "seleniumHost" ),
-                           Integer.getInteger( "seleniumPort" ) );
-    }
-
-    @BeforeTest
-    @Parameters( { "baseUrl", "browser", "maxWaitTimeInMs", "seleniumHost", "seleniumPort" } )
-    public void initializeArchiva( String baseUrl, String browser, int maxWaitTimeInMs,
-                                   @Optional( "localhost" ) String seleniumHost, @Optional( "4444" ) int seleniumPort )
-        throws Exception
-    {
-
-        super.open( baseUrl, browser, seleniumHost, seleniumPort, Integer.toString( maxWaitTimeInMs ) );
-
-        getSelenium().open( baseUrl );
-
-        waitPage();
-
-        // if not admin user created create one
-        if ( isElementVisible( "create-admin-link" ) )
-        {
-            Assert.assertFalse( getSelenium().isVisible( "login-link-a" ) );
-            Assert.assertFalse( getSelenium().isVisible( "register-link-a" ) );
-            clickLinkWithLocator( "create-admin-link-a", false );
-            assertCreateAdmin();
-            String fullname = getProperty( "ADMIN_FULLNAME" );
-            String username = getAdminUsername();
-            String mail = getProperty( "ADMIN_EMAIL" );
-            String password = getProperty( "ADMIN_PASSWORD" );
-            submitAdminData( fullname, mail, password );
-            assertUserLoggedIn( username );
-            clickLinkWithLocator( "logout-link-a" );
-        }
-        else
-        {
-            Assert.assertTrue( getSelenium().isVisible( "login-link-a" ) );
-            Assert.assertTrue( getSelenium().isVisible( "register-link-a" ) );
-            login( getAdminUsername(), getAdminPassword() );
-        }
-
-    }
-
-    protected static String getErrorMessageText()
-    {
-        return getSelenium().getText( "//ul[@class='errorMessage']/li/span" );
-    }
-
-    public String getUserEmail()
-    {
-        String email = getProperty( "USERROLE_EMAIL" );
-        return email;
-    }
-
-    public String getUserRolePassword()
-    {
-        String password = getProperty( "USERROLE_PASSWORD" );
-        return password;
-    }
-
-    public String getUserRoleNewPassword()
-    {
-        String password_new = getProperty( "NEW_USERROLE_PASSWORD" );
-        return password_new;
-    }
-
-    public String getBasedir()
-    {
-        String basedir = System.getProperty( "basedir" );
-
-        if ( basedir == null )
-        {
-            basedir = new File( "" ).getAbsolutePath();
-        }
-
-        return basedir;
-    }
-
-    public String getAdminUsername()
-    {
-        String adminUsername = getProperty( "ADMIN_USERNAME" );
-        return adminUsername;
-    }
-
-    public String getAdminPassword()
-    {
-        String adminPassword = getProperty( "ADMIN_PASSWORD" );
-        return adminPassword;
-    }
-
-    public void assertCreateAdmin()
-    {
-        assertElementPresent( "user-create" );
-        assertFieldValue( "admin", "username" );
-        assertElementPresent( "fullname" );
-        assertElementPresent( "password" );
-        assertElementPresent( "confirmPassword" );
-        assertElementPresent( "email" );
-    }
-
-    public void submitAdminData( String fullname, String email, String password )
-    {
-        setFieldValue( "fullname", fullname );
-        setFieldValue( "email", email );
-        setFieldValue( "password", password );
-        setFieldValue( "confirmPassword", password );
-        clickButtonWithLocator( "user-create-form-register-button" );
-        //submit();
-    }
-
-    // Go to Login Page
-    public void goToLoginPage()
-    {
-        getSelenium().open( baseUrl );
-        waitPage();
-        // are we already logged in ?
-        if ( isElementVisible( "logout-link" ) ) //isElementPresent( "logoutLink" ) )
-        {
-            // so logout
-            clickLinkWithLocator( "logout-link-a", false );
-            clickLinkWithLocator( "login-link-a" );
-        }
-        else if ( isElementVisible( "login-link-a" ) )
-        {
-            clickLinkWithLocator( "login-link-a" );
-        }
-        assertLoginModal();
-    }
-
-    public void submitUserData( String username, String password, boolean rememberme, boolean success )
-    {
-
-        setFieldValue( "username", username );
-        setFieldValue( "password", password );
-        if ( rememberme )
-        {
-            checkField( "rememberMe" );
-        }
-
-        submit();
-        if ( success )
-        {
-            assertUserLoggedIn( username );
-        }
-        else
-        {
-            assertLoginModal();
-        }
-    }
-
-    public void assertLoginModal()
-    {
-        assertElementPresent( "user-login-form" );
-        Assert.assertTrue( isElementVisible( "register-link" ) );
-        assertElementPresent( "user-login-form-username" );
-        assertElementPresent( "user-login-form-password" );
-        assertButtonWithIdPresent( "modal-login-ok" );
-    }
-
-    // User Management
-    public void goToUserManagementPage()
-    {
-        getSelenium().open( "/archiva/security/userlist.action" );
-        assertUserManagementPage();
-    }
-
-    public void assertUserManagementPage()
-    {
-        assertPage( "Apache Archiva \\ [Admin] User List" );
-        assertTextPresent( "[Admin] List of Users in Role: Any" );
-        assertTextPresent( "Navigation" );
-        assertImgWithAlt( "First" );
-        assertImgWithAlt( "Prev" );
-        assertImgWithAlt( "Next" );
-        assertImgWithAlt( "Last" );
-        assertTextPresent( "Display Rows" );
-        assertTextPresent( "Username" );
-        assertTextPresent( "Full Name" );
-        assertTextPresent( "Email" );
-        assertTextPresent( "Permanent" );
-        assertTextPresent( "Validated" );
-        assertTextPresent( "Locked" );
-        assertTextPresent( "Tasks" );
-        assertTextPresent( "Tools" );
-        assertTextPresent( "Tasks" );
-        assertTextPresent( "The following tools are available for administrators to manipulate the user list." );
-        assertButtonWithValuePresent( "Create New User" );
-        assertButtonWithValuePresent( "Show Users In Role" );
-        assertElementPresent( "roleName" );
-        assertTextPresent( "Reports" );
-        assertTextPresent( "Name" );
-        assertTextPresent( "Types" );
-        assertTextPresent( "User List" );
-        assertTextPresent( "Roles Matrix" );
-    }
-
-    /*
-     * //User Role public void goToUserRolesPage() { clickLinkWithText( "User Roles" ); assertUserRolesPage(); }
-     */
-
-    public void assertUserRolesPage()
-    {
-        //assertPage( "Apache Archiva \\ [Admin] User Edit" );
-        //[Admin] Rôles de l'utilisateur
-
-        assertTextPresent( "[Admin] User Roles", "[Admin] R\u00F4les de l'utilisateur" );
-        assertTextPresent( "Username", "Nom d'utilisateur" );
-        assertTextPresent( "Full Name", "Nom complet" );
-        String userRoles =
-            "Guest,Registered User,System Administrator,User Administrator,Global Repository Observer,Global Repository Manager,Repository Observer,Repository Manager,internal";
-        String[] arrayRole = userRoles.split( "," );
-        for ( String userroles : arrayRole )
-        {
-            assertTextPresent( userroles );
-        }
-    }
-
-    public void assertDeleteUserPage( String username )
-    {
-        assertTextPresent( "[Admin] User Delete", "[Admin] Suppression de l'utilisateur",
-                           "L'utilisateur suivant va \u00EAtre supprim\u00E9:" );
-        assertTextPresent( "The following user will be deleted:" );
-        assertTextPresent( "Username: " + username, "Nom d'utilisateur:" + username );
-        assertButtonWithIdPresent( "userDeleteSubmit" );
-    }
-
-    public void createUser( String userName, String fullName, String email, String password, boolean valid )
-    {
-        createUser( userName, fullName, email, password, password, valid );
-    }
-
-    private void createUser( String userName, String fullName, String emailAd, String password, String confirmPassword,
-                             boolean valid )
-    {
-
-        clickLinkWithLocator( "menu-users-list-a", true );
-        clickLinkWithLocator( "users-view-tabs-li-user-edit-a", true );
-
-        assertCreateUserPage();
-        setFieldValue( "username", userName );
-        setFieldValue( "fullname", fullName );
-        setFieldValue( "email", emailAd );
-        setFieldValue( "password", password );
-        setFieldValue( "confirmPassword", confirmPassword );
-
-        clickLinkWithLocator( "user-create-form-register-button", true );
-
-        assertTextPresent( "User " + userName + " created." );
-        assertElementPresent( "users-grid-user-id-" + userName );
-
-        if ( valid )
-        {
-            //String[] columnValues = { userName, fullName, emailAd };
-            //assertElementPresent( XPathExpressionUtil.getTableRow( columnValues ) );
-
-        }
-        else
-        {
-            assertCreateUserPage();
-        }
-    }
-
-    public void deleteUser( String userName, String fullName, String emailAdd )
-    {
-        deleteUser( userName, fullName, emailAdd, false, false );
-    }
-
-    public void deleteUser( String userName, String fullName, String emailAd, boolean validated, boolean locked )
-    {
-        clickLinkWithLocator( "menu-users-list-a", true );
-        assertTextPresent( userName );
-        assertTextPresent( fullName );
-
-        clickLinkWithLocator( "users-grid-delete-" + userName );
-
-        clickLinkWithLocator( "dialog-confirm-modal-ok" );
-        assertTextPresent( "User " + userName + " deleted." );
-
-        clickLinkWithLocator( "alert-message-success-close-a" );
-
-        assertElementNotPresent( "users-grid-user-id-" + userName );
-        assertTextNotPresent( fullName );
-
-
-    }
-
-    public void login( String username, String password )
-    {
-        login( username, password, true, "Login Page" );
-    }
-
-    public void login( String username, String password, boolean valid, String assertReturnPage )
-    {
-        if ( isElementVisible( "login-link-a" ) )//isElementPresent( "loginLink" ) )
-        {
-            goToLoginPage();
-
-            submitLoginPage( username, password, false, valid, assertReturnPage );
-        }
-        if ( valid )
-        {
-            assertUserLoggedIn( username );
-        }
-    }
-
-    public void submitLoginPage( String username, String password )
-    {
-        submitLoginPage( username, password, false, true, "Login Page" );
-    }
-
-    public void submitLoginPage( String username, String password, boolean validUsernamePassword )
-    {
-        submitLoginPage( username, password, false, validUsernamePassword, "Login Page" );
-    }
-
-    public void submitLoginPage( String username, String password, boolean rememberMe, boolean validUsernamePassword,
-                                 String assertReturnPage )
-    {
-        clickLinkWithLocator( "login-link-a", false );
-        setFieldValue( "user-login-form-username", username );
-        setFieldValue( "user-login-form-password", password );
-        /*
-        if ( rememberMe )
-        {
-            checkField( "rememberMe" );
-        }*/
-
-        clickButtonWithLocator( "modal-login-ok" );
-        if ( validUsernamePassword )
-        {
-            assertUserLoggedIn( username );
-        }
-        /*
-        else
-        {
-            if ( "Login Page".equals( assertReturnPage ) )
-            {
-                assertLoginPage();
-            }
-            else
-            {
-                assertPage( assertReturnPage );
-            }
-        }*/
-    }
-
-    protected void assertUserLoggedIn( String username )
-    {
-        Assert.assertFalse( isElementVisible( "login-link" ) );
-        Assert.assertTrue( isElementVisible( "logout-link" ) );
-        Assert.assertFalse( isElementVisible( "register-link" ) );
-        Assert.assertFalse( isElementVisible( "create-admin-link" ) );
-    }
-
-    // User Roles
-    public void assertUserRoleCheckBoxPresent( String value )
-    {
-        getSelenium().isElementPresent(
-            "xpath=//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='" + value
-                + "']" );
-    }
-
-    public void assertResourceRolesCheckBoxPresent( String value )
-    {
-        getSelenium().isElementPresent( "xpath=//input[@name='addDSelectedRoles' and @value='" + value + "']" );
-    }
-
-    public void checkUserRoleWithValue( String value )
-    {
-        assertUserRoleCheckBoxPresent( value );
-        getSelenium().click(
-            "xpath=//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='" + value
-                + "']" );
-    }
-
-    public void checkResourceRoleWithValue( String value )
-    {
-        assertResourceRolesCheckBoxPresent( value );
-        getSelenium().click( "xpath=//input[@name='addDSelectedRoles' and @value='" + value + "']" );
-    }
-
-    public void changePassword( String oldPassword, String newPassword )
-    {
-        assertPage( "Apache Archiva \\ Change Password" );
-        setFieldValue( "existingPassword", oldPassword );
-        setFieldValue( "newPassword", newPassword );
-        setFieldValue( "newPasswordConfirm", newPassword );
-        clickButtonWithValue( "Change Password" );
-    }
-
-    public void assertCreateUserPage()
-    {
-        assertTextPresent( "Username" );
-        assertElementPresent( "username" );
-        assertTextPresent( "Full Name" );
-        assertElementPresent( "fullname" );
-        assertTextPresent( "Email Address" );
-        assertElementPresent( "email" );
-        assertTextPresent( "Password" );
-        assertElementPresent( "password" );
-        assertTextPresent( "Confirm Password" );
-        assertElementPresent( "confirmPassword" );
-        assertButtonWithIdPresent( "user-create-form-register-button" );
-
-    }
-
-    public void assertLeftNavMenuWithRole( String role )
-    {
-        if ( role.equals( "Guest" ) || role.equals( "Registered User" ) || role.equals( "Global Repository Observer" )
-            || role.equals( "Repository Observer - internal" ) || role.equals( "Repository Observer - snapshots" ) )
-        {
-            assertTextPresent( "Search" );
-            assertLinkPresent( "Find Artifact" );
-            assertLinkPresent( "Browse" );
-            assertLinkNotPresent( "Repositories" );
-        }
-        else if ( role.equals( "User Administrator" ) )
-        {
-            assertTextPresent( "Search" );
-            assertLinkPresent( "Find Artifact" );
-            assertLinkPresent( "Browse" );
-            assertLinkPresent( "User Management" );
-            assertLinkPresent( "User Roles" );
-            assertLinkNotPresent( "Repositories" );
-        }
-        else if ( role.equals( "Global Repository Manager" ) || role.equals( "Repository Manager - internal" )
-            || role.equals( "Repository Manager - snapshots" ) )
-        {
-            assertTextPresent( "Search" );
-            assertLinkPresent( "Find Artifact" );
-            assertLinkPresent( "Browse" );
-            assertLinkPresent( "Upload Artifact" );
-            assertLinkPresent( "Delete Artifact" );
-            assertLinkNotPresent( "Repositories" );
-        }
-        else
-        {
-            assertTextPresent( "Search" );
-            String navMenu =
-                "Find Artifact,Browse,Reports,User Management,User Roles,Appearance,Upload Artifact,Delete Artifact,Repository Groups,Repositories,Proxy Connectors,Legacy Support,Network Proxies,Repository Scanning";
-            String[] arrayMenu = navMenu.split( "," );
-            for ( String navmenu : arrayMenu )
-            {
-                assertLinkPresent( navmenu );
-            }
-        }
-    }
-
-    // Find Artifact
-    public void goToFindArtifactPage()
-    {
-        getSelenium().open( "/archiva/findArtifact.action" );
-        assertFindArtifactPage();
-    }
-
-    public void assertFindArtifactPage()
-    {
-        //assertPage( "Apache Archiva \\ Find Artifact" );
-        assertElementPresent( "searchBox" );
-        //assertTextPresent( "Find Artifact" );
-        //assertTextPresent( "Search for:" );
-        //assertTextPresent( "Checksum:" );
-        assertElementPresent( "quickSearchBox" );
-        assertElementPresent( "checksumSearch" );
-        //assertButtonWithValuePresent( "Search" );
-        assertElementPresent( "checksumSearch_0" );
-    }
-
-    // Appearance
-    public void goToAppearancePage()
-    {
-        getSelenium().open( "/archiva/admin/configureAppearance.action" );
-        assertAppearancePage();
-    }
-
-    public void assertAppearancePage()
-    {
-        assertPage( "Apache Archiva \\ Configure Appearance" );
-        String appearance =
-            "Appearance,Organization Details,The logo in the top right of the screen is controlled by the following settings.,Organization Information,Name,URL,Logo URL";
-        String[] arrayAppearance = appearance.split( "," );
-        for ( String appear : arrayAppearance )
-        {
-            assertTextPresent( appear );
-        }
-        assertLinkPresent( "Edit" );
-        assertLinkPresent( "Change your appearance" );
-    }
-
-    public void addEditAppearance( String name, String url, String logoUrl, boolean wait )
-    {
-        setFieldValue( "organisationName", name );
-        setFieldValue( "organisationUrl", url );
-        setFieldValue( "organisationLogo", logoUrl );
-        clickButtonWithValue( "Save", wait );
-    }
-
-    public void goToHomePage()
-    {
-        getSelenium().open( baseUrl );
-    }
-
-    // Upload Artifact
-    public void goToAddArtifactPage()
-    {
-        // must be logged as admin
-        getSelenium().open( "/archiva/upload.action" );
-        assertAddArtifactPage();
-    }
-
-    public void assertAddArtifactPage()
-    {
-        assertPage( "Apache Archiva \\ Upload Artifact" );
-        assertTextPresent( "Upload Artifact" );
-
-        String artifact =
-            "Upload Artifact,Group Id*:,Artifact Id*:,Version*:,Packaging*:,Classifier:,Generate Maven 2 POM,Artifact File*:,POM File:,Repository Id:";
-        String[] arrayArtifact = artifact.split( "," );
-        for ( String arrayartifact : arrayArtifact )
-        {
-            assertTextPresent( arrayartifact );
-        }
-
-        String artifactElements =
-            "upload_groupId,upload_artifactId,upload_version,upload_packaging,upload_classifier,upload_generatePom,upload_artifact,upload_pom,upload_repositoryId,uploadSubmit";
-        String[] arrayArtifactElements = artifactElements.split( "," );
-        for ( String artifactelements : arrayArtifactElements )
-        {
-            assertElementPresent( artifactelements );
-        }
-    }
-
-    public void addArtifact( String groupId, String artifactId, String version, String packaging,
-                             String artifactFilePath, String repositoryId, boolean wait )
-    {
-        addArtifact( groupId, artifactId, version, packaging, true, artifactFilePath, repositoryId, wait );
-    }
-
-    public void addArtifact( String groupId, String artifactId, String version, String packaging, boolean generatePom,
-                             String artifactFilePath, String repositoryId, boolean wait )
-    {
-        login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) );
-        goToAddArtifactPage();
-        setFieldValue( "groupId", groupId );
-        setFieldValue( "artifactId", artifactId );
-        setFieldValue( "version", version );
-        setFieldValue( "packaging", packaging );
-
-        if ( generatePom )
-        {
-            checkField( "generatePom" );
-        }
-
-        String path;
-        if ( artifactFilePath != null && artifactFilePath.trim().length() > 0 )
-        {
-            File f = new File( artifactFilePath );
-            try
-            {
-                path = f.getCanonicalPath();
-            }
-            catch ( IOException e )
-            {
-                path = f.getAbsolutePath();
-            }
-        }
-        else
-        {
-            path = artifactFilePath;
-        }
-
-        setFieldValue( "artifact", path );
-        selectValue( "upload_repositoryId", repositoryId );
-
-        //clickButtonWithValue( "Submit" );
-        clickButtonWithLocator( "uploadSubmit", wait );
-    }
-
-    public void goToRepositoriesPage()
-    {
-        if ( !getTitle().equals( "Apache Archiva \\ Administration - Repositories" ) )
-        {
-            getSelenium().open( "/archiva/admin/repositories.action" );
-        }
-        assertRepositoriesPage();
-    }
-
-    public void assertRepositoriesPage()
-    {
-        assertPage( "Apache Archiva \\ Administration - Repositories" );
-        assertTextPresent( "Administration - Repositories" );
-        assertTextPresent( "Managed Repositories" );
-        assertTextPresent( "Remote Repositories" );
-    }
-
-    public void addManagedRepository( String identifier, String name, String directory, String indexDirectory,
-                                      String type, String cron, String daysOlder, String retentionCount, boolean wait )
-    {
-        // goToRepositoriesPage();
-        // clickLinkWithText( "Add" );
-        setFieldValue( "repository.id", identifier );
-        setFieldValue( "repository.name", name );
-        setFieldValue( "repository.location", directory );
-        setFieldValue( "repository.indexDirectory", indexDirectory );
-        selectValue( "repository.layout", type );
-        setFieldValue( "repository.cronExpression", cron );
-        setFieldValue( "repository.daysOlder", daysOlder );
-        setFieldValue( "repository.retentionCount", retentionCount );
-        // TODO
-        clickButtonWithValue( "Add Repository", wait );
-    }
-
-    // artifact management
-    public void assertDeleteArtifactPage()
-    {
-        assertPage( "Apache Archiva \\ Delete Artifact" );
-        assertTextPresent( "Delete Artifact" );
-        assertTextPresent( "Group Id*:" );
-        assertTextPresent( "Artifact Id*:" );
-        assertTextPresent( "Version*:" );
-        assertTextPresent( "Repository Id:" );
-        assertElementPresent( "groupId" );
-        assertElementPresent( "artifactId" );
-        assertElementPresent( "version" );
-        assertElementPresent( "repositoryId" );
-        assertButtonWithValuePresent( "Submit" );
-    }
-
-    // network proxies
-    public void goToNetworkProxiesPage()
-    {
-        clickLinkWithText( "Network Proxies" );
-        assertNetworkProxiesPage();
-    }
-
-    public void assertNetworkProxiesPage()
-    {
-        assertPage( "Apache Archiva \\ Administration - Network Proxies" );
-        assertTextPresent( "Administration - Network Proxies" );
-        assertTextPresent( "Network Proxies" );
-        assertLinkPresent( "Add Network Proxy" );
-    }
-
-    public void addNetworkProxy( String identifier, String protocol, String hostname, String port, String username,
-                                 String password )
-    {
-        //goToNetworkProxiesPage();
-        clickLinkWithText( "Add Network Proxy" );
-        assertAddNetworkProxy();
-        setFieldValue( "proxy.id", identifier );
-        setFieldValue( "proxy.protocol", protocol );
-        setFieldValue( "proxy.host", hostname );
-        setFieldValue( "proxy.port", port );
-        setFieldValue( "proxy.username", username );
-        setFieldValue( "proxy.password", password );
-        clickButtonWithValue( "Save Network Proxy" );
-    }
-
-    public void assertAddNetworkProxy()
-    {
-        assertPage( "Apache Archiva \\ Admin: Add Network Proxy" );
-        assertTextPresent( "Admin: Add Network Proxy" );
-        assertTextPresent( "Add network proxy:" );
-        assertTextPresent( "Identifier*:" );
-        assertTextPresent( "Protocol*:" );
-        assertTextPresent( "Hostname*:" );
-        assertTextPresent( "Port*:" );
-        assertTextPresent( "Username:" );
-        assertTextPresent( "Password:" );
-        assertButtonWithValuePresent( "Save Network Proxy" );
-    }
-
-    // Legacy Support
-    public void goToLegacySupportPage()
-    {
-        getSelenium().open( "/archiva/admin/legacyArtifactPath.action" );
-        assertLegacySupportPage();
-    }
-
-    public void assertLegacySupportPage()
-    {
-        assertPage( "Apache Archiva \\ Administration - Legacy Support" );
-        assertTextPresent( "Administration - Legacy Artifact Path Resolution" );
-        assertTextPresent( "Path Mappings" );
-        assertLinkPresent( "Add" );
-    }
-
-    public void addLegacyArtifactPath( String path, String groupId, String artifactId, String version,
-                                       String classifier, String type, boolean wait )
-    {
-        assertAddLegacyArtifactPathPage();
-        setFieldValue( "legacyArtifactPath.path", path );
-        setFieldValue( "groupId", groupId );
-        setFieldValue( "artifactId", artifactId );
-        setFieldValue( "version", version );
-        setFieldValue( "classifier", classifier );
-        setFieldValue( "type", type );
-        clickButtonWithValue( "Add Legacy Artifact Path", wait );
-    }
-
-    public void assertAddLegacyArtifactPathPage()
-    {
-        assertPage( "Apache Archiva \\ Admin: Add Legacy Artifact Path" );
-        assertTextPresent( "Admin: Add Legacy Artifact Path" );
-        assertTextPresent(
-            "Enter the legacy path to map to a particular artifact reference, then adjust the fields as necessary." );
-        String element =
-            "addLegacyArtifactPath_legacyArtifactPath_path,addLegacyArtifactPath_groupId,addLegacyArtifactPath_artifactId,addLegacyArtifactPath_version,addLegacyArtifactPath_classifier,addLegacyArtifactPath_type";
-        String[] arrayElement = element.split( "," );
-        for ( String arrayelement : arrayElement )
-        {
-            assertElementPresent( arrayelement );
-        }
-        assertButtonWithValuePresent( "Add Legacy Artifact Path" );
-    }
-
-    // add managed repository and its staging repository
-    public void addStagingRepository( String identifier, String name, String directory, String indexDirectory,
-                                      String type, String cron, String daysOlder, String retentionCount )
-    {
-        setFieldValue( "repository.id", identifier );
-        setFieldValue( "repository.name", name );
-        setFieldValue( "repository.location", directory );
-        setFieldValue( "repository.indexDirectory", indexDirectory );
-        selectValue( "repository.layout", type );
-        setFieldValue( "repository.cronExpression", cron );
-        setFieldValue( "repository.daysOlder", daysOlder );
-        setFieldValue( "repository.retentionCount", retentionCount );
-        checkField( "stageNeeded" );
-
-        clickButtonWithValue( "Add Repository" );
-    }
-
-    protected void logout()
-    {
-        clickLinkWithText( "Logout" );
-        assertTextNotPresent( "Current User:" );
-        assertLinkNotVisible( "Edit Details" );
-        assertLinkNotVisible( "Logout" );
-        assertLinkVisible( "Login" );
-    }
-
-    protected String getAdminUserName()
-    {
-        return getProperty( "ADMIN_FULLNAME" );
-    }
-}
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java
deleted file mode 100644 (file)
index 5869a06..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-package org.apache.archiva.web.test.parent;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-public abstract class AbstractArtifactManagementTest
-    extends AbstractArchivaTest
-{
-
-    public String getGroupId()
-    {
-        String groupId = getProperty( "GROUPID" );
-        return groupId;
-    }
-
-    public String getArtifactId()
-    {
-        String artifactId = getProperty( "ARTIFACTID" );
-        return artifactId;
-    }
-
-    public String getVersion()
-    {
-        String version = getProperty( "VERSION" );
-        return version;
-    }
-
-    public String getPackaging()
-    {
-        String packaging = getProperty( "PACKAGING" );
-        return packaging;
-    }
-
-    public String getArtifactFilePath()
-    {
-        return "src/test/resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar";
-    }
-
-    public String getRepositoryId()
-    {
-        String repositoryId = getProperty( "REPOSITORYID" );
-        return repositoryId;
-    }
-
-    public void goToDeleteArtifactPage()
-    {
-        login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) );
-        getSelenium().open( "/archiva/deleteArtifact.action" );
-        assertDeleteArtifactPage();
-    }
-
-    public void deleteArtifact( String groupId, String artifactId, String version, String repositoryId )
-    {
-        deleteArtifact( groupId, artifactId, version, repositoryId, false );
-    }
-
-    public void deleteArtifact( String groupId, String artifactId, String version, String repositoryId, boolean wait )
-    {
-        goToDeleteArtifactPage();
-        setFieldValue( "groupId", groupId );
-        setFieldValue( "artifactId", artifactId );
-        setFieldValue( "version", version );
-        selectValue( "repositoryId", repositoryId );
-        clickButtonWithValue( "Submit", wait );
-    }
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactReportsTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactReportsTest.java
deleted file mode 100644 (file)
index e026f78..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.apache.archiva.web.test.parent;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-public abstract class AbstractArtifactReportsTest
-    extends AbstractArchivaTest
-{
-
-    // Reports
-    public void goToReportsPage()
-    {
-        getSelenium().open( "/archiva/report/pickReport.action" );
-        assertReportsPage();
-    }
-
-    public void assertReportsPage()
-    {
-        assertPage( "Apache Archiva \\ Reports" );
-        assertTextPresent( "Reports" );
-        assertTextPresent( "Repository Statistics" );
-        assertTextPresent( "Repositories To Be Compared" );
-        assertElementPresent( "availableRepositories" );
-        assertButtonWithValuePresent( "v" );
-        assertButtonWithValuePresent( "^" );
-        assertButtonWithValuePresent( "<-" );
-        assertButtonWithValuePresent( "->" );
-        assertButtonWithValuePresent( "<<--" );
-        assertButtonWithValuePresent( "-->>" );
-        assertButtonWithValuePresent( "<*>" );
-        assertElementPresent( "selectedRepositories" );
-        assertButtonWithValuePresent( "v" );
-        assertButtonWithValuePresent( "^" );
-        assertTextPresent( "Row Count" );
-        assertElementPresent( "rowCount" );
-        assertTextPresent( "Start Date" );
-        assertElementPresent( "startDate" );
-        assertTextPresent( "End Date" );
-        assertElementPresent( "endDate" );
-        assertButtonWithValuePresent( "View Statistics" );
-        assertTextPresent( "Repository Health" );
-        assertTextPresent( "Row Count" );
-        assertElementPresent( "rowCount" );
-        assertTextPresent( "Group ID" );
-        assertElementPresent( "groupId" );
-        assertTextPresent( "Repository ID" );
-        assertElementPresent( "repositoryId" );
-        assertButtonWithValuePresent( "Show Report" );
-    }
-
-    public void compareRepositories( String labelSelected, String startDate, String endDate )
-    {
-        goToReportsPage();
-        getSelenium().removeSelection( "generateStatisticsReport_availableRepositories", labelSelected );
-        clickButtonWithValue( "->", false );
-        getSelenium().type( "startDate", startDate );
-        // clickLinkWithLocator( "1" , false );
-        // getSelenium().click( "endDate" );
-        getSelenium().type( "endDate", endDate );
-        // clickLinkWithLocator( "30" , false );
-        clickButtonWithValue( "View Statistics" );
-    }
-
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractBrowseTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractBrowseTest.java
deleted file mode 100644 (file)
index 2b4fc11..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.apache.archiva.web.test.parent;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-public abstract class AbstractBrowseTest
-    extends AbstractArchivaTest
-{
-
-    // Browse
-    public void goToBrowsePage()
-    {
-        getSelenium().open( "/archiva/browse" );
-        assertBrowsePage();
-    }
-
-    public void assertBrowsePage()
-    {
-        assertPage( "Apache Archiva \\ Browse Repository" );
-        assertTextPresent( "Browse Repository" );
-        assertTextPresent( "Groups" );
-    }
-
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractMergingRepositoriesTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractMergingRepositoriesTest.java
deleted file mode 100644 (file)
index 91af2cf..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.apache.archiva.web.test.parent;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-
-public class AbstractMergingRepositoriesTest
-    extends AbstractArchivaTest
-{
-
-    public void goToAuditLogReports()
-    {
-        getSelenium().open( "/archiva/report/queryAuditLogReport.action" );
-    }
-
-    public String getRepositoryDir()
-    {
-        File f = new File( "" );
-        String artifactFilePath = f.getAbsolutePath();
-        return artifactFilePath + "/target/";
-    }
-
-    public void editManagedRepository()
-    {
-        goToRepositoriesPage();
-        clickLinkWithXPath( "//div[@id='contentArea']/div/div[5]/div[1]/a[1]/img" );
-        assertPage( "Apache Archiva \\ Admin: Edit Managed Repository" );
-        checkField( "repository.blockRedeployments" );
-        clickButtonWithValue( "Update Repository" );
-    }
-
-    public String getGroupId()
-    {
-        return getProperty( "VALIDARTIFACT_GROUPID" );
-    }
-
-    public String getArtifactId()
-    {
-        return getProperty( "VALIDARTIFACT_ARTIFACTID" );
-    }
-
-    public String getVersion()
-    {
-        return getProperty( "VERSION" );
-    }
-
-    public String getPackaging()
-    {
-        return getProperty( "PACKAGING" );
-    }
-
-    public String getValidArtifactFilePath()
-    {
-        return "src/test/resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar";
-    }
-
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java
deleted file mode 100644 (file)
index a1214ac..0000000
+++ /dev/null
@@ -1,358 +0,0 @@
-package org.apache.archiva.web.test.parent;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import org.testng.Assert;
-
-public abstract class AbstractRepositoryTest
-    extends AbstractArchivaTest
-{
-    // Repository Groups
-    public void goToRepositoryGroupsPage()
-    {
-        if ( !getTitle().equals( "Apache Archiva \\ Administration - Repository Groups" ) )
-        {
-            getSelenium().open( "/archiva/admin/repositoryGroups.action" );
-        }
-        assertRepositoryGroupsPage();
-    }
-
-    public void assertRepositoryGroupsPage()
-    {
-        assertPage( "Apache Archiva \\ Administration - Repository Groups" );
-        assertTextPresent( "Administration - Repository Groups" );
-        assertTextPresent( "Identifier*:" );
-        assertElementPresent( "repositoryGroup.id" );
-        assertButtonWithValuePresent( "Add Group" );
-        assertTextPresent( "Repository Groups" );
-    }
-
-    public void assertAddedRepositoryLink( String repositoryGroupName )
-    {
-        assertPage( "Apache Archiva \\ Administration - Repository Groups" );
-        String repositoryGroupUrlValue = "repository/" + repositoryGroupName + "/";
-        String baseUrlValue = "archiva";
-        String repositoryGroupLink = baseUrl.replaceFirst( baseUrlValue, repositoryGroupUrlValue );
-        assertTextPresent( repositoryGroupLink );
-    }
-
-    public void assertAddedRepositoryToRepositoryGroups( String repositoryName )
-    {
-        assertPage( "Apache Archiva \\ Administration - Repository Groups" );
-        assertTextPresent( repositoryName );
-        assertTextPresent( "Archiva Managed Internal Repository" );
-        assertAddedRepositoryLink( repositoryName );
-    }
-
-    public void assertDeleteRepositoryGroupPage( String repositoryName )
-    {
-        assertPage( "Apache Archiva \\ Admin: Delete Repository Group" );
-        assertTextPresent( "WARNING: This operation can not be undone." );
-        assertTextPresent( "Are you sure you want to delete the following repository group?" );
-        assertTextPresent( "ID:" );
-        assertTextPresent( repositoryName );
-        assertButtonWithValuePresent( "Confirm" );
-        assertButtonWithValuePresent( "Cancel" );
-    }
-
-    public void addRepositoryGroup( String repoGroupName, boolean wait )
-    {
-        goToRepositoryGroupsPage();
-        setFieldValue( "repositoryGroup.id", repoGroupName );
-        clickButtonWithValue( "Add Group", wait );
-    }
-
-    public void addRepositoryToRepositoryGroup( String repositoryGroupName, String repositoryName )
-    {
-        goToRepositoryGroupsPage();
-        String s = getSelenium().getBodyText();
-        if ( s.contains( "No Repository Groups Defined." ) )
-        {
-            setFieldValue( "repositoryGroup.id", repositoryGroupName );
-            clickButtonWithValue( "Add Group" );
-            // assertAddedRepositoryLink( repositoryGroupName );
-
-            selectValue( "addRepositoryToGroup_repoId", repositoryName );
-            clickButtonWithValue( "Add Repository" );
-            assertAddedRepositoryToRepositoryGroups( repositoryName );
-        }
-        else
-        {
-            // assertAddedRepositoryLink( repositoryGroupName );
-            selectValue( "addRepositoryToGroup_repoId", repositoryName );
-            clickButtonWithValue( "Add Repository" );
-        }
-    }
-
-    public void deleteRepositoryInRepositoryGroups()
-    {
-        goToRepositoryGroupsPage();
-        getSelenium().click( "xpath=//div[@id='contentArea']/div[2]/div/div[3]/div[1]/a/img" );
-        waitPage();
-    }
-
-    public void deleteRepositoryGroup( String repositoryName )
-    {
-        getSelenium().click( "xpath=//div[@id='contentArea']/div[2]/div/div[1]/div/a/img" );
-        waitPage();
-        assertDeleteRepositoryGroupPage( repositoryName );
-        clickButtonWithValue( "Confirm" );
-    }
-
-    // /////////////////////////////
-    // proxy connectors
-    // /////////////////////////////
-    public void goToProxyConnectorsPage()
-    {
-        clickLinkWithText( "Proxy Connectors" );
-        assertProxyConnectorsPage();
-    }
-
-    public void assertProxyConnectorsPage()
-    {
-        assertPage( "Apache Archiva \\ Administration - Proxy Connectors" );
-        assertTextPresent( "Administration - Proxy Connectors" );
-        assertTextPresent( "Repository Proxy Connectors" );
-        assertTextPresent( "internal" );
-        assertTextPresent( "Archiva Managed Internal Repository" );
-        assertTextPresent( "Proxy Connector" );
-        assertTextPresent( "Central Repository" );
-    }
-
-    public void assertAddProxyConnectorPage()
-    {
-        assertPage( "Apache Archiva \\ Admin: Add Proxy Connector" );
-        assertTextPresent( "Admin: Add Proxy Connector" );
-        String proxy =
-            "Network Proxy*:,Managed Repository*:,Remote Repository*:,Policies:,Return error when:,On remote error:,Releases:,Snapshots:,Checksum:,Cache failures:,Properties:,No properties have been set.,Black List:,No black list patterns have been set.,White List:,No white list patterns have been set.";
-        String[] arrayProxy = proxy.split( "," );
-        for ( String arrayproxy : arrayProxy )
-            assertTextPresent( arrayproxy );
-        /*
-         * String proxyElements =
-         * "addProxyConnector_connector_proxyId,addProxyConnector_connector_sourceRepoId,addProxyConnector_connector_targetRepoId,policy_propagate-errors-on-update,policy_propagate-errors,policy_releases,policy_snapshots,policy_checksum,policy_cache-failures,propertiesEntry,propertiesValue,blackListEntry,whiteListEntry"
-         * ; String[] arrayProxyElements = proxyElements.split( "," ); for ( String arrayproxyelements :
-         * arrayProxyElements ) assertTextPresent( arrayproxyelements );
-         */
-        assertButtonWithValuePresent( "Add Property" );
-        assertButtonWithValuePresent( "Add Pattern" );
-        assertButtonWithValuePresent( "Add Proxy Connector" );
-    }
-
-    // this only fills in the values of required fields in adding Proxy Connectors
-    public void addProxyConnector( String networkProxy, String managedRepo, String remoteRepo )
-    {
-        goToProxyConnectorsPage();
-        clickLinkWithText( "Add" );
-        assertAddProxyConnectorPage();
-        selectValue( "connector.proxyId", networkProxy );
-        selectValue( "connector.sourceRepoId", managedRepo );
-        selectValue( "connector.targetRepoId", remoteRepo );
-        clickButtonWithValue( "Add Proxy Connector" );
-    }
-
-    public void deleteProxyConnector()
-    {
-        goToProxyConnectorsPage();
-        clickLinkWithXPath( "//div[@id='contentArea']/div[2]/div[1]/div[2]/div[1]/a[3]/img" );
-        assertPage( "Apache Archiva \\ Admin: Delete Proxy Connectors" );
-        clickButtonWithValue( "Delete" );
-        assertPage( "Apache Archiva \\ Administration - Proxy Connectors" );
-    }
-
-    // /////////////////////////////
-    // network proxies
-    // /////////////////////////////
-
-    public void editNetworkProxies( String fieldName, String value )
-    {
-        // goToNetworkProxiesPage();
-        clickLinkWithText( "Edit Network Proxy" );
-        setFieldValue( fieldName, value );
-        clickButtonWithValue( "Save Network Proxy" );
-    }
-
-    public void deleteNetworkProxy()
-    {
-        // goToNetworkProxiesPage();
-        clickLinkWithText( "Delete Network Proxy" );
-        assertPage( "Apache Archiva \\ Admin: Delete Network Proxy" );
-        assertTextPresent( "WARNING: This operation can not be undone." );
-        clickButtonWithValue( "Delete" );
-    }
-
-    // remote repositories
-    public void assertAddRemoteRepository()
-    {
-        assertPage( "Apache Archiva \\ Admin: Add Remote Repository" );
-        String remote = "Identifier*:,Name*:,URL*:,Username:,Password:,Timeout in seconds:,Type:";
-        String[] arrayRemote = remote.split( "," );
-        for ( String arrayremote : arrayRemote )
-            assertTextPresent( arrayremote );
-        String remoteElements =
-            "addRemoteRepository_repository_id,addRemoteRepository_repository_name,addRemoteRepository_repository_url,addRemoteRepository_repository_userName,addRemoteRepository_repository_password,addRemoteRepository_repository_timeout,addRemoteRepository_repository_layout";
-        String[] arrayRemoteElements = remoteElements.split( "," );
-        for ( String arrayremotelement : arrayRemoteElements )
-            assertElementPresent( arrayremotelement );
-    }
-
-    public void assertDeleteRemoteRepositoryPage()
-    {
-        assertPage( "Apache Archiva \\ Admin: Delete Remote Repository" );
-        assertTextPresent( "Admin: Delete Remote Repository" );
-        assertTextPresent( "WARNING: This operation can not be undone." );
-        assertTextPresent( "Are you sure you want to delete the following remote repository?" );
-        assertButtonWithValuePresent( "Confirm" );
-        assertButtonWithValuePresent( "Cancel" );
-    }
-
-    public void addRemoteRepository( String identifier, String name, String url, String username, String password,
-                                     String timeout, String type, boolean wait )
-    {
-        assertAddRemoteRepository();
-        setFieldValue( "addRemoteRepository_repository_id", identifier );
-        setFieldValue( "addRemoteRepository_repository_name", name );
-        setFieldValue( "addRemoteRepository_repository_url", url );
-        setFieldValue( "addRemoteRepository_repository_userName", username );
-        setFieldValue( "addRemoteRepository_repository_password", password );
-        setFieldValue( "addRemoteRepository_repository_timeout", timeout );
-        selectValue( "addRemoteRepository_repository_layout", type );
-        clickButtonWithValue( "Add Repository", wait );
-    }
-
-    public void deleteRemoteRepository()
-    {
-        goToRepositoriesPage();
-        clickLinkWithXPath( "//div[@id='contentArea']/div/div[8]/div[1]/a[2]" );
-        assertDeleteRemoteRepositoryPage();
-        clickButtonWithValue( "Confirm" );
-    }
-
-    public void editRemoteRepository( String fieldName, String value )
-    {
-        goToRepositoriesPage();
-        clickLinkWithXPath( "//div[@id='contentArea']/div/div[8]/div[1]/a[1]" );
-        setFieldValue( fieldName, value );
-        clickButtonWithValue( "Update Repository" );
-    }
-
-    public void editManagedRepository( String fieldName, String value )
-    {
-        goToRepositoriesPage();
-        clickLinkWithXPath( "//div[@id='contentArea']/div/div[5]/div[1]/a[1]/img" );
-        assertPage( "Apache Archiva \\ Admin: Edit Managed Repository" );
-        setFieldValue( fieldName, value );
-        // TODO
-        clickButtonWithValue( "Update Repository" );
-    }
-
-    public void editManagedRepository(String name, String directory, String indexDirectory, String type, String cron, String daysOlder, String retentionCount)
-    {
-        goToRepositoriesPage();
-        clickLinkWithXPath( "//div[@id='contentArea']/div/div[5]/div[1]/a[1]/img" );
-        assertPage( "Apache Archiva \\ Admin: Edit Managed Repository" );
-        setFieldValue( "repository.name" , name );
-        setFieldValue( "repository.location" , directory );
-        setFieldValue( "repository.indexDirectory" , indexDirectory );
-        selectValue( "repository.layout", type );
-        setFieldValue( "repository.cronExpression" , cron );
-        setFieldValue( "repository.daysOlder" , daysOlder );
-        setFieldValue( "repository.retentionCount" , retentionCount );
-        clickButtonWithValue( "Update Repository" );
-    }
-
-    public void deleteManagedRepository()
-    {
-        clickLinkWithXPath( "//div[@id='contentArea']/div/div[5]/div[1]/a[2]" );
-        assertPage( "Apache Archiva \\ Admin: Delete Managed Repository" );
-        clickButtonWithValue( "Delete Configuration Only" );
-    }
-
-    public String getRepositoryDir()
-    {
-        File f = new File( "" );
-        String artifactFilePath = f.getAbsolutePath();
-        return artifactFilePath + "/target/";
-    }
-
-    // ///////////////////////////////////////////
-    // Repository Scanning
-    // ///////////////////////////////////////////
-    public void goToRepositoryScanningPage()
-    {
-        getSelenium().open( "/archiva/admin/repositoryScanning.action" );
-        assertRepositoryScanningPage();
-    }
-
-    public void assertRepositoryScanningPage()
-    {
-        assertPage( "Apache Archiva \\ Administration - Repository Scanning" );
-        assertTextPresent( "Administration - Repository Scanning" );
-        assertTextPresent( "Repository Scanning - File Types" );
-        String artifactsTypes =
-            "**/*.pom,**/*.jar,**/*.ear,**/*.war,**/*.car,**/*.sar,**/*.mar,**/*.rar,**/*.dtd,**/*.tld,**/*.tar.gz,**/*.tar.bz2,**/*.zip";
-        String[] arrayArtifactTypes = artifactsTypes.split( "," );
-        for ( int i = 0; i < arrayArtifactTypes.length; i++ )
-            Assert.assertEquals( getSelenium().getTable( "//div[@id='contentArea']/div/div[1]/table." + i + ".0" ),
-                                 arrayArtifactTypes[i] );
-
-        String autoremove = "**/*.bak,**/*~,**/*-";
-        String[] arrayAutoremove = autoremove.split( "," );
-        for ( int i = 0; i < arrayAutoremove.length; i++ )
-            Assert.assertEquals( getSelenium().getTable( "//div[@id='contentArea']/div/div[2]/table." + i + ".0" ),
-                                 arrayAutoremove[i] );
-
-        String ignored = "**/.htaccess,**/KEYS,**/*.rb,**/*.sh,**/.svn/**,**/.DAV/**";
-        String[] arrayIgnored = ignored.split( "," );
-        for ( int i = 0; i < arrayIgnored.length; i++ )
-            Assert.assertEquals( getSelenium().getTable( "//div[@id='contentArea']/div/div[3]/table." + i + ".0" ),
-                                 arrayIgnored[i] );
-
-        String indexableContent =
-            "**/*.txt,**/*.TXT,**/*.block,**/*.config,**/*.pom,**/*.xml,**/*.xsd,**/*.dtd,**/*.tld";
-        String[] arrayIndexableContent = indexableContent.split( "," );
-        for ( int i = 0; i < arrayIndexableContent.length; i++ )
-            Assert.assertEquals( getSelenium().getTable( "//div[@id='contentArea']/div/div[4]/table." + i + ".0" ),
-                                 arrayIndexableContent[i] );
-    }
-
-    // ///////////////////////////////////////////
-    // Database
-    // ///////////////////////////////////////////
-    public void goToDatabasePage()
-    {
-        clickLinkWithText( "Database" );
-        assertDatabasePage();
-    }
-
-    public void assertDatabasePage()
-    {
-        assertPage( "Apache Archiva \\ Administration - Database" );
-        assertTextPresent( "Administration - Database" );
-        assertTextPresent( "Database - Unprocessed Artifacts Scanning" );
-        assertTextPresent( "Cron:" );
-        assertElementPresent( "database_cron" );
-        assertButtonWithValuePresent( "Update Cron" );
-        assertButtonWithValuePresent( "Update Database Now" );
-        assertTextPresent( "Database - Unprocessed Artifacts Scanning" );
-        assertTextPresent( "Database - Artifact Cleanup Scanning" );
-    }
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java
deleted file mode 100644 (file)
index 33b12be..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-package org.apache.archiva.web.test.parent;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-public abstract class AbstractSearchTest
-    extends AbstractArchivaTest
-{
-    // Search
-    public void goToSearchPage()
-    {
-        goToHomePage();
-        if (!isElementPresent( "quickSearchBox" ) )
-        {
-            getSelenium().open( "/index.action");
-            //getSelenium().waitForPageToLoad( maxWaitTimeInMs );
-            waitPage();
-            assertElementPresent( "quickSearchSubmit" );
-        }
-    }
-
-    public void assertSearchPage()
-    {
-        assertPage( "Apache Archiva \\ Quick Search" );
-        assertTextPresent( "Search for" );
-        assertElementPresent( "quickSearchSubmit" );
-        assertButtonWithValuePresent( "Search" );
-        // assertLinkPresent( "Advanced Search" );
-        assertTextPresent( "Enter your search terms. A variety of data will be searched for your keywords." );
-        // assertButtonWithDivIdPresent( "searchHint" );
-    }
-
-    public void searchForArtifact( String artifactId )
-    {
-        goToSearchPage();
-
-        setFieldValue( "quickSearchValue", artifactId );
-        clickButtonWithLocator( "quickSearchSubmit" );
-    }
-
-    public void searchForArtifactAdvancedSearch( String groupId, String artifactId, String version, String repositoryId,
-                                                 String className, String rowCount )
-    {
-        goToSearchPage();
-
-        clickLinkWithXPath( "//div[@id='contentArea']/div[1]/a[1]/strong", false );
-        assertElementPresent( "filteredSearch_searchField" );
-        assertElementPresent( "filteredSearch_repositoryId" );
-
-        if ( groupId != null )
-        {
-            selectValue( "filteredSearch_searchField", "Group ID" );
-            clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
-
-            assertElementPresent( "groupId" );
-            setFieldValue( "groupId", groupId );
-        }
-
-        if ( artifactId != null )
-        {
-            selectValue( "filteredSearch_searchField", "Artifact ID" );
-            clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
-
-            assertElementPresent( "artifactId" );
-            setFieldValue( "artifactId", artifactId );
-        }
-
-        if ( version != null )
-        {
-            selectValue( "filteredSearch_searchField", "Version" );
-            clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
-
-            assertElementPresent( "version" );
-            setFieldValue( "version", version );
-        }
-
-        if ( className != null )
-        {
-            selectValue( "filteredSearch_searchField", "Class/Package Name" );
-            clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
-
-            assertElementPresent( "className" );
-            setFieldValue( "className", className );
-        }
-
-        if ( rowCount != null )
-        {
-            selectValue( "filteredSearch_searchField", "Row Count" );
-            clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
-
-            assertElementPresent( "rowCount" );
-            setFieldValue( "rowCount", rowCount );
-        }
-
-        if ( repositoryId != null )
-        {
-            selectValue( "filteredSearch_repositoryId", repositoryId );
-        }
-        clickSubmitWithLocator( "filteredSearch_0" );
-    }
-}
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
deleted file mode 100644 (file)
index a394b59..0000000
+++ /dev/null
@@ -1,499 +0,0 @@
-package org.apache.archiva.web.test.parent;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import com.thoughtworks.selenium.DefaultSelenium;
-import com.thoughtworks.selenium.Selenium;
-import org.apache.commons.io.IOUtils;
-import org.testng.Assert;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-
-/**
- * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
- * @version $Id: AbstractSeleniumTestCase.java 761154 2009-04-02 03:31:19Z wsmoak $
- */
-
-public abstract class AbstractSeleniumTest
-{
-
-    public static String baseUrl;
-
-    public static String maxWaitTimeInMs;
-
-    private static ThreadLocal<Selenium> selenium = new ThreadLocal<Selenium>();
-
-    public static Properties p;
-
-    private final static String PROPERTIES_SEPARATOR = "=";
-
-    public void open()
-        throws Exception
-    {
-        p = new Properties();
-        p.load( this.getClass().getClassLoader().getResourceAsStream( "test.properties" ) );
-    }
-
-    /**
-     * Initialize selenium
-     */
-    public void open( String baseUrl, String browser, String seleniumHost, int seleniumPort, String maxWaitTimeInMs )
-        throws Exception
-    {
-        try
-        {
-            AbstractSeleniumTest.baseUrl = baseUrl;
-            AbstractSeleniumTest.maxWaitTimeInMs = maxWaitTimeInMs;
-
-            if ( getSelenium() == null )
-            {
-                DefaultSelenium s = new DefaultSelenium( seleniumHost, seleniumPort, browser, baseUrl );
-
-                s.start();
-                s.setTimeout( maxWaitTimeInMs );
-                selenium.set( s );
-            }
-        }
-        catch ( Exception e )
-        {
-            // yes
-            System.out.print( e.getMessage() );
-            e.printStackTrace();
-        }
-    }
-
-    public static Selenium getSelenium()
-    {
-        return selenium == null ? null : selenium.get();
-    }
-
-    protected String getProperty( String key )
-    {
-        return p.getProperty( key );
-    }
-
-    protected String getEscapeProperty( String key )
-    {
-        InputStream input = this.getClass().getClassLoader().getResourceAsStream( "test.properties" );
-        String value = null;
-        List<String> lines;
-        try
-        {
-            lines = IOUtils.readLines( input );
-        }
-        catch ( IOException e )
-        {
-            lines = new ArrayList<String>();
-        }
-        for ( String l : lines )
-        {
-            if ( l != null && l.startsWith( key ) )
-            {
-                int indexSeparator = l.indexOf( PROPERTIES_SEPARATOR );
-                value = l.substring( indexSeparator + 1 ).trim();
-                break;
-            }
-        }
-        return value;
-    }
-
-    /**
-     * Close selenium session. Called from AfterSuite method of sub-class
-     */
-    public void close()
-        throws Exception
-    {
-        if ( getSelenium() != null )
-        {
-            getSelenium().stop();
-            selenium.set( null );
-        }
-    }
-
-    // *******************************************************
-    // Auxiliar methods. This method help us and simplify test.
-    // *******************************************************
-
-    public void assertFieldValue( String fieldValue, String fieldName )
-    {
-        assertElementPresent( fieldName );
-        Assert.assertEquals( fieldValue, getSelenium().getValue( fieldName ) );
-    }
-
-    public void assertPage( String title )
-    {
-        Assert.assertEquals( getTitle(), title );
-    }
-
-    public String getTitle()
-    {
-        // Collapse spaces
-        return getSelenium().getTitle().replaceAll( "[ \n\r]+", " " );
-    }
-
-    public String getHtmlContent()
-    {
-        return getSelenium().getHtmlSource();
-    }
-
-    public String getText( String locator )
-    {
-        return getSelenium().getText( locator );
-    }
-
-    public void assertTextPresent( String text )
-    {
-        Assert.assertTrue( getSelenium().isTextPresent( text ), "'" + text + "' isn't present." );
-    }
-
-    /**
-     * one of text args must be in the page so use en and fr text (olamy use en locale :-) )
-     *
-     * @param texts
-     */
-    public void assertTextPresent( String... texts )
-    {
-        boolean present = false;
-        StringBuilder sb = new StringBuilder();
-        for ( String text : texts )
-        {
-            present = present || getSelenium().isTextPresent( text );
-            sb.append( " " + text + " " );
-        }
-        Assert.assertTrue( present, "'one of the following test " + sb.toString() + "' isn't present." );
-    }
-
-    public void assertTextNotPresent( String text )
-    {
-        Assert.assertFalse( getSelenium().isTextPresent( text ), "'" + text + "' is present." );
-    }
-
-    public void assertElementPresent( String elementLocator )
-    {
-        Assert.assertTrue( isElementPresent( elementLocator ), "'" + elementLocator + "' isn't present." );
-    }
-
-    public void assertElementNotPresent( String elementLocator )
-    {
-        Assert.assertFalse( isElementPresent( elementLocator ), "'" + elementLocator + "' is present." );
-    }
-
-    public void assertLinkPresent( String text )
-    {
-        Assert.assertTrue( isElementPresent( "link=" + text ), "The link '" + text + "' isn't present." );
-    }
-
-    public void assertLinkNotPresent( String text )
-    {
-        Assert.assertFalse( isElementPresent( "link=" + text ), "The link('" + text + "' is present." );
-    }
-
-    public void assertLinkNotVisible( String text )
-    {
-        Assert.assertFalse( isElementVisible( "link=" + text ), "The link('" + text + "' is visible." );
-    }
-
-    public void assertLinkVisible( String text )
-    {
-        Assert.assertTrue( isElementVisible( "link=" + text ), "The link('" + text + "' is not visible." );
-    }
-
-    public void assertImgWithAlt( String alt )
-    {
-        assertElementPresent( "/¯img[@alt='" + alt + "']" );
-    }
-
-    public void assertImgWithAltAtRowCol( boolean isALink, String alt, int row, int column )
-    {
-        String locator = "//tr[" + row + "]/td[" + column + "]/";
-        locator += isALink ? "a/" : "";
-        locator += "img[@alt='" + alt + "']";
-
-        assertElementPresent( locator );
-    }
-
-    public void assertImgWithAltNotPresent( String alt )
-    {
-        assertElementNotPresent( "/¯img[@alt='" + alt + "']" );
-    }
-
-    public void assertCellValueFromTable( String expected, String tableElement, int row, int column )
-    {
-        Assert.assertEquals( expected, getCellValueFromTable( tableElement, row, column ) );
-    }
-
-    public boolean isTextPresent( String text )
-    {
-        return getSelenium().isTextPresent( text );
-    }
-
-    public boolean isLinkPresent( String text )
-    {
-        return isElementPresent( "link=" + text );
-    }
-
-    public boolean isElementPresent( String locator )
-    {
-        return getSelenium().isElementPresent( locator );
-    }
-
-    public boolean isElementVisible( String locator )
-    {
-        return getSelenium().isVisible( locator );
-    }
-
-
-    public void waitPage()
-    {
-        // TODO define a smaller maxWaitTimeJsInMs for wait javascript response for browser side validation
-        //getSelenium().w .wait( Long.parseLong( maxWaitTimeInMs ) );
-        //getSelenium().waitForPageToLoad( maxWaitTimeInMs );
-        // http://jira.openqa.org/browse/SRC-302
-        // those hack looks to break some tests :-(
-        // getSelenium().waitForCondition( "selenium.isElementPresent('document.body');", maxWaitTimeInMs );
-        //getSelenium().waitForCondition( "selenium.isElementPresent('footer');", maxWaitTimeInMs );
-        //getSelenium().waitForCondition( "selenium.browserbot.getCurrentWindow().document.getElementById('footer')",
-        //                                maxWaitTimeInMs );
-        // so the only hack is to not use a too small wait time
-
-        try
-        {
-            Thread.sleep( Long.parseLong( maxWaitTimeInMs ) );
-        }
-        catch ( InterruptedException e )
-        {
-            throw new RuntimeException( "issue on Thread.sleep : " + e.getMessage(), e );
-        }
-    }
-
-    public String getFieldValue( String fieldName )
-    {
-        return getSelenium().getValue( fieldName );
-    }
-
-    public String getCellValueFromTable( String tableElement, int row, int column )
-    {
-        return getSelenium().getTable( tableElement + "." + row + "." + column );
-    }
-
-    public void selectValue( String locator, String value )
-    {
-        getSelenium().select( locator, "label=" + value );
-    }
-
-
-    public void assertOptionPresent( String selectField, String[] options )
-    {
-        assertElementPresent( selectField );
-        String[] optionsPresent = getSelenium().getSelectOptions( selectField );
-        List<String> expected = Arrays.asList( options );
-        List<String> present = Arrays.asList( optionsPresent );
-        Assert.assertTrue( present.containsAll( expected ), "Options expected are not included in present options" );
-    }
-
-    public void assertSelectedValue( String value, String fieldName )
-    {
-        assertElementPresent( fieldName );
-        String optionsPresent = getSelenium().getSelectedLabel( value );
-        Assert.assertEquals( optionsPresent, value );
-    }
-
-    public void submit()
-    {
-        clickLinkWithXPath( "//input[@type='submit']" );
-    }
-
-    public void assertButtonWithValuePresent( String text )
-    {
-        Assert.assertTrue( isButtonWithValuePresent( text ), "'" + text + "' button isn't present" );
-    }
-
-    public void assertButtonWithIdPresent( String id )
-    {
-        Assert.assertTrue( isButtonWithIdPresent( id ), "'Button with id =" + id + "' isn't present" );
-    }
-
-    public void assertButtonWithValueNotPresent( String text )
-    {
-        Assert.assertFalse( isButtonWithValuePresent( text ), "'" + text + "' button is present" );
-    }
-
-    public boolean isButtonWithValuePresent( String text )
-    {
-        return isElementPresent( "//button[@value='" + text + "']" ) || isElementPresent(
-            "//input[@value='" + text + "']" );
-    }
-
-    public boolean isButtonWithIdPresent( String text )
-    {
-        return isElementPresent( "//button[@id='" + text + "']" ) || isElementPresent( "//input[@id='" + text + "']" );
-    }
-
-    public void clickButtonWithName( String text, boolean wait )
-    {
-        clickLinkWithXPath( "//input[@name='" + text + "']", wait );
-    }
-
-    public void clickButtonWithValue( String text )
-    {
-        clickButtonWithValue( text, true );
-    }
-
-    public void clickButtonWithValue( String text, boolean wait )
-    {
-        assertButtonWithValuePresent( text );
-
-        if ( isElementPresent( "//button[@value='" + text + "']" ) )
-        {
-            clickLinkWithXPath( "//button[@value='" + text + "']", wait );
-        }
-        else
-        {
-            clickLinkWithXPath( "//input[@value='" + text + "']", wait );
-        }
-    }
-
-    public void clickSubmitWithLocator( String locator )
-    {
-        clickLinkWithLocator( locator );
-    }
-
-    public void clickSubmitWithLocator( String locator, boolean wait )
-    {
-        clickLinkWithLocator( locator, wait );
-    }
-
-    public void clickImgWithAlt( String alt )
-    {
-        clickLinkWithLocator( "//img[@alt='" + alt + "']" );
-    }
-
-    public void clickLinkWithText( String text )
-    {
-        clickLinkWithText( text, true );
-    }
-
-    public void clickLinkWithText( String text, boolean wait )
-    {
-        clickLinkWithLocator( "link=" + text, wait );
-    }
-
-    public void clickLinkWithXPath( String xpath )
-    {
-        clickLinkWithXPath( xpath, true );
-    }
-
-    public void clickLinkWithXPath( String xpath, boolean wait )
-    {
-        clickLinkWithLocator( "xpath=" + xpath, wait );
-    }
-
-    public void clickLinkWithLocator( String locator )
-    {
-        clickLinkWithLocator( locator, true );
-    }
-
-    public void clickLinkWithLocator( String locator, boolean wait )
-    {
-        assertElementPresent( locator );
-        getSelenium().click( locator );
-        if ( wait )
-        {
-            waitPage();
-        }
-    }
-
-    public void clickButtonWithLocator( String locator )
-    {
-        clickButtonWithLocator( locator, true );
-    }
-
-    public void clickButtonWithLocator( String locator, boolean wait )
-    {
-        assertElementPresent( locator );
-        getSelenium().click( locator );
-        if ( wait )
-        {
-            waitPage();
-        }
-    }
-
-    public void setFieldValues( Map<String, String> fieldMap )
-    {
-        Map.Entry<String, String> entry;
-
-        for ( Iterator<Entry<String, String>> entries = fieldMap.entrySet().iterator(); entries.hasNext(); )
-        {
-            entry = entries.next();
-
-            getSelenium().type( entry.getKey(), entry.getValue() );
-        }
-    }
-
-    public void setFieldValue( String fieldName, String value )
-    {
-        getSelenium().type( fieldName, value );
-    }
-
-    public void checkField( String locator )
-    {
-        getSelenium().check( locator );
-    }
-
-    public void uncheckField( String locator )
-    {
-        getSelenium().uncheck( locator );
-    }
-
-    public boolean isChecked( String locator )
-    {
-        return getSelenium().isChecked( locator );
-    }
-
-    public void assertIsChecked( String locator )
-    {
-        Assert.assertTrue( getSelenium().isChecked( locator ) );
-    }
-
-    public void assertIsNotChecked( String locator )
-    {
-        Assert.assertFalse( getSelenium().isChecked( locator ) );
-    }
-
-    public void assertXpathCount( String locator, int expectedCount )
-    {
-        int count = getSelenium().getXpathCount( locator ).intValue();
-        Assert.assertEquals( count, expectedCount );
-    }
-
-    public void assertElementValue( String locator, String expectedValue )
-    {
-        Assert.assertEquals( getSelenium().getValue( locator ), expectedValue );
-    }
-
-}
\ No newline at end of file