Exemplo n.º 1
0
  /**
   * Get the Complete query from the property files
   *
   * @param dbQueries
   * @return
   * @throws IOException
   */
  public List<String> getQueries(String dbQueries) throws Exception, IOException {

    requestProp = new Properties();
    FileInputStream fis = new FileInputStream(Constants.SQL_QUERIES_PROP_PATH + sqlPropFileName);
    requestProp.load(fis);
    List<String> allQueries = new ArrayList<String>();
    String[] queryKeyValues = dbQueries.split(",");
    for (String queryKeyValue : queryKeyValues) {

      queryKeyValue = queryKeyValue.trim();
      if (!queryKeyValue.isEmpty()) {
        String[] keyValue = queryKeyValue.split(":");
        if (keyValue.length != 2) {
          throw new Exception("Query or Parameter key missing in the excel sheet.");
        }
        String query1 = requestProp.getProperty(keyValue[0]);
        String param1 = requestProp.getProperty(keyValue[1]);
        if (param1 != null) {
          // Combines query and parameter
          query1 = ParamsUtil.replaceParams(query1, param1);
        }
        allQueries.add(query1);
        logger.info(query1);
      }
    }
    return allQueries;
  }
Exemplo n.º 2
0
 public OpenBistuProvider(String url, OpenConsumer consumer, Context context) {
   super();
   this._url = url;
   this._consumer = consumer;
   this._context = context;
   this._mustParams = new HashMap<String, String>();
   this._mustParams.put(Contants.RequestParamName.APP_KEY, _consumer.getAppId());
   this._mustParams.put(Contants.RequestParamName.TIME_STAMP, ParamsUtil.getTimeStamp());
 }