43 using namespace basis;
45 using namespace cromp;
63 #define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), astring(s))
64 #define BASE_LOG(s) EMERGENCY_LOG(program_wide_logger::get(), astring(s))
72 virtual int execute();
84 many_cromp_tester::many_cromp_tester()
103 if (args.get_value(
"port", port_text,
false)) {
105 port = port_text.
convert(5678);
107 server_loc.
port = port;
110 if (args.get_value(
"count", count_text,
false)) {
112 _count = count_text.
convert(_count);
118 if (args.find(
"encrypt", indy,
false)
119 || (args.find(
'e', indy,
false)) ) {
127 if (args.get_value(
"host", host_temp,
false)) {
129 hostname = host_temp;
132 strcpy(server_loc.
hostname, hostname.s());
136 LOG(
a_sprintf(
"count of %d cromps will be created.", _count));
138 for (
int i = 0; i < _count; i++) {
144 _uplinks.append(uplink);
149 many_cromp_tester::~many_cromp_tester()
153 int many_cromp_tester::execute()
158 for (
int i = 0; i < _uplinks.elements(); i++) {
159 _uplinks.borrow(i)->enable_encryption();
163 for (
int i = 0; i < _uplinks.elements(); i++) {
164 outcome ret = _uplinks.borrow(i)->connect();
165 if (ret != cromp_client::OKAY) {
167 + cromp_client::outcome_name(ret));
177 for (
int i = 0; i < _uplinks.elements(); i++) {
178 if (!_uplinks.borrow(i)->connected())
183 int connected = _uplinks.elements() - unconnected;
184 LOG(
a_sprintf(
"[ %d connected and %d did not ]", connected, unconnected));
190 time_control::sleep_ms(100);
194 BASE_LOG(
"many cromp_client:: works for those functions tested.");
The application_shell is a base object for console programs.
a_sprintf is a specialization of astring that provides printf style support.
Provides a dynamically resizable ASCII character string.
int convert(int default_value) const
Converts the string into a corresponding integer.
Outcomes describe the state of completion for an operation.
virtual basis::outcome add_tentacle(octopi::tentacle *to_add, bool filter=false)
this type of address describes a destination out on the internet.
basis::astring text_form() const
char hostname[MAXIMUM_HOSTNAME_LENGTH]
Represents a point in time relative to the operating system startup time.
#define deadly_error(c, f, i)
#define DEFINE_CLASS_NAME(objname)
Defines the name of a class by providing a couple standard methods.
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
Provides macros that implement the 'main' program of an application.
#define HOOPLE_MAIN(obj_name, obj_args)
options that should work for most unix and linux apps.
Implements an application lock to ensure only one is running at once.
The guards collection helps in testing preconditions and reporting errors.
const int SECOND_ms
Number of milliseconds in a second.
const int HOUR_ms
Number of milliseconds in an hour.
A platform independent way to obtain the timestamp of a file.
A logger that sends to the console screen using the standard output device.
An extension to floating point primitives providing approximate equality.
Provides access to the operating system's socket methods.
A dynamic container class that holds any kind of object via pointers.
Useful support functions for unit testing, especially within hoople.
const int REPORTING_INTERVAL