#!/usr/bin/env python
import coral
TM = coral.getTransactionManager()

fileName="../../io/unittests/PMM10.xmi"
TM.beginModifyCmd()
try:
    st = coral.loadDocument(fileName)
finally:
    TM.endModifyCmd()

tr = TM.getCurrentTransaction()
print tr
assert tr
print "Commands in transaction:", tr.size()
for cmd in tr:
    if isinstance(cmd, coral.ProjectNameChangeCommand):
        continue
    print cmd, cmd.getNewProject().getFilename()

assert tr.size() == 2
assert tr[0].getNewProject().getHrefFilename() == fileName
#assert tr[2].getNewProject().getHrefFilename() == "coral/core/CORE01.xmi"
#assert tr[4].getNewProject().getHrefFilename() == "coral/core/XMI12.xmi"

