[c5ae6f]: test / plugins / tasks / DownloadTaskTest.cpp Maximize Restore History

Download this file

DownloadTaskTest.cpp    43 lines (38 with data), 1.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* File: DownloadTaskTest.cpp
* Author: HoelscJ
*
* Created on 19. Oktober 2011, 14:03
*/
#include <cstdlib>
#include "org/esb/core/PluginRegistry.h"
#include "org/esb/core/Task.h"
#include "org/esb/core/TaskException.h"
#include "org/esb/util/Log.h"
#include "org/esb/config/config.h"
using namespace std;
/*
*
*/
int main(int argc, char** argv) {
Log::open();
org::esb::core::PluginRegistry::getInstance()->load(DOWNLOADTASK_PLUGIN);
org::esb::core::PluginRegistry::getInstance()->initPlugins();
std::map<std::string, std::string> cfg;
cfg["downloadtask.src"]="http://www.google.de";
cfg["downloadtask.trg"]="/tmp/index.html";
try{
Ptr<org::esb::core::Task> task = org::esb::core::PluginRegistry::getInstance()->createTask("InputTask", cfg);
if (task) {
task->prepare();
task->execute();
}else{
LOGDEBUG("task not found");
}
}catch(const org::esb::core::TaskException & ex){
LOGERROR(ex.displayText());
}
org::esb::core::PluginRegistry::close();
org::esb::config::Config::close();
return 0;
}