testPolicyYes rerunnable +@Override in test classes

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1370044 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
skygo 2012-08-06 22:17:09 +00:00
parent 1d46686015
commit cec0299444
2 changed files with 8 additions and 14 deletions

View File

@ -81,7 +81,7 @@ public class CachedFailuresPolicyTest
policy.applyPolicy( CachedFailuresPolicy.NO, request, localFile ); policy.applyPolicy( CachedFailuresPolicy.NO, request, localFile );
} }
@Test @Test( expected = PolicyViolationException.class )
public void testPolicyYes() public void testPolicyYes()
throws Exception throws Exception
{ {
@ -89,28 +89,21 @@ public class CachedFailuresPolicyTest
DownloadPolicy policy = lookupPolicy(); DownloadPolicy policy = lookupPolicy();
File localFile = getFile(); File localFile = getFile();
Properties request = createRequest(); Properties request = createRequest();
// make unique name
request.setProperty( "url", "http://a.bad.hostname.maven.org/path/to/resource.txt" ); String url = "http://a.bad.hostname.maven.org/path/to/resource"+ System.currentTimeMillis() +".txt";
request.setProperty( "url", url );
// should not fail // should not fail
policy.applyPolicy( CachedFailuresPolicy.YES, request, localFile ); policy.applyPolicy( CachedFailuresPolicy.YES, request, localFile );
// status Yes Not In cache // status Yes Not In cache
// Yes in Cache // Yes in Cache
String url = "http://a.bad.hostname.maven.org/path/to/resource.txt";
urlFailureCache.cacheFailure( url ); urlFailureCache.cacheFailure( url );
request.setProperty( "url", url ); request.setProperty( "url", url );
try policy.applyPolicy( CachedFailuresPolicy.YES, request, localFile );
{
policy.applyPolicy( CachedFailuresPolicy.YES, request, localFile );
fail( "Expected a PolicyViolationException." );
}
catch ( PolicyViolationException e )
{
// expected path.
}
} }
} }

View File

@ -368,6 +368,7 @@ public class ReleasePolicyTest
@Before @Before
@Override
public void setUp() public void setUp()
throws Exception throws Exception
{ {