Versions Compared

Key

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

...

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

Code Block
languagebash
titlegetTemplateForDirectory
linenumberstrue
collapsetrue
> getTemplateForDirectory MODROOT_WS sim_comp
> cd sim_comp

...

Code Block
languagecpp
titlesim_comp/idl/MountExample.idl
linenumberstrue
collapsetrue
#ifndef _MOUNT_EXAMPLE_IDL_
#define _MOUNT_EXAMPLE_IDL_

#include <acscomponent.idl>

#pragma prefix "alma"

module workshop
{
    interface MountExample : ACS::ACSComponent {
        void objfix (in double az, in double elev);
    };    
};

#endif

...

Code Block
languagexml
titlesim_comp/test/CDB/MACI/Managers/Manager/Manager.xml
linenumberstrue
collapsetrue
<Manager xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns="urn:schemas-cosylab-com:Manager:1.0" xmlns:log="urn:schemas-cosylab-com:LoggingConfig:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Timeout="50.0" ContainerPingInterval="20.0">
    <Startup> </Startup>
    <ServiceComponents>
        <cdb:e string="Log"/>
        <cdb:e string="LogFactory"/>
        <cdb:e string="NotifyEventChannelFactory"/>
        <cdb:e string="MC_NotifyEventChannelFactory" />
        <cdb:e string="LoggingNotifyEventChannelFactory" />
        <cdb:e string="MC_LoggingNotifyEventChannelFactory" />
        <cdb:e string="LoggingChannel@LOGGING.channels"/>
        <cdb:e string="ArchivingChannel@ARCHIVING.channels"/>
        <cdb:e string="AlarmNotifyEventChannelFactory" />
        <cdb:e string="MC_AlarmNotifyEventChannelFactory" />
        <cdb:e string="InterfaceRepository"/>
        <cdb:e string="AlarmChannel" />
        <cdb:e string="CDB"/>
        <cdb:e string="ACSLogSvc"/>
        <cdb:e string="AcsAlarmService"/>
    </ServiceComponents>
    <LoggingConfig>
        <log:e Name="jacorb@Manager" minLogLevel="5" minLogLevelLocal="5"/>
    </LoggingConfig>
</Manager>

...

Code Block
languagexml
titlesim_comp/test/CDB/MACI/Components/Components.xml
linenumberstrue
collapsetrue
<Components xmlns="urn:schemas-cosylab-com:Components:1.0" xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<e Name="MOUNT" Code="Acssim.Servants.Simulator" 
   Type="IDL:alma/ACS_COURSE/MountExample:1.0"
   Container="pyContainer"
   ImplLang="py"/>
</Components>

Prepare the Makefile:

Code Block
languagebash
titleCopy Makefile
linenumberstrue
collapsetrue
> cp src/Makefile test/Makefile

Add the following to IDL entry:

Code Block
titlesim_comp/test/Makefile
linenumberstrue
collapsetrue
# 
# IDL Files and flags
# 
IDL_FILES = MountExample
TAO_IDLFLAGS =
USER_IDL =
MountExampleStubs_LIBS = acscomponentStubs

Generate code stubs and skeletons:

Code Block
languagebash
titlesim_comp/test Compile
linenumberstrue
collapsetrue
> cd test
> make all

...

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>

...

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)

...