mirror of https://github.com/apache/archiva.git
fix repository scanning tests
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@899066 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4457762692
commit
9ef096945d
|
@ -1,8 +1,5 @@
|
||||||
package org.apache.archiva.web.test;
|
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
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
@ -22,6 +19,10 @@ import org.testng.annotations.Test;
|
||||||
* under the License.
|
* 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 )
|
@Test( groups = { "reposcan" }, dependsOnMethods = { "testWithCorrectUsernamePassword" }, sequential = true )
|
||||||
public class RepositoryScanningTest
|
public class RepositoryScanningTest
|
||||||
extends AbstractRepositoryTest
|
extends AbstractRepositoryTest
|
||||||
|
@ -38,7 +39,7 @@ public class RepositoryScanningTest
|
||||||
{
|
{
|
||||||
setFieldValue( "newpattern_0" , "**/*.dll" );
|
setFieldValue( "newpattern_0" , "**/*.dll" );
|
||||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" );
|
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" } )
|
@Test (dependsOnMethods = { "testAddArtifactFileType" } )
|
||||||
|
@ -46,14 +47,15 @@ public class RepositoryScanningTest
|
||||||
{
|
{
|
||||||
setFieldValue( "newpattern_0" , "**/*.zip" );
|
setFieldValue( "newpattern_0" , "**/*.zip" );
|
||||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[15]/td[2]/a/img" );
|
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" } )
|
@Test (dependsOnMethods = { "testAddArtifactFileType_ExistingValue" } )
|
||||||
public void testDeleteArtifactFileType()
|
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" );
|
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" } )
|
@Test (dependsOnMethods = { "testDeleteArtifactFileType" } )
|
||||||
|
@ -69,7 +71,7 @@ public class RepositoryScanningTest
|
||||||
{
|
{
|
||||||
setFieldValue( "newpattern_1" , "**/*-" );
|
setFieldValue( "newpattern_1" , "**/*-" );
|
||||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
|
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" } )
|
@Test (dependsOnMethods = { "testAddAutoRemove_ExistingValue" } )
|
||||||
|
@ -77,14 +79,15 @@ public class RepositoryScanningTest
|
||||||
{
|
{
|
||||||
setFieldValue( "newpattern_1" , "**/*.test" );
|
setFieldValue( "newpattern_1" , "**/*.test" );
|
||||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
|
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" } )
|
@Test (dependsOnMethods = { "testAddAutoRemove" } )
|
||||||
public void testDeleteAutoRemove()
|
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" );
|
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" } )
|
@Test (dependsOnMethods = { "testDeleteAutoRemove" } )
|
||||||
|
@ -92,7 +95,7 @@ public class RepositoryScanningTest
|
||||||
{
|
{
|
||||||
setFieldValue( "newpattern_2" , "" );
|
setFieldValue( "newpattern_2" , "" );
|
||||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
|
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" } )
|
@Test (dependsOnMethods = { "testAddIgnoredArtifacts_NullValue" } )
|
||||||
|
@ -100,7 +103,7 @@ public class RepositoryScanningTest
|
||||||
{
|
{
|
||||||
setFieldValue( "newpattern_2" , "**/*.sh" );
|
setFieldValue( "newpattern_2" , "**/*.sh" );
|
||||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
|
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" } )
|
@Test (dependsOnMethods = { "testAddIgnoredArtifacts_ExistingValue" } )
|
||||||
|
@ -108,14 +111,15 @@ public class RepositoryScanningTest
|
||||||
{
|
{
|
||||||
setFieldValue( "newpattern_2" , "**/*.log" );
|
setFieldValue( "newpattern_2" , "**/*.log" );
|
||||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
|
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" } )
|
@Test (dependsOnMethods = { "testAddIgnoredArtifacts" } )
|
||||||
public void testDeleteIgnoredArtifacts()
|
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" );
|
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"), "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -124,7 +128,7 @@ public class RepositoryScanningTest
|
||||||
{
|
{
|
||||||
setFieldValue( "newpattern_3" , "" );
|
setFieldValue( "newpattern_3" , "" );
|
||||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
|
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" } )
|
@Test (dependsOnMethods = { "testAddIndexableContent_NullValue" } )
|
||||||
|
@ -132,7 +136,7 @@ public class RepositoryScanningTest
|
||||||
{
|
{
|
||||||
setFieldValue( "newpattern_3" , "**/*.xml" );
|
setFieldValue( "newpattern_3" , "**/*.xml" );
|
||||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
|
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" } )
|
@Test (dependsOnMethods = { "testAddIndexableContent_ExistingValue" } )
|
||||||
|
@ -140,14 +144,15 @@ public class RepositoryScanningTest
|
||||||
{
|
{
|
||||||
setFieldValue( "newpattern_3" , "**/*.html" );
|
setFieldValue( "newpattern_3" , "**/*.html" );
|
||||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
|
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" } )
|
@Test (dependsOnMethods = { "testAddIndexableContent" } )
|
||||||
public void testDeleteIndexableContent()
|
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" );
|
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" } )
|
@Test (dependsOnMethods = { "testDeleteIndexableContent" } )
|
||||||
|
@ -172,10 +177,6 @@ public class RepositoryScanningTest
|
||||||
getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='validate-checksums']" );
|
getSelenium().uncheck( "//input[@name='enabledKnownContentConsumers' and @value='validate-checksums']" );
|
||||||
clickButtonWithValue( "Update Consumers" );
|
clickButtonWithValue( "Update Consumers" );
|
||||||
|
|
||||||
// remove the ff. 2 lines if MRM-1238 will be fixed.
|
|
||||||
getSelenium().goBack();
|
|
||||||
waitPage();
|
|
||||||
|
|
||||||
assertPage( "Apache Archiva \\ Administration - Repository Scanning" );
|
assertPage( "Apache Archiva \\ Administration - Repository Scanning" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,26 @@
|
||||||
package org.apache.archiva.web.test.parent;
|
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 java.io.File;
|
||||||
|
import org.testng.Assert;
|
||||||
|
|
||||||
public abstract class AbstractRepositoryTest
|
public abstract class AbstractRepositoryTest
|
||||||
extends AbstractArchivaTest
|
extends AbstractArchivaTest
|
||||||
|
@ -307,23 +327,23 @@ public abstract class AbstractRepositoryTest
|
||||||
assertTextPresent( "Repository Scanning - File Types" );
|
assertTextPresent( "Repository Scanning - File Types" );
|
||||||
String artifactsTypes = "**/*.pom,**/*.jar,**/*.ear,**/*.war,**/*.car,**/*.sar,**/*.mar,**/*.rar,**/*.dtd,**/*.tld,**/*.tar.gz,**/*.tar.bz2,**/*.zip";
|
String artifactsTypes = "**/*.pom,**/*.jar,**/*.ear,**/*.war,**/*.car,**/*.sar,**/*.mar,**/*.rar,**/*.dtd,**/*.tld,**/*.tar.gz,**/*.tar.bz2,**/*.zip";
|
||||||
String [] arrayArtifactTypes = artifactsTypes.split( "," );
|
String [] arrayArtifactTypes = artifactsTypes.split( "," );
|
||||||
for (String artifacttypes : arrayArtifactTypes )
|
for (int i = 0; i < arrayArtifactTypes.length; i++)
|
||||||
assertTextPresent( artifacttypes );
|
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[1]/table."+i+".0"), arrayArtifactTypes[i]);
|
||||||
|
|
||||||
String autoremove = "**/*.bak,**/*~,**/*-";
|
String autoremove = "**/*.bak,**/*~,**/*-";
|
||||||
String [] arrayAutoremove = autoremove.split( "," );
|
String [] arrayAutoremove = autoremove.split( "," );
|
||||||
for ( String arrayautoremove : arrayAutoremove )
|
for (int i = 0; i < arrayAutoremove.length; i++)
|
||||||
assertTextPresent( arrayautoremove );
|
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[2]/table."+i+".0"), arrayAutoremove[i]);
|
||||||
|
|
||||||
String ignored = "**/.htaccess,**/KEYS,**/*.rb,**/*.sh,**/.svn/**,**/.DAV/**";
|
String ignored = "**/.htaccess,**/KEYS,**/*.rb,**/*.sh,**/.svn/**,**/.DAV/**";
|
||||||
String [] arrayIgnored = ignored.split( "," );
|
String [] arrayIgnored = ignored.split( "," );
|
||||||
for ( String arrayignored : arrayIgnored )
|
for (int i = 0; i < arrayIgnored.length; i++)
|
||||||
assertTextPresent( arrayignored );
|
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 indexableContent = "**/*.txt,**/*.TXT,**/*.block,**/*.config,**/*.pom,**/*.xml,**/*.xsd,**/*.dtd,**/*.tld";
|
||||||
String [] arrayIndexableContent = indexableContent.split( "," );
|
String [] arrayIndexableContent = indexableContent.split( "," );
|
||||||
for ( String indexablecontent : arrayIndexableContent )
|
for (int i = 0; i < arrayIndexableContent.length; i++)
|
||||||
assertTextPresent( indexablecontent );
|
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[4]/table."+i+".0"), arrayIndexableContent[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue