package org.apache.archiva.web.test;
-import org.apache.archiva.web.test.parent.AbstractRepositoryTest;
-import org.testng.annotations.Test;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* under the License.
*/
+import org.apache.archiva.web.test.parent.AbstractRepositoryTest;
+import org.testng.annotations.Test;
+import org.testng.Assert;
+
@Test( groups = { "reposcan" }, dependsOnMethods = { "testWithCorrectUsernamePassword" }, sequential = true )
public class RepositoryScanningTest
extends AbstractRepositoryTest
{
setFieldValue( "newpattern_0" , "**/*.dll" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" );
- assertTextPresent( "**/*.dll" );
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[1]/table.13.0"), "**/*.dll" );
}
@Test (dependsOnMethods = { "testAddArtifactFileType" } )
{
setFieldValue( "newpattern_0" , "**/*.zip" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[15]/td[2]/a/img" );
- assertTextPresent( "Not adding pattern \"**/*.zip\" to filetype artifacts as it already exists." );
+ Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.zip\" to filetype artifacts as it already exists." );
}
@Test (dependsOnMethods = { "testAddArtifactFileType_ExistingValue" } )
public void testDeleteArtifactFileType()
{
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[1]/table.13.0"), "**/*.dll" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" );
- assertTextNotPresent( "dll" );
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[1]/table.13.0"), "" );
}
@Test (dependsOnMethods = { "testDeleteArtifactFileType" } )
{
setFieldValue( "newpattern_1" , "**/*-" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
- assertTextPresent( "Not adding pattern \"**/*-\" to filetype auto-remove as it already exists." );
+ Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*-\" to filetype auto-remove as it already exists." );
}
@Test (dependsOnMethods = { "testAddAutoRemove_ExistingValue" } )
{
setFieldValue( "newpattern_1" , "**/*.test" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
- assertTextPresent( "**/*.test" );
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[2]/table.3.0"), "**/*.test" );
}
@Test (dependsOnMethods = { "testAddAutoRemove" } )
public void testDeleteAutoRemove()
{
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[2]/table.3.0"), "**/*.test" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
- assertTextNotPresent( "test" );
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[2]/table.3.0"), "" );
}
@Test (dependsOnMethods = { "testDeleteAutoRemove" } )
{
setFieldValue( "newpattern_2" , "" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
- assertTextPresent( "Unable to process blank pattern." );
+ Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Unable to process blank pattern." );
}
@Test (dependsOnMethods = { "testAddIgnoredArtifacts_NullValue" } )
{
setFieldValue( "newpattern_2" , "**/*.sh" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
- assertTextPresent( "Not adding pattern \"**/*.sh\" to filetype ignored as it already exists." );
+ Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.sh\" to filetype ignored as it already exists." );
}
@Test (dependsOnMethods = { "testAddIgnoredArtifacts_ExistingValue" } )
{
setFieldValue( "newpattern_2" , "**/*.log" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
- assertTextPresent( "**/*.log" );
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[3]/table.6.0"), "**/*.log" );
}
@Test (dependsOnMethods = { "testAddIgnoredArtifacts" } )
public void testDeleteIgnoredArtifacts()
{
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[3]/table.6.0"), "**/*.log" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
- assertTextNotPresent( "log" );
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[3]/table.6.0"), "" );
}
//
{
setFieldValue( "newpattern_3" , "" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
- assertTextPresent( "Unable to process blank pattern." );
+ Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Unable to process blank pattern." );
}
@Test (dependsOnMethods = { "testAddIndexableContent_NullValue" } )
{
setFieldValue( "newpattern_3" , "**/*.xml" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
- assertTextPresent( "Not adding pattern \"**/*.xml\" to filetype indexable-content as it already exists." );
+ Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.xml\" to filetype indexable-content as it already exists." );
}
@Test (dependsOnMethods = { "testAddIndexableContent_ExistingValue" } )
{
setFieldValue( "newpattern_3" , "**/*.html" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
- assertTextPresent( "**/*.html" );
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[4]/table.9.0"), "**/*.html" );
}
@Test (dependsOnMethods = { "testAddIndexableContent" } )
public void testDeleteIndexableContent()
{
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[4]/table.9.0"), "**/*.html" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
- assertTextNotPresent( "html" );
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[4]/table.9.0"), "" );
}
@Test (dependsOnMethods = { "testDeleteIndexableContent" } )
getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='validate-checksums']" );
clickButtonWithValue( "Update Consumers" );
- // remove the ff. 2 lines if MRM-1238 will be fixed.
- getSelenium().goBack();
- waitPage();
-
assertPage( "Apache Archiva \\ Administration - Repository Scanning" );
}
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
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 (String artifacttypes : arrayArtifactTypes )
- assertTextPresent( artifacttypes );
+ 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 ( String arrayautoremove : arrayAutoremove )
- assertTextPresent( arrayautoremove );
+ 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 ( String arrayignored : arrayIgnored )
- assertTextPresent( arrayignored );
+ 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 ( String indexablecontent : arrayIndexableContent )
- assertTextPresent( indexablecontent );
+ for (int i = 0; i < arrayIndexableContent.length; i++)
+ Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[4]/table."+i+".0"), arrayIndexableContent[i]);
}
/////////////////////////////////////////////