Using a simulation for inspecting objects
A simulation provides an environment for developing and testing remote object inspection within a single image by converting the views to their specification in the inspector, like it happens when inspecting a proxy.
The main simulation class is GtRemoteInspectionSimulation
. Another version is GtRemotePlainInspectionSimulation
that should be used to simulate creating views using the API provided by GtRemotePhlowProtoView
. This API is used from GemStone and plain Pharo.
From the perspective of the inspector a simulation acts as a proxy to a remote object with inspection support. This is the same support for inspection provided by GtRsrProxyServiceClient
or LanguageLinkProxyObject
.
Internally the simulation uses a proxy to an inspector wrapper (GtRemotePhlowViewedObject
when the remote side is Glamorous Toolkit, GemStone or Pharo) and attaches views to the inspector in the same way that provy objects do.
simulation := GtRemoteInspectionSimulation openOn: GtRemotePhlowDeclarativeTestInspectable new.
simulation := GtRemotePlainInspectionSimulation openOn: GtRemotePhlowDeclarativeTestInspectable new.
As in the case of a proxy object we can ask the simulation for the view specifications of the object.
simulation declarativeViews
We can also just get the raw data from for the view specifications.
simulation getViewsDeclarations
We can the use the simulation to create a view specification and link it with the remote view.
First we get the data of the view specification.
viewSpecificationData := simulation getViewDeclaration: #gtListFor:
Then from the data we instantiate and initialize a local view specification object.
viewSpecification := GtPhlowViewSpecification fromDictionary: viewSpecificationData. viewSpecification methodSelector: #gtListFor:; initializeFromInspector: simulation.
We can then use this view specification to retrieve the items in the list view.
viewSpecification retrieveItems: 2 fromIndex: 2