constraintT.cc

Go to the documentation of this file.
00001 // constraintT.cc
00002 
00003 #include <iostream>
00004 
00005 using std::cerr ;
00006 using std::cout ;
00007 using std::endl ;
00008 
00009 #include "constraintT.h"
00010 #include "BESContainer.h"
00011 #include "BESDataHandlerInterface.h"
00012 #include "BESConstraintFuncs.h"
00013 #include "BESException.h"
00014 #include "BESDataNames.h"
00015 #include <test_config.h>
00016 
00017 int constraintT::
00018 run(void)
00019 {
00020     cout << endl << "*****************************************" << endl;
00021     cout << "Entered constraintT::run" << endl;
00022     int retVal = 0;
00023 
00024     cout << endl << "*****************************************" << endl;
00025     cout << "Build the data and build the post constraint" << endl ;
00026     BESDataHandlerInterface dhi ;
00027     BESContainer d1( "sym1" ) ;
00028     d1.set_constraint( "var1" ) ;
00029     dhi.containers.push_back( d1 ) ;
00030 
00031     BESContainer d2( "sym2" ) ;
00032     d2.set_constraint( "var2" ) ;
00033     dhi.containers.push_back( d2 ) ;
00034 
00035     dhi.first_container() ;
00036     BESConstraintFuncs::post_append( dhi ) ;
00037     dhi.next_container() ;
00038     BESConstraintFuncs::post_append( dhi ) ;
00039 
00040     string should_be = "sym1.var1,sym2.var2" ;
00041     if( dhi.data[POST_CONSTRAINT] != should_be )
00042     {
00043         cerr << "bad things man" << endl ;
00044         cerr << "    post constraint: " << dhi.data[POST_CONSTRAINT] << endl;
00045         cerr << "    should be: " << should_be << endl;
00046     }
00047     else
00048     {
00049         cout << "good" << endl ;
00050         cout << "    post constraint: " << dhi.data[POST_CONSTRAINT] << endl;
00051         cout << "    should be: " << should_be << endl;
00052     }
00053 
00054     cout << endl << "*****************************************" << endl;
00055     cout << "Returning from constraintT::run" << endl;
00056 
00057     return retVal;
00058 }
00059 
00060 int
00061 main(int argC, char **argV) {
00062     string env_var = (string)"BES_CONF=" + TEST_SRC_DIR
00063                      + "/persistence_cgi_test.ini" ;
00064     putenv( (char *)env_var.c_str() ) ;
00065     Application *app = new constraintT();
00066     return app->main(argC, argV);
00067 }
00068 

Generated on Wed Aug 29 02:59:01 2007 for OPeNDAP Back End Server (BES) by  doxygen 1.5.2