Пример #1
0
 def test_run(self):
     mga = GPyUnit.util.parse_xme(self.connstr)
     try:
         mga.Save()
         selectedobj = DispatchEx("Mga.MgaFCOs")
         launcher = DispatchEx("Mga.MgaLauncher")
         launcher.RunComponent("Mga.Interpreter.MetaInterpreter", mga, None, selectedobj, 128)
         launcher.RunComponent("Mga.Interpreter.CSharpDSMLGenerator", mga, None, selectedobj, 128)
     finally:
         mga.Close()
     self.assertTrue(os.path.isfile(os.path.join(self.outdir(), "ISIS.GME.Dsml.MetaGME.Classes.cs")))
     self.assertTrue(os.path.isfile(os.path.join(self.outdir(), "ISIS.GME.Dsml.MetaGME.dll")))
Пример #2
0
    def test_run(self):
        mga = GPyUnit.util.parse_xme(
            "MGA=" + _adjacent_file("BidirConnection.mga"),
            _adjacent_file("BidirConnection.xme"))
        print self.connstr
        try:
            mga.Save()
            selectedobj = DispatchEx("Mga.MgaFCOs")
            launcher = DispatchEx("Mga.MgaLauncher")
            #launcher.RunComponent("Mga.Interpreter.MetaInterpreter", mga, None, selectedobj, 128)
            launcher.RunComponent("Mga.Interpreter.CSharpDSMLGenerator", mga,
                                  None, selectedobj, 128)
        finally:
            mga.Close()
        self.assertTrue(
            os.path.isfile(
                os.path.join(self.outdir(),
                             "ISIS.GME.Dsml.BidirConnection.Classes.cs")))
        self.assertTrue(
            os.path.isfile(
                os.path.join(self.outdir(),
                             "ISIS.GME.Dsml.BidirConnection.dll")))

        mga = GPyUnit.util.parse_xme(
            self.connstr, _adjacent_file("BidirConnectionModel.xme"))
        mga.Save()
        mga.BeginTransactionInNewTerr()
        try:
            self.assertEqual(
                mga.ObjectByPath("/@NewModel/@Child1").PartOfConns.Count, 2)
            self.assertEqual(
                set([
                    x.ConnRole
                    for x in mga.ObjectByPath("/@NewModel/@Child1").PartOfConns
                ]), set(['src', 'dst']))
            self.assertEqual(
                set([
                    x.ConnRole
                    for x in mga.ObjectByPath("/@NewModel/@Child2").PartOfConns
                ]), set(['src', 'dst']))
        finally:
            mga.AbortTransaction()
            mga.Close()

        import subprocess
        subprocess.check_call(
            [_adjacent_file(r"DsmlGeneratorTest\.nuget\NuGet.exe"), "restore"],
            cwd=_adjacent_file("DsmlGeneratorTest"))
        subprocess.check_call([
            r"c:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe",
            _adjacent_file(r"DsmlGeneratorTest\DsmlGeneratorTest.sln")
        ])
        subprocess.check_call([
            _adjacent_file(
                r"DsmlGeneratorTest\bin\Debug\DsmlGeneratorTest.exe"),
            self.connstr
        ])
Пример #3
0
	def run_interpreter(self, interpreter, focusobj=None, selectedobj=None, param=0):
		if not selectedobj:
			selectedobj=DispatchEx("Mga.MgaFCOs")
		self.commit_transaction()
		try:
			launcher = DispatchEx("Mga.MgaLauncher")
			launcher.RunComponent(interpreter, self.project, focusobj, selectedobj, param)
		finally:
			self.begin_transaction()
Пример #4
0
    def test_AttributeOrdering(self):
        mga = GPyUnit.util.parse_xme(self.connstr)
        try:
            mga.Save()
            selectedobj = DispatchEx("Mga.MgaFCOs")
            launcher = DispatchEx("Mga.MgaLauncher")
            launcher.RunComponent("Mga.Interpreter.MetaInterpreter", mga, None, selectedobj, 128)
        finally:
            mga.Close()

        with open(os.path.join(self.outdir(), "MetaGME.xmp")) as xmp:
            lines = xmp.readlines()
            atomattributes = "IsAbstract InRootFolder GeneralPreferences DisplayedName IsTypeShown Icon IsNameEnabled PortIcon SubTypeIcon NamePosition InstanceIcon Decorator NameWrapNum IsHotspotEnabled IsResizable AutoRouterPref HelpURL IsGradientFillEnabled GradientFillColor GradientFillDirection IsShadowCastEnabled ShadowColor ShadowThickness ShadowDirection IsRoundRectangleEnabled RoundRectangleRadius"
            self.assertTrue(atomattributes in "".join(lines), filter(lambda x: '<atom name = "Atom"' in x, lines))
        
        metaproj = DispatchEx("Mga.MgaMetaProject")
        metaproj.Open("MGA=" + os.path.join(self.outdir(), "MetaGME.mta"))
        try:
            atomattrs = [attr.Name for attr in metaproj.RootFolder.DefinedFCOByName("Atom", True).Attributes]
            self.assertEqual(atomattrs, list(atomattributes.split()))
        finally:
            metaproj.Close()