From 9d1f342bc5daa06270283d4635c32af4e6307011 Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Mon, 21 Apr 2008 10:00:35 +0000 Subject: [PATCH] fix the tests to operate consistently on all platforms git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@650071 13f79535-47bb-0310-9956-ffa450edef68 --- .../AbstractRepositoryServletTestCase.java | 3 +++ .../web/repository/RepositoryServletTest.java | 12 +++--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/AbstractRepositoryServletTestCase.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/AbstractRepositoryServletTestCase.java index bfd363edc..83c508b56 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/AbstractRepositoryServletTestCase.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/AbstractRepositoryServletTestCase.java @@ -20,6 +20,7 @@ package org.apache.maven.archiva.web.repository; */ import com.meterware.httpunit.WebResponse; +import com.meterware.httpunit.HttpUnitOptions; import com.meterware.servletunit.ServletRunner; import com.meterware.servletunit.ServletUnitClient; import net.sf.ehcache.CacheManager; @@ -162,6 +163,8 @@ public abstract class AbstractRepositoryServletTestCase CacheManager.getInstance().removeCache( "url-failures-cache" ); + HttpUnitOptions.setExceptionsThrownOnErrorStatus( false ); + sr = new ServletRunner( getTestFile( "src/test/webapp/WEB-INF/web.xml" ) ); sr.registerServlet( "/repository/*", UnauthenticatedRepositoryServlet.class.getName() ); sc = sr.newClient(); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletTest.java index 42c9a6068..201d1db99 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletTest.java @@ -117,14 +117,8 @@ public class RepositoryServletTest String path = REQUEST_PATH + ".index/filecontent/foo.bar"; WebRequest request = new GetMethodWebRequest( path ); - try - { - sc.getResponse( request ); - fail( "should have been not found" ); - } - catch ( HttpNotFoundException e ) - { - assertEquals( "Error on HTTP request: 404 Invalid path to Artifact: legacy paths should have an expected type ending in [s] in the second part of the path. [http://machine.com/repository/internal/.index/filecontent/foo.bar]", e.getMessage() ); - } + WebResponse response = sc.getResponse( request ); + assertResponseNotFound( response ); + assertEquals( "Invalid path to Artifact: legacy paths should have an expected type ending in [s] in the second part of the path.", response.getResponseMessage() ); } } -- 2.39.5