#!/usr/bin/env python
import os

import coral
SMD=coral.lang.SMD01 

from coral.lgen.smd2lang import *

assert(SMD.Property.getPropertyByName("opposite").getOppositeProperty() is not None)

uml14_model = coral.loadModel("../../../coral/lang/UML14/def/UML14.xmi")
assert(uml14_model)

coral.saveModel("tmp/testUML14.xmi", uml14_model)

print
print "*********************************"
print "* Loaded UML14 metamodel as XMI *"
print "*********************************"
print

enums = 0
for i in uml14_model.elements:
    if i.oclIsKindOf(SMD.EnumerationDefinition):
        enums += 1
        print str(i.name) + ":"
        for v in i.values:
            print "  " + str(v)
        print

assert(enums == 8)

uml14_lang = smd2lang(uml14_model)

print uml14_lang

os.remove("tmp/testUML14.xmi")
