You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by sc...@apache.org on 2010/02/17 11:19:09 UTC
svn commit: r910895 -
/incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/ProxyTest.java
Author: scottbw
Date: Wed Feb 17 10:19:09 2010
New Revision: 910895
URL: http://svn.apache.org/viewvc?rev=910895&view=rev
Log:
Added test cases for POST with no parameters (only querystring) and for GET with parameters (both encoded and unencoded)
Modified:
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/ProxyTest.java
Modified: incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/ProxyTest.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/ProxyTest.java?rev=910895&r1=910894&r2=910895&view=diff
==============================================================================
--- incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/ProxyTest.java (original)
+++ incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/ProxyTest.java Wed Feb 17 10:19:09 2010
@@ -93,6 +93,38 @@
String url = PROXY_URL+"?instanceid_key="+instance_id_key+"&url="+BLOCKED_SITE_URL;
assertEquals(403,send(url,"GET"));
}
+
+ @Test
+ public void postWithOnlyQueryStringParameters() throws Exception{
+ HttpClient client = new HttpClient();
+ List<String> authPrefs = new ArrayList<String>(2);
+ authPrefs.add(AuthPolicy.DIGEST );
+ authPrefs.add(AuthPolicy.BASIC);
+ client.getParams().setParameter (AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);
+ // send the basic authentication response even before the server gives an unauthorized response
+ client.getParams().setAuthenticationPreemptive(true);
+ client.getState().setCredentials(
+ new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM),
+ new UsernamePasswordCredentials("java", "java"));
+ PostMethod req;
+ req = new PostMethod(PROXY_URL+"?instanceid_key="+instance_id_key+"&url="+PROTECTED_SITE_URL);
+ client.executeMethod(req);
+ int code = req.getStatusCode();
+ req.releaseConnection();
+ assertEquals(200,code);
+ }
+
+ @Test
+ public void getWithEncodedParameters(){
+ String url = PROXY_URL+"?instanceid_key="+instance_id_key+"&url="+VALID_SITE_URL+"%3Fx=1%26y=2";
+ assertEquals(200,send(url,"GET"));
+ }
+
+ @Test
+ public void getWithUnencodedParameters(){
+ String url = PROXY_URL+"?instanceid_key="+instance_id_key+"&url="+VALID_SITE_URL+"?x=1&y=2";
+ assertEquals(200,send(url,"GET"));
+ }
@Test
public void postWithMixedQueryAndParameters() throws Exception{