diff options
author | Brett Porter <brett@apache.org> | 2009-11-19 06:20:43 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2009-11-19 06:20:43 +0000 |
commit | 601939b9e9c69210e63991a1ccb420cbc79fa85f (patch) | |
tree | b9e5bb624d3bcec6486a3669de723d2376159c2a /archiva-modules | |
parent | fcd88ac350901c34b7fa451eb7ad91317da727e3 (diff) | |
parent | 2819ac8d303be0c480c8e35a97f379007aec7cc9 (diff) | |
download | archiva-601939b9e9c69210e63991a1ccb420cbc79fa85f.tar.gz archiva-601939b9e9c69210e63991a1ccb420cbc79fa85f.zip |
Merged /archiva/trunk:r825850-882054
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@882055 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
13 files changed, 159 insertions, 388 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java index 775d7650a..2567d13ba 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java @@ -173,6 +173,8 @@ public class NexusIndexerConsumer includes.clear(); includes.addAll( filetypes.getFileTypePatterns( FileTypes.INDEXABLE_CONTENT ) ); + + includes.addAll( filetypes.getFileTypePatterns( FileTypes.ARTIFACTS ) ); } public void initialize() diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java index 0da5b2bf1..fc725f785 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.util.Calendar; import java.util.Date; import java.util.HashSet; +import java.util.List; import java.util.Set; import org.apache.commons.io.FileUtils; @@ -36,6 +37,7 @@ import org.apache.maven.archiva.scheduled.ArchivaTaskScheduler; import org.apache.maven.archiva.scheduled.tasks.ArtifactIndexingTask; import org.apache.maven.archiva.scheduled.tasks.DatabaseTask; import org.apache.maven.archiva.scheduled.tasks.RepositoryTask; +import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; import org.codehaus.plexus.spring.PlexusInSpringTestCase; import org.codehaus.plexus.taskqueue.TaskQueueException; import org.codehaus.plexus.taskqueue.execution.TaskExecutionException; @@ -125,6 +127,9 @@ public class NexusIndexerConsumerTest FileTypes filetypes = (FileTypes) lookup( FileTypes.class ); nexusIndexerConsumer = new NexusIndexerConsumer( scheduler, configuration, filetypes ); + + // initialize to set the file types to be processed + ( (Initializable) nexusIndexerConsumer ).initialize(); repositoryConfig = new ManagedRepositoryConfiguration(); repositoryConfig.setId( "test-repo" ); @@ -218,6 +223,19 @@ public class NexusIndexerConsumerTest assertTrue( scheduler.indexed.contains( artifactFile ) ); } + + // MRM-1275 - Include other file types for the index consumer instead of just the indexable-content + public void testIncludedFileTypes() + throws Exception + { + List<String> includes = nexusIndexerConsumer.getIncludes(); + assertTrue( ".pom artifacts should be processed.", includes.contains( "**/*.pom" ) ); + assertTrue( ".xml artifacts should be processed.", includes.contains( "**/*.xml" ) ); + assertTrue( ".txt artifacts should be processed.", includes.contains( "**/*.txt" ) ); + assertTrue( ".jar artifacts should be processed.", includes.contains( "**/*.jar" ) ); + assertTrue( ".war artifacts should be processed.", includes.contains( "**/*.war" ) ); + assertTrue( ".zip artifacts should be processed.", includes.contains( "**/*.zip" ) ); + } @Override protected String getPlexusConfigLocation() diff --git a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml index d005fcfc5..a939999f2 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml @@ -30,10 +30,6 @@ <dependencies> <dependency> <groupId>org.apache.archiva</groupId> - <artifactId>archiva-xml-tools</artifactId> - </dependency> - <dependency> - <groupId>org.apache.archiva</groupId> <artifactId>archiva-model</artifactId> </dependency> <dependency> diff --git a/archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java b/archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java index af20d0868..a0e90b647 100644 --- a/archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java +++ b/archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java @@ -101,7 +101,8 @@ public class ArchivaIndexingTaskExecutorTest protected void tearDown() throws Exception { - context.close( false ); + context.close( true ); + indexer.removeIndexingContext( context, true ); // delete created index in the repository File indexDir = new File( repositoryConfig.getLocation(), ".indexer" ); @@ -151,6 +152,8 @@ public class ArchivaIndexingTaskExecutorTest assertEquals( "org.apache.archiva", artifactInfo.groupId ); assertEquals( "archiva-index-methods-jar-test", artifactInfo.artifactId ); assertEquals( "test-repo", artifactInfo.repository ); + + context.close( true ); } public void testUpdateArtifactInIndex() @@ -173,6 +176,8 @@ public class ArchivaIndexingTaskExecutorTest IndexSearcher searcher = new IndexSearcher( repositoryConfig.getLocation() + "/.indexer" ); TopDocs topDocs = searcher.search( q, null, 10 ); + searcher.close(); + assertTrue( new File( repositoryConfig.getLocation(), ".indexer" ).exists() ); assertFalse( new File( repositoryConfig.getLocation(), ".index" ).exists() ); @@ -206,6 +211,8 @@ public class ArchivaIndexingTaskExecutorTest // should return 1 hit assertEquals( 1, topDocs.totalHits ); + searcher.close(); + context = TaskCreator.createContext( repositoryConfig ); // remove added artifact from index @@ -230,6 +237,8 @@ public class ArchivaIndexingTaskExecutorTest // artifact should have been removed from the index! assertEquals( 0, topDocs.totalHits ); + context.close( true ); + searcher.close(); // TODO: test it was removed from the packaged index also } @@ -278,6 +287,8 @@ public class ArchivaIndexingTaskExecutorTest assertEquals( "org.apache.archiva", artifactInfo.groupId ); assertEquals( "archiva-index-methods-jar-test", artifactInfo.artifactId ); assertEquals( "test-repo", artifactInfo.repository ); + + context.close( true ); } private void unzipIndex( String indexDir, String destDir ) diff --git a/archiva-modules/archiva-web/archiva-webapp-test/ReadMe.txt b/archiva-modules/archiva-web/archiva-webapp-test/ReadMe.txt index 5a24e5b8d..a1d2d6396 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/ReadMe.txt +++ b/archiva-modules/archiva-web/archiva-webapp-test/ReadMe.txt @@ -9,7 +9,11 @@ Run Selenium tests in src/test/testng against an existing Archiva instance - modify src/test/resources/testng.properties as needed - mvn clean install -Dcontainer-existing +The Cargo installations are stored outside of target to avoid multiple downloads. +To remove the Cargo installations and re-download them next run, use: + - mvn -Pclean-cargo clean + For the default values in the scripts, to pass all the tests, you need to add an artifact in internal repository. Run Selenium tests in src/test/it with Maven and JUnit - - mvn clean install -f junit-pom.xml
\ No newline at end of file + - mvn clean install -f junit-pom.xml diff --git a/archiva-modules/archiva-web/archiva-webapp-test/junit-pom.xml b/archiva-modules/archiva-web/archiva-webapp-test/junit-pom.xml deleted file mode 100644 index 1b507b051..000000000 --- a/archiva-modules/archiva-web/archiva-webapp-test/junit-pom.xml +++ /dev/null @@ -1,332 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.archiva</groupId> - <artifactId>archiva-web</artifactId> - <version>1.2.1-SNAPSHOT</version> - </parent> - <artifactId>archiva-webapp-test</artifactId> - <packaging>pom</packaging> - <name>Archiva Web :: Application Tests</name> - <dependencies> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-command-line</artifactId> - <version>1.0-alpha-2</version> - <exclusions> - <exclusion> - <artifactId>plexus-container-default</artifactId> - <groupId>org.codehaus.plexus</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.archiva</groupId> - <artifactId>archiva-webapp</artifactId> - <type>war</type> - </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-utils</artifactId> - </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-slf4j-logging</artifactId> - </dependency> - <dependency> - <groupId>org.openqa.selenium.client-drivers</groupId> - <artifactId>selenium-java-client-driver</artifactId> - <version>0.8.1</version> - <scope>test</scope> - </dependency> - - <!-- Dependency for MavenConnectionTest --> - <dependency> - <groupId>jdom</groupId> - <artifactId>jdom</artifactId> - </dependency> - <dependency> - <groupId>jaxen</groupId> - <artifactId>jaxen</artifactId> - </dependency> - - <!-- Dependencies below are provided by the appserver --> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derby</artifactId> - </dependency> - <dependency> - <groupId>javax.mail</groupId> - <artifactId>mail</artifactId> - </dependency> - <dependency> - <groupId>javax.activation</groupId> - <artifactId>activation</artifactId> - </dependency> - </dependencies> - <build> - <testSourceDirectory>src/test/it</testSourceDirectory> - <plugins> - <plugin> - <artifactId>maven-resources-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>testResources</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>dependency-maven-plugin</artifactId> - <executions> - <execution> - <id>unzip-archiva-webapp</id> - <phase>generate-resources</phase> - <goals> - <goal>unpack</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>${project.groupId}</groupId> - <artifactId>archiva-webapp</artifactId> - <version>${project.version}</version> - <type>war</type> - </artifactItem> - </artifactItems> - <outputDirectory>${project.build.directory}/${container.name}conf/webapps/archiva</outputDirectory> - </configuration> - </execution> - <execution> - <id>prepare-provided-dependencies</id> - <phase>generate-resources</phase> - <goals> - <goal>copy-dependencies</goal> - </goals> - <configuration> - <includeGroupIds>org.apache.derby,javax.mail,javax.activation</includeGroupIds> - <overWriteReleases>false</overWriteReleases> - <overWriteSnapshots>true</overWriteSnapshots> - <excludeTransitive>false</excludeTransitive> - <outputDirectory>${project.build.directory}/providedDependencies</outputDirectory> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-antrun-plugin</artifactId> - <executions> - <execution> - <phase>generate-resources</phase> - <goals> - <goal>run</goal> - </goals> - <configuration> - <tasks> - <copy todir="${project.build.directory}/appserver-base"> - <fileset dir="src/test/it-resources/appserver-base" /> - </copy> - <copy todir="${project.build.directory}/repository"> - <fileset dir="src/test/it-resources/repository" /> - </copy> - <copy todir="${project.build.directory}/index"> - <fileset dir="src/test/it-resources/index" /> - </copy> - <copy todir="${project.build.directory}/snapshots"> - <fileset dir="src/test/it-resources/snapshots" /> - </copy> - <copy todir="${project.build.directory}/projects"> - <fileset dir="src/test/it-resources/projects" /> - </copy> - <copy todir="${project.build.directory}/local-repo"> - <fileset dir="src/test/it-resources/local-repo" /> - </copy> - </tasks> - </configuration> - </execution> - <execution> - <id>copy-container-conf</id> - <phase>package</phase> - <configuration> - <tasks> - <copy todir="${project.build.directory}/${container.name}conf"> - <fileset dir="src/test/${container.name}" /> - </copy> - <copy - todir="${project.build.directory}/installs/${container.name}/apache-tomcat-5.5.26/apache-tomcat-5.5.26/common/lib"> - <fileset dir="${project.build.directory}/providedDependencies"> - <include name="**/*.jar" /> - </fileset> - </copy> - </tasks> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - <execution> - <id>check-archiva-loaded</id> - <phase>integration-test</phase> - <configuration> - <tasks> - <get src="http://localhost:9696/archiva/" dest="${project.build.directory}/index.html" /> - <delete file="${project.build.directory}/index.html" /> - </tasks> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>testCompile</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>selenium-maven-plugin</artifactId> - <version>1.0-beta-1</version> - <executions> - <execution> - <id>start-selenium</id> - <phase>pre-integration-test</phase> - <goals> - <goal>start-server</goal> - </goals> - </execution> - </executions> - <configuration> - <background>true</background> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.cargo</groupId> - <artifactId>cargo-maven2-plugin</artifactId> - <version>1.0</version> - <executions> - <execution> - <id>start-container</id> - <phase>pre-integration-test</phase> - <goals> - <goal>start</goal> - </goals> - </execution> - <execution> - <id>stop-container</id> - <phase>post-integration-test</phase> - <goals> - <goal>stop</goal> - </goals> - </execution> - </executions> - <configuration> - <wait>false</wait> - <container> - <containerId>${container.name}</containerId> - <zipUrlInstaller> - <url>${container.url}</url> - <installDir>${project.build.directory}/installs/${container.name}</installDir> - </zipUrlInstaller> - <log>${project.build.directory}/logs/${container.name}.log</log> - <output>${project.build.directory}/logs/${container.name}.out</output> - <timeout>600000</timeout> - <systemProperties> - <appserver.base>${project.build.directory}/appserver-base</appserver.base> - <appserver.home>${project.build.directory}/appserver-base</appserver.home> - </systemProperties> - </container> - <configuration> - <home>${project.build.directory}/${container.name}conf</home> - <type>existing</type> - <properties> - <cargo.servlet.port>9696</cargo.servlet.port> - </properties> - </configuration> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <executions> - <execution> - <phase>integration-test</phase> - <goals> - <goal>test</goal> - </goals> - </execution> - </executions> - <configuration> - <systemProperties> - <property> - <name>browser</name> - <value>${browser}</value> - </property> - </systemProperties> - </configuration> - </plugin> - </plugins> - </build> - <profiles> - <profile> - <id>tomcat5x</id> - <activation> - <activeByDefault>true</activeByDefault> - </activation> - <properties> - <container.name>tomcat5x</container.name> - <container.url>http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.26/bin/apache-tomcat-5.5.26.zip</container.url> - </properties> - </profile> - <profile> - <id>firefox</id> - <activation> - <activeByDefault>true</activeByDefault> - </activation> - <properties> - <browser>*firefox</browser> - </properties> - </profile> - <profile> - <id>iexplore</id> - <properties> - <browser>*iexplore</browser> - </properties> - </profile> - <profile> - <id>otherbrowser</id> - <properties> - <browser>*custom ${browserPath}</browser> - </properties> - </profile> - </profiles> -</project>
\ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml index 774a3aea2..d70d16632 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml @@ -29,14 +29,6 @@ <packaging>pom</packaging> <name>Archiva Web :: Application Tests</name> - <repositories> - <repository> - <id>openqa-snapshots</id> - <url>http://nexus.openqa.org/content/repositories/snapshots</url> - <releases><enabled>false</enabled></releases> - </repository> - </repositories> - <dependencies> <dependency> <groupId>org.testng</groupId> @@ -76,9 +68,9 @@ <artifactId>plexus-slf4j-logging</artifactId> </dependency> <dependency> - <groupId>org.openqa.selenium.client-drivers</groupId> + <groupId>org.seleniumhq.selenium.client-drivers</groupId> <artifactId>selenium-java-client-driver</artifactId> - <version>1.0-SNAPSHOT</version> + <version>1.0.1</version> <scope>test</scope> <exclusions> <exclusion> @@ -273,7 +265,7 @@ <fileset dir="src/test/${container.name}" /> </copy> <copy - todir="${project.build.directory}/installs/${container.name}/apache-tomcat-5.5.27/apache-tomcat-5.5.27/common/lib"> + todir="${cargo.install.dir}/${container.name}/apache-tomcat-${tomcat5x.version}/apache-tomcat-${tomcat5x.version}/common/lib"> <fileset dir="${project.build.directory}/providedDependencies"> <include name="**/*.jar" /> </fileset> @@ -320,12 +312,12 @@ </execution> </executions> <configuration> - <wait>false</wait> + <wait>${cargo.wait}</wait> <container> <containerId>${container.name}</containerId> <zipUrlInstaller> <url>${container.url}</url> - <installDir>${project.build.directory}/installs/${container.name}</installDir> + <installDir>${project.basedir}/${cargo.install.dir}/${container.name}</installDir> </zipUrlInstaller> <log>${project.build.directory}/logs/${container.name}.log</log> <output>${project.build.directory}/logs/${container.name}.out</output> @@ -400,7 +392,7 @@ </activation> <properties> <container.name>tomcat5x</container.name> - <container.url>http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.27/bin/apache-tomcat-5.5.27.zip</container.url> + <container.url>http://archive.apache.org/dist/tomcat/tomcat-5/v${tomcat5x.version}/bin/apache-tomcat-${tomcat5x.version}.zip</container.url> </properties> </profile> <profile> @@ -451,6 +443,24 @@ </properties> </profile> <profile> + <id>clean-cargo</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>${cargo.install.dir}</directory> + </fileset> + </filesets> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> <id>headless</id> <build> <plugins> @@ -471,4 +481,9 @@ </build> </profile> </profiles> + <properties> + <tomcat5x.version>5.5.27</tomcat5x.version> + <cargo.wait>false</cargo.wait> + <cargo.install.dir>cargo-installs</cargo.install.dir> + </properties> </project> diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java index 6366f919d..4b3bc1825 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java @@ -55,7 +55,7 @@ public class ArchivaAdminTest super.open( baseUrl, browser, seleniumHost, seleniumPort ); getSelenium().open( baseUrl ); String title = getSelenium().getTitle(); - if ( title.equals( "Apache Archiva \\ Create Admin User" ) ) + if ( title.endsWith( "Create Admin User" ) ) { assertCreateAdmin(); String fullname = getProperty( "ADMIN_FULLNAME" ); diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java index 553216561..08a748a49 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java @@ -54,6 +54,24 @@ public class SearchTest assertPage( "Apache Archiva \\ Browse Repository" ); } - + public void testSearchNonExistingArtifactInAdvancedSearch() + { + searchForArtifactAdvancedSearch( null, getProperty( "SEARCH_BAD_ARTIFACT"), null, null, null, null ); + assertTextPresent( "No results found" ); + } + + public void testSearchNoSearchCriteriaSpecifiedInAdvancedSearch() + { + searchForArtifactAdvancedSearch( null, null, null, null, null, null ); + assertTextPresent( "Advanced Search - At least one search criteria must be provided." ); + } + /* public void testSearchExistingArtifactUsingAdvancedSearchArtifactId() + { + searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null, null, null, null ); + assertTextPresent( "Results" ); + assertTextPresent( "Hits: 1 to 1 of 1" ); + assertLinkPresent( "test" ); + }*/ } + diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java index f31f5dc7e..410ec14ab 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java @@ -25,8 +25,13 @@ public abstract class AbstractSearchTest //Search public void goToSearchPage() { - clickLinkWithText( "Search" ); - assertSearchPage(); + if ( !"Apache Archiva \\ Quick Search".equals( getSelenium().getTitle() ) ) + { + clickLinkWithText( "Search" ); + getSelenium().waitForPageToLoad( maxWaitTimeInMs ); + + assertPage( "Apache Archiva \\ Quick Search" ); + } } public void assertSearchPage() @@ -42,16 +47,66 @@ public abstract class AbstractSearchTest public void searchForArtifact( String artifactId ) { - if ( !"Apache Archiva \\ Quick Search".equals( getSelenium().getTitle() ) ) - { - clickLinkWithText( "Search" ); - - getSelenium().waitForPageToLoad( maxWaitTimeInMs ); - - assertPage( "Apache Archiva \\ Quick Search" ); - } + goToSearchPage(); getSelenium().type( "dom=document.forms[1].elements[0]", artifactId ); clickButtonWithValue( "Search" ); } + + 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 ); + } + + clickSubmitWithLocator( "filteredSearch_0" ); + } }
\ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java index 938ab1d97..2c697d725 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java @@ -60,8 +60,6 @@ public abstract class AbstractSeleniumTest { //baseUrl = getProperty( "BASE_URL" ); maxWaitTimeInMs = getProperty( "MAX_WAIT_TIME_IN_MS" ); - - } /** @@ -76,6 +74,7 @@ public abstract class AbstractSeleniumTest { { DefaultSelenium s = new DefaultSelenium( seleniumHost, seleniumPort, browser, baseUrl ); s.start(); + s.setTimeout( maxWaitTimeInMs ); selenium.set( s ); } } @@ -139,10 +138,12 @@ public abstract class AbstractSeleniumTest { Assert.assertEquals( fieldValue, getSelenium().getValue( fieldName ) ); } - public void assertPage( String title ) - { - Assert.assertEquals( getSelenium().getTitle(), title ); - } + public void assertPage( String title ) + { + // Collapse spaces + String actualTitle = getSelenium().getTitle().replaceAll( "[ \n\r]+", " " ); + Assert.assertEquals( actualTitle, title ); + } public String getTitle() { diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/tomcat5x/conf/Catalina/localhost/archiva.xml b/archiva-modules/archiva-web/archiva-webapp-test/src/test/tomcat5x/conf/Catalina/localhost/archiva.xml index 180dbb742..42dc7d3e2 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/tomcat5x/conf/Catalina/localhost/archiva.xml +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/tomcat5x/conf/Catalina/localhost/archiva.xml @@ -32,5 +32,5 @@ username="sa" password="" driverClassName="org.apache.derby.jdbc.EmbeddedDriver" - url="jdbc:derby:database/archiva;create=true" /> + url="jdbc:derby:target/database/archiva;create=true" /> </Context> diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index 44e4b143e..3ddb6f90b 100644 --- a/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -282,23 +282,6 @@ </configuration> </plugin> --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-clean-plugin</artifactId> - <version>2.1.1</version> - <!-- This configuration is added to cleanup from war:inplace --> - <configuration> - <filesets> - <fileset> - <directory>${basedir}</directory> - <includes> - <!-- TODO: META-INF shouldn't be required, seems to be an issue with the current war plugin --> - <include>appserver-base</include> - </includes> - </fileset> - </filesets> - </configuration> - </plugin> <!-- hack for jetty:run, archiva web config files are checked in /WEB-INF/ dir --> <plugin> <artifactId>maven-antrun-plugin</artifactId> |