]> SALOME platform Git repositories - modules/kernel.git/blob - src/MPILifeCycleCORBA/TestMPILifeCycleCORBA.cxx
Salome HOME
9e2c5c160a11dd0b4cb67bde001a4bda0cbf9d6b
[modules/kernel.git] / src / MPILifeCycleCORBA / TestMPILifeCycleCORBA.cxx
1 // using namespace std;
2 //=============================================================================
3 // File      : TestMPILifeCycleCORBA.cxx
4 // Created   : mer jui 4 13:11:27 CEST 2003
5 // Author    : Bernard SECHER, 2003
6 // Project   : SALOME
7 // Copyright : CEA 2003
8 // $Header$
9 //=============================================================================
10
11 #include "utilities.h"
12 #include <iostream>
13 #include <unistd.h>
14 #include <string>
15 #include <SALOMEconfig.h>
16 #include CORBA_CLIENT_HEADER(SALOME_MPIContainer)
17 #include CORBA_CLIENT_HEADER(SALOME_TestMPIComponent)
18
19 # include "Utils_ORB_INIT.hxx"
20 # include "Utils_SINGLETON.hxx"
21 #include "SALOME_NamingService.hxx"
22 #include "SALOME_MPILifeCycleCORBA.hxx"
23 #include "OpUtil.hxx"
24
25 int main (int argc, char * argv[])
26 {
27
28   try{
29     // Initializing omniORB
30     CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
31     
32     // Obtain a reference to the root POA
33     CORBA::Object_var obj = orb->resolve_initial_references("RootPOA") ;
34     PortableServer::POA_var poa = PortableServer::POA::_narrow(obj) ;
35     
36     // Use Name Service to find container
37     SALOME_NamingService NS(orb);
38     
39     SALOME_MPILifeCycleCORBA LCC(&NS);
40     
41     Engines::Component_var comp = LCC.FindOrLoad_MPIComponent("MPIFactoryServer","TestMPIComponent",2);
42     
43     Engines::TestMPIComponent_var m1 = Engines::TestMPIComponent::_narrow(comp);
44     if(CORBA::is_nil(m1)){
45       INFOS("echec recuperation poignee composant");
46     }
47     else{
48       
49       INFOS("Lancement de coucou");
50       m1->Coucou(1L);
51     }
52
53     orb->destroy();
54   }
55   catch(CORBA::COMM_FAILURE& ex) {
56     INFOS("Caught system exception COMM_FAILURE -- unable to contact the object.");
57   }
58   catch(CORBA::SystemException&) {
59     INFOS("Caught a CORBA::SystemException.");
60   }
61   catch(CORBA::Exception&) {
62     INFOS("Caught CORBA::Exception.");
63   }
64   catch(...) {
65     INFOS("Caught unknown exception.");
66   }
67
68   return 0;
69 }