00001
00002
00003 #include <iostream>
00004 #include <fstream>
00005
00006 using std::cerr ;
00007 using std::cout ;
00008 using std::endl ;
00009 using std::ifstream ;
00010
00011 #include "encodeT.h"
00012 #include "BESProcessEncodedString.h"
00013 #include "test_config.h"
00014
00015 int
00016 encodeT::run(void)
00017 {
00018 cout << endl << "*****************************************" << endl;
00019 cout << "Entered encodeT::run" << endl;
00020 int retVal = 0;
00021
00022 string teststr = "request=%22This%20is%20a%20test%3B%22&username=pwest" ;
00023 BESProcessEncodedString pes( teststr.c_str() ) ;
00024 string request = pes.get_key( "request" ) ;
00025 cout << "request = " << request << endl ;
00026 if( request != "\"This is a test;\"" )
00027 {
00028 cerr << "Resulting request incorrect" << endl ;
00029 return 1 ;
00030 }
00031 else
00032 {
00033 cout << "Resulting request correct" << endl ;
00034 }
00035 string username = pes.get_key( "username" ) ;
00036 cout << "username = " << username << endl ;
00037 if( username != "pwest" )
00038 {
00039 cerr << "Resulting username incorrect" << endl ;
00040 return 1 ;
00041 }
00042 else
00043 {
00044 cout << "Resulting username correct" << endl ;
00045 }
00046
00047 cout << endl << "*****************************************" << endl;
00048 cout << "Returning from encodeT::run" << endl;
00049
00050 return retVal;
00051 }
00052
00053 int
00054 main(int argC, char **argV) {
00055 string env_var = (string)"BES_CONF=" + TEST_SRC_DIR + "/bes.conf" ;
00056 putenv( (char *)env_var.c_str() ) ;
00057 Application *app = new encodeT();
00058 return app->main(argC, argV);
00059 }
00060