bool checkPoolAttribs()

in cppcache/integration-test/testXmlCacheCreationWithPools.cpp [77:225]


bool checkPoolAttribs(std::shared_ptr<Pool> pool, SLIST &locators,
                      SLIST &servers, int freeConnectionTimeout,
                      int loadConditioningInterval, int minConnections,
                      int maxConnections, int retryAttempts,
                      std::chrono::milliseconds idleTimeout, int pingInterval,
                      const std::string &name, int readTimeout,
                      const std::string &serverGroup, int socketBufferSize,
                      bool subscriptionEnabled,
                      int subscriptionMessageTrackingTimeout,
                      int subscriptionAckInterval, int subscriptionRedundancy,
                      int statisticInterval, bool prSingleHopEnabled,
                      int updateLocatorListInterval) {
  using apache::geode::internal::chrono::duration::to_string;

  if (pool == nullptr) {
    LOG("checkPoolAttribs: std::shared_ptr<Pool> is nullptr");
    return false;
  }

  std::cout << "Checking pool " << pool->getName() << std::endl;

  if (pool->getName() != name) {
    LOG(std::string("checkPoolAttribs: Pool name expected [") + name +
        "], actual[" + pool->getName() + "]");
    return false;
  }
  if (!checkStringArray(locators, pool->getLocators())) {
    LOG("checkPoolAttribs: locators mismatch");
    return false;
  }
  if (servers.size() > 0 && !checkStringArray(servers, pool->getServers())) {
    LOG("checkPoolAttribs: servers mismatch");
    return false;
  }
  if (std::chrono::milliseconds(freeConnectionTimeout) !=
      pool->getFreeConnectionTimeout()) {
    LOG(std::string("checkPoolAttribs: Pool freeConnectionTimeout expected [") +
        std::to_string(freeConnectionTimeout) + ", actual[" +
        std::to_string(pool->getFreeConnectionTimeout().count()) + "]");
    return false;
  }
  if (std::chrono::milliseconds(loadConditioningInterval) !=
      pool->getLoadConditioningInterval()) {
    LOG(std::string(
            "checkPoolAttribs: Pool loadConditioningInterval expected [") +
        std::to_string(loadConditioningInterval) + ", actual[" +
        std::to_string(pool->getLoadConditioningInterval().count()) + "]");
    return false;
  }
  if (minConnections != pool->getMinConnections()) {
    LOG(std::string("checkPoolAttribs: Pool minConnections expected [") +
        std::to_string(minConnections) + ", actual[" +
        std::to_string(pool->getMinConnections()) + "]");
    return false;
  }
  if (maxConnections != pool->getMaxConnections()) {
    LOG(std::string("checkPoolAttribs: Pool maxConnections expected [") +
        std::to_string(maxConnections) + ", actual[" +
        std::to_string(pool->getMaxConnections()) + "]");
    return false;
  }
  if (retryAttempts != pool->getRetryAttempts()) {
    LOG(std::string("checkPoolAttribs: Pool retryAttempts expected [") +
        std::to_string(retryAttempts) + ", actual[" +
        std::to_string(pool->getRetryAttempts()) + "]");
    return false;
  }
  if (idleTimeout != pool->getIdleTimeout()) {
    LOG(std::string("checkPoolAttribs: Pool idleTimeout expected [") +
        std::to_string(idleTimeout.count()) + ", actual[" +
        std::to_string(pool->getIdleTimeout().count()) + "]");
    return false;
  }
  if (std::chrono::milliseconds(pingInterval) != pool->getPingInterval()) {
    LOG(std::string("checkPoolAttribs: Pool pingInterval expected [") +
        std::to_string(pingInterval) + ", actual[" +
        std::to_string(pool->getPingInterval().count()) + "]");
    return false;
  }
  if (std::chrono::milliseconds(readTimeout) != pool->getReadTimeout()) {
    LOG(std::string("checkPoolAttribs: Pool readTimeout expected [") +
        std::to_string(readTimeout) + ", actual[" +
        std::to_string(pool->getReadTimeout().count()) + "]");
    return false;
  }
  if (serverGroup != pool->getServerGroup()) {
    LOG(std::string("checkPoolAttribs: Pool serverGroup expected [") +
        serverGroup + ", actual[" + pool->getServerGroup() + "]");
    return false;
  }
  if (socketBufferSize != pool->getSocketBufferSize()) {
    LOG(std::string("checkPoolAttribs: Pool socketBufferSize expected [") +
        std::to_string(socketBufferSize) + ", actual[" +
        std::to_string(pool->getSocketBufferSize()) + "]");
    return false;
  }
  if (subscriptionEnabled != pool->getSubscriptionEnabled()) {
    LOG(std::string("checkPoolAttribs: Pool subscriptionEnabled expected [") +
        (subscriptionEnabled ? "true" : "false") +
        (pool->getSubscriptionEnabled() ? "true" : "false") + "]");
    return false;
  }
  if (std::chrono::milliseconds(subscriptionMessageTrackingTimeout) !=
      pool->getSubscriptionMessageTrackingTimeout()) {
    LOG(std::string("checkPoolAttribs: Pool subscriptionMessageTrackingTimeout "
                    "expected [") +
        std::to_string(subscriptionMessageTrackingTimeout) + ", actual[" +
        std::to_string(pool->getSubscriptionMessageTrackingTimeout().count()) +
        "]");
    return false;
  }
  if (std::chrono::milliseconds(subscriptionAckInterval) !=
      pool->getSubscriptionAckInterval()) {
    LOG(std::string(
            "checkPoolAttribs: Pool subscriptionAckInterval expected [") +
        std::to_string(subscriptionAckInterval) + ", actual[" +
        std::to_string(pool->getSubscriptionAckInterval().count()) + "]");
    return false;
  }
  if (subscriptionRedundancy != pool->getSubscriptionRedundancy()) {
    LOG(std::string(
            "checkPoolAttribs: Pool subscriptionRedundancy expected [") +
        std::to_string(subscriptionRedundancy) + ", actual[" +
        std::to_string(pool->getSubscriptionRedundancy()) + "]");
    return false;
  }
  if (std::chrono::milliseconds(statisticInterval) !=
      pool->getStatisticInterval()) {
    LOG(std::string("checkPoolAttribs: Pool statisticInterval expected [") +
        std::to_string(statisticInterval) + ", actual[" +
        std::to_string(pool->getStatisticInterval().count()) + "]");
    return false;
  }
  if (prSingleHopEnabled != pool->getPRSingleHopEnabled()) {
    LOG(std::string("checkPoolAttribs: Pool subscriptionEnabled expected [") +
        (prSingleHopEnabled ? "true" : "false") +
        (pool->getPRSingleHopEnabled() ? "true" : "false") + "]");
    return false;
  }
  if (std::chrono::milliseconds(updateLocatorListInterval) !=
      pool->getUpdateLocatorListInterval()) {
    LOG(std::string(
            "checkPoolAttribs: Pool updateLocatorListInterval expected [") +
        std::to_string(updateLocatorListInterval) + ", actual[" +
        std::to_string(pool->getUpdateLocatorListInterval().count()) + "]");
    return false;
  }
  return true;
}