package org.sana.android.net.test;

import org.apache.http.util.VersionInfo;

import android.test.AndroidTestCase;
import android.util.Log;

public class ApacheTest extends AndroidTestCase {

	
	public void testVersion(){
		VersionInfo vi = VersionInfo.loadVersionInfo("org.apache.http.client",getClass().getClassLoader());  
		String version = vi.getRelease();  
		Log.d("apache http client version", version);
	}
}

@@ -56,87 +56,886 @@
 ttp.
-util.VersionInfo;%0A%0Aimport android.test.AndroidTestCase;%0Aimport android.util.Log
+HttpResponse;%0Aimport org.apache.http.NameValuePair;%0Aimport org.apache.http.client.ClientProtocolException;%0Aimport org.apache.http.client.HttpClient;%0Aimport org.apache.http.client.entity.UrlEncodedFormEntity;%0Aimport org.apache.http.client.methods.HttpPost;%0Aimport org.apache.http.message.BasicNameValuePair;%0Aimport org.apache.http.params.HttpConnectionParams;%0Aimport org.apache.http.params.HttpParams;%0Aimport org.apache.http.util.EntityUtils;%0Aimport org.apache.http.util.VersionInfo;%0Aimport org.sana.R;%0Aimport org.sana.android.net.HttpRequestFactory;%0Aimport org.sana.android.net.MDSInterface2;%0Aimport org.sana.net.http.HttpTaskFactory;%0A%0Aimport android.test.AndroidTestCase;%0Aimport android.util.Log;%0A%0Aimport java.io.IOException;%0Aimport java.io.UnsupportedEncodingException;%0Aimport java.net.URI;%0Aimport java.net.URISyntaxException;%0Aimport java.util.ArrayList;%0Aimport java.util.List
 ;%0A%0Ap
@@ -1169,48 +1169,1912 @@
 .d(%22
+org.
 apache
- http client version%22, version);%0A%09
+.http.client%22, version);%0A%09%7D%0A%0A    public void testJsonResponse()%7B%0A        String username = getContext().getString(R.string.debug_user);%0A        String password = getContext().getString(R.string.debug_password);%0A        String url = MDSInterface2.getMDSUrl(getContext(), getContext().getString(R.string.path_session));%0A        URI uri = null;%0A        try %7B%0A            uri = MDSInterface2.getURI(getContext(), getContext().getString(R.string.path_session));%0A%0A        List%3CNameValuePair%3E postData = new ArrayList%3CNameValuePair%3E();%0A        postData.add(new BasicNameValuePair(%22username%22, username));%0A        postData.add(new BasicNameValuePair(%22password%22, password));%0A        HttpPost post = HttpRequestFactory.getPostRequest(uri, postData);%0A        //HttpPost post = new HttpPost(uri);%0A        post.setHeader(%22Accept%22, %22application/json%22);%0A        UrlEncodedFormEntity entity = null;%0A            entity = new UrlEncodedFormEntity(postData, %22UTF-8%22);%0A            post.setEntity(entity);%0A            HttpResponse response;%0A            String responseString;%0A            HttpClient client = HttpTaskFactory.CLIENT_FACTORY.produce();%0A            HttpParams httpParams = client.getParams();%0A            int timeout = -1;%0A            if(timeout %3E 0)%7B%0A                HttpConnectionParams.setConnectionTimeout(httpParams, timeout);%0A                HttpConnectionParams.setSoTimeout(httpParams, timeout);%0A            %7D%0A            response = client.execute(post);%0A            responseString = EntityUtils.toString(response.getEntity());%0A            Log.d(%22ApacheTest%22, responseString);%0A        %7D catch (UnsupportedEncodingException e) %7B%0A            e.printStackTrace();%0A        %7D catch (URISyntaxException e) %7B%0A            e.printStackTrace();%0A        %7D catch (ClientProtocolException e) %7B%0A            e.printStackTrace();%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A        %7D%0A    
 %7D%0A%7D%0A

Test update