Commit c38a2f26 authored by Yann Garcia's avatar Yann Garcia
Browse files

Adding new TCs for I1

parent c7b208ea
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -121,7 +121,27 @@ namespace LibHelpers__Functions {
   * @brief Retrieve the current local date/time formatted as yyyy-mm-ddThh:mm:ss.lll+nn:00
   * @return The the current date/time on success, a null string otherwise 
   */
  CHARSTRING fx__get__current__date__time() { //2018-01-18T13:19:35.367+01:00
  CHARSTRING fx__get__current__date__time(const INTEGER& p__shift__time) { //2018-01-18T13:19:35.367+01:00
    loggers::get_instance().log(">>> fx__get__current__date__time");

    time_t t = std::time(nullptr);
    if (p__shift__time != 0) {
      t += static_cast<int>(p__shift__time);
    }
    auto tm = *std::localtime(&t);
    std::ostringstream oss;
    oss << std::put_time(&tm, "%FT%TZ");//%FT%T%Z

    CHARSTRING dt(oss.str().c_str());
    loggers::get_instance().log_msg("fx__get__current__date__time: ", dt);
    return dt;
  }

  /**
   * @brief Retrieve the local date/time in the past formatted as yyyy-mm-ddThh:mm:ss.lll+nn:00
   * @return The the current date/time on success, a null string otherwise 
   */
  CHARSTRING fx__get__current__date__time__past() { //2018-01-18T13:19:35.367+01:00
    loggers::get_instance().log(">>> fx__get__current__date__time");

    time_t t = std::time(nullptr);
+10 −5
Original line number Diff line number Diff line
@@ -186,6 +186,10 @@ int certs_cache::store_certificate(const std::string& p_certificate_name, const
    loggers::get_instance().warning("certs_cache::store_certificate: Failed to load certificate");
    return -1;
  }

  loggers::get_instance().log("certs_cache::store_certificate: Dump of current certificates: ");
  dump();

  // Certificate is on the DB, load it
  std::map<std::string, std::unique_ptr<const certs_db_record>>::const_iterator it = _certificates.find(p_certificate_id);
  *p_record = it->second.get();
@@ -201,10 +205,11 @@ int certs_cache::store_certificate(const std::string& p_certificate_name, const
}

void certs_cache::dump() const {
  loggers::get_instance().log("certs_cache::dump_certificates: # items = %d", _certificates.size());
  loggers::get_instance().log(">>> certs_cache::dump_certificates: # items = %d", _certificates.size());

  for (std::map<std::string, std::unique_ptr<const certs_db_record>>::const_iterator it = _certificates.cbegin(); it != _certificates.cend(); ++it) {
    const certs_db_record *p = it->second.get();
    loggers::get_instance().log("certs_cache::dump_certificates: certificate_id: '%s'", p->certificate_id().c_str());
  } // End of 'for' statement
} // End of method dump

+4 −1
Original line number Diff line number Diff line
@@ -210,6 +210,10 @@ int certs_loader::store_certificate(const std::string& p_certificate_name, const
  loggers::get_instance().log("certs_loader::store_certificate: p_certificate_id: '%s'", p_certificate_id.c_str());
  loggers::get_instance().log("certs_loader::store_certificate: cert: '%p'", cert);


  // FIXME Dump certificate


  // Create new record
  certs_db_record *r = new certs_db_record(p_certificate_name, cert, nullptr, p_certificate_pem);
  std::pair<std::map<std::string, std::unique_ptr<const certs_db_record>>::iterator, bool> result = p_certificates.insert(std::pair<std::string, std::unique_ptr<const certs_db_record>>(p_certificate_id, std::unique_ptr<const certs_db_record>(r)));
@@ -221,4 +225,3 @@ int certs_loader::store_certificate(const std::string& p_certificate_name, const

  return 0;
} // End of method store_certificate
+1 −1
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ module LibHelpers_Functions {
        */
        external function fx_generate_uuid() return charstring;

        external function fx_get_current_date_time() return charstring;
        external function fx_get_current_date_time(in integer p_shift_time) return charstring;

    } // End of externals