Version: 8.3.0
YACSPMMLBasicsTest1.cxx File Reference
#include "YACSPMMLBasicsTest1.hxx"
#include "PMMLlib.hxx"
#include "yacsconfig.h"
#include "RuntimeSALOME.hxx"
#include "PythonPorts.hxx"
#include "CORBAPorts.hxx"
#include "parsers.hxx"
#include "Proc.hxx"
#include "Exception.hxx"
#include "Executor.hxx"
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <unistd.h>
#include "YacsTrace.hxx"
Include dependency graph for YACSPMMLBasicsTest1.cxx:

Go to the source code of this file.

Functions

int driverTest (Proc *&p, const char *schema)
 

Function Documentation

int driverTest ( Proc *&  p,
const char *  schema 
)

Definition at line 53 of file YACSPMMLBasicsTest1.cxx.

References DEBTRACE, gui.CONNECTOR::f(), YACS::YACSLoader::load(), loader, YACS::ENGINE::Executor::RunW(), YACS::ENGINE::RuntimeSALOME::setRuntime(), YACS::Exception::what(), and YACS::ENGINE::Proc::writeDot().

Referenced by YACSPMMLBasicsTest1::testYACSdriver_LRANN(), YACSPMMLBasicsTest1::testYACSdriver_PmmlDoesNotExist(), YACSPMMLBasicsTest1::testYACSdriverLinearRegression(), and YACSPMMLBasicsTest1::testYACSdriverNeuralNetwork().

54 {
55  DEBTRACE("+++++++++++++++++++ BEGIN test " << schema);
56  RuntimeSALOME::setRuntime();
57 
59  Executor executor;
60 
61  try
62  {
63  p=loader.load(schema);
64  DEBTRACE("Proc *p = " << p);
65  std::ofstream f("toto");
66  p->writeDot(f);
67  f.close();
68  DEBTRACE("+++++++++++++++++++ BEGIN execution " << schema);
69  executor.RunW(p,0);
70  DEBTRACE("+++++++++++++++++++ END execution " << schema);
71  std::ofstream g("titi");
72  p->writeDot(g);
73  g.close();
74  DEBTRACE("+++++++++++++++++++ END test " << schema);
75  return 0;
76  }
77  catch (YACS::Exception& e)
78  {
79  DEBTRACE("YACS exception caught: ");
80  DEBTRACE(e.what());
81  DEBTRACE("+++++++++++++++++++ END test in error " << schema);
82  return 1;
83  }
84  catch (const std::ios_base::failure&)
85  {
86  DEBTRACE("io failure");
87  DEBTRACE("+++++++++++++++++++ END test in error " << schema);
88  return 1;
89  }
90  catch(CORBA::SystemException& ex)
91  {
92  DEBTRACE("Caught a CORBA::SystemException.");
93  CORBA::Any tmp;
94  tmp <<= ex;
95  CORBA::TypeCode_var tc = tmp.type();
96  const char *p = tc->name();
97  if ( *p != '\0' )
98  {
99  DEBTRACE(p);
100  }
101  else
102  {
103  DEBTRACE(tc->id());
104  }
105  DEBTRACE("+++++++++++++++++++ END test in error " << schema);
106  return 1;
107  }
108  catch(omniORB::fatalException& fe)
109  {
110  DEBTRACE("Caught omniORB::fatalException:" );
111  DEBTRACE(" file: " << fe.file());
112  DEBTRACE(" line: " << fe.line());
113  DEBTRACE(" mesg: " << fe.errmsg());
114  DEBTRACE("+++++++++++++++++++ END test in error " << schema);
115  return 1;
116  }
117  catch(...)
118  {
119  DEBTRACE("Caught unknown exception.");
120  DEBTRACE("+++++++++++++++++++ END test in error " << schema);
121  return 1;
122  }
123 }