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; tkScenario = scenario;
static const Init doInit(stdPropsPath); static const Init doInit(system_props_file);
} }

View File

@ -4,6 +4,6 @@
#include <string> #include <string>
void init(const std::string &system_props_file); 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 #endif

Binary file not shown.

View File

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

View File

@ -7,6 +7,19 @@
#include "session/SessionManagerProperties.hpp" #include "session/SessionManagerProperties.hpp"
#include "session/SessionManager.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 * This factory provides instances of SessionManager implementations. The
* default SessionManager implementation is * default SessionManager implementation is

View File

@ -7,17 +7,6 @@
#include <unistd.h> #include <unistd.h>
#include <netinet/in.h> // htonl #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 char *otePeer;
extern const int tkScenario; extern const int tkScenario;

View File

@ -5,6 +5,19 @@
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <string> #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 class TLSSocket
{ {
public: public:

View File

@ -90,9 +90,10 @@ ARTKDEPS = -L$(ARTK_LIB_DIR) -lACTK1_0 \
# --- targets # --- targets
# #
all: cliever all: cliever md
cliever: build/$(CLIENT)-cliever cliever: build/$(CLIENT)-cliever
md: build/ausreg-md
.c.o: .c.o:
$(Cc) -c $(CLFLAGS) -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. // 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; daysRunning = 0;
} }
bool didInit(const std::string propertiesFilePath); bool doNothing(const std::string propertiesFilePath);
void doOTEA(); void doOTEA();
void doOTEB(); void doOTEB();

View File

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

View File

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

View File

@ -126,14 +126,17 @@ void masterDaemon::dispatch(const mdIncoming &what) {
int masterDaemon::initAusRegTK(void) { int masterDaemon::initAusRegTK(void) {
#if ARTKENABLED > 0 #if ARTKENABLED > 0
int rc=OK; 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 { 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(); artk = new ausRegEPPTK();
if (!artk->didInit(nil)) { if (!artk->doNothing(cfg)) {
theseLogs->logN(1,"Toolkit init failed."); theseLogs->logN(1,"Toolkit init failed.");
rc = NOT_OK; rc = NOT_OK;
} }

View File

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

View File

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