Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.6.4)
set(PROJECT_NAME_STR cql)
set(PROJECT_NAME_STR datastaxcql)
# Alias for project name used in unit tests
set(CQL_DRIVER_PROJECT_NAME ${PROJECT_NAME_STR})
project(${PROJECT_NAME_STR} C CXX)
Expand All @@ -8,7 +8,7 @@ project(${PROJECT_NAME_STR} C CXX)
# The version number
#-------------------
set(PROJECT_VERSION_MAJOR 0)
set(PROJECT_VERSION_MINOR 7)
set(PROJECT_VERSION_MINOR 8)
set(PROJECT_VERSION_PATCH 0)
set(PROJECT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})

Expand Down Expand Up @@ -224,3 +224,8 @@ add_custom_target(UNINSTALL
# the demo program
#-------------------
add_subdirectory(demo)

#-------------------
# the stress test
#-------------------
add_subdirectory(stress)
20 changes: 15 additions & 5 deletions demo/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,17 @@ log_callback(

void
demo(
const std::string& host,
const std::vector<std::string>& hosts,
bool use_ssl)
{
try
{
boost::shared_ptr<cql::cql_builder_t> builder = cql::cql_cluster_t::builder();
builder->with_log_callback(&log_callback);
builder->add_contact_point(boost::asio::ip::address::from_string(host));

for (std::vector<std::string>::const_iterator it = hosts.begin(); it != hosts.end(); it++) {
builder->add_contact_point(boost::asio::ip::address::from_string(*it));
}

if (use_ssl) {
builder->with_ssl();
Expand Down Expand Up @@ -140,13 +143,14 @@ main(
char** vargs)
{
bool ssl = false;
std::string host;
std::string hoststr;
std::vector<std::string> hosts;

boost::program_options::options_description desc("Options");
desc.add_options()
("help", "produce help message")
("ssl", boost::program_options::value<bool>(&ssl)->default_value(false), "use SSL")
("host", boost::program_options::value<std::string>(&host)->default_value("127.0.0.1"), "node to use as initial contact point");
("hosts", boost::program_options::value<std::string>(&hoststr)->default_value("127.0.0.1"), "comma separated list of notes to use as initial contact point");

boost::program_options::variables_map variables_map;
try {
Expand All @@ -164,8 +168,14 @@ main(
return 0;
}

std::stringstream ss(hoststr);
std::string s;
while (getline(ss, s, ',')) {
hosts.push_back(s);
}

cql::cql_initialize();
demo(host, ssl);
demo(hosts, ssl);

cql::cql_terminate();
return 0;
Expand Down
32 changes: 32 additions & 0 deletions stress/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#-------------------
# Stress
#-------------------
cmake_minimum_required(VERSION 2.6.4)

# set(STRESS Stress_${CQL_DRIVER_PROJECT_NAME})
# project(${STRESS} C CXX)

# file(GLOB STRESS_SRC_FILES *.cpp)

# # Add EXCLUDE_FROM_ALL flag to exclude stress test
# # from ALL target
# add_executable(${STRESS} ${STRESS_SRC_FILES})

# set_property(
# TARGET ${STRESS}
# APPEND PROPERTY COMPILE_FLAGS ${PROJECT_COMPILER_FLAGS})




set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".")
set(PROJECT_STRESS_NAME ${PROJECT_NAME_STR}_stress)

file(GLOB STRESS_SRC_FILES ${PROJECT_SOURCE_DIR}/stress/*.cpp)
include_directories(${INCLUDES})
add_executable(${PROJECT_STRESS_NAME} ${STRESS_SRC_FILES})
target_link_libraries(${PROJECT_STRESS_NAME} ${LIBS} ${PROJECT_LIB_NAME})

set_property(
TARGET ${PROJECT_STRESS_NAME}
APPEND PROPERTY COMPILE_FLAGS ${PROJECT_COMPILER_FLAGS})
Loading