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