aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web/archiva-web-common
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2015-02-11 22:43:25 +1100
committerOlivier Lamy <olamy@apache.org>2015-02-11 22:43:25 +1100
commitd3f56e231eae8ec312a1057da23cca5a943506a7 (patch)
tree1899834b4627535ca1aba3c4c33a6739b386b28b /archiva-modules/archiva-web/archiva-web-common
parent28dae86beaf01bc0646a65e2fe31738d7c5727cd (diff)
downloadarchiva-d3f56e231eae8ec312a1057da23cca5a943506a7.tar.gz
archiva-d3f56e231eae8ec312a1057da23cca5a943506a7.zip
fix junit
Diffstat (limited to 'archiva-modules/archiva-web/archiva-web-common')
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactFromQueryTest.java32
1 files changed, 24 insertions, 8 deletions
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactFromQueryTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactFromQueryTest.java
index cedd46a24..341d8388e 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactFromQueryTest.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactFromQueryTest.java
@@ -23,6 +23,7 @@ import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
import org.apache.archiva.rest.api.services.RepositoriesService;
import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
import org.apache.commons.io.FileUtils;
+import org.assertj.core.api.Assertions;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
@@ -30,9 +31,11 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+import javax.ws.rs.RedirectionException;
import javax.ws.rs.core.Response;
import java.io.File;
import java.io.IOException;
+import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -121,7 +124,7 @@ public class DownloadArtifactFromQueryTest
}
- @Test
+ @Test( expected = RedirectionException.class )
public void downloadFixedVersion()
throws Exception
{
@@ -136,10 +139,17 @@ public class DownloadArtifactFromQueryTest
Assert.assertEquals( Response.Status.TEMPORARY_REDIRECT.getStatusCode(), response.getStatus() );
- String location = String.class.cast( response.getMetadata().get( "Location" ).get( 0 ) );
+ //String location = String.class.cast( response.getMetadata().get( "Location" ).get( 0 ) );
- Assert.assertEquals( "http://localhost:" + port + "/repository/" + id
- + "/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar", location );
+ //Assert.assertEquals( "http://localhost:" + port + "/repository/" + id
+ // + "/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar", location );
+ }
+ catch ( RedirectionException e )
+ {
+ Assertions.assertThat( e.getLocation().compareTo( new URI( "http://localhost:" + port + "/repository/" + id
+ + "/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar" ) ) ).isEqualTo(
+ 0 );
+ throw e;
}
finally
{
@@ -149,7 +159,7 @@ public class DownloadArtifactFromQueryTest
}
- @Test
+ @Test( expected = RedirectionException.class )
public void downloadLatestVersion()
throws Exception
{
@@ -167,11 +177,17 @@ public class DownloadArtifactFromQueryTest
/// http://localhost:57168/repository/1400639145722/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar
- Assert.assertEquals( "http://localhost:" + port + "/repository/" + id
- + "/org/apache/archiva/archiva-test/2.0/archiva-test-2.0.jar", location );
-
+ //Assert.assertEquals( "http://localhost:" + port + "/repository/" + id
+ // + "/org/apache/archiva/archiva-test/2.0/archiva-test-2.0.jar", location );
}
+ catch ( RedirectionException e )
+ {
+ Assertions.assertThat( e.getLocation().compareTo( new URI( "http://localhost:" + port + "/repository/" + id
+ + "/org/apache/archiva/archiva-test/2.0/archiva-test-2.0.jar" ) ) ).isEqualTo(
+ 0 );
+ throw e;
+ }
finally
{
getManagedRepositoriesService().deleteManagedRepository( id, false );