RobotTrajectoryDesignerTestEnvironment.h
Go to the documentation of this file.
1 #include <VirtualRobot/XML/RobotIO.h>
2 
5 #include <ArmarXCore/core/test/IceTestHelper.h>
6 
7 #include <RobotTrajectoryDesigner/gui-plugins/RobotTrajectoryDesignerGuiPlugin/RobotTrajectoryDesignerGuiPluginGuiPlugin.h>
8 
10 {
11 public:
12  RobotTrajectoryDesignerTestEnvironment(const std::string& testName,
13  int registryPort = 11220,
14  bool addObjects = true)
15  {
18  const std::string project = "RobotAPI";
20 
21  if (!finder.packageFound())
22  {
23  ARMARX_ERROR << "ArmarX Package " << project << " has not been found!";
24  }
25  else
26  {
28  }
29 
30  std::string fn = "RobotAPI/robots/Armar3/ArmarIII.xml";
31  ArmarXDataPath::getAbsolutePath(fn, fn);
32  std::string robotFilename = fn;
33 
34  _spaceSavePath = test::getCmakeValue("PROJECT_BINARY_DIR") + "/Testing/Temporary/spaces/";
35 
36  if (loadSpaces)
37  {
38  properties->setProperty("ArmarX.RobotIK.ReachabilitySpacesFolder", _spaceSavePath);
39  properties->setProperty("ArmarX.RobotIK.InitialReachabilitySpaces",
40  "testReachabilitySpace.bin");
41  }
42 
43  _iceTestHelper = new IceTestHelper(registryPort, registryPort + 1);
44  _iceTestHelper->startEnvironment();
45 
46  // The manager allows you to create new ArmarX components
47  _manager = new TestArmarXManager(testName, _iceTestHelper->getCommunicator(), properties);
48  if (addObjects)
49  {
50  // This is how you create components.
52  _manager->createComponentAndRun<YourComponent, YourComponentInterfacePrx>(
53  "ArmarX", "RobotTrajectoryDesigner");
54  }
55 
56  _robotModel =
57  VirtualRobot::RobotIO::loadRobot(robotFilename, VirtualRobot::RobotIO::eStructure);
58  }
59 
61  {
62  _manager->shutdown();
63  }
64 
65  // In your tests, you can access your component through this proxy
66  RobotTrajectoryDesignerInterfacePrx _robotTrajectoryDesigner;
67  TestArmarXManagerPtr _manager;
68  IceTestHelperPtr _iceTestHelper;
70 };
71 
73  std::shared_ptr<RobotTrajectoryDesignerTestEnvironment>;
RobotTrajectoryDesignerTestEnvironment::_robotModel
VirtualRobot::RobotPtr _robotModel
Definition: RobotTrajectoryDesignerTestEnvironment.h:69
armarx::CMakePackageFinder::packageFound
bool packageFound() const
Returns whether or not this package was found with cmake.
Definition: CMakePackageFinder.cpp:511
RobotTrajectoryDesignerTestEnvironmentPtr
std::shared_ptr< RobotTrajectoryDesignerTestEnvironment > RobotTrajectoryDesignerTestEnvironmentPtr
Definition: RobotTrajectoryDesignerTestEnvironment.h:73
RobotTrajectoryDesignerTestEnvironment::RobotTrajectoryDesignerTestEnvironment
RobotTrajectoryDesignerTestEnvironment(const std::string &testName, int registryPort=11220, bool addObjects=true)
Definition: RobotTrajectoryDesignerTestEnvironment.h:12
RobotTrajectoryDesignerTestEnvironment
Definition: RobotTrajectoryDesignerTestEnvironment.h:9
armarx::CMakePackageFinder
The CMakePackageFinder class provides an interface to the CMake Package finder capabilities.
Definition: CMakePackageFinder.h:52
FactoryCollectionBase.h
RobotTrajectoryDesignerTestEnvironment::_manager
TestArmarXManagerPtr _manager
Definition: RobotTrajectoryDesignerTestEnvironment.h:67
project
std::string project
Definition: VisualizationRobot.cpp:85
IceInternal::Handle<::Ice::Properties >
Ice::createProperties
Ice::PropertiesPtr createProperties()
armarx::CMakePackageFinder::getDataDir
std::string getDataDir() const
Definition: CMakePackageFinder.h:194
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:196
RobotTrajectoryDesignerTestEnvironment::_iceTestHelper
IceTestHelperPtr _iceTestHelper
Definition: RobotTrajectoryDesignerTestEnvironment.h:68
armarx::Application::LoadDefaultConfig
static void LoadDefaultConfig(Ice::PropertiesPtr properties)
Definition: Application.cpp:849
armarx::ArmarXDataPath::addDataPaths
static void addDataPaths(const std::string &dataPathList)
Definition: ArmarXDataPath.cpp:554
RobotTrajectoryDesignerTestEnvironment::~RobotTrajectoryDesignerTestEnvironment
~RobotTrajectoryDesignerTestEnvironment()
Definition: RobotTrajectoryDesignerTestEnvironment.h:60
RobotTrajectoryDesignerTestEnvironment::_robotTrajectoryDesigner
RobotTrajectoryDesignerInterfacePrx _robotTrajectoryDesigner
Definition: RobotTrajectoryDesignerTestEnvironment.h:66
Application.h
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:19