ACS Component Simulator

Download Report

Transcript ACS Component Simulator

ACS Component
Simulator
J. Ibsen
European Southern Observatory
Garching – January 2007
ESO
Summary
ALMA Project
•
•
•
•
•
•
•
What is it?
(some) Requirements
Implementation
What do we need?
Cookbook
Examples
Final remarks/Homework
Garching, January 2007
Component Simulator
2
What is it?
ALMA Project
• An ACS component/characteristic
component capable to implement its IDL
interface at runtime
• Useful for test driven development and to
provide cheap/easy-to-deploy mock-up
components (simulating normal/alternative
behaviors).
Garching, January 2007
Component Simulator
3
(some) Requirements
ALMA Project
•
Methods and attributes should be generated on the fly
•
Simulated component should behave as a real
component (respecting the component lifecyle)
•
Different component behaviors should be “easily”
added.
•
APIs should be available to developers.
Garching, January 2007
Component Simulator
4
Implementation
ALMA Project
• Simulator component has been
implemented in python (dynamic
inheritance, methods can be redefined at
runtime)
• Configuration is done populating the CDB
(CDB/alma/simulated)
Garching, January 2007
Component Simulator
5
What do we need?
ALMA Project
• Brand new IDL (and schema if we have a
characteristic component)
• Runtime environment (i.e. CDB suitable to
start ACS and containers)
Garching, January 2007
Component Simulator
6
Cookbook: deployment
ALMA Project
• Add component to
CDB/MACI/Components.xml
• If we’re dealing with a characteristic
component, add an entry to:
CDB/alma/<Name>/<Name>.xml
• Add entry to:
CDB/alma/simulated/<Name>/<Name>.xml
Garching, January 2007
Component Simulator
7
Ex 1: getting a reference
ALMA Project
• Start ACS
• Start simulationContainer
• Open objexp and get a reference to the
simulated component
Garching, January 2007
Component Simulator
8
Ex 2: methods
ALMA Project
• From the simulation GUI, select the objfix
method
• Insert code to change objfix
• Setup simulation CDB entry to add the code
Garching, January 2007
Component Simulator
9
Simulation CDB elements
ALMA Project
•
•
•
•
•
•
<pythonImports>: python libraries
<initialize>
<cleanUp>
<_corbaMethod>
<_corbaAttribute>
Schema file: SimulatedComponent.xsd
Garching, January 2007
Component Simulator
10
Ex 3: properties
ALMA Project
• Properties are simulated at DevIO level.
• Tip: write down a python module with the
DevIO for the simulated property and a
getDevIO function
• Add code to the simulation CDB entry
Garching, January 2007
Component Simulator
11
Ex 4: methods and properties
ALMA Project
• Write down a python module with the
desired simulation
• Include it in the <pythonImports> section
• Call your functions from the
<_corbaAttribute> and <_corbaMethod>
sections
Garching, January 2007
Component Simulator
12
Final Remarks
ALMA Project
• The component simulator allows to
decouple some test development from
implementation
• Allows developers to a test first approach
Garching, January 2007
Component Simulator
13
Homework
ALMA Project
• Prepare a simulation for your interface
• Prepare xUnit/other tests to use when the
implementation is ready
Garching, January 2007
Component Simulator
14