Expand Up
@@ -49,23 +49,6 @@ public void testListApps() throws Exception {
}
}
@ Test
public void testListAppsJsonp () throws Exception {
ClientHttpRequest request =
getPrintRequest (MapPrinterServlet .LIST_APPS_URL + "?jsonp=listApps" , HttpMethod .GET );
try (ClientHttpResponse response = request .execute ()) {
assertEquals (HttpStatus .OK , response .getStatusCode ());
assertEquals (getJavaScriptMediaType (), response .getHeaders ().getContentType ());
String responseAsText = getBodyAsText (response );
assertTrue (responseAsText .startsWith ("listApps(" ));
responseAsText = responseAsText .replace ("listApps(" , "" ).replace (");" , "" );
final JSONArray appIdsJson = new JSONArray (responseAsText );
assertTrue (appIdsJson .length () > 0 );
}
}
@ Test
public void testGetCapabilities_NoApp () throws Exception {
ClientHttpRequest request = getPrintRequest (MapPrinterServlet .CAPABILITIES_URL , HttpMethod .GET );
Expand Down
Expand Up
@@ -107,31 +90,6 @@ public void testGetCapabilitiesPretty_NoApp() throws Exception {
}
}
@ Test
public void testGetCapabilitiesJsonp_NoApp () throws Exception {
ClientHttpRequest request =
getPrintRequest (MapPrinterServlet .CAPABILITIES_URL + "?jsonp=printCapabilities" ,
HttpMethod .GET );
try (ClientHttpResponse response = request .execute ()) {
assertEquals (HttpStatus .OK , response .getStatusCode ());
assertEquals (getJavaScriptMediaType (), response .getHeaders ().getContentType ());
assertTrue (getBodyAsText (response ).startsWith ("printCapabilities(" ));
}
}
@ Test
public void testGetCapabilitiesJsonpPretty_NoApp () throws Exception {
ClientHttpRequest request = getPrintRequest (
MapPrinterServlet .CAPABILITIES_URL + "?pretty=true&jsonp=printCapabilities" , HttpMethod .GET );
try (ClientHttpResponse response = request .execute ()) {
assertEquals (HttpStatus .OK , response .getStatusCode ());
assertEquals (getJavaScriptMediaType (), response .getHeaders ().getContentType ());
String responseAsText = getBodyAsText (response );
assertTrue (responseAsText .startsWith ("printCapabilities(" ));
assertTrue (responseAsText .contains ("\n " ));
}
}
@ Test
public void testExampleRequest_NoApp () throws Exception {
ClientHttpRequest request = getPrintRequest (MapPrinterServlet .EXAMPLE_REQUEST_URL , HttpMethod .GET );
Expand All
@@ -142,23 +100,6 @@ public void testExampleRequest_NoApp() throws Exception {
}
}
@ Test
public void testExampleRequestJsonp_NoApp () throws Exception {
ClientHttpRequest request =
getPrintRequest (MapPrinterServlet .EXAMPLE_REQUEST_URL + "?jsonp=exampleRequest" ,
HttpMethod .GET );
try (ClientHttpResponse response = request .execute ()) {
assertEquals (HttpStatus .OK , response .getStatusCode ());
assertEquals (getJavaScriptMediaType (), response .getHeaders ().getContentType ());
String responseAsText = getBodyAsText (response );
assertTrue (responseAsText .startsWith ("exampleRequest(" ));
responseAsText = responseAsText .replace ("exampleRequest(" , "" ).replace (");" , "" );
checkExampleRequest (responseAsText );
}
}
@ Test
public void testExampleRequest_App () throws Exception {
ClientHttpRequest request =
Expand All
@@ -170,23 +111,6 @@ public void testExampleRequest_App() throws Exception {
}
}
@ Test
public void testExampleRequestJsonp_App () throws Exception {
ClientHttpRequest request =
getPrintRequest ("geoext" + MapPrinterServlet .EXAMPLE_REQUEST_URL + "?jsonp=exampleRequest" ,
HttpMethod .GET );
try (ClientHttpResponse response = request .execute ()) {
assertEquals (HttpStatus .OK , response .getStatusCode ());
assertEquals (getJavaScriptMediaType (), response .getHeaders ().getContentType ());
String responseAsText = getBodyAsText (response );
assertTrue (responseAsText .startsWith ("exampleRequest(" ));
responseAsText = responseAsText .replace ("exampleRequest(" , "" ).replace (");" , "" );
checkExampleRequest (responseAsText );
}
}
private void checkExampleRequest (String responseAsText ) throws JSONException {
JSONObject samplesRequest = new JSONObject (responseAsText );
final Iterator keys = samplesRequest .keys ();
Expand Down
Expand Up
@@ -308,17 +232,13 @@ private void testCreateReport(String requestPath, String printSpec) throws Excep
}
}
// check status with JSONP
request = getPrintRequest (MapPrinterServlet .STATUS_URL + "/" + ref + ".json?jsonp=getStatus" ,
request = getPrintRequest (MapPrinterServlet .STATUS_URL + "/" + ref + ".json" ,
HttpMethod .GET );
try (ClientHttpResponse response = request .execute ()) {
assertEquals (HttpStatus .OK , response .getStatusCode ());
assertEquals (getJavaScriptMediaType (), response .getHeaders ().getContentType ());
assertEquals (getJsonMediaType (), response .getHeaders ().getContentType ());
String responseAsText = getBodyAsText (response );
assertTrue (responseAsText .startsWith ("getStatus(" ));
responseAsText = responseAsText .replace ("getStatus(" , "" ).replace (");" , "" );
JSONObject statusResult = new JSONObject (responseAsText );
assertTrue (statusResult .has (MapPrinterServlet .JSON_DONE ));
Expand Down