You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by br...@apache.org on 2010/01/14 06:28:32 UTC

svn commit: r899066 - in /archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test: RepositoryScanningTest.java parent/AbstractRepositoryTest.java

Author: brett
Date: Thu Jan 14 05:28:31 2010
New Revision: 899066

URL: http://svn.apache.org/viewvc?rev=899066&view=rev
Log:
fix repository scanning tests

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryScanningTest.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryScanningTest.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryScanningTest.java?rev=899066&r1=899065&r2=899066&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryScanningTest.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryScanningTest.java Thu Jan 14 05:28:31 2010
@@ -1,8 +1,5 @@
 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
@@ -22,6 +19,10 @@
  * 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
@@ -38,7 +39,7 @@
 	{
 		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" } )
@@ -46,14 +47,15 @@
 	{
 		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" } )
@@ -69,7 +71,7 @@
 	{
 		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" } )
@@ -77,14 +79,15 @@
 	{
 		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" } )
@@ -92,7 +95,7 @@
 	{
 		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" } )
@@ -100,7 +103,7 @@
 	{
 		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" } )
@@ -108,14 +111,15 @@
 	{
 		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"), "" );
 	 }
 	
 	//
@@ -124,7 +128,7 @@
 	{
 		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" } )
@@ -132,7 +136,7 @@
 	{
 		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" } )
@@ -140,14 +144,15 @@
 	{
 		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" } )
@@ -172,10 +177,6 @@
 		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" );
 	}
 	

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java?rev=899066&r1=899065&r2=899066&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java Thu Jan 14 05:28:31 2010
@@ -1,6 +1,26 @@
 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
@@ -307,23 +327,23 @@
 		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]);
 	}
 	
 	/////////////////////////////////////////////