diff options
author | Olivier Lamy <olamy@apache.org> | 2011-09-30 09:38:20 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2011-09-30 09:38:20 +0000 |
commit | 42b564bb7d017bbbc32c95418c9ede7967c814d0 (patch) | |
tree | 0332e68ae1aa0b2ac4349e91807c0b2a482a79c1 /archiva-modules/archiva-web | |
parent | 5daf80bc20b5bf59ba3a635f332a542411bb9c40 (diff) | |
download | archiva-42b564bb7d017bbbc32c95418c9ede7967c814d0.tar.gz archiva-42b564bb7d017bbbc32c95418c9ede7967c814d0.zip |
use Base64 from commons-codec
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1177567 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web')
-rw-r--r-- | archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java index ac257635b..d44687168 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java @@ -28,7 +28,7 @@ import com.meterware.servletunit.ServletUnitClient; import junit.framework.TestCase; import org.apache.commons.codec.Encoder; import org.apache.commons.codec.binary.Base64; -import sun.misc.BASE64Encoder; + import java.io.File; import javax.servlet.http.HttpServletResponse; @@ -47,6 +47,23 @@ public class RssFeedServletTest client = sr.newClient(); } + @Override + protected void tearDown() + throws Exception + { + if ( client != null ) + { + client.clearContents(); + } + + if ( sr != null ) + { + sr.shutDown(); + } + + super.tearDown(); + } + public void testRetrieveServlet() throws Exception { @@ -64,9 +81,9 @@ public class RssFeedServletTest WebRequest request = new GetMethodWebRequest( "http://localhost/feeds/test-repo" ); - BASE64Encoder encoder = new BASE64Encoder(); + Base64 encoder = new Base64(0, new byte[0]); String userPass = "user1:password1"; - String encodedUserPass = encoder.encode( userPass.getBytes() ); + String encodedUserPass = encoder.encodeToString( userPass.getBytes() ); request.setHeaderField( "Authorization", "BASIC " + encodedUserPass ); WebResponse response = client.getResponse( request ); @@ -84,9 +101,9 @@ public class RssFeedServletTest WebRequest request = new GetMethodWebRequest( "http://localhost/feeds/org/apache/archiva/artifact-two" ); - BASE64Encoder encoder = new BASE64Encoder(); + Base64 encoder = new Base64(0, new byte[0]); String userPass = "user1:password1"; - String encodedUserPass = encoder.encode( userPass.getBytes() ); + String encodedUserPass = encoder.encodeToString( userPass.getBytes() ); request.setHeaderField( "Authorization", "BASIC " + encodedUserPass ); WebResponse response = client.getResponse( request ); @@ -149,9 +166,9 @@ public class RssFeedServletTest WebRequest request = new GetMethodWebRequest( "http://localhost/feeds/unauthorized-repo" ); - BASE64Encoder encoder = new BASE64Encoder(); + Base64 encoder = new Base64(0, new byte[0]); String userPass = "user1:password1"; - String encodedUserPass = encoder.encode( userPass.getBytes() ); + String encodedUserPass = encoder.encodeToString( userPass.getBytes() ); request.setHeaderField( "Authorization", "BASIC " + encodedUserPass ); try @@ -166,21 +183,6 @@ public class RssFeedServletTest } } - @Override - protected void tearDown() - throws Exception - { - if ( client != null ) - { - client.clearContents(); - } - - if ( sr != null ) - { - sr.shutDown(); - } - super.tearDown(); - } } |