@Test public void testPublishFromTemplateSimpleInput() throws Exception { Map<String, String> parameters = new HashMap<String, String>(); parameters.put(AppSetupHandler.KEY_PUBDATA, ResourceHelper.readStringResource("AppSetupHandlerTest-input-simple.json", this)); parameters.put(AppSetupHandler.PARAM_PUBLISHER_VIEW_UUID, VALUE_PARENT_UUID); final ActionParameters params = createActionParams(parameters, getLoggedInUser()); verifyResponseNotWritten(params); handler.handlePost(params); verifyResponseWritten(params); final JSONObject expectedResult = ResourceHelper.readJSONResource("AppSetupHandlerTest-output-simple.json", this); final JSONObject actualResponse = getResponseJSON(); assertNotNull("Must contain actual UUID", actualResponse.getString("uuid")); actualResponse.remove("uuid"); expectedResult.remove("uuid"); assertNotNull("Must contain some URL", actualResponse.getString("url")); assertNotNull("URL should start with expected format", actualResponse.getString("url").startsWith(" actualResponse.remove("url"); expectedResult.remove("url"); assertTrue("Response should match expected", JSONHelper.isEqual(expectedResult, actualResponse)); }
public void handlePost(ActionParameters params) throws ActionException { final View publishedMap = buildPublishedView(params); try { JSONObject newViewJson = new JSONObject(publishedMap.toString()); ResponseHelper.writeResponse(params, newViewJson); } catch (JSONException je) { LOG.error(je, "Could not create JSON response."); ResponseHelper.writeResponse(params, false); } }
AppSetupHandler extends RestActionHandler { public void handlePost(ActionParameters params) throws ActionException { final View publishedMap = buildPublishedView(params); try { JSONObject newViewJson = new JSONObject(publishedMap.toString()); ResponseHelper.writeResponse(params, newViewJson); } catch (JSONException je) { LOG.error(je, "Could not create JSON response."); ResponseHelper.writeResponse(params, false); } } }
AppSetupHandler extends RestActionHandler { public void handlePost(ActionParameters params) throws ActionException { final View publishedMap = buildPublishedView(params); try { JSONObject newViewJson = new JSONObject(publishedMap.toString()); ResponseHelper.writeResponse(params, newViewJson); } catch (JSONException je) { LOG.error(je, "Could not create JSON response."); ResponseHelper.writeResponse(params, false); } }  }
AppSetupHandler extends RestActionHandler { public void handlePost(ActionParameters params) throws ActionException { final View publishedMap = buildPublishedView(params); try { JSONObject newViewJson = new JSONObject(publishedMap.toString()); ResponseHelper.writeResponse(params, newViewJson); } catch (JSONException je) { LOG.error(je, "Could not create JSON response."); ResponseHelper.writeResponse(params, false); } }  void setMyPlacesService(final MyPlacesService service); void setAnalysisService(final AnalysisDbService service); void setUserLayerService(final UserLayerDbService service); void setPermissionsService(final PermissionService service); void setOskariLayerService(final OskariLayerService service); void setViewService(final ViewService service); void setBundleService(final BundleService service); void init(); void preProcess(ActionParameters params); void handleGet(ActionParameters params); void handlePut(ActionParameters params); void handlePost(ActionParameters params); }
AppSetupHandler extends RestActionHandler { public void handlePost(ActionParameters params) throws ActionException { final View publishedMap = buildPublishedView(params); try { JSONObject newViewJson = new JSONObject(publishedMap.toString()); ResponseHelper.writeResponse(params, newViewJson); } catch (JSONException je) { LOG.error(je, "Could not create JSON response."); ResponseHelper.writeResponse(params, false); } }  void setMyPlacesService(final MyPlacesService service); void setAnalysisService(final AnalysisDbService service); void setUserLayerService(final UserLayerDbService service); void setPermissionsService(final PermissionService service); void setOskariLayerService(final OskariLayerService service); void setViewService(final ViewService service); void setBundleService(final BundleService service); void init(); void preProcess(ActionParameters params); void handleGet(ActionParameters params); void handlePut(ActionParameters params); void handlePost(ActionParameters params); static final String PROPERTY_DRAW_TOOLS_ENABLED; static final String KEY_DOMAIN; static final String KEY_LANGUAGE; static final String KEY_PLUGINS; static final String KEY_LAYERS; static final String KEY_SELLAYERS; static final String KEY_CROSSHAIR; }