...
Create a module for the tests that are going to be performed:
Code Block |
---|
language | bash |
---|
title | getTemplateForDirectory |
---|
linenumbers | true |
---|
collapse | true |
---|
|
> getTemplateForDirectory MODROOT_WS sim_comp
> cd sim_comp |
...
Code Block |
---|
language | cpp |
---|
title | sim_comp/idl/MountExample.idl |
---|
linenumbers | true |
---|
collapse | true |
---|
|
#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 |
---|
language | xml |
---|
title | sim_comp/test/CDB/MACI/Managers/Manager/Manager.xml |
---|
linenumbers | true |
---|
collapse | true |
---|
|
<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 |
---|
language | xml |
---|
title | sim_comp/test/CDB/MACI/Components/Components.xml |
---|
linenumbers | true |
---|
collapse | true |
---|
|
<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 |
---|
language | bash |
---|
title | Copy Makefile |
---|
linenumbers | true |
---|
collapse | true |
---|
|
> cp src/Makefile test/Makefile |
Add the following to IDL entry:
Code Block |
---|
title | sim_comp/test/Makefile |
---|
linenumbers | true |
---|
collapse | true |
---|
|
#
# IDL Files and flags
#
IDL_FILES = MountExample
TAO_IDLFLAGS =
USER_IDL =
MountExampleStubs_LIBS = acscomponentStubs |
Generate code stubs and skeletons:
Code Block |
---|
language | bash |
---|
title | sim_comp/test Compile |
---|
linenumbers | true |
---|
collapse | true |
---|
|
> cd test
> make all |
...
Code Block |
---|
language | xml |
---|
title | sim_comp/test/CDB/alma/simulated/MOUNT/MOUNT.xml |
---|
linenumbers | true |
---|
collapse | true |
---|
|
<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 |
---|
language | py |
---|
title | sim_comp/test/client.py |
---|
linenumbers | true |
---|
collapse | true |
---|
|
from Acspy.Clients.SimpleClient import PySimpleClient
client = PySimpleClient()
m = client.getComponent("MOUNT")
m.objfix(3,6) |
...