This commit is contained in:
Ren RenJuan 2014-01-16 15:35:39 +00:00
parent 8636800fee
commit bc12879ab5
15 changed files with 61 additions and 38 deletions

View File

@ -89,10 +89,9 @@ void init(const std::string& system_props_file)
}
void scenario(int scenario,char *cgfPath)
void scenario(int scenario,const std::string& system_props_file)
{
std::string stdPropsPath(cfgPath);
tkScenario = scenario;
static const Init doInit(stdPropsPath);
static const Init doInit(system_props_file);
}

View File

@ -4,6 +4,6 @@
#include <string>
void init(const std::string &system_props_file);
void scenario(int which,char *cfgPath);
void scenario(int which,const std::string &system_props_file);
#endif

Binary file not shown.

View File

@ -21,10 +21,8 @@ SessionManager*
SessionManagerFactory::newInstance(SessionManagerProperties* properties)
throw (ConfigurationException)
{
switch(tkScenario) {
case 0: return new SessionManagerImpl(properties);
break;
case 1: return new ACSession(properties);
break;
}
if (tkScenario < ACTK_OTEB)
return new SessionManagerImpl(properties);
else
return new ACSession(properties);
}

View File

@ -7,6 +7,19 @@
#include "session/SessionManagerProperties.hpp"
#include "session/SessionManager.hpp"
#ifndef KEEPINSYNCWMD
#define KEEPINSYNCWMD
enum acTKScenario {
ACTK_ALONE = 0,
ACTK_INSECURE,
ACTK_OTEA,
ACTK_OTEB,
ACTK_OTEC,
ACTK_PROD,
N_ACTK_SCENARIOS
};
#endif
/**
* This factory provides instances of SessionManager implementations. The
* default SessionManager implementation is

View File

@ -7,17 +7,6 @@
#include <unistd.h>
#include <netinet/in.h> // htonl
#ifndef acTKScenario
enum acTKScenario {
ACTK_ALONE = 0,
ACTK_INSECURE,
ACTK_OTEA,
ACTK_OTEB,
ACTK_OTEC,
ACTK_PROD,
N_ACTK_SCENARIOS
};
#endif
extern char *otePeer;
extern const int tkScenario;

View File

@ -5,6 +5,19 @@
#include <openssl/ssl.h>
#include <string>
#ifndef KEEPINSYNCWMD
#define KEEPINSYNCWMD
enum acTKScenario {
ACTK_ALONE = 0,
ACTK_INSECURE,
ACTK_OTEA,
ACTK_OTEB,
ACTK_OTEC,
ACTK_PROD,
N_ACTK_SCENARIOS
};
#endif
class TLSSocket
{
public:

View File

@ -90,9 +90,10 @@ ARTKDEPS = -L$(ARTK_LIB_DIR) -lACTK1_0 \
# --- targets
#
all: cliever
all: cliever md
cliever: build/$(CLIENT)-cliever
md: build/ausreg-md
.c.o:
$(Cc) -c $(CLFLAGS) -o $<

Binary file not shown.

View File

@ -27,10 +27,10 @@ class ausRegEPPTK {
// See the Toolkit Overview. At tkScenario zeo supposedly it can do everything.
ausRegEPPTK() { tkScenario = ACTK_OTEB;
ausRegEPPTK() { // tkScenario = ACTK_OTEB; moved to config
daysRunning = 0;
}
bool didInit(const std::string propertiesFilePath);
bool doNothing(const std::string propertiesFilePath);
void doOTEA();
void doOTEB();

View File

@ -16,6 +16,7 @@ class masterDaemonConfig {
public:
int tkScenario; // How the AusRegistry toolkit used
bool daemonized;
bool halt;
bool shuttingDown;

View File

@ -65,6 +65,8 @@ void md() {
if (mdHasEPPTk) {
theseLogs->logN(0,"AusReg Cliever <- MasterDaemon.");
}
else
theseLogs->logN(0,"Unit testing md without toolkit.");
boost::thread foreground(runMasterDaemon);
boost::thread background(runAPILayer);
@ -100,7 +102,7 @@ int
main(int const argc,
const char ** const argv) {
char msg[512];
char msg[512],*c;
const char *banner = MD_NAME " " MD_VERSION " compiled on " __DATE__ " @ " __TIME__ "(%d)\n";
int mthParm, rc = 0;
@ -108,10 +110,10 @@ main(int const argc,
thisConfig->shellProcess = getpid();
mdOrAC = (strcspn(argv[0],"./") == strlen(argv[0])) ? argv[0] : strrchr(argv[0],'/') + 1;
mdHasEPPTk = strstr(argv[0],"noepp") ? false : true;
mdHasEPPTk = strstr(argv[0],"ausreg-md") ? false : true;
if (argc < 3 || argc > 6) usage();
if (argc < 3 || argc > 7) usage();
thisConfig->servicePort = atoi(argv[1]);
thisConfig->clientPort = atoi(argv[2]);
@ -144,6 +146,11 @@ main(int const argc,
thisConfig->logPath = thisConfig->log_path.c_str();
}
else
if (!strncmp(argv[mthParm],"tk=",2)) {
c = (char *)&argv[mthParm][3];
thisConfig->tkScenario = atoi(c);
}
else
if (!strncmp(argv[mthParm],"cfg=",3)) {
thisConfig->cfg_path = std::string(argv[mthParm]+3);
thisConfig->configPath = thisConfig->cfg_path.c_str();
@ -191,9 +198,10 @@ void signal_handler(int sig)
}
void usage() {
std::cerr << "Usage: " << mdOrAC << " <client-udp-port> <service-socket-port> [cfg=<path>] [log=<path>] [!] \n\n"
" where \n\nconfig directory defaults to the current directory \n"
"log directory to /tmp \nand ! to not daemonize (for diagnostic purposes)\n\n";
std::cerr << "Usage: " << mdOrAC << " <client-udp-port> <service-socket-port> [tk=<n>] [cfg=<path>] [log=<path>] [!] \n\n"
" where tk is the Toolkit Scenario (default ACTK_PROD) \n"
"\nconfig directory defaults to ./etc/toolkit2.conf \n"
"log directory to /tmp \nand ! to not daemonize (for diagnostic purposes)\n\n";
exit(1);
}

View File

@ -126,14 +126,17 @@ void masterDaemon::dispatch(const mdIncoming &what) {
int masterDaemon::initAusRegTK(void) {
#if ARTKENABLED > 0
int rc=OK;
const std::string nil("/home/drde/etc/toolkit2.conf");
const std::string cfg(thisConfig->cfg_path.empty() ?
"/home/jdaugherty/etc/toolkit2.conf" : thisConfig->cfg_path );
try {
theseLogs->logN(0,"Attaching AusRegistry EPP Toolkit 1.3.2");
theseLogs->logN(0,"Attaching AusRegistry EPP Toolkit 1.3.2 at tkScenario %d.",
thisConfig->tkScenario);
artk = new ausRegEPPTK();
if (!artk->didInit(nil)) {
if (!artk->doNothing(cfg)) {
theseLogs->logN(1,"Toolkit init failed.");
rc = NOT_OK;
}

View File

@ -5,6 +5,7 @@ const char *mdStdErrs[] = { "No error detected.", "Required state/element mi
masterDaemonConfig::masterDaemonConfig() {
tkScenario = ACTK_PROD;
nClievers = 0;
configPath = "./";
logPath = "/tmp";

View File

@ -15,12 +15,12 @@ static std::string TEST_SE =
// static void testExecuteParallelTransactions() throw (EPPException);
bool ausRegEPPTK::didInit(const std::string propertiesFilePath) {
bool ausRegEPPTK::doNothing(const std::string propertiesFilePath) { // Just verify load
bool did=false;
try {
scenario( tkScenario );
scenario( 0, propertiesFilePath ); // tkScenario 0 assumed
did = true;
}
catch(std::exception &e) {
@ -34,7 +34,6 @@ void ausRegEPPTK::doOTEA()
int hours,hoops;
string op("newInstance");
if (!daysRunning)
scenario(tkScenario,thisConfig->cfg_path);
try {
@ -75,8 +74,6 @@ void ausRegEPPTK::doOTEA()
}
void ausRegEPPTK::doOTEB()
{
#define N_OTE_B
int cmd=0;
string op("newInstance");