reSIProcate/DialogUsageManager  9694
Classes | Defines | Functions
testCurlHttpProvider.cxx File Reference
#include "resip/stack/TransactionUser.hxx"
#include "CurlHttpProvider.hxx"
#include "rutil/Logger.hxx"
#include "resip/stack/external/HttpProvider.hxx"
#include "resip/stack/external/HttpGetMessage.hxx"
Include dependency graph for testCurlHttpProvider.cxx:

Go to the source code of this file.

Classes

class  TestCurlTransactionUser

Defines

#define RESIPROCATE_SUBSYSTEM   Subsystem::TEST

Functions

int main (int argc, char *argv[])

Define Documentation

#define RESIPROCATE_SUBSYSTEM   Subsystem::TEST

Definition at line 7 of file testCurlHttpProvider.cxx.


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 24 of file testCurlHttpProvider.cxx.

References resip::Log::Cout, resip::Log::Debug, resip::HttpProvider::get(), TestCurlTransactionUser::getFifo(), resip::TimeLimitFifo< Msg >::getNext(), InfoLog, resip::Log::initialize(), resip::HttpProvider::instance(), resip::HttpProvider::setFactory(), and resip::GenericUri::uri().

{
   Log::initialize(Log::Cout, Log::Debug, argv[0]);
   
   HttpProvider::setFactory(std::auto_ptr<HttpProviderFactory>(new CurlHttpProviderFactory()));
   
   GenericUri target;
   if (argc == 2)
   {
      InfoLog ( << "Looking up: " << argv[1]);
      target.uri() = argv[1];
   }
   else
   {
      target.uri() = "www.google.ca";
   }
   TestCurlTransactionUser testCurlTu;
   HttpProvider::instance()->get(target, "aaa", testCurlTu);
   
   Message* res = testCurlTu.getFifo().getNext(3000);
   if (res)
   {
      HttpGetMessage* msg = dynamic_cast<HttpGetMessage*>(res);
      assert(msg);
      InfoLog( << "Received: " << *msg);
      delete msg;
   }
   else
   {
      InfoLog( << "Reqeust timed out");
      exit(-1);
   }
   return 0;
}

Here is the call graph for this function: