Bug 484247: [test] Mutual References test model compilation failure

* Updated test model

Change-Id: Idf9e0bfe81bc7718822d9c9f13116a2e3d983498
Signed-off-by: Ernesto Posse <eposse@gmail.com>
diff --git a/models/other/codepattern/general/MutualReferences/MutualReferences.di b/models/other/codepattern/general/MutualReferences/MutualReferences.di
deleted file mode 100644
index bf9abab..0000000
--- a/models/other/codepattern/general/MutualReferences/MutualReferences.di
+++ /dev/null
@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/models/other/codepattern/general/MutualReferences/.project b/models/tests/codepattern/general/MutualReferences/.project
similarity index 100%
rename from models/other/codepattern/general/MutualReferences/.project
rename to models/tests/codepattern/general/MutualReferences/.project
diff --git a/models/tests/codepattern/general/MutualReferences/MutualReferences.di b/models/tests/codepattern/general/MutualReferences/MutualReferences.di
new file mode 100644
index 0000000..47e812d
--- /dev/null
+++ b/models/tests/codepattern/general/MutualReferences/MutualReferences.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<architecture:ArchitectureDescription xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:architecture="http://www.eclipse.org/papyrus/infra/core/architecture" contextId="org.eclipse.papyrusrt.umlrt.architecture"/>
diff --git a/models/other/codepattern/general/MutualReferences/MutualReferences.notation b/models/tests/codepattern/general/MutualReferences/MutualReferences.notation
similarity index 83%
rename from models/other/codepattern/general/MutualReferences/MutualReferences.notation
rename to models/tests/codepattern/general/MutualReferences/MutualReferences.notation
index c6f5077..f7954b3 100644
--- a/models/other/codepattern/general/MutualReferences/MutualReferences.notation
+++ b/models/tests/codepattern/general/MutualReferences/MutualReferences.notation
@@ -1,17 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML">
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML">
   <notation:Diagram xmi:id="_ZPi3UDSOEeW3Wtd_ydJ-cQ" type="PapyrusUMLClassDiagram" name="Class Diagram" measurementUnit="Pixel">
-    <children xmi:type="notation:Shape" xmi:id="_bp-SYDSOEeW3Wtd_ydJ-cQ" type="2008">
-      <children xmi:type="notation:DecorationNode" xmi:id="_bp-5cDSOEeW3Wtd_ydJ-cQ" type="5029"/>
-      <children xmi:type="notation:DecorationNode" xmi:id="_bp-5cTSOEeW3Wtd_ydJ-cQ" type="8510">
+    <children xmi:type="notation:Shape" xmi:id="_bp-SYDSOEeW3Wtd_ydJ-cQ" type="Class_Shape">
+      <children xmi:type="notation:DecorationNode" xmi:id="_bp-5cDSOEeW3Wtd_ydJ-cQ" type="Class_NameLabel"/>
+      <children xmi:type="notation:DecorationNode" xmi:id="_bp-5cTSOEeW3Wtd_ydJ-cQ" type="Class_FloatingNameLabel">
         <layoutConstraint xmi:type="notation:Location" xmi:id="_bp-5cjSOEeW3Wtd_ydJ-cQ" y="5"/>
       </children>
-      <children xmi:type="notation:BasicCompartment" xmi:id="_bp-5czSOEeW3Wtd_ydJ-cQ" type="7017">
-        <children xmi:type="notation:Shape" xmi:id="_etwMcDSOEeW3Wtd_ydJ-cQ" type="3012">
+      <children xmi:type="notation:BasicCompartment" xmi:id="_bp-5czSOEeW3Wtd_ydJ-cQ" type="Class_AttributeCompartment">
+        <children xmi:type="notation:Shape" xmi:id="_etwMcDSOEeW3Wtd_ydJ-cQ" type="Property_ClassAttributeLabel">
           <element xmi:type="uml:Property" href="MutualReferences.uml#_etoQoDSOEeW3Wtd_ydJ-cQ"/>
           <layoutConstraint xmi:type="notation:Location" xmi:id="_etwMcTSOEeW3Wtd_ydJ-cQ"/>
         </children>
-        <children xmi:type="notation:Shape" xmi:id="_iLXi0DSOEeW3Wtd_ydJ-cQ" type="3012">
+        <children xmi:type="notation:Shape" xmi:id="_iLXi0DSOEeW3Wtd_ydJ-cQ" type="Property_ClassAttributeLabel">
           <element xmi:type="uml:Property" href="MutualReferences.uml#_iLO_8DSOEeW3Wtd_ydJ-cQ"/>
           <layoutConstraint xmi:type="notation:Location" xmi:id="_iLXi0TSOEeW3Wtd_ydJ-cQ"/>
         </children>
@@ -20,13 +20,13 @@
         <styles xmi:type="notation:FilteringStyle" xmi:id="_bp-5djSOEeW3Wtd_ydJ-cQ"/>
         <layoutConstraint xmi:type="notation:Bounds" xmi:id="_bp-5dzSOEeW3Wtd_ydJ-cQ"/>
       </children>
-      <children xmi:type="notation:BasicCompartment" xmi:id="_bp-5eDSOEeW3Wtd_ydJ-cQ" type="7018">
+      <children xmi:type="notation:BasicCompartment" xmi:id="_bp-5eDSOEeW3Wtd_ydJ-cQ" type="Class_OperationCompartment">
         <styles xmi:type="notation:TitleStyle" xmi:id="_bp-5eTSOEeW3Wtd_ydJ-cQ"/>
         <styles xmi:type="notation:SortingStyle" xmi:id="_bp-5ejSOEeW3Wtd_ydJ-cQ"/>
         <styles xmi:type="notation:FilteringStyle" xmi:id="_bp-5ezSOEeW3Wtd_ydJ-cQ"/>
         <layoutConstraint xmi:type="notation:Bounds" xmi:id="_bp-5fDSOEeW3Wtd_ydJ-cQ"/>
       </children>
-      <children xmi:type="notation:BasicCompartment" xmi:id="_bp-5fTSOEeW3Wtd_ydJ-cQ" type="7019">
+      <children xmi:type="notation:BasicCompartment" xmi:id="_bp-5fTSOEeW3Wtd_ydJ-cQ" type="Class_NestedClassifierCompartment">
         <styles xmi:type="notation:TitleStyle" xmi:id="_bp-5fjSOEeW3Wtd_ydJ-cQ"/>
         <styles xmi:type="notation:SortingStyle" xmi:id="_bp-5fzSOEeW3Wtd_ydJ-cQ"/>
         <styles xmi:type="notation:FilteringStyle" xmi:id="_bp-5gDSOEeW3Wtd_ydJ-cQ"/>
@@ -35,17 +35,17 @@
       <element xmi:type="uml:Class" href="MutualReferences.uml#_bntokDSOEeW3Wtd_ydJ-cQ"/>
       <layoutConstraint xmi:type="notation:Bounds" xmi:id="_bp-SYTSOEeW3Wtd_ydJ-cQ" x="143" y="138"/>
     </children>
-    <children xmi:type="notation:Shape" xmi:id="_dI8x0DSOEeW3Wtd_ydJ-cQ" type="2008">
-      <children xmi:type="notation:DecorationNode" xmi:id="_dI8x0jSOEeW3Wtd_ydJ-cQ" type="5029"/>
-      <children xmi:type="notation:DecorationNode" xmi:id="_dI8x0zSOEeW3Wtd_ydJ-cQ" type="8510">
+    <children xmi:type="notation:Shape" xmi:id="_dI8x0DSOEeW3Wtd_ydJ-cQ" type="Class_Shape">
+      <children xmi:type="notation:DecorationNode" xmi:id="_dI8x0jSOEeW3Wtd_ydJ-cQ" type="Class_NameLabel"/>
+      <children xmi:type="notation:DecorationNode" xmi:id="_dI8x0zSOEeW3Wtd_ydJ-cQ" type="Class_FloatingNameLabel">
         <layoutConstraint xmi:type="notation:Location" xmi:id="_dI8x1DSOEeW3Wtd_ydJ-cQ" y="5"/>
       </children>
-      <children xmi:type="notation:BasicCompartment" xmi:id="_dI8x1TSOEeW3Wtd_ydJ-cQ" type="7017">
-        <children xmi:type="notation:Shape" xmi:id="_k76-4DSOEeW3Wtd_ydJ-cQ" type="3012">
+      <children xmi:type="notation:BasicCompartment" xmi:id="_dI8x1TSOEeW3Wtd_ydJ-cQ" type="Class_AttributeCompartment">
+        <children xmi:type="notation:Shape" xmi:id="_k76-4DSOEeW3Wtd_ydJ-cQ" type="Property_ClassAttributeLabel">
           <element xmi:type="uml:Property" href="MutualReferences.uml#_k7zqIDSOEeW3Wtd_ydJ-cQ"/>
           <layoutConstraint xmi:type="notation:Location" xmi:id="_k76-4TSOEeW3Wtd_ydJ-cQ"/>
         </children>
-        <children xmi:type="notation:Shape" xmi:id="_maiR8DSOEeW3Wtd_ydJ-cQ" type="3012">
+        <children xmi:type="notation:Shape" xmi:id="_maiR8DSOEeW3Wtd_ydJ-cQ" type="Property_ClassAttributeLabel">
           <element xmi:type="uml:Property" href="MutualReferences.uml#_macLUDSOEeW3Wtd_ydJ-cQ"/>
           <layoutConstraint xmi:type="notation:Location" xmi:id="_maiR8TSOEeW3Wtd_ydJ-cQ"/>
         </children>
@@ -54,13 +54,13 @@
         <styles xmi:type="notation:FilteringStyle" xmi:id="_dI8x2DSOEeW3Wtd_ydJ-cQ"/>
         <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dI8x2TSOEeW3Wtd_ydJ-cQ"/>
       </children>
-      <children xmi:type="notation:BasicCompartment" xmi:id="_dI8x2jSOEeW3Wtd_ydJ-cQ" type="7018">
+      <children xmi:type="notation:BasicCompartment" xmi:id="_dI8x2jSOEeW3Wtd_ydJ-cQ" type="Class_OperationCompartment">
         <styles xmi:type="notation:TitleStyle" xmi:id="_dI8x2zSOEeW3Wtd_ydJ-cQ"/>
         <styles xmi:type="notation:SortingStyle" xmi:id="_dI8x3DSOEeW3Wtd_ydJ-cQ"/>
         <styles xmi:type="notation:FilteringStyle" xmi:id="_dI8x3TSOEeW3Wtd_ydJ-cQ"/>
         <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dI8x3jSOEeW3Wtd_ydJ-cQ"/>
       </children>
-      <children xmi:type="notation:BasicCompartment" xmi:id="_dI8x3zSOEeW3Wtd_ydJ-cQ" type="7019">
+      <children xmi:type="notation:BasicCompartment" xmi:id="_dI8x3zSOEeW3Wtd_ydJ-cQ" type="Class_NestedClassifierCompartment">
         <styles xmi:type="notation:TitleStyle" xmi:id="_dI8x4DSOEeW3Wtd_ydJ-cQ"/>
         <styles xmi:type="notation:SortingStyle" xmi:id="_dI8x4TSOEeW3Wtd_ydJ-cQ"/>
         <styles xmi:type="notation:FilteringStyle" xmi:id="_dI8x4jSOEeW3Wtd_ydJ-cQ"/>
@@ -69,9 +69,9 @@
       <element xmi:type="uml:Class" href="MutualReferences.uml#_dI6VkDSOEeW3Wtd_ydJ-cQ"/>
       <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dI8x0TSOEeW3Wtd_ydJ-cQ" x="392" y="136"/>
     </children>
-    <styles xmi:type="notation:StringValueStyle" xmi:id="_ZPi3UTSOEeW3Wtd_ydJ-cQ" name="diagram_compatibility_version" stringValue="1.1.0"/>
+    <styles xmi:type="notation:StringValueStyle" xmi:id="_ZPi3UTSOEeW3Wtd_ydJ-cQ" name="diagram_compatibility_version" stringValue="1.3.0"/>
     <styles xmi:type="notation:DiagramStyle" xmi:id="_ZPi3UjSOEeW3Wtd_ydJ-cQ"/>
-    <styles xmi:type="style:PapyrusViewStyle" xmi:id="_ZPi3UzSOEeW3Wtd_ydJ-cQ">
+    <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_o-iIYF0DEeeJDoHWZt2tkw" diagramKindId="org.eclipse.papyrus.uml.diagram.class">
       <owner xmi:type="uml:Model" href="MutualReferences.uml#_ZKeKEDSOEeW3Wtd_ydJ-cQ"/>
     </styles>
     <element xmi:type="uml:Model" href="MutualReferences.uml#_ZKeKEDSOEeW3Wtd_ydJ-cQ"/>
@@ -91,9 +91,8 @@
     </children>
     <styles xmi:type="notation:StringValueStyle" xmi:id="_zDoUEaA0EeWSY7VdA529Xw" name="diagram_compatibility_version" stringValue="1.1.0"/>
     <styles xmi:type="notation:DiagramStyle" xmi:id="_zDoUEqA0EeWSY7VdA529Xw"/>
-    <styles xmi:type="style:PapyrusViewStyle" xmi:id="_zDoUE6A0EeWSY7VdA529Xw">
+    <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_j_rBsF0DEeeJDoHWZt2tkw" diagramKindId="org.eclipse.papyrusrt.umlrt.tooling.diagram.common.UMLRTCapsuleStructure">
       <owner xmi:type="uml:Class" href="MutualReferences.uml#_zCXIwKA0EeWSY7VdA529Xw"/>
-      <configuration xmi:type="configuration:PapyrusDiagram" href="platform:/plugin/org.eclipse.papyrusrt.umlrt.tooling.diagram.common/configuration/UMLRT.configuration#_Z79eQHcZEeSnWeKqQOfW2A"/>
     </styles>
     <element xmi:type="uml:Class" href="MutualReferences.uml#_zCXIwKA0EeWSY7VdA529Xw"/>
   </notation:Diagram>
diff --git a/models/other/codepattern/general/MutualReferences/MutualReferences.uml b/models/tests/codepattern/general/MutualReferences/MutualReferences.uml
similarity index 61%
rename from models/other/codepattern/general/MutualReferences/MutualReferences.uml
rename to models/tests/codepattern/general/MutualReferences/MutualReferences.uml
index 7dd9dd2..887ddc6 100644
--- a/models/other/codepattern/general/MutualReferences/MutualReferences.uml
+++ b/models/tests/codepattern/general/MutualReferences/MutualReferences.uml
@@ -1,6 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:UMLRealTime="http://www.eclipse.org/papyrus/umlrt" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML">
-  <uml:Model xmi:id="_ZKeKEDSOEeW3Wtd_ydJ-cQ" name="RootElement">
+<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:RTCppProperties="http://www.eclipse.org/papyrus/umlrt/cppproperties" xmlns:UMLRealTime="http://www.eclipse.org/papyrus/umlrt" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML">
+  <uml:Model xmi:id="_ZKeKEDSOEeW3Wtd_ydJ-cQ" name="MutualReferences">
+    <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_cQbooF0EEeeJDoHWZt2tkw" source="http://www.eclipse.org/papyrus-rt/language/1.0.0">
+      <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_cQdd0F0EEeeJDoHWZt2tkw" key="language" value="umlrt-cpp"/>
+    </eAnnotations>
     <packageImport xmi:type="uml:PackageImport" xmi:id="_ZP-VIDSOEeW3Wtd_ydJ-cQ">
       <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
     </packageImport>
@@ -23,6 +26,13 @@
       </eAnnotations>
       <appliedProfile xmi:type="uml:Profile" href="pathmap://UML_RT_PROFILE/uml-rt.profile.uml#_1h74oEeVEeO0lv5O1DTHOQ"/>
     </profileApplication>
+    <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_cQhIMF0EEeeJDoHWZt2tkw">
+      <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_cQlZoF0EEeeJDoHWZt2tkw" source="http://www.eclipse.org/uml2/2.0.0/UML">
+        <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/umlrt/cppproperties#/"/>
+      </eAnnotations>
+      <appliedProfile xmi:type="uml:Profile" href="pathmap://UMLRT_CPP/RTCppProperties.profile.uml#_vl5LALs8EeSTjNEQkASznQ"/>
+    </profileApplication>
   </uml:Model>
   <UMLRealTime:Capsule xmi:id="_zEGOIKA0EeWSY7VdA529Xw" base_Class="_zCXIwKA0EeWSY7VdA529Xw"/>
+  <RTCppProperties:AttributeProperties xmi:id="_QI8c8F0FEeeJDoHWZt2tkw" pointsToConstType="true" base_Property="_macLUDSOEeW3Wtd_ydJ-cQ"/>
 </xmi:XMI>
diff --git a/models/other/codepattern/general/MutualReferences/READ_ME.txt b/models/tests/codepattern/general/MutualReferences/READ_ME.txt
similarity index 100%
rename from models/other/codepattern/general/MutualReferences/READ_ME.txt
rename to models/tests/codepattern/general/MutualReferences/READ_ME.txt
diff --git a/models/tests/codepattern/general/MutualReferences/expected_src/CMakeLists.txt b/models/tests/codepattern/general/MutualReferences/expected_src/CMakeLists.txt
new file mode 100644
index 0000000..dc820ba
--- /dev/null
+++ b/models/tests/codepattern/general/MutualReferences/expected_src/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Generated 2017-06-29 15:58:11
+
+cmake_minimum_required(VERSION 2.8.7)
+set(TARGET TopMain)
+project(${TARGET})
+
+# require location of supporting RTS
+if (NOT UMLRTS_ROOT)
+  if (DEFINED ENV{UMLRTS_ROOT})
+    set(UMLRTS_ROOT $ENV{UMLRTS_ROOT})
+  else ()
+    set(UMLRTS_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/umlrt.rts)
+  endif ()
+endif ()
+
+# setup primary envars - provides tooling config
+include(${UMLRTS_ROOT}/build/buildenv.cmake)
+
+# model sources
+set(SRCS TopMain.cc Class1.cc Class2.cc Top.cc TopControllers.cc )
+
+# specify target
+add_executable(${TARGET} ${SRCS})
+
+# setup lib dependency support after defining TARGET
+include(${UMLRTS_ROOT}/build/rtslib.cmake)
+
+# compiler parameters
+set_target_properties(${TARGET} PROPERTIES COMPILE_OPTIONS "${COPTS}")
+set_target_properties(${TARGET} PROPERTIES COMPILE_DEFINITIONS "${CDEFS}")
+include_directories(${INCS})
+
+# linker parameters
+set_target_properties(${TARGET} PROPERTIES CMAKE_EXE_LINKER_FLAGS "${LOPTS}")
+target_link_libraries(${TARGET} ${LIBS})
+
diff --git a/models/tests/codepattern/general/MutualReferences/expected_src/Class1.cc b/models/tests/codepattern/general/MutualReferences/expected_src/Class1.cc
new file mode 100644
index 0000000..4836812
--- /dev/null
+++ b/models/tests/codepattern/general/MutualReferences/expected_src/Class1.cc
@@ -0,0 +1,47 @@
+
+#include "Class1.hh"
+
+#include "umlrtobjectclass.hh"
+#include "umlrtobjectclassgeneric.hh"
+#include <cstddef>
+
+const UMLRTObject_field Class1::fields[] = 
+{
+    {
+        "Attribute1",
+        &UMLRTType_bool,
+        offsetof( Class1, Attribute1 ),
+        1,
+        0
+    },
+    {
+        "Attribute2",
+        &UMLRTType_Class2,
+        offsetof( Class1, Attribute2 ),
+        1,
+        0
+    }
+};
+
+
+
+
+const UMLRTObject_class UMLRTType_Class1 = 
+{
+    UMLRTObjectInitialize<Class1>,
+    UMLRTObjectCopy<Class1>,
+    UMLRTObject_decode,
+    UMLRTObject_encode,
+    UMLRTObjectDestroy<Class1>,
+    UMLRTObject_fprintf,
+    "Class1",
+    NULL,
+    {
+        sizeof( Class1 ),
+        2,
+        Class1::fields
+    },
+    UMLRTOBJECTCLASS_DEFAULT_VERSION,
+    UMLRTOBJECTCLASS_DEFAULT_BACKWARDS
+};
+
diff --git a/models/tests/codepattern/general/MutualReferences/expected_src/Class1.hh b/models/tests/codepattern/general/MutualReferences/expected_src/Class1.hh
new file mode 100644
index 0000000..94c43f0
--- /dev/null
+++ b/models/tests/codepattern/general/MutualReferences/expected_src/Class1.hh
@@ -0,0 +1,18 @@
+
+#ifndef CLASS1_HH
+#define CLASS1_HH
+
+#include "Class2.hh"
+#include "umlrtobjectclass.hh"
+
+class Class1
+{
+public:
+    bool Attribute1;
+    Class2 Attribute2;
+    static const UMLRTObject_field fields[];
+};
+extern const UMLRTObject_class UMLRTType_Class1;
+
+#endif
+
diff --git a/models/tests/codepattern/general/MutualReferences/expected_src/Class2.cc b/models/tests/codepattern/general/MutualReferences/expected_src/Class2.cc
new file mode 100644
index 0000000..9ffe084
--- /dev/null
+++ b/models/tests/codepattern/general/MutualReferences/expected_src/Class2.cc
@@ -0,0 +1,47 @@
+
+#include "Class2.hh"
+
+#include "umlrtobjectclass.hh"
+#include "umlrtobjectclassgeneric.hh"
+#include <cstddef>
+
+const UMLRTObject_field Class2::fields[] = 
+{
+    {
+        "Attribute1",
+        &UMLRTType_int,
+        offsetof( Class2, Attribute1 ),
+        1,
+        0
+    },
+    {
+        "Attribute2",
+        &UMLRTType_ptr,
+        offsetof( Class2, Attribute2 ),
+        1,
+        0
+    }
+};
+
+
+
+
+const UMLRTObject_class UMLRTType_Class2 = 
+{
+    UMLRTObjectInitialize<Class2>,
+    UMLRTObjectCopy<Class2>,
+    UMLRTObject_decode,
+    UMLRTObject_encode,
+    UMLRTObjectDestroy<Class2>,
+    UMLRTObject_fprintf,
+    "Class2",
+    NULL,
+    {
+        sizeof( Class2 ),
+        2,
+        Class2::fields
+    },
+    UMLRTOBJECTCLASS_DEFAULT_VERSION,
+    UMLRTOBJECTCLASS_DEFAULT_BACKWARDS
+};
+
diff --git a/models/tests/codepattern/general/MutualReferences/expected_src/Class2.hh b/models/tests/codepattern/general/MutualReferences/expected_src/Class2.hh
new file mode 100644
index 0000000..a9d0aef
--- /dev/null
+++ b/models/tests/codepattern/general/MutualReferences/expected_src/Class2.hh
@@ -0,0 +1,18 @@
+
+#ifndef CLASS2_HH
+#define CLASS2_HH
+
+#include "umlrtobjectclass.hh"
+class Class1;
+
+class Class2
+{
+public:
+    int Attribute1;
+    const Class1 * Attribute2;
+    static const UMLRTObject_field fields[];
+};
+extern const UMLRTObject_class UMLRTType_Class2;
+
+#endif
+
diff --git a/models/tests/codepattern/general/MutualReferences/expected_src/Makefile b/models/tests/codepattern/general/MutualReferences/expected_src/Makefile
new file mode 100644
index 0000000..0bcbd22
--- /dev/null
+++ b/models/tests/codepattern/general/MutualReferences/expected_src/Makefile
@@ -0,0 +1,11 @@
+##################################################
+# Default makefile
+# Redirect make to target makefile
+##################################################
+
+all:
+	make -f MakefileTop.mk all
+clean:
+	make -f MakefileTop.mk clean
+.PHONY: 
+	make -f MakefileTop.mk all clean
diff --git a/models/tests/codepattern/general/MutualReferences/expected_src/MakefileTop.mk b/models/tests/codepattern/general/MutualReferences/expected_src/MakefileTop.mk
new file mode 100644
index 0000000..d9eea3c
--- /dev/null
+++ b/models/tests/codepattern/general/MutualReferences/expected_src/MakefileTop.mk
@@ -0,0 +1,49 @@
+# set default value for TARGETOS if is it not defined
+ifeq ($(TARGETOS), )
+$(warning warning: TARGETOS not defined. Choosing linux)
+TARGETOS=linux
+endif
+
+# set default value for BUILDTOOLS if is it not defined
+ifeq ($(BUILDTOOLS), )
+$(warning warning: BUILDTOOLS not defined. Choosing x86-gcc-4.6.3)
+BUILDTOOLS=x86-gcc-4.6.3
+endif
+
+# Location of RTS root.
+UMLRTS_ROOT ?= ./umlrt.rts
+
+CONFIG=$(TARGETOS).$(BUILDTOOLS)
+
+# Destination directory for the RTS services library.
+LIBDEST=$(UMLRTS_ROOT)/lib/$(CONFIG)
+
+include $(UMLRTS_ROOT)/build/host/host.mk
+include $(UMLRTS_ROOT)/build/buildtools/$(BUILDTOOLS)/buildtools.mk
+
+LD_PATHS=$(LIBDEST)
+CC_INCLUDES+=$(UMLRTS_ROOT)/include
+
+CC_DEFINES:=$(foreach d, $(CC_DEFINES), $(CC_DEF)$d)
+CC_INCLUDES:=$(foreach i, $(CC_INCLUDES), $(CC_INC)$i)
+LD_LIBS:=$(foreach i, $(LD_LIBS), $(LD_LIB)$i)
+LD_PATHS:=$(foreach i, $(LD_PATHS), $(LD_LIBPATH)$i)
+
+SRCS = TopMain.cc Class1.cc Class2.cc Top.cc TopControllers.cc 
+OBJS = $(subst $(CC_EXT),$(OBJ_EXT),$(SRCS))
+
+MAIN = TopMain$(EXE_EXT)
+
+all: $(MAIN)
+
+$(MAIN): $(OBJS) $(UMLRTS_ROOT)/lib/$(CONFIG)/$(LIB_PRFX)rts$(LIB_EXT)
+	$(LD) $(LD_FLAGS) $(OBJS) $(LD_PATHS) $(LD_LIBS) $(LD_OUT)$@
+
+%$(OBJ_EXT) : %$(CC_EXT)
+	$(CC) $< $(CC_FLAGS) $(CC_DEFINES) $(CC_INCLUDES) $(CC_OUT)$@
+
+clean :
+	@echo $(RM) main$(EXE_EXT) *$(OBJ_EXT) *$(DEP_EXT) $(DBG_FILES)
+	@$(RM) main$(EXE_EXT) *$(OBJ_EXT) *$(DEP_EXT) $(DBG_FILES)
+
+.PHONY: all clean
diff --git a/models/tests/codepattern/general/MutualReferences/expected_src/Top-connections.log b/models/tests/codepattern/general/MutualReferences/expected_src/Top-connections.log
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/models/tests/codepattern/general/MutualReferences/expected_src/Top-connections.log
diff --git a/models/tests/codepattern/general/MutualReferences/expected_src/Top.cc b/models/tests/codepattern/general/MutualReferences/expected_src/Top.cc
new file mode 100644
index 0000000..cee38bc
--- /dev/null
+++ b/models/tests/codepattern/general/MutualReferences/expected_src/Top.cc
@@ -0,0 +1,50 @@
+
+#include "Top.hh"
+
+#include "umlrtslot.hh"
+#include <cstddef>
+#include "umlrtcapsuleclass.hh"
+class UMLRTRtsInterface;
+struct UMLRTCommsPort;
+
+Capsule_Top::Capsule_Top( const UMLRTCapsuleClass * cd, UMLRTSlot * st, const UMLRTCommsPort * * border, const UMLRTCommsPort * * internal, bool isStat )
+: UMLRTCapsule( NULL, cd, st, border, internal, isStat )
+{
+}
+
+
+void Capsule_Top::bindPort( bool isBorder, int portId, int index )
+{
+}
+
+void Capsule_Top::unbindPort( bool isBorder, int portId, int index )
+{
+}
+
+void Capsule_Top::initialize( const UMLRTMessage & msg )
+{
+}
+
+void Capsule_Top::inject( const UMLRTMessage & msg )
+{
+}
+
+
+static void instantiate_Top( const UMLRTRtsInterface * rts, UMLRTSlot * slot, const UMLRTCommsPort * * borderPorts )
+{
+    slot->capsule = new Capsule_Top( &Top, slot, borderPorts, NULL, false );
+}
+
+const UMLRTCapsuleClass Top = 
+{
+    "Top",
+    NULL,
+    instantiate_Top,
+    0,
+    NULL,
+    0,
+    NULL,
+    0,
+    NULL
+};
+
diff --git a/models/tests/codepattern/general/MutualReferences/expected_src/Top.hh b/models/tests/codepattern/general/MutualReferences/expected_src/Top.hh
new file mode 100644
index 0000000..27d0e6a
--- /dev/null
+++ b/models/tests/codepattern/general/MutualReferences/expected_src/Top.hh
@@ -0,0 +1,26 @@
+
+#ifndef TOP_HH
+#define TOP_HH
+
+#include "umlrtcapsule.hh"
+#include "umlrtcapsuleclass.hh"
+#include "umlrtmessage.hh"
+struct UMLRTCommsPort;
+struct UMLRTSlot;
+
+class Capsule_Top : public UMLRTCapsule
+{
+public:
+    Capsule_Top( const UMLRTCapsuleClass * cd, UMLRTSlot * st, const UMLRTCommsPort * * border, const UMLRTCommsPort * * internal, bool isStat );
+    enum PartId
+    {
+    };
+    virtual void bindPort( bool isBorder, int portId, int index );
+    virtual void unbindPort( bool isBorder, int portId, int index );
+    virtual void initialize( const UMLRTMessage & msg );
+    virtual void inject( const UMLRTMessage & msg );
+};
+extern const UMLRTCapsuleClass Top;
+
+#endif
+
diff --git a/models/tests/codepattern/general/MutualReferences/expected_src/TopControllers.cc b/models/tests/codepattern/general/MutualReferences/expected_src/TopControllers.cc
new file mode 100644
index 0000000..856e551
--- /dev/null
+++ b/models/tests/codepattern/general/MutualReferences/expected_src/TopControllers.cc
@@ -0,0 +1,36 @@
+
+#include "TopControllers.hh"
+
+#include "Top.hh"
+#include "umlrtcapsuleclass.hh"
+#include "umlrtcontroller.hh"
+#include "umlrtslot.hh"
+#include <cstddef>
+
+
+static UMLRTController DefaultController_( "DefaultController" );
+
+UMLRTController * DefaultController = &DefaultController_;
+
+static Capsule_Top top( &Top, &Top_slots[InstId_Top], NULL, NULL, true );
+
+UMLRTSlot Top_slots[] = 
+{
+    {
+        "Top",
+        0,
+        &Top,
+        NULL,
+        0,
+        &top,
+        &DefaultController_,
+        0,
+        NULL,
+        0,
+        NULL,
+        NULL,
+        true,
+        false
+    }
+};
+
diff --git a/models/tests/codepattern/general/MutualReferences/expected_src/TopControllers.hh b/models/tests/codepattern/general/MutualReferences/expected_src/TopControllers.hh
new file mode 100644
index 0000000..b060ded
--- /dev/null
+++ b/models/tests/codepattern/general/MutualReferences/expected_src/TopControllers.hh
@@ -0,0 +1,16 @@
+
+#ifndef TOPCONTROLLERS_HH
+#define TOPCONTROLLERS_HH
+
+class UMLRTController;
+struct UMLRTSlot;
+
+enum CapsuleInstanceId
+{
+    InstId_Top
+};
+extern UMLRTController * DefaultController;
+extern UMLRTSlot Top_slots[];
+
+#endif
+
diff --git a/models/tests/codepattern/general/MutualReferences/expected_src/TopMain.cc b/models/tests/codepattern/general/MutualReferences/expected_src/TopMain.cc
new file mode 100644
index 0000000..bf88ec4
--- /dev/null
+++ b/models/tests/codepattern/general/MutualReferences/expected_src/TopMain.cc
@@ -0,0 +1,38 @@
+#include "umlrtmain.hh"
+
+#include "umlrtcontroller.hh"
+#include "TopControllers.hh"
+#include "umlrtcapsuletocontrollermap.hh"
+#include "umlrtmessagepool.hh"
+#include "umlrtsignalelementpool.hh"
+#include "umlrttimerpool.hh"
+#include "umlrtuserconfig.hh"
+#include <stdio.h>
+
+static UMLRTSignalElement signalElementBuffer[USER_CONFIG_SIGNAL_ELEMENT_POOL_SIZE];
+static UMLRTSignalElementPool signalElementPool( signalElementBuffer, USER_CONFIG_SIGNAL_ELEMENT_POOL_SIZE );
+
+static UMLRTMessage messageBuffer[USER_CONFIG_MESSAGE_POOL_SIZE];
+static UMLRTMessagePool messagePool( messageBuffer, USER_CONFIG_MESSAGE_POOL_SIZE );
+
+static UMLRTTimer timers[USER_CONFIG_TIMER_POOL_SIZE];
+static UMLRTTimerPool timerPool( timers, USER_CONFIG_TIMER_POOL_SIZE );
+
+int main( int argc, char * argv[] )
+{
+    UMLRTController::initializePools( &signalElementPool, &messagePool, &timerPool );
+    UMLRTMain::setArgs( argc, argv );
+    UMLRTCapsuleToControllerMap::setDefaultSlotList( Top_slots, 1 );
+
+    if( ! UMLRTMain::targetStartup() )
+        return EXIT_FAILURE;
+
+    DefaultController->spawn();
+
+    if( ! UMLRTMain::mainLoop() )
+        return UMLRTMain::targetShutdown( false );
+
+    DefaultController->join();
+
+    return UMLRTMain::targetShutdown( true );
+}