[ChangeRecoder] Unexpected behavior [message #1254558] |
Sun, 23 February 2014 09:38  |
Eclipse User |
|
|
|
Hi (again),
I'm trying to evaluate the Change Recorder. I adapted the sample provided in the EMF reference book like this:
@Test
def void testChangeRecorder() {
// Initialize the model
ParticipantPackage.eINSTANCE.eClass()
// Retrieve the default factory singleton
val factory = ParticipantFactory.eINSTANCE
// create the content of the model via this program
val org = factory.createOrganization
// Register the XMI resource factory for the .website extension
val reg = Resource.Factory.Registry.INSTANCE
val m = reg.getExtensionToFactoryMap()
m.put("xmi", new XMIResourceFactoryImpl())
// Obtain a new resource set
val resSet = new ResourceSetImpl()
// create a resource
val resource = resSet.createResource(URI.createURI("resource.xmi"))
// add the instance to the resource
resource.contents += org
// start recording
val recorder = new ChangeRecorder(resource)
org.name = "Axway"
org.url = "axway://participant"
// now save the content.
try {
resource.save(Collections.EMPTY_MAP);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// stop recording
val description = recorder.endRecording()
log.info("description = " + ReflectionToStringBuilder.toString(description, ToStringStyle.MULTI_LINE_STYLE))
}
I was expecting to see the changes to the "org" instance in the change description. However, here is the output of the program:
[main] INFO com.axway.mda.runtime.PrototypeTest - description = org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl@687191d6[
objectChanges=[org.eclipse.emf.ecore.change.impl.EObjectToChangesMapEntryImpl@2525732f]
objectsToDetach=<null>
objectsToAttach=[]
resourceChanges=[]
oldContainmentInformation=<null>
eFlags=1
eAdapters=<null>
eContainer=<null>
eContainerFeatureID=0
eProperties=<null>
]
It seems that the change set is empty whereas I expected to see 2 entries (1 for the name change and 1 for the url change).
Note that I'm running as a standalone application (not inside Eclipse).
Can anyone explain what I miss?
Regards,
BQ.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.49891 seconds