Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

The CDB Simulated Components are a quick way to make a component available for development and testing. They could be used to prototype basic functionality and to mock-up components in order to prepare module tests which need to interact with other components.

Preparations

Create a module for the tests that are going to be performed:

...

Code Block
languagebash
> cd test
> make all

Simulated Component

The simulation code needs to be put in the CDB:

Code Block
languagexml
titlesim_comp/test/CDB/alma/simulated/MOUNT/MOUNT.xml
linenumberstrue
collapsetrue
<SimulatedComponent xmlns="urn:schemas-cosylab-com:SimulatedComponent:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<pythonImports>
from acstime import Duration
</pythonImports>
<initialize>
logger=parameters[0].getLogger()
logger.logInfo("Component initialized!")
</initialize>
<cleanUp>
print('Simulated component cleaning up')
</cleanUp>
<_corbaMethod Name="objfix" Timeout="0">
print("\nobjfix called with params ", parameters, "\n")
</_corbaMethod>
</SimulatedComponent>

Client

A simple client could be prepared:

Code Block
languagepy
titlesim_comp/test/client.py
linenumberstrue
collapsetrue
from Acspy.Clients.SimpleClient import PySimpleClient
client = PySimpleClient()
m = client.getComponent("MOUNT")
m.objfix(3,6)

Executing

Start ACS:

Code Block
languagebash
titleConsole 1
> cd sim_comp
> export ACS_CDB=$PWD/test
> export IDL_PATH="-I$PWD/idl $IDLPATH"
> acsStart

...