[commit] r2178 - in trunk: Install SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Properties Tests/GPyUnit Tests/GPyUnit/DsmlGeneratorTest Tests/GPyUnit/DsmlGeneratorTest/Properties
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Fri Apr 19 12:02:59 CDT 2013
Author: ksmyth
Date: Fri Apr 19 12:02:59 2013
New Revision: 2178
Log:
Fix bidir conns in DsmlGenerator. Write test for it
Added:
trunk/Tests/GPyUnit/BidirConnection.xme
trunk/Tests/GPyUnit/BidirConnection.xmp
trunk/Tests/GPyUnit/BidirConnectionModel.xme
trunk/Tests/GPyUnit/DsmlGeneratorTest/
trunk/Tests/GPyUnit/DsmlGeneratorTest/DsmlGeneratorTest.csproj
trunk/Tests/GPyUnit/DsmlGeneratorTest/Program.cs
trunk/Tests/GPyUnit/DsmlGeneratorTest/Properties/
trunk/Tests/GPyUnit/DsmlGeneratorTest/Properties/AssemblyInfo.cs
- copied, changed from r2177, trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Properties/AssemblyInfo.cs
trunk/Tests/GPyUnit/test_DsmlGenerator.py
Modified:
trunk/Install/GME_SDK.wxs
trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoHelper.cs
trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoSrcDstConnections.cs
trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Properties/AssemblyInfo.cs
trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/app.manifest
trunk/Tests/GPyUnit/__init__.py
Modified: trunk/Install/GME_SDK.wxs
==============================================================================
--- trunk/Install/GME_SDK.wxs Fri Apr 19 12:01:51 2013 (r2177)
+++ trunk/Install/GME_SDK.wxs Fri Apr 19 12:02:59 2013 (r2178)
@@ -187,7 +187,7 @@
</Class>
<RegistryValue Root="HKCR" Key="CLSID\{78BE7B95-3564-4BA9-8FE6-8D9B91EEE0B8}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{78BE7B95-3564-4BA9-8FE6-8D9B91EEE0B8}\InprocServer32" Name="Class" Value="CSharpDSMLGenerator.CSharpDSMLGeneratorInterpreter" Type="string" Action="write" />
- <RegistryValue Root="HKCR" Key="CLSID\{78BE7B95-3564-4BA9-8FE6-8D9B91EEE0B8}\InprocServer32" Name="Assembly" Value="CSharpDSMLGenerator, Version=1.0.6.0, Culture=neutral" Type="string" Action="write" />
+ <RegistryValue Root="HKCR" Key="CLSID\{78BE7B95-3564-4BA9-8FE6-8D9B91EEE0B8}\InprocServer32" Name="Assembly" Value="CSharpDSMLGenerator, Version=1.0.7.0, Culture=neutral" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{78BE7B95-3564-4BA9-8FE6-8D9B91EEE0B8}\InprocServer32" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{78BE7B95-3564-4BA9-8FE6-8D9B91EEE0B8}\InprocServer32" Name="CodeBase" Value="file:///[#CSharpDSMLGenerator.dll]" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="Component Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Name="0" Value=".NET Category" Type="string" Action="write" />
Modified: trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoHelper.cs
==============================================================================
--- trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoHelper.cs Fri Apr 19 12:01:51 2013 (r2177)
+++ trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoHelper.cs Fri Apr 19 12:02:59 2013 (r2178)
@@ -512,7 +512,7 @@
}
- public static IEnumerable<MgaFCO> GetSrcConnections(MgaFCO mgaFCO)
+ public static IEnumerable<Tuple<MgaFCO, string>> GetSrcConnections(MgaFCO mgaFCO)
{
//Contract.Requires<ArgumentNullException>(mgaFCO != null);
@@ -527,7 +527,7 @@
connector = simple.Src;
}
if (simple.MetaBase.Name == "SourceToConnector" &&
- string.IsNullOrEmpty(simple.StrAttrByName["srcRolename"]))
+ string.IsNullOrEmpty(simple.StrAttrByName["srcRolename"])) // bidirectional connection
{
connector = simple.Dst;
}
@@ -540,28 +540,19 @@
{
if (simpleConn.MetaBase.Name == "AssociationClass")
{
- if (simpleConn.Src == connector)
+ MgaFCO target = simpleConn.Src;
+ if (target is MgaReference)
+ {
+ target = (target as MgaReference).Referred;
+ }
+ if (simple.Src == connector)
{
- if (simpleConn.Dst is MgaReference)
- {
- yield return (simpleConn.Dst as MgaReference).Referred;
- }
- else
- {
- yield return simpleConn.Dst;
- }
+ yield return new Tuple<MgaFCO, string>(target, "Src");
}
- else
+ else // bidirectional connection
{
- if (simpleConn.Src is MgaReference)
- {
- yield return (simpleConn.Src as MgaReference).Referred;
- }
- else
- {
- yield return simpleConn.Src;
- }
- }
+ yield return new Tuple<MgaFCO, string>(target, "Dst");
+ }
}
}
}
@@ -570,7 +561,7 @@
}
}
- public static IEnumerable<MgaFCO> GetDstConnections(MgaFCO mgaFCO)
+ public static IEnumerable<Tuple<MgaFCO, string>> GetDstConnections(MgaFCO mgaFCO)
{
//Contract.Requires<ArgumentNullException>(mgaFCO != null);
@@ -585,7 +576,7 @@
connector = simple.Dst;
}
if (simple.MetaBase.Name == "ConnectorToDestination" &&
- string.IsNullOrEmpty(simple.StrAttrByName["dstRolename"]))
+ string.IsNullOrEmpty(simple.StrAttrByName["dstRolename"])) // bidirectional connection
{
connector = simple.Src;
}
@@ -598,28 +589,19 @@
{
if (simpleConn.MetaBase.Name == "AssociationClass")
{
- if (simpleConn.Src == connector)
+ MgaFCO target = simpleConn.Src;
+ if (target is MgaReference)
{
- if (simpleConn.Dst is MgaReference)
- {
- yield return (simpleConn.Dst as MgaReference).Referred;
- }
- else
- {
- yield return simpleConn.Dst;
- }
+ target = (target as MgaReference).Referred;
+ }
+ if (simple.Dst == connector)
+ {
+ yield return new Tuple<MgaFCO, string>(target, "Dst");
}
- else
+ else // bidirectional connection
{
- if (simpleConn.Src is MgaReference)
- {
- yield return (simpleConn.Src as MgaReference).Referred;
- }
- else
- {
- yield return simpleConn.Src;
- }
- }
+ yield return new Tuple<MgaFCO, string>(target, "Src");
+ }
}
}
}
Modified: trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoSrcDstConnections.cs
==============================================================================
--- trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoSrcDstConnections.cs Fri Apr 19 12:01:51 2013 (r2177)
+++ trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoSrcDstConnections.cs Fri Apr 19 12:02:59 2013 (r2178)
@@ -18,7 +18,7 @@
{
// find the connection objects
- List<MgaFCO> connections = new List<MgaFCO>();
+ List<Tuple<MgaFCO, string>> connections = new List<Tuple<MgaFCO, string>>();
List<MgaFCO> _listWProxies = new List<MgaFCO>();
@@ -56,8 +56,13 @@
newSrcConn.Members.Add(ctor);
- foreach (MgaFCO item in connections.OfType<MgaAtom>().Distinct())
+ foreach (IGrouping<MgaFCO, string> tuple in connections.GroupBy(x => x.Item1, x => x.Item2))
{
+ MgaFCO item = tuple.Key;
+ if (!(item is MgaAtom))
+ {
+ continue;
+ }
CodeMemberProperty newConnections = new CodeMemberProperty()
{
Attributes = MemberAttributes.Public,
@@ -69,9 +74,25 @@
newConnections.Comments.Add(
new CodeCommentStatement(Configuration.Comments.SrcConnections, true));
- newConnections.GetStatements.Add(
- new CodeMethodReturnStatement(
- new CodeSnippetExpression(typeof(ISIS.GME.Common.Utils).FullName + ".CastSrcConnections<" + Configuration.GetClassName(item as MgaObject) + ", global::" + typeof(MgaFCO).FullName + ">(Impl as global::" + typeof(MgaFCO).FullName + ", \"" + Configuration.GetKindName(item as MgaObject) + "\")")));
+ if (tuple.Count() == 1)
+ {
+ newConnections.GetStatements.Add(
+ new CodeMethodReturnStatement(
+ new CodeSnippetExpression(typeof(ISIS.GME.Common.Utils).FullName + ".Cast" + tuple.First() + "Connections<" + Configuration.GetClassName(item as MgaObject) + ", global::" + typeof(MgaFCO).FullName + ">(Impl as global::" + typeof(MgaFCO).FullName + ", \"" + Configuration.GetKindName(item as MgaObject) + "\")")));
+ }
+ else
+ {
+ newConnections.GetStatements.Add(
+ new CodeMethodReturnStatement(
+ new CodeSnippetExpression(
+
+
+ typeof(ISIS.GME.Common.Utils).FullName + ".CastSrcConnections<" + Configuration.GetClassName(item as MgaObject) + ", global::" + typeof(MgaFCO).FullName + ">(Impl as global::" + typeof(MgaFCO).FullName + ", \"" + Configuration.GetKindName(item as MgaObject) + "\")"
+ + ".Concat(" +
+ typeof(ISIS.GME.Common.Utils).FullName + ".CastDstConnections<" + Configuration.GetClassName(item as MgaObject) + ", global::" + typeof(MgaFCO).FullName + ">(Impl as global::" + typeof(MgaFCO).FullName + ", \"" + Configuration.GetKindName(item as MgaObject) + "\")"
+ + ")"
+ )));
+ }
newSrcConn.Members.Add(newConnections);
}
@@ -96,14 +117,15 @@
}
else
{
+ var allConnectionClasses = connections.Select(x => x.Item1).Distinct();
newAllSrcConnections.GetStatements.Add(
new CodeSnippetExpression(
"IEnumerable<" + typeof(ISIS.GME.Common.Interfaces.Connection).FullName + "> result = ((" +
Configuration.GetInterfaceName(Subject) +
- ")(this)).SrcConnections." + connections.FirstOrDefault().Name + "Collection.Cast<" +
+ ")(this)).SrcConnections." + allConnectionClasses.FirstOrDefault().Name + "Collection.Cast<" +
typeof(ISIS.GME.Common.Interfaces.Connection).FullName + ">()"));
- foreach (var childFco in connections.Skip(1))
+ foreach (var childFco in allConnectionClasses.Skip(1))
{
newAllSrcConnections.GetStatements.Add(
new CodeSnippetExpression(
@@ -143,7 +165,7 @@
{
// find the connection objects
- List<MgaFCO> connections = new List<MgaFCO>();
+ List<Tuple<MgaFCO, string>> connections = new List<Tuple<MgaFCO, string>>();
List<MgaFCO> _listWProxies = new List<MgaFCO>();
@@ -181,8 +203,13 @@
newDstConn.Members.Add(ctor);
- foreach (MgaFCO item in connections.OfType<MgaAtom>().Distinct())
+ foreach (IGrouping<MgaFCO, string> tuple in connections.GroupBy(x => x.Item1, x => x.Item2))
{
+ MgaFCO item = tuple.Key;
+ if (!(item is MgaAtom))
+ {
+ continue;
+ }
CodeMemberProperty newConnections = new CodeMemberProperty()
{
Attributes = MemberAttributes.Public,
@@ -194,9 +221,23 @@
newConnections.Comments.Add(
new CodeCommentStatement(Configuration.Comments.DstConnections, true));
- newConnections.GetStatements.Add(
- new CodeMethodReturnStatement(
- new CodeSnippetExpression(typeof(ISIS.GME.Common.Utils).FullName + ".CastDstConnections<" + Configuration.GetClassName(item as MgaObject) + ", global::" + typeof(MgaFCO).FullName + ">(Impl as global::" + typeof(MgaFCO).FullName + ", \"" + Configuration.GetKindName(item as MgaObject) + "\")")));
+ if (tuple.Count() == 1)
+ {
+ newConnections.GetStatements.Add(
+ new CodeMethodReturnStatement(
+ new CodeSnippetExpression(typeof(ISIS.GME.Common.Utils).FullName + ".CastDstConnections<" + Configuration.GetClassName(item as MgaObject) + ", global::" + typeof(MgaFCO).FullName + ">(Impl as global::" + typeof(MgaFCO).FullName + ", \"" + Configuration.GetKindName(item as MgaObject) + "\")")));
+ }
+ else
+ {
+ newConnections.GetStatements.Add(
+ new CodeMethodReturnStatement(
+ new CodeSnippetExpression(
+ typeof(ISIS.GME.Common.Utils).FullName + ".CastSrcConnections<" + Configuration.GetClassName(item as MgaObject) + ", global::" + typeof(MgaFCO).FullName + ">(Impl as global::" + typeof(MgaFCO).FullName + ", \"" + Configuration.GetKindName(item as MgaObject) + "\")"
+ + ".Concat(" +
+ typeof(ISIS.GME.Common.Utils).FullName + ".CastDstConnections<" + Configuration.GetClassName(item as MgaObject) + ", global::" + typeof(MgaFCO).FullName + ">(Impl as global::" + typeof(MgaFCO).FullName + ", \"" + Configuration.GetKindName(item as MgaObject) + "\")"
+ + ")"
+ )));
+ }
newDstConn.Members.Add(newConnections);
}
@@ -221,14 +262,14 @@
}
else
{
- newAllDstConnections.GetStatements.Add(
+ var allConnectionClasses = connections.Select(x => x.Item1).Distinct();
newAllDstConnections.GetStatements.Add(
new CodeSnippetExpression(
"IEnumerable<" + typeof(ISIS.GME.Common.Interfaces.Connection).FullName + "> result = ((" +
Configuration.GetInterfaceName(Subject) +
- ")(this)).DstConnections." + connections.FirstOrDefault().Name + "Collection.Cast<" +
+ ")(this)).DstConnections." + allConnectionClasses.FirstOrDefault().Name + "Collection.Cast<" +
typeof(ISIS.GME.Common.Interfaces.Connection).FullName + ">()"));
- foreach (var childFco in connections.Skip(1))
+ foreach (var childFco in allConnectionClasses.Skip(1))
{
newAllDstConnections.GetStatements.Add(
new CodeSnippetExpression(
Modified: trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Properties/AssemblyInfo.cs
==============================================================================
--- trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Properties/AssemblyInfo.cs Fri Apr 19 12:01:51 2013 (r2177)
+++ trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Properties/AssemblyInfo.cs Fri Apr 19 12:02:59 2013 (r2178)
@@ -33,6 +33,6 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
// Keep in sync with app.manifest and GME_SDK.wxs
-[assembly: AssemblyVersion("1.0.6.0")]
-[assembly: AssemblyFileVersion("1.0.6.0")]
+[assembly: AssemblyVersion("1.0.7.0")]
+[assembly: AssemblyFileVersion("1.0.7.0")]
// also change GME_SDK.wxs
Modified: trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/app.manifest
==============================================================================
--- trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/app.manifest Fri Apr 19 12:01:51 2013 (r2177)
+++ trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/app.manifest Fri Apr 19 12:02:59 2013 (r2178)
@@ -3,7 +3,7 @@
<assemblyIdentity
type="win32"
name="CSharpDSMLGenerator"
- version="1.0.6.0"
+ version="1.0.7.0"
publicKeyToken="1321e6b92842fe54"
processorArchitecture="msil" />
<clrClass
Added: trunk/Tests/GPyUnit/BidirConnection.xme
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/Tests/GPyUnit/BidirConnection.xme Fri Apr 19 12:02:59 2013 (r2178)
@@ -0,0 +1,419 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project SYSTEM "mga.dtd">
+
+<project guid="{B3EFE7F8-14C0-4895-B3F6-1CE07FAA942D}" cdate="Fri Apr 19 09:19:52 2013" mdate="Fri Apr 19 09:19:52 2013" version="" metaguid="{9D3F9884-FE60-409C-8FC1-45789193989B}" metaversion="" metaname="MetaGME">
+ <name>BidirConnection</name>
+ <comment></comment>
+ <author></author>
+ <folder id="id-006a-00000001" relid="0x1" childrelidcntr="0x1" kind="RootFolder" guid="{41e7bb40-a1d7-4b69-ade8-8ca45a3cb375}">
+ <name>BidirConnection</name>
+ <regnode name="AspectRegistry" status="undefined">
+ <value></value>
+ <regnode name="AspectMetaRefs" status="undefined">
+ <value></value>
+ <regnode name="Aspect" status="undefined">
+ <value></value>
+ <regnode name="MetaRef" status="undefined">
+ <value></value>
+ <regnode name="Model" isopaque="yes">
+ <value>1004</value>
+ </regnode>
+ </regnode>
+ </regnode>
+ </regnode>
+ </regnode>
+ <regnode name="BidirConnection" status="undefined">
+ <value></value>
+ <regnode name="Connection-3-Connection" status="undefined">
+ <value></value>
+ <regnode name="MetaRef" isopaque="yes">
+ <value>1001</value>
+ <regnode name="Model" status="undefined">
+ <value></value>
+ <regnode name="Connection" isopaque="yes">
+ <value>1006</value>
+ <regnode name="Aspect" isopaque="yes">
+ <value>1007</value>
+ </regnode>
+ </regnode>
+ </regnode>
+ </regnode>
+ <regnode name="PrimaryAspects" status="undefined">
+ <value></value>
+ <regnode name="Model:Connection" status="undefined">
+ <value></value>
+ <regnode name="Aspect" isopaque="yes">
+ <value>yes</value>
+ </regnode>
+ </regnode>
+ </regnode>
+ </regnode>
+ <regnode name="Model-1-Model" status="undefined">
+ <value></value>
+ <regnode name="KindAspects" status="undefined">
+ <value></value>
+ <regnode name="Model:Model" status="undefined">
+ <value></value>
+ <regnode name="Aspect" isopaque="yes">
+ <value> </value>
+ </regnode>
+ </regnode>
+ </regnode>
+ <regnode name="MetaRef" isopaque="yes">
+ <value>1002</value>
+ <regnode name="Model" status="undefined">
+ <value></value>
+ <regnode name="Model" isopaque="yes">
+ <value>1003</value>
+ <regnode name="Aspect" isopaque="yes">
+ <value>1005</value>
+ </regnode>
+ </regnode>
+ </regnode>
+ </regnode>
+ <regnode name="PrimaryAspects" status="undefined">
+ <value></value>
+ <regnode name="Model:Model" status="undefined">
+ <value></value>
+ <regnode name="Aspect" isopaque="yes">
+ <value>yes</value>
+ </regnode>
+ </regnode>
+ </regnode>
+ </regnode>
+ </regnode>
+ <regnode name="MetaGME_Options" status="undefined">
+ <value></value>
+ <regnode name="GeneratedConstraints" isopaque="yes">
+ <value>skip_dialog</value>
+ <regnode name="ConnectionEndEventMask" isopaque="yes">
+ <value>0x00000000</value>
+ </regnode>
+ <regnode name="FolderContainmentEventMask" isopaque="yes">
+ <value>0x00000000</value>
+ </regnode>
+ <regnode name="Priority" isopaque="yes">
+ <value>1</value>
+ </regnode>
+ <regnode name="RegularContainmentEventMask" isopaque="yes">
+ <value>0x00000000</value>
+ </regnode>
+ </regnode>
+ </regnode>
+ <model id="id-0065-00000001" kind="ParadigmSheet" guid="{95c63d7e-6de3-4b21-b35f-754bdd133879}" relid="0x1" childrelidcntr="0xa">
+ <name>BidirConnection</name>
+ <atom id="id-0066-00000001" kind="Model" role="Model" guid="{4c9c993f-ee1d-48b2-8bc4-ca0b7f041d4e}" relid="0x1">
+ <name>Model</name>
+ <regnode name="PartRegs" status="undefined">
+ <value></value>
+ <regnode name="All" status="undefined">
+ <value></value>
+ <regnode name="Position" isopaque="yes">
+ <value>441,112</value>
+ </regnode>
+ </regnode>
+ <regnode name="Attributes" status="undefined">
+ <value></value>
+ <regnode name="Position" isopaque="yes">
+ <value>441,112</value>
+ </regnode>
+ </regnode>
+ <regnode name="ClassDiagram" status="undefined">
+ <value></value>
+ <regnode name="Position" isopaque="yes">
+ <value>441,112</value>
+ </regnode>
+ </regnode>
+ <regnode name="Constraints" status="undefined">
+ <value></value>
+ <regnode name="Position" isopaque="yes">
+ <value>441,112</value>
+ </regnode>
+ </regnode>
+ <regnode name="Visualization" status="undefined">
+ <value></value>
+ <regnode name="Position" isopaque="yes">
+ <value>441,112</value>
+ </regnode>
+ </regnode>
+ </regnode>
+ <attribute kind="AutoRouterPref" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="Decorator" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="DisplayedName" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="GeneralPreferences" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="GradientFillColor" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="GradientFillDirection" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="HelpURL" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="Icon" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="InRootFolder">
+ <value>true</value>
+ </attribute>
+ <attribute kind="InstanceIcon" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="IsAbstract" status="meta">
+ <value>false</value>
+ </attribute>
+ <attribute kind="IsGradientFillEnabled" status="meta">
+ <value>false</value>
+ </attribute>
+ <attribute kind="IsHotspotEnabled" status="meta">
+ <value>true</value>
+ </attribute>
+ <attribute kind="IsModelAutoRouted" status="meta">
+ <value>true</value>
+ </attribute>
+ <attribute kind="IsNameEnabled" status="meta">
+ <value>true</value>
+ </attribute>
+ <attribute kind="IsResizable" status="meta">
+ <value>false</value>
+ </attribute>
+ <attribute kind="IsRoundRectangleEnabled" status="meta">
+ <value>false</value>
+ </attribute>
+ <attribute kind="IsShadowCastEnabled" status="meta">
+ <value>false</value>
+ </attribute>
+ <attribute kind="IsTypeInfoShown" status="meta">
+ <value>true</value>
+ </attribute>
+ <attribute kind="IsTypeShown" status="meta">
+ <value>false</value>
+ </attribute>
+ <attribute kind="NamePosition" status="meta">
+ <value>4</value>
+ </attribute>
+ <attribute kind="NameWrapNum" status="meta">
+ <value>0</value>
+ </attribute>
+ <attribute kind="PortIcon" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="RoundRectangleRadius" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="ShadowColor" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="ShadowDirection" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="ShadowThickness" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="SubTypeIcon" status="meta">
+ <value></value>
+ </attribute>
+ </atom>
+ <atom id="id-0066-00000002" kind="Connection" role="Connection" guid="{ebe21d31-6022-4ce3-89e6-86a5d5af7c30}" relid="0x3">
+ <name>Connection</name>
+ <regnode name="PartRegs" status="undefined">
+ <value></value>
+ <regnode name="All" status="undefined">
+ <value></value>
+ <regnode name="Position" isopaque="yes">
+ <value>434,322</value>
+ </regnode>
+ </regnode>
+ <regnode name="Attributes" status="undefined">
+ <value></value>
+ <regnode name="Position" isopaque="yes">
+ <value>434,322</value>
+ </regnode>
+ </regnode>
+ <regnode name="ClassDiagram" status="undefined">
+ <value></value>
+ <regnode name="Position" isopaque="yes">
+ <value>434,322</value>
+ </regnode>
+ </regnode>
+ <regnode name="Constraints" status="undefined">
+ <value></value>
+ <regnode name="Position" isopaque="yes">
+ <value>434,322</value>
+ </regnode>
+ </regnode>
+ <regnode name="Visualization" status="undefined">
+ <value></value>
+ <regnode name="Position" isopaque="yes">
+ <value>434,322</value>
+ </regnode>
+ </regnode>
+ </regnode>
+ <attribute kind="Color" status="meta">
+ <value>0x000000</value>
+ </attribute>
+ <attribute kind="ConnLineEnd" status="meta">
+ <value>butt</value>
+ </attribute>
+ <attribute kind="ConnLineStart" status="meta">
+ <value>butt</value>
+ </attribute>
+ <attribute kind="ConnLineType" status="meta">
+ <value>solid</value>
+ </attribute>
+ <attribute kind="DisplayedName" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="DstAttrLabel1" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="DstAttrLabel2" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="GeneralPreferences" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="InRootFolder" status="meta">
+ <value>false</value>
+ </attribute>
+ <attribute kind="IsAbstract" status="meta">
+ <value>false</value>
+ </attribute>
+ <attribute kind="IsAutoRouted" status="meta">
+ <value>true</value>
+ </attribute>
+ <attribute kind="LabelFormatStr" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="NamePosition" status="meta">
+ <value>4</value>
+ </attribute>
+ <attribute kind="SrcAttrLabel1" status="meta">
+ <value></value>
+ </attribute>
+ <attribute kind="SrcAttrLabel2" status="meta">
+ <value></value>
+ </attribute>
+ </atom>
+ <atom id="id-0066-00000003" kind="Connector" role="Connector" guid="{97f2fedf-ee63-4673-bb56-ef9cc95272df}" relid="0x4">
+ <name>Connector</name>
+ <regnode name="PartRegs" status="undefined">
+ <value></value>
+ <regnode name="All" status="undefined">
+ <value></value>
+ <regnode name="Position" isopaque="yes">
+ <value>616,266</value>
+ </regnode>
+ </regnode>
+ <regnode name="ClassDiagram" status="undefined">
+ <value></value>
+ <regnode name="Position" isopaque="yes">
+ <value>616,266</value>
+ </regnode>
+ </regnode>
+ <regnode name="Visualization" status="undefined">
+ <value></value>
+ <regnode name="Position" isopaque="yes">
+ <value>616,266</value>
+ </regnode>
+ </regnode>
+ </regnode>
+ </atom>
+ <connection id="id-0068-00000001" kind="Containment" role="Containment" guid="{f5b4e993-83fd-47f0-8431-cdb483266045}" relid="0x2">
+ <name>Containment</name>
+ <attribute kind="Cardinality" status="meta">
+ <value>0..*</value>
+ </attribute>
+ <attribute kind="IsPort" status="meta">
+ <value>false</value>
+ </attribute>
+ <attribute kind="Rolename" status="meta">
+ <value></value>
+ </attribute>
+ <connpoint role="dst" target="id-0066-00000001"/>
+ <connpoint role="src" target="id-0066-00000001"/>
+ </connection>
+ <connection id="id-0068-00000002" kind="AssociationClass" role="AssociationClass" guid="{a4cc8c91-2dc6-4a10-8937-615acf1e53a8}" relid="0x5">
+ <name>AssociationClass</name>
+ <regnode name="autorouterPref" isopaque="yes">
+ <value>s</value>
+ </regnode>
+ <connpoint role="src" target="id-0066-00000002"/>
+ <connpoint role="dst" target="id-0066-00000003"/>
+ </connection>
+ <connection id="id-0068-00000003" kind="ConnectorToDestination" role="ConnectorToDestination" guid="{c7fd1d1c-ba76-4865-9e85-8a962400e26f}" relid="0x6">
+ <name>ConnectorToDestination</name>
+ <regnode name="autorouterPref" isopaque="yes">
+ <value>W</value>
+ </regnode>
+ <attribute kind="Cardinality" status="meta">
+ <value>0..*</value>
+ </attribute>
+ <attribute kind="dstRolename">
+ <value></value>
+ </attribute>
+ <connpoint role="dst" target="id-0066-00000001"/>
+ <connpoint role="src" target="id-0066-00000003"/>
+ </connection>
+ <connection id="id-0068-00000004" kind="SourceToConnector" role="SourceToConnector" guid="{ebab94f6-17ea-43a1-b9d8-ee3eba646e6c}" relid="0x7">
+ <name>SourceToConnector</name>
+ <attribute kind="Cardinality" status="meta">
+ <value>0..*</value>
+ </attribute>
+ <attribute kind="srcRolename">
+ <value></value>
+ </attribute>
+ <connpoint role="src" target="id-0066-00000001"/>
+ <connpoint role="dst" target="id-0066-00000003"/>
+ </connection>
+ <connection id="id-0068-00000005" kind="HasAspect" role="HasAspect" guid="{a13894a9-795c-4512-a8b2-e5d43d0214dc}" relid="0x9">
+ <name>HasAspect</name>
+ <connpoint role="dst" target="id-0066-00000001"/>
+ <connpoint role="src" target="id-0069-00000001"/>
+ </connection>
+ <connection id="id-0068-00000006" kind="Containment" role="Containment" guid="{a0c6cbac-1160-418a-918e-847749049b8f}" relid="0xa">
+ <name>Containment</name>
+ <attribute kind="Cardinality" status="meta">
+ <value>0..*</value>
+ </attribute>
+ <attribute kind="IsPort" status="meta">
+ <value>false</value>
+ </attribute>
+ <attribute kind="Rolename" status="meta">
+ <value></value>
+ </attribute>
+ <connpoint role="dst" target="id-0066-00000001"/>
+ <connpoint role="src" target="id-0066-00000002"/>
+ </connection>
+ <set id="id-0069-00000001" kind="Aspect" role="Aspect" guid="{f3de9b6f-05dd-4204-8c49-1131eda2c76d}" relid="0x8" members="id-0066-00000001 id-0066-00000002">
+ <name>Aspect</name>
+ <regnode name="PartRegs" status="undefined">
+ <value></value>
+ <regnode name="All" status="undefined">
+ <value></value>
+ <regnode name="Position" isopaque="yes">
+ <value>294,231</value>
+ </regnode>
+ </regnode>
+ <regnode name="Visualization" status="undefined">
+ <value></value>
+ <regnode name="Position" isopaque="yes">
+ <value>294,231</value>
+ </regnode>
+ </regnode>
+ </regnode>
+ <attribute kind="DisplayedName" status="meta">
+ <value></value>
+ </attribute>
+ </set>
+ </model>
+ </folder>
+</project>
Added: trunk/Tests/GPyUnit/BidirConnection.xmp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/Tests/GPyUnit/BidirConnection.xmp Fri Apr 19 12:02:59 2013 (r2178)
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!DOCTYPE paradigm SYSTEM "edf.dtd">
+
+<paradigm name="BidirConnection" guid="{F573F775-0373-43B2-853A-AFDBF9E5EBAA}" cdate="Fri Apr 19 09:19:52 2013" mdate="Fri Apr 19 09:19:52 2013" >
+
+ <comment></comment>
+
+ <author></author>
+
+ <folder name = "RootFolder" metaref = "1000" rootobjects = "Model" >
+ <connection name = "Connection" metaref = "1001" >
+ <regnode name = "color" value ="0x000000"></regnode>
+ <regnode name = "dstStyle" value ="butt"></regnode>
+ <regnode name = "srcStyle" value ="butt"></regnode>
+ <regnode name = "lineType" value ="solid"></regnode>
+ <connjoint>
+ <pointerspec name = "src">
+ <pointeritem desc = "Model"></pointeritem>
+ </pointerspec>
+ <pointerspec name = "dst">
+ <pointeritem desc = "Model"></pointeritem>
+ </pointerspec>
+ </connjoint>
+ <connjoint>
+ <pointerspec name = "src">
+ <pointeritem desc = "Model"></pointeritem>
+ </pointerspec>
+ <pointerspec name = "dst">
+ <pointeritem desc = "Model"></pointeritem>
+ </pointerspec>
+ </connjoint>
+ </connection>
+ <model name = "Model" metaref = "1002" >
+ <regnode name = "namePosition" value ="4"></regnode>
+ <regnode name = "isTypeInfoShown" value ="true"></regnode>
+ <role name = "Connection" metaref = "1006" kind = "Connection"></role>
+ <role name = "Model" metaref = "1003" kind = "Model"></role>
+ <aspect name = "Aspect" metaref = "1004" >
+ <part metaref = "1007" role = "Connection" primary = "yes" linked = "no"></part>
+ <part metaref = "1005" role = "Model" primary = "yes" linked = "no"></part>
+ </aspect>
+ </model>
+ </folder>
+</paradigm>
Added: trunk/Tests/GPyUnit/BidirConnectionModel.xme
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/Tests/GPyUnit/BidirConnectionModel.xme Fri Apr 19 12:02:59 2013 (r2178)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project SYSTEM "mga.dtd">
+
+<project guid="{A006DA6F-5153-431A-81F9-E2291E29D7F4}" cdate="Fri Apr 19 09:21:54 2013" mdate="Fri Apr 19 09:21:54 2013" version="" metaguid="{F573F775-0373-43B2-853A-AFDBF9E5EBAA}" metaversion="" metaname="BidirConnection">
+ <name>RootFolder</name>
+ <comment></comment>
+ <author></author>
+ <folder id="id-006a-00000001" relid="0x1" childrelidcntr="0x1" kind="RootFolder" guid="{aae18111-a09b-46cf-9791-a0d6cf04959a}">
+ <name>RootFolder</name>
+ <model id="id-0065-00000001" kind="Model" guid="{2e10cc7e-6375-429a-9e87-80c035a1624d}" relid="0x1" childrelidcntr="0x4">
+ <name>NewModel</name>
+ <model id="id-0065-00000002" kind="Model" role="Model" guid="{22693372-db90-423b-b2bd-ac2d7225415f}" relid="0x1" childrelidcntr="0x0">
+ <name>Child1</name>
+ <regnode name="PartRegs" status="undefined">
+ <value></value>
+ <regnode name="Aspect" status="undefined">
+ <value></value>
+ <regnode name="Position" isopaque="yes">
+ <value>560,217</value>
+ </regnode>
+ </regnode>
+ </regnode>
+ </model>
+ <model id="id-0065-00000003" kind="Model" role="Model" guid="{b243eba2-36c7-46c9-9242-d90bf4c50966}" relid="0x2" childrelidcntr="0x0">
+ <name>Child2</name>
+ <regnode name="PartRegs" status="undefined">
+ <value></value>
+ <regnode name="Aspect" status="undefined">
+ <value></value>
+ <regnode name="Position" isopaque="yes">
+ <value>812,210</value>
+ </regnode>
+ </regnode>
+ </regnode>
+ </model>
+ <connection id="id-0068-00000001" kind="Connection" role="Connection" guid="{63d8a8a0-8f2b-44cf-8468-aad9ed639405}" relid="0x3">
+ <name>C1_C2</name>
+ <connpoint role="src" target="id-0065-00000002"/>
+ <connpoint role="dst" target="id-0065-00000003"/>
+ </connection>
+ <connection id="id-0068-00000002" kind="Connection" role="Connection" guid="{45a057f0-81d6-4665-b22a-1e7a95dbdbd2}" relid="0x4">
+ <name>C2_C1</name>
+ <connpoint role="dst" target="id-0065-00000002"/>
+ <connpoint role="src" target="id-0065-00000003"/>
+ </connection>
+ </model>
+ </folder>
+</project>
Added: trunk/Tests/GPyUnit/DsmlGeneratorTest/DsmlGeneratorTest.csproj
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/Tests/GPyUnit/DsmlGeneratorTest/DsmlGeneratorTest.csproj Fri Apr 19 12:02:59 2013 (r2178)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{FC2EE6AB-4F38-4E0B-B2B7-54536E43F267}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>DsmlGeneratorTest</RootNamespace>
+ <AssemblyName>DsmlGeneratorTest</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="GME.MGA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f240a760fe751c2e, processorArchitecture=MSIL">
+ <EmbedInteropTypes>True</EmbedInteropTypes>
+ </Reference>
+ <Reference Include="GME.MGA.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f240a760fe751c2e, processorArchitecture=MSIL">
+ <EmbedInteropTypes>True</EmbedInteropTypes>
+ </Reference>
+ <Reference Include="GME.MGA.Meta, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f240a760fe751c2e, processorArchitecture=MSIL">
+ <EmbedInteropTypes>True</EmbedInteropTypes>
+ </Reference>
+ <Reference Include="ISIS.GME.Common, Version=1.0.2.0, Culture=neutral, PublicKeyToken=1321e6b92842fe54, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\SDK\DotNet\DsmlGenerator\ISIS.GME.Common\bin\Release\ISIS.GME.Common.dll</HintPath>
+ </Reference>
+ <Reference Include="ISIS.GME.Dsml.BidirConnection">
+ <HintPath>..\ISIS.GME.Dsml.BidirConnection.dll</HintPath>
+ </Reference>
+ <Reference Include="MgaMeta">
+ <HintPath>..\..\..\SDK\DotNet\DsmlGenerator\MgaMeta\bin\Release\MgaMeta.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: trunk/Tests/GPyUnit/DsmlGeneratorTest/Program.cs
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/Tests/GPyUnit/DsmlGeneratorTest/Program.cs Fri Apr 19 12:02:59 2013 (r2178)
@@ -0,0 +1,62 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using GME.MGA;
+using System.Linq;
+using ISIS.GME.Dsml.BidirConnection.Interfaces;
+
+namespace DsmlGeneratorTest
+{
+ class Program
+ {
+ static void AssertEqual<T>(IEnumerable<T> model, IEnumerable<string> names)
+ where T : ISIS.GME.Common.Interfaces.Base
+ {
+ IEnumerable<string> modelNames = model.Select(m => m.Name).OrderBy(name => name);
+ if (Enumerable.SequenceEqual(
+ modelNames,
+ names) == false)
+ {
+ throw new Exception(String.Format("Expected {1}. Got {0}", String.Join(" ", modelNames.ToArray()), String.Join(" ", names.ToArray())));
+ }
+ }
+
+ static int Main(string[] args)
+ {
+ try
+ {
+ MgaProject project = new MgaProject();
+ bool ro_mode;
+ project.Open(args[0], out ro_mode);
+ project.BeginTransactionInNewTerr();
+ try
+ {
+ RootFolder rf = ISIS.GME.Dsml.BidirConnection.Classes.RootFolder.GetRootFolder(project);
+ var children = rf.Children.ModelCollection.GetEnumerator();
+ children.MoveNext();
+ Model model = children.Current;
+ AssertEqual(model.Children.ModelCollection, new string[] { "Child1", "Child2" });
+ foreach (Model child in model.Children.ModelCollection)
+ {
+ var conns = new string[] { "C1_C2", "C2_C1" };
+ AssertEqual(child.SrcConnections.ConnectionCollection, conns);
+ AssertEqual(child.DstConnections.ConnectionCollection, conns);
+ AssertEqual(child.AllDstConnections, conns);
+ AssertEqual(child.AllSrcConnections, conns);
+ }
+ }
+ finally
+ {
+ project.AbortTransaction();
+ project.Close();
+ }
+ }
+ catch (Exception e)
+ {
+ Console.Error.WriteLine(e.ToString());
+ return 11;
+ }
+ return 0;
+ }
+ }
+}
Copied and modified: trunk/Tests/GPyUnit/DsmlGeneratorTest/Properties/AssemblyInfo.cs (from r2177, trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Properties/AssemblyInfo.cs)
==============================================================================
--- trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Properties/AssemblyInfo.cs Fri Apr 19 12:01:51 2013 (r2177, copy source)
+++ trunk/Tests/GPyUnit/DsmlGeneratorTest/Properties/AssemblyInfo.cs Fri Apr 19 12:02:59 2013 (r2178)
@@ -5,12 +5,12 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("CSharpDSMLGenerator")]
+[assembly: AssemblyTitle("DsmlGeneratorTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("ISIS, Vanderbilt University")]
-[assembly: AssemblyProduct("CSharpDSMLGenerator")]
-[assembly: AssemblyCopyright("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("DsmlGeneratorTest")]
+[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -20,7 +20,7 @@
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("0ef63ebb-4e0e-4f0e-8274-6c12ba7dfd15")]
+[assembly: Guid("61131367-b3e9-4f90-a289-dd73e4db2dd4")]
// Version information for an assembly consists of the following four values:
//
@@ -32,7 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-// Keep in sync with app.manifest and GME_SDK.wxs
-[assembly: AssemblyVersion("1.0.6.0")]
-[assembly: AssemblyFileVersion("1.0.6.0")]
-// also change GME_SDK.wxs
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Modified: trunk/Tests/GPyUnit/__init__.py
==============================================================================
--- trunk/Tests/GPyUnit/__init__.py Fri Apr 19 12:01:51 2013 (r2177)
+++ trunk/Tests/GPyUnit/__init__.py Fri Apr 19 12:02:59 2013 (r2178)
@@ -34,6 +34,7 @@
'test_MetaInterpreter',
'Regr.Mga.tc1',
'test_decorators',
+ 'test_DsmlGenerator',
]
if platform.system() != 'Java':
_test_names += [
Added: trunk/Tests/GPyUnit/test_DsmlGenerator.py
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/Tests/GPyUnit/test_DsmlGenerator.py Fri Apr 19 12:02:59 2013 (r2178)
@@ -0,0 +1,65 @@
+import unittest
+import os
+import os.path
+import GPyUnit.util
+from GPyUnit.util import DispatchEx
+
+_filedir = os.path.dirname(os.path.abspath(__file__))
+def _adjacent_file(file):
+ return os.path.join(_filedir, file)
+
+class TestCSharpDSMLGenerator(unittest.TestCase):
+ 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([r"c:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe", _adjacent_file(r"DsmlGeneratorTest\DsmlGeneratorTest.csproj")])
+ subprocess.check_call([_adjacent_file(r"DsmlGeneratorTest\bin\Debug\DsmlGeneratorTest.exe"), self.connstr])
+
+
+ def setUp(self):
+ registrar = DispatchEx("Mga.MgaRegistrar")
+ registrar.RegisterParadigmFromData("XML=" + _adjacent_file("BidirConnection.xmp"), "BidirConnection", 1)
+
+ def tearDown(self):
+ for file in ("AssemblySignature.snk", "ISIS.GME.Dsml.BidirConnection.Classes.cs", "ISIS.GME.Dsml.BidirConnection.dll",
+ "ISIS.GME.Dsml.BidirConnection.Interfaces.cs", "ISIS.GME.Dsml.BidirConnection.xml", "ISIS.GME.Dsml.pdb", "BidirConnection.xmp.log",
+ "BidirConnection.mta", r"DsmlGeneratorTest\bin\Debug\DsmlGeneratorTest.exe"):
+ if os.path.isfile(os.path.join(self.outdir(), file)):
+ os.unlink(os.path.join(self.outdir(), file))
+
+ @property
+ def connstr(self):
+ return "MGA=" + _adjacent_file("BidirConnectionModel.mga")
+
+ def outdir(self):
+ return os.path.abspath(_adjacent_file('.'))
+
+if GPyUnit.util._opts.Dispatch_x64:
+ del TestCSharpDSMLGenerator
+ #FIXME: TestCSharpDSMLGenerator on x64 make PGO fail
+
+if __name__ == "__main__":
+ unittest.main()
More information about the gme-commit
mailing list