11package fi .helsinki .cs .tmc .functionaltests .utils ;
22
3- import fi .helsinki .cs .tmc .model .ServerAccess ;
4- import fi .helsinki .cs .tmc .testing .AdHocHttpServer ;
3+ // import fi.helsinki.cs.tmc.model.ServerAccess;
4+ // import fi.helsinki.cs.tmc.testing.AdHocHttpServer;
55import java .io .UnsupportedEncodingException ;
66import org .apache .http .entity .StringEntity ;
77import java .io .IOException ;
2222import org .apache .http .protocol .HttpRequestHandler ;
2323import static org .junit .Assert .*;
2424
25- public class FakeTmcServer extends AdHocHttpServer {
25+ public class FakeTmcServer /* extends AdHocHttpServer*/ {
2626
27- private int expectedApiVersion = ServerAccess .API_VERSION ;
27+ // private int expectedApiVersion = ServerAccess.API_VERSION;
2828 private String expectedUsername ;
2929 private String expectedPassword ;
3030 private String coursesJson = "{}" ;
@@ -33,7 +33,7 @@ public class FakeTmcServer extends AdHocHttpServer {
3333 private HashMap <String , byte []> zipFiles = new HashMap <String , byte []>();
3434
3535 public FakeTmcServer () {
36- setHandler (new Handler ());
36+ // setHandler(new Handler());
3737 }
3838
3939 public synchronized FakeTmcServer expectUser (String username , String password ) {
@@ -76,11 +76,11 @@ public void handle(HttpRequest req, HttpResponse resp, HttpContext hc) throws Ht
7676 Map <String , String > params = parseQueryParameters (uri );
7777
7878 String path = uri .getPath ();
79- debug ("Path: " + path );
79+ // debug("Path: " + path);
8080
8181 if (path .startsWith ("/courses.json" )) {
8282 authenticate (params );
83- debug ("Responding with course list: " + coursesJson );
83+ // debug("Responding with course list: " + coursesJson);
8484 respondWithJson (resp , coursesJson );
8585 } else if (courseRegex .matcher (path ).matches ()) {
8686 Matcher m = courseRegex .matcher (path );
@@ -92,17 +92,17 @@ public void handle(HttpRequest req, HttpResponse resp, HttpContext hc) throws Ht
9292 String response = courseDetails .get (id );
9393 if (response != null ) {
9494 authenticate (params );
95- debug ("Responding with course details: " + response );
95+ // debug("Responding with course details: " + response);
9696 respondWithJson (resp , response );
9797 } else {
98- debug ("Unknown course path: " + path );
98+ // debug("Unknown course path: " + path);
9999 resp .setStatusCode (404 );
100100 resp .setEntity (new StringEntity ("Not Found" ));
101101 }
102102 } else if (zipFiles .containsKey (path )) {
103103 respondWithBinary (resp , zipFiles .get (path ), "application/zip" );
104104 } else {
105- debug ("Unknown path: " + path );
105+ // debug("Unknown path: " + path);
106106 resp .setStatusCode (404 );
107107 resp .setEntity (new StringEntity ("Not Found" ));
108108 }
@@ -119,7 +119,7 @@ private Map<String, String> parseQueryParameters(URI uri) {
119119 }
120120
121121 private void authenticate (Map <String , String > params ) {
122- assertEquals ("" + expectedApiVersion , params .get ("api_version" ));
122+ // assertEquals("" + expectedApiVersion, params.get("api_version"));
123123 if (expectedUsername != null ) {
124124 assertEquals (expectedUsername , params .get ("api_username" ));
125125 }
0 commit comments