コード例 #1
0
 @Test
 public void testGetAjugglerURLkeyDefault() throws JSONException {
   JSONObject actionJO = new JSONObject();
   actionJO.put(Constant.JSON_KEY_FROM, Constant.KEY_ADJUGGLER_FROM_MAIN);
   actionJO.put(Constant.JSON_KEY_ISPREMIUMACCOUNT, 0);
   Object o = AdjugglerUtil.getAjugglerURLkeyDefault(actionJO);
   Assert.assertNotNull(o);
 }
コード例 #2
0
  @Test
  public void testDealWithExternalURL() throws JSONException {
    JSONObject action = new JSONObject();
    action.put("type", Constant.KEY_ADJUGGLER_BROWSER);

    JSONObject adJo = new JSONObject();
    adJo.put("action", action);
    Object o = AdjugglerUtil.dealWithExternalURL(adJo, handler);
    Assert.assertNotNull(o);
  }
コード例 #3
0
 @Test
 public void testGetPoiSearchRequest() throws JSONException {
   JSONObject locationJO = new JSONObject();
   locationJO.put("lat", 3737453);
   locationJO.put("lon", -12199983);
   long categoryId = 703;
   int sortType = 4;
   PoiSearchRequest req =
       AdjugglerUtil.getPoiSearchRequest(handler, locationJO, categoryId, sortType, true);
   Assert.assertNotNull(req);
 }
コード例 #4
0
  @Test
  public void testSetImageUrlSuffix() throws JSONException {

    JSONObject backgroundImageJo = new JSONObject();
    backgroundImageJo.put("focusUrl", "focusUrl");
    backgroundImageJo.put("unfocusUrl", "unfocusUrl");

    JSONObject adJo = new JSONObject();
    adJo.put("backgroundImage", backgroundImageJo);

    Object o = AdjugglerUtil.setImageUrlSuffix(adJo, "suffix");
    Assert.assertNotNull(o);
  }
コード例 #5
0
  @Test
  public void testHandleAdjugglerURL() throws JSONException {

    JSONObject actionJO = new JSONObject();
    actionJO.put("keyword", "");
    Object o = AdjugglerUtil.handleAdjugglerURL("http://", handler, actionJO);
    Assert.assertNotNull(o);
  }
コード例 #6
0
  public JSONArray serializeJSON() throws JSONException {

    JSONArray a = new JSONArray();

    //  Mandatory items

    for (int i = 0; i < contacts.length; i++) {
      Contact c = contacts[i];
      JSONObject o = new JSONObject();
      o.put("contact", c.serializeJSON());
      a.put(o);
    }

    return a;
  }
コード例 #7
0
  @Test
  public void testGetMovieSearchRequestDTO() throws JSONException {

    JSONObject locationJO = new JSONObject();
    locationJO.put("lat", 3737453);
    locationJO.put("lon", -12199983);

    JSONObject adJo = new JSONObject();
    JSONObject actionJson = new JSONObject();
    adJo.put("action", actionJson);
    actionJson.put("searchName", "Movie");
    actionJson.put("searchDate", "2012-03-05");
    actionJson.put("SortBy", AdjugglerUtil.MOVIE_SORT_BY_WEEKEND_GROSS);

    AdjugglerUtil.getMovieSearchRequestDTO(handler, locationJO, adJo);
  }
コード例 #8
0
  @Before
  public void setUp() throws Exception {

    JSONObject paramJSON = HtmlAdjugglerDefaultJSON.getDefaultJSONForPrem();
    paramJSON.put("loginLocator", "");
    paramJSON.put("ssoToken", "");
    paramJSON.put("appCode", "");
    paramJSON.put("clientInfoStr", "");
    paramJSON.put("width", "480-800");
    paramJSON.put("height", "800-480");

    HtmlClientInfo htmlClientInfo = new HtmlClientInfo();

    dataSource.addData(JSONObject.class.getName(), paramJSON);
    dataSource.addData(String.class.getName(), String.valueOf("1"));
    dataSource.addData(HtmlClientInfo.class.getName(), htmlClientInfo);
  }
コード例 #9
0
  @Override
  public void parseBrowserResponse(
      HttpServletRequest httpRequest, ExecutorResponse executorResponse) {
    ShareAddressResponse response = (ShareAddressResponse) executorResponse;
    int status = response.getStatus();
    boolean isRGC = response.isRGC();
    String resultText = "N";
    if (status == ExecutorResponse.STATUS_OK) {
      resultText = "Y";
    }
    TxNode node = new TxNode();
    node.addMsg(resultText);
    if (isRGC) {
      Stop stop = response.getAddress();
      JSONObject stopJo = new JSONObject();
      try {
        stopJo.put("firstLine", stop.firstLine);
        stopJo.put("city", stop.city);
        stopJo.put("state", stop.state);
        stopJo.put("country", stop.country);
        stopJo.put("lon", stop.lon);
        stopJo.put("zip", stop.zip);
        stopJo.put("lat", stop.lat);
        stopJo.put("lon", stop.lon);
        stopJo.put("label", stop.label);
      } catch (JSONException e) {
        // TODO Auto-generated catch block
        logger.error("JSONException occured when we want to put a string into it");
        logger.error("cause:" + e.getCause() + ",message:" + e.getMessage());
      }

      node.addMsg(stopJo.toString());
    }
    httpRequest.setAttribute("node", node);

    // TODO save audio
  }
コード例 #10
0
  private void parseResultSet(Properties prop, ResultSet rs, List<JSONObject> newNotification)
      throws SQLException, JSONException {

    if (!rs.isBeforeFirst()) {
      log.debug("No Data Available ");
      return;
    } else {
      while (rs.next()) {
        JSONObject notiObj = new JSONObject();
        notiObj.put("title", rs.getString("tittle"));
        notiObj.put("auther", rs.getString("auther"));
        notiObj.put("publisher", rs.getString("publisher"));
        notiObj.put("release_date", rs.getDate("release_date").toString());
        notiObj.put("list_price", rs.getString("list_price"));
        notiObj.put("id", rs.getString("id"));
        newNotification.add(notiObj);
        invalidate_record(rs.getString("id"), prop);
        log.debug("==New Notification Record=" + notiObj.toString());
      }
    }
  }