Index: /trunk/autoquest-plugin-uml-test/pom.xml
===================================================================
--- /trunk/autoquest-plugin-uml-test/pom.xml	(revision 1751)
+++ /trunk/autoquest-plugin-uml-test/pom.xml	(revision 1752)
@@ -18,4 +18,12 @@
         <connection>scm:svn:${autoquest-scm-trunk-dir}/${project.artifactId}</connection>
     </scm>
+    
+    <repositories>
+		<repository>
+			<id>autoquest-thirdparty-repo</id>
+			<url>https://trex.informatik.uni-goettingen.de/nexus/content/repositories/thirdparty</url>
+		</repository>
+	</repositories>
+    
     <properties>
         <tested-artifactId>autoquest-plugin-uml</tested-artifactId>
@@ -33,4 +41,86 @@
             <version>${project.parent.version}</version>
         </dependency>
+        
+        <dependency>
+			<groupId>org.eclipse.emf</groupId>
+			<artifactId>org.eclipse.emf.common</artifactId>
+			<version>2.9.2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.emf</groupId>
+			<artifactId>org.eclipse.emf.ecore</artifactId>
+			<version>2.9.2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.emf</groupId>
+			<artifactId>org.eclipse.emf.ecore.xmi</artifactId>
+			<version>2.9.1</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.emf</groupId>
+			<artifactId>org.eclipse.emf.mapping.ecore2xml</artifactId>
+			<version>2.7.0</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.eclipse.uml2</groupId>
+			<artifactId>org.eclipse.uml2.common</artifactId>
+			<version>1.8.2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.uml2</groupId>
+			<artifactId>org.eclipse.uml2.types</artifactId>
+			<version>1.1.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.uml2</groupId>
+			<artifactId>org.eclipse.uml2.uml</artifactId>
+			<version>4.1.2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.uml2</groupId>
+			<artifactId>org.eclipse.uml2.uml.profile.l2</artifactId>
+			<version>1.1.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.uml2</groupId>
+			<artifactId>org.eclipse.uml2.uml.profile.l3</artifactId>
+			<version>1.1.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.uml2</groupId>
+			<artifactId>org.eclipse.uml2.uml.resources</artifactId>
+			<version>4.1.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.emf</groupId>
+			<artifactId>org.eclipse.emf.validation</artifactId>
+			<version>1.7.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.equinox</groupId>
+			<artifactId>org.eclipse.equinox.common</artifactId>
+			<version>3.6.2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.equinox</groupId>
+			<artifactId>org.eclipse.equinox.registry</artifactId>
+			<version>3.5.3</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.core</groupId>
+			<artifactId>org.eclipse.core.expressions</artifactId>
+			<version>3.4.5</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.osgi</groupId>
+			<artifactId>org.eclipse.osgi</artifactId>
+			<version>3.9.1</version>
+		</dependency>
+        <dependency>
+           <groupId>eu.midas_project</groupId>
+           <artifactId>ConstraintValidator</artifactId>
+           <version>0.2</version>
+        </dependency>
     </dependencies>
 </project>
Index: /trunk/autoquest-plugin-uml-test/src/test/java/de/ugoe/cs/autoquest/plugin/uml/UMLUtilsTest.java
===================================================================
--- /trunk/autoquest-plugin-uml-test/src/test/java/de/ugoe/cs/autoquest/plugin/uml/UMLUtilsTest.java	(revision 1751)
+++ /trunk/autoquest-plugin-uml-test/src/test/java/de/ugoe/cs/autoquest/plugin/uml/UMLUtilsTest.java	(revision 1752)
@@ -27,4 +27,5 @@
 import java.util.Random;
 
+import org.eclipse.core.runtime.IStatus;
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.EPackage;
@@ -55,4 +56,5 @@
 import de.ugoe.cs.autoquest.testgeneration.RandomWalkGenerator;
 import de.ugoe.cs.autoquest.usageprofiles.FirstOrderMarkovModel;
+import eu.midas.dsl.validation.util.ConstraintValidator;
 
 /**
@@ -178,6 +180,20 @@
             UMLUtils.createInteractionFromEventSequence(httpSequence, model, "testSequence");
         }
+
+        ConstraintValidator validator = new ConstraintValidator();
+        IStatus validationStatus = validator.validate(model);
+        if (validationStatus.getSeverity() == IStatus.OK) {
+            System.out.println("success");
+        }
+        else {
+            System.out.println("Errors during the model validation: ");
+            for (IStatus status : validationStatus.getChildren()) {
+                System.out.println("\t" + status.getMessage());
+            }
+        }
+
         writeModelToFile(model, OUTPUT_DIR + "testCreateInteractionFromEventSequence_1_result.uml");
-        loadModelFromInputStream(new FileInputStream(OUTPUT_DIR + "testCreateInteractionFromEventSequence_1_result.uml"));
+        loadModelFromInputStream(new FileInputStream(OUTPUT_DIR +
+            "testCreateInteractionFromEventSequence_1_result.uml"));
     }
 
@@ -225,5 +241,5 @@
                                                        UMLPackage.Literals.INTERACTION, true);
             double usageScore = UMLUtils.calculateUsageScore(interaction, usageProfile);
-            System.out.format("usage score %02d: %.2f \t %d\n",j+1, usageScore, lengths[j]);
+            System.out.format("usage score %02d: %.2f \t %d\n", j + 1, usageScore, lengths[j]);
         }
     }
Index: /trunk/autoquest-plugin-uml-test/src/test/resources/testCreateInteractionFromEventSequence_1_model.uml
===================================================================
--- /trunk/autoquest-plugin-uml-test/src/test/resources/testCreateInteractionFromEventSequence_1_model.uml	(revision 1751)
+++ /trunk/autoquest-plugin-uml-test/src/test/resources/testCreateInteractionFromEventSequence_1_model.uml	(revision 1752)
@@ -1,47 +1,87 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<uml:Model xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_O3qgoAaaEeS7deEA7EQ5bQ" name="Model">
-  <packageImport xmi:type="uml:PackageImport" xmi:id="_O3qgoQaaEeS7deEA7EQ5bQ">
+<uml:Model xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_I6KgoCRYEeS7ONCnthfEow" name="Model">
+  <packageImport xmi:type="uml:PackageImport" xmi:id="_I6KgoSRYEeS7ONCnthfEow">
     <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
   </packageImport>
-  <packagedElement xmi:type="uml:Class" xmi:id="_Wh3rMBZcEeSVxMc4KdphRg" name="ixsmq">
-    <ownedOperation xmi:type="uml:Operation" xmi:id="_noyI0BZcEeSVxMc4KdphRg" name="removeIdentity"/>
-    <ownedOperation xmi:type="uml:Operation" xmi:id="_ueUdQBZcEeSVxMc4KdphRg" name="registerEntityWithIdentity"/>
-    <ownedOperation xmi:type="uml:Operation" xmi:id="_wa1NQBZcEeSVxMc4KdphRg" name="createIdentityFromEntity"/>
-    <ownedOperation xmi:type="uml:Operation" xmi:id="_xt2UUBZcEeSVxMc4KdphRg" name="updateEntityTraitValues"/>
-    <ownedOperation xmi:type="uml:Operation" xmi:id="_zPftQBZcEeSVxMc4KdphRg" name="getEntityTraitValues"/>
-    <ownedOperation xmi:type="uml:Operation" xmi:id="_2z7dUBZcEeSVxMc4KdphRg" name="findEntitiesByTraits"/>
-    <ownedOperation xmi:type="uml:Operation" xmi:id="_4U0BQBZcEeSVxMc4KdphRg" name="listLinkedEntities"/>
-    <ownedOperation xmi:type="uml:Operation" xmi:id="_6TAMQBZcEeSVxMc4KdphRg" name="listUnlinkedEntities"/>
+  <packagedElement xmi:type="uml:Interface" xmi:id="_OdlF4CRYEeS7ONCnthfEow" name="rlus">
+    <ownedOperation xmi:type="uml:Operation" xmi:id="_Wp5AACRYEeS7ONCnthfEow" name="get"/>
+    <ownedOperation xmi:type="uml:Operation" xmi:id="_Xo0tcCRYEeS7ONCnthfEow" name="put"/>
+    <ownedOperation xmi:type="uml:Operation" xmi:id="_YPSQgCRYEeS7ONCnthfEow" name="list"/>
+    <ownedOperation xmi:type="uml:Operation" xmi:id="_eNhJgCRYEeS7ONCnthfEow" name="discard"/>
+    <ownedOperation xmi:type="uml:Operation" xmi:id="_f7d5ECRYEeS7ONCnthfEow" name="locate"/>
+    <ownedOperation xmi:type="uml:Operation" xmi:id="_gwVEgCRYEeS7ONCnthfEow" name="initialize"/>
+    <ownedOperation xmi:type="uml:Operation" xmi:id="_3Xe3kCRYEeS7ONCnthfEow" name="describe"/>
   </packagedElement>
-  <packagedElement xmi:type="uml:Class" xmi:id="_9LnYIBZcEeSVxMc4KdphRg" name="rlus">
-    <ownedOperation xmi:type="uml:Operation" xmi:id="_m-fZMBZdEeSVxMc4KdphRg" name="get"/>
-    <ownedOperation xmi:type="uml:Operation" xmi:id="_nonUQBZdEeSVxMc4KdphRg" name="list"/>
-    <ownedOperation xmi:type="uml:Operation" xmi:id="_obRgQBZdEeSVxMc4KdphRg" name="put"/>
-    <ownedOperation xmi:type="uml:Operation" xmi:id="_ppx6wBZdEeSVxMc4KdphRg" name="discard"/>
-    <ownedOperation xmi:type="uml:Operation" xmi:id="_qTNSQBZdEeSVxMc4KdphRg" name="locate"/>
-    <ownedOperation xmi:type="uml:Operation" xmi:id="_q7CuUBZdEeSVxMc4KdphRg" name="initialize"/>
-    <ownedOperation xmi:type="uml:Operation" xmi:id="_rzk40BZdEeSVxMc4KdphRg" name="describe"/>
+  <packagedElement xmi:type="uml:Interface" xmi:id="_-9-H0CRYEeS7ONCnthfEow" name="ixsmq">
+    <ownedOperation xmi:type="uml:Operation" xmi:id="_djsT8CRZEeS7ONCnthfEow" name="removeIdentity"/>
+    <ownedOperation xmi:type="uml:Operation" xmi:id="_fmAxACRZEeS7ONCnthfEow" name="registerEntityWithIdentity"/>
+    <ownedOperation xmi:type="uml:Operation" xmi:id="_hgAYgCRZEeS7ONCnthfEow" name="createIdentityFromEntity"/>
+    <ownedOperation xmi:type="uml:Operation" xmi:id="_lERwgCRZEeS7ONCnthfEow" name="updateEntityTraitValues"/>
+    <ownedOperation xmi:type="uml:Operation" xmi:id="_oWGGkCRZEeS7ONCnthfEow" name="getEntityTraitValues"/>
+    <ownedOperation xmi:type="uml:Operation" xmi:id="_CgldgCRaEeS7ONCnthfEow" name="findIdentitiesByTraits"/>
+    <ownedOperation xmi:type="uml:Operation" xmi:id="_IYzOECRaEeS7ONCnthfEow" name="listedLinkedEntities"/>
+    <ownedOperation xmi:type="uml:Operation" xmi:id="_K8rgECRaEeS7ONCnthfEow" name="listedUnlinkedEntities"/>
   </packagedElement>
-  <packagedElement xmi:type="uml:Class" xmi:id="_QK3v0Bb_EeSVxMc4KdphRg" name="user">
-    <ownedAttribute xmi:type="uml:Property" xmi:id="_TB2kABb_EeSVxMc4KdphRg" name="rlus" type="_9LnYIBZcEeSVxMc4KdphRg" association="_TB4ZMBb_EeSVxMc4KdphRg">
-      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_TB2kARb_EeSVxMc4KdphRg" value="1"/>
-      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_TB2kAhb_EeSVxMc4KdphRg" value="1"/>
+  <packagedElement xmi:type="uml:Component" xmi:id="_MBWsUCReEeS7ONCnthfEow" name="TestContext">
+    <ownedAttribute xmi:type="uml:Property" xmi:id="_e_S9ACReEeS7ONCnthfEow" name="rlus_property" visibility="public" type="_vFOpUCRfEeS7ONCnthfEow">
+      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_fXwgUCReEeS7ONCnthfEow" value="1"/>
+      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_fXxHYCReEeS7ONCnthfEow" value="1"/>
     </ownedAttribute>
-    <ownedAttribute xmi:type="uml:Property" xmi:id="_UH_ssBb_EeSVxMc4KdphRg" name="ixsmq" type="_Wh3rMBZcEeSVxMc4KdphRg" association="_UIA60Bb_EeSVxMc4KdphRg">
-      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_UIATwBb_EeSVxMc4KdphRg" value="1"/>
-      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_UIATwRb_EeSVxMc4KdphRg" value="1"/>
+    <ownedAttribute xmi:type="uml:Property" xmi:id="_mwuR8CReEeS7ONCnthfEow" name="ixsmq_property" visibility="public" type="_w3q3UCRfEeS7ONCnthfEow">
+      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_nLN1kCReEeS7ONCnthfEow" value="1"/>
+      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_nLOcoCReEeS7ONCnthfEow" value="1"/>
+    </ownedAttribute>
+    <ownedAttribute xmi:type="uml:Property" xmi:id="_IBEI4CRtEeS7ONCnthfEow" name="user" type="_E5BZ4CRtEeS7ONCnthfEow"/>
+    <ownedConnector xmi:type="uml:Connector" xmi:id="_Mkge4CRtEeS7ONCnthfEow" name="Connector1">
+      <end xmi:type="uml:ConnectorEnd" xmi:id="_Mkge4SRtEeS7ONCnthfEow" partWithPort="_e_S9ACReEeS7ONCnthfEow" role="_9zoXcCRfEeS7ONCnthfEow">
+        <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_Mkge4iRtEeS7ONCnthfEow" value="1"/>
+        <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_Mkge4yRtEeS7ONCnthfEow" value="1"/>
+      </end>
+      <end xmi:type="uml:ConnectorEnd" xmi:id="_MkhF8CRtEeS7ONCnthfEow" partWithPort="_IBEI4CRtEeS7ONCnthfEow" role="_I39UoCRtEeS7ONCnthfEow">
+        <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_MkhF8SRtEeS7ONCnthfEow" value="1"/>
+        <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_MkhF8iRtEeS7ONCnthfEow" value="1"/>
+      </end>
+    </ownedConnector>
+    <ownedConnector xmi:type="uml:Connector" xmi:id="_oqbnwCRtEeS7ONCnthfEow" name="Connector2">
+      <end xmi:type="uml:ConnectorEnd" xmi:id="_oqbnwSRtEeS7ONCnthfEow" partWithPort="_mwuR8CReEeS7ONCnthfEow" role="_CqD64CRgEeS7ONCnthfEow">
+        <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_oqbnwiRtEeS7ONCnthfEow" value="1"/>
+        <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_oqbnwyRtEeS7ONCnthfEow" value="1"/>
+      </end>
+      <end xmi:type="uml:ConnectorEnd" xmi:id="_oqcO0CRtEeS7ONCnthfEow" partWithPort="_IBEI4CRtEeS7ONCnthfEow" role="_lgPjsCRtEeS7ONCnthfEow">
+        <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_oqcO0SRtEeS7ONCnthfEow" value="1"/>
+        <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_oqcO0iRtEeS7ONCnthfEow" value="1"/>
+      </end>
+    </ownedConnector>
+  </packagedElement>
+  <packagedElement xmi:type="uml:Component" xmi:id="_vFOpUCRfEeS7ONCnthfEow" name="rlus">
+    <ownedAttribute xmi:type="uml:Port" xmi:id="_9zoXcCRfEeS7ONCnthfEow" name="p_rlus" visibility="public" type="_LP9HwCRiEeS7ONCnthfEow" aggregation="composite">
+      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_-F3-ACRfEeS7ONCnthfEow" value="1"/>
+      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_-F4lECRfEeS7ONCnthfEow" value="1"/>
+    </ownedAttribute>
+    <nestedClassifier xmi:type="uml:Component" xmi:id="_LP9HwCRiEeS7ONCnthfEow" clientDependency="_3Fl_4CRkEeS7ONCnthfEow" name="p_rlus_PortConfiguration">
+      <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_3Fl_4CRkEeS7ONCnthfEow" name="realization" client="_LP9HwCRiEeS7ONCnthfEow" supplier="_OdlF4CRYEeS7ONCnthfEow" contract="_OdlF4CRYEeS7ONCnthfEow"/>
+    </nestedClassifier>
+  </packagedElement>
+  <packagedElement xmi:type="uml:Component" xmi:id="_w3q3UCRfEeS7ONCnthfEow" name="ixsmq">
+    <ownedAttribute xmi:type="uml:Port" xmi:id="_CqD64CRgEeS7ONCnthfEow" name="p_ixsmq" visibility="public" type="_Rjka4CRiEeS7ONCnthfEow" aggregation="composite">
+      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_C9P8oCRgEeS7ONCnthfEow" value="1"/>
+      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_C9RKwCRgEeS7ONCnthfEow" value="1"/>
+    </ownedAttribute>
+    <nestedClassifier xmi:type="uml:Component" xmi:id="_Rjka4CRiEeS7ONCnthfEow" clientDependency="_E-V4YCRlEeS7ONCnthfEow" name="p_ixsmq_PortConfiguration">
+      <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_E-V4YCRlEeS7ONCnthfEow" name="realization" client="_Rjka4CRiEeS7ONCnthfEow" supplier="_-9-H0CRYEeS7ONCnthfEow" contract="_-9-H0CRYEeS7ONCnthfEow"/>
+    </nestedClassifier>
+  </packagedElement>
+  <packagedElement xmi:type="uml:Component" xmi:id="_E5BZ4CRtEeS7ONCnthfEow" name="User">
+    <ownedAttribute xmi:type="uml:Port" xmi:id="_I39UoCRtEeS7ONCnthfEow" name="p_user_rlus" visibility="public" type="_LP9HwCRiEeS7ONCnthfEow" aggregation="composite" isConjugated="true">
+      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_JDqOUCRtEeS7ONCnthfEow" value="1"/>
+      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_JDq1YCRtEeS7ONCnthfEow" value="1"/>
+    </ownedAttribute>
+    <ownedAttribute xmi:type="uml:Port" xmi:id="_lgPjsCRtEeS7ONCnthfEow" name="r_user_isxmq" visibility="public" type="_Rjka4CRiEeS7ONCnthfEow" aggregation="composite" isConjugated="true">
+      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_l1ASwCRtEeS7ONCnthfEow" value="1"/>
+      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_l1Bg4CRtEeS7ONCnthfEow" value="1"/>
     </ownedAttribute>
   </packagedElement>
-  <packagedElement xmi:type="uml:Association" xmi:id="_TB4ZMBb_EeSVxMc4KdphRg" name="user_rlus" memberEnd="_TB4ZMRb_EeSVxMc4KdphRg _TB2kABb_EeSVxMc4KdphRg">
-    <ownedEnd xmi:type="uml:Property" xmi:id="_TB4ZMRb_EeSVxMc4KdphRg" name="user" type="_QK3v0Bb_EeSVxMc4KdphRg" association="_TB4ZMBb_EeSVxMc4KdphRg">
-      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_TB4ZMhb_EeSVxMc4KdphRg" value="1"/>
-      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_TB4ZMxb_EeSVxMc4KdphRg" value="1"/>
-    </ownedEnd>
-  </packagedElement>
-  <packagedElement xmi:type="uml:Association" xmi:id="_UIA60Bb_EeSVxMc4KdphRg" name="user_ixsmq" memberEnd="_UIA60Rb_EeSVxMc4KdphRg _UH_ssBb_EeSVxMc4KdphRg">
-    <ownedEnd xmi:type="uml:Property" xmi:id="_UIA60Rb_EeSVxMc4KdphRg" name="user" type="_QK3v0Bb_EeSVxMc4KdphRg" association="_UIA60Bb_EeSVxMc4KdphRg">
-      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_UIA60hb_EeSVxMc4KdphRg" value="1"/>
-      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_UIA60xb_EeSVxMc4KdphRg" value="1"/>
-    </ownedEnd>
+  <packagedElement xmi:type="uml:Interaction" xmi:id="_fH4hMCRyEeS7ONCnthfEow" name="Interaction1">
+    <lifeline xmi:type="uml:Lifeline" xmi:id="_g20vQCRyEeS7ONCnthfEow" name="Lifeline" represents="_9zoXcCRfEeS7ONCnthfEow"/>
   </packagedElement>
 </uml:Model>
Index: /trunk/autoquest-plugin-uml/src/main/java/de/ugoe/cs/autoquest/plugin/uml/UMLUtils.java
===================================================================
--- /trunk/autoquest-plugin-uml/src/main/java/de/ugoe/cs/autoquest/plugin/uml/UMLUtils.java	(revision 1751)
+++ /trunk/autoquest-plugin-uml/src/main/java/de/ugoe/cs/autoquest/plugin/uml/UMLUtils.java	(revision 1752)
@@ -24,15 +24,19 @@
 
 import org.eclipse.emf.common.util.EList;
-import org.eclipse.uml2.uml.Association;
-import org.eclipse.uml2.uml.Class;
 import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Component;
+import org.eclipse.uml2.uml.Connector;
+import org.eclipse.uml2.uml.ConnectorEnd;
 import org.eclipse.uml2.uml.Element;
 import org.eclipse.uml2.uml.Interaction;
 import org.eclipse.uml2.uml.InteractionFragment;
+import org.eclipse.uml2.uml.Interface;
 import org.eclipse.uml2.uml.Lifeline;
 import org.eclipse.uml2.uml.Message;
 import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
+import org.eclipse.uml2.uml.MessageSort;
 import org.eclipse.uml2.uml.Model;
 import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Port;
 import org.eclipse.uml2.uml.Region;
 import org.eclipse.uml2.uml.StateMachine;
@@ -258,10 +262,11 @@
                                                           String interactionName)
     {
-        Map<String, Class> classMap = new HashMap<>();
+        Map<String, Interface> interfaceMap = new HashMap<>();
+        Map<String, Port> portMap = new HashMap<>();
 
         EList<Element> elements = model.getOwnedElements();
         for (Element element : elements) {
-            if (element instanceof Class) {
-                classMap.put(((Class) element).getName(), (Class) element);
+            if (element instanceof Interface) {
+                interfaceMap.put(((Interface) element).getName(), (Interface) element);
             }
         }
@@ -272,5 +277,11 @@
 
         Lifeline userLifeline = interaction.createLifeline("user");
-
+        
+        Component testContext = (Component) model.getPackagedElement("TestContext", true, UMLPackage.Literals.COMPONENT, true);
+        userLifeline.setRepresents(testContext.getAttribute("user", null));
+        
+        Component userComponent = (Component) model.getPackagedElement("User", true, UMLPackage.Literals.COMPONENT, true);
+        Port userPort = (Port) userComponent.getAttribute("p_user_rlus", null);
+        
         int i = 0;
         for (Event event : sequence) {
@@ -279,8 +290,8 @@
                 String methodName = getCalledMethodFromEvent(event);
 
-                Class targetClass = classMap.get(serviceName);
-                if (targetClass == null) {
+                Interface targetInterface = interfaceMap.get(serviceName);
+                if (targetInterface == null) {
                     throw new RuntimeException(
-                                               "Could not find class in the UML model that belong to the service: " +
+                                               "Could not find interface in the UML model that belong to the service: " +
                                                    serviceName);
                 }
@@ -289,11 +300,10 @@
                 if (targetLifeline == null) {
                     targetLifeline = interaction.createLifeline(serviceName);
-                    Association association =
-                        (Association) model.getPackagedElement("user_" + serviceName, true,
-                                                               UMLPackage.Literals.ASSOCIATION,
-                                                               true);
-                    targetLifeline
-                        .setRepresents(association.getMemberEnd(serviceName,
-                                                                classMap.get(serviceName)));
+                    
+                    
+                    targetLifeline.setRepresents(testContext.getAttribute(serviceName+"_property", null));
+
+                    Component component = (Component) model.getPackagedElement(serviceName, true, UMLPackage.Literals.COMPONENT, true);
+                    portMap.put(serviceName, (Port) component.getAttribute("p_" + serviceName, null));
                 }
                 MessageOccurrenceSpecification sendFragment =
@@ -310,8 +320,25 @@
 
                 Message message = interaction.createMessage(methodName);
-                message.setSignature(getOperationFromName(targetClass.getOperations(), methodName));
+                if( getOperationFromName(targetInterface.getOperations(), methodName)==null ) {
+                    System.out.println("operation not found: " + methodName);
+                }
+                message.setSignature(getOperationFromName(targetInterface.getOperations(), methodName));
+                message.setMessageSort(MessageSort.ASYNCH_CALL_LITERAL);
                 message.setSendEvent(sendFragment);
                 message.setReceiveEvent(recvFragment);
-
+                                
+                EList<ConnectorEnd> sourceEnds = userPort.getEnds();
+                EList<ConnectorEnd> targetEnds = portMap.get(serviceName).getEnds();
+                
+                for( ConnectorEnd sourceEnd : sourceEnds ) {
+                    Connector sourceConnector = (Connector) sourceEnd.eContainer();
+                    for( ConnectorEnd targetEnd : targetEnds ) {
+                        Connector targetConnector =  (Connector) targetEnd.eContainer();
+                        if( targetConnector==sourceConnector ) {
+                            message.setConnector(targetConnector);
+                        }
+                    }
+                }               
+                
                 sendFragment.setMessage(message);
                 recvFragment.setMessage(message);
