Changeset 1752


Ignore:
Timestamp:
09/18/14 09:58:15 (10 years ago)
Author:
sherbold
Message:
  • updated UMLUtils.createInteractionFromEventSequence to be compatible with the MIDAS DSL
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-plugin-uml-test/pom.xml

    r1643 r1752  
    1818        <connection>scm:svn:${autoquest-scm-trunk-dir}/${project.artifactId}</connection> 
    1919    </scm> 
     20     
     21    <repositories> 
     22                <repository> 
     23                        <id>autoquest-thirdparty-repo</id> 
     24                        <url>https://trex.informatik.uni-goettingen.de/nexus/content/repositories/thirdparty</url> 
     25                </repository> 
     26        </repositories> 
     27     
    2028    <properties> 
    2129        <tested-artifactId>autoquest-plugin-uml</tested-artifactId> 
     
    3341            <version>${project.parent.version}</version> 
    3442        </dependency> 
     43         
     44        <dependency> 
     45                        <groupId>org.eclipse.emf</groupId> 
     46                        <artifactId>org.eclipse.emf.common</artifactId> 
     47                        <version>2.9.2</version> 
     48                </dependency> 
     49                <dependency> 
     50                        <groupId>org.eclipse.emf</groupId> 
     51                        <artifactId>org.eclipse.emf.ecore</artifactId> 
     52                        <version>2.9.2</version> 
     53                </dependency> 
     54                <dependency> 
     55                        <groupId>org.eclipse.emf</groupId> 
     56                        <artifactId>org.eclipse.emf.ecore.xmi</artifactId> 
     57                        <version>2.9.1</version> 
     58                </dependency> 
     59                <dependency> 
     60                        <groupId>org.eclipse.emf</groupId> 
     61                        <artifactId>org.eclipse.emf.mapping.ecore2xml</artifactId> 
     62                        <version>2.7.0</version> 
     63                </dependency> 
     64 
     65                <dependency> 
     66                        <groupId>org.eclipse.uml2</groupId> 
     67                        <artifactId>org.eclipse.uml2.common</artifactId> 
     68                        <version>1.8.2</version> 
     69                </dependency> 
     70                <dependency> 
     71                        <groupId>org.eclipse.uml2</groupId> 
     72                        <artifactId>org.eclipse.uml2.types</artifactId> 
     73                        <version>1.1.0</version> 
     74                </dependency> 
     75                <dependency> 
     76                        <groupId>org.eclipse.uml2</groupId> 
     77                        <artifactId>org.eclipse.uml2.uml</artifactId> 
     78                        <version>4.1.2</version> 
     79                </dependency> 
     80                <dependency> 
     81                        <groupId>org.eclipse.uml2</groupId> 
     82                        <artifactId>org.eclipse.uml2.uml.profile.l2</artifactId> 
     83                        <version>1.1.0</version> 
     84                </dependency> 
     85                <dependency> 
     86                        <groupId>org.eclipse.uml2</groupId> 
     87                        <artifactId>org.eclipse.uml2.uml.profile.l3</artifactId> 
     88                        <version>1.1.0</version> 
     89                </dependency> 
     90                <dependency> 
     91                        <groupId>org.eclipse.uml2</groupId> 
     92                        <artifactId>org.eclipse.uml2.uml.resources</artifactId> 
     93                        <version>4.1.0</version> 
     94                </dependency> 
     95                <dependency> 
     96                        <groupId>org.eclipse.emf</groupId> 
     97                        <artifactId>org.eclipse.emf.validation</artifactId> 
     98                        <version>1.7.0</version> 
     99                </dependency> 
     100                <dependency> 
     101                        <groupId>org.eclipse.equinox</groupId> 
     102                        <artifactId>org.eclipse.equinox.common</artifactId> 
     103                        <version>3.6.2</version> 
     104                </dependency> 
     105                <dependency> 
     106                        <groupId>org.eclipse.equinox</groupId> 
     107                        <artifactId>org.eclipse.equinox.registry</artifactId> 
     108                        <version>3.5.3</version> 
     109                </dependency> 
     110                <dependency> 
     111                        <groupId>org.eclipse.core</groupId> 
     112                        <artifactId>org.eclipse.core.expressions</artifactId> 
     113                        <version>3.4.5</version> 
     114                </dependency> 
     115                <dependency> 
     116                        <groupId>org.eclipse.osgi</groupId> 
     117                        <artifactId>org.eclipse.osgi</artifactId> 
     118                        <version>3.9.1</version> 
     119                </dependency> 
     120        <dependency> 
     121           <groupId>eu.midas_project</groupId> 
     122           <artifactId>ConstraintValidator</artifactId> 
     123           <version>0.2</version> 
     124        </dependency> 
    35125    </dependencies> 
    36126</project> 
  • trunk/autoquest-plugin-uml-test/src/test/java/de/ugoe/cs/autoquest/plugin/uml/UMLUtilsTest.java

    r1651 r1752  
    2727import java.util.Random; 
    2828 
     29import org.eclipse.core.runtime.IStatus; 
    2930import org.eclipse.emf.common.util.URI; 
    3031import org.eclipse.emf.ecore.EPackage; 
     
    5556import de.ugoe.cs.autoquest.testgeneration.RandomWalkGenerator; 
    5657import de.ugoe.cs.autoquest.usageprofiles.FirstOrderMarkovModel; 
     58import eu.midas.dsl.validation.util.ConstraintValidator; 
    5759 
    5860/** 
     
    178180            UMLUtils.createInteractionFromEventSequence(httpSequence, model, "testSequence"); 
    179181        } 
     182 
     183        ConstraintValidator validator = new ConstraintValidator(); 
     184        IStatus validationStatus = validator.validate(model); 
     185        if (validationStatus.getSeverity() == IStatus.OK) { 
     186            System.out.println("success"); 
     187        } 
     188        else { 
     189            System.out.println("Errors during the model validation: "); 
     190            for (IStatus status : validationStatus.getChildren()) { 
     191                System.out.println("\t" + status.getMessage()); 
     192            } 
     193        } 
     194 
    180195        writeModelToFile(model, OUTPUT_DIR + "testCreateInteractionFromEventSequence_1_result.uml"); 
    181         loadModelFromInputStream(new FileInputStream(OUTPUT_DIR + "testCreateInteractionFromEventSequence_1_result.uml")); 
     196        loadModelFromInputStream(new FileInputStream(OUTPUT_DIR + 
     197            "testCreateInteractionFromEventSequence_1_result.uml")); 
    182198    } 
    183199 
     
    225241                                                       UMLPackage.Literals.INTERACTION, true); 
    226242            double usageScore = UMLUtils.calculateUsageScore(interaction, usageProfile); 
    227             System.out.format("usage score %02d: %.2f \t %d\n",j+1, usageScore, lengths[j]); 
     243            System.out.format("usage score %02d: %.2f \t %d\n", j + 1, usageScore, lengths[j]); 
    228244        } 
    229245    } 
  • trunk/autoquest-plugin-uml-test/src/test/resources/testCreateInteractionFromEventSequence_1_model.uml

    r1643 r1752  
    11<?xml version="1.0" encoding="UTF-8"?> 
    2 <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"> 
    3   <packageImport xmi:type="uml:PackageImport" xmi:id="_O3qgoQaaEeS7deEA7EQ5bQ"> 
     2<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"> 
     3  <packageImport xmi:type="uml:PackageImport" xmi:id="_I6KgoSRYEeS7ONCnthfEow"> 
    44    <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> 
    55  </packageImport> 
    6   <packagedElement xmi:type="uml:Class" xmi:id="_Wh3rMBZcEeSVxMc4KdphRg" name="ixsmq"> 
    7     <ownedOperation xmi:type="uml:Operation" xmi:id="_noyI0BZcEeSVxMc4KdphRg" name="removeIdentity"/> 
    8     <ownedOperation xmi:type="uml:Operation" xmi:id="_ueUdQBZcEeSVxMc4KdphRg" name="registerEntityWithIdentity"/> 
    9     <ownedOperation xmi:type="uml:Operation" xmi:id="_wa1NQBZcEeSVxMc4KdphRg" name="createIdentityFromEntity"/> 
    10     <ownedOperation xmi:type="uml:Operation" xmi:id="_xt2UUBZcEeSVxMc4KdphRg" name="updateEntityTraitValues"/> 
    11     <ownedOperation xmi:type="uml:Operation" xmi:id="_zPftQBZcEeSVxMc4KdphRg" name="getEntityTraitValues"/> 
    12     <ownedOperation xmi:type="uml:Operation" xmi:id="_2z7dUBZcEeSVxMc4KdphRg" name="findEntitiesByTraits"/> 
    13     <ownedOperation xmi:type="uml:Operation" xmi:id="_4U0BQBZcEeSVxMc4KdphRg" name="listLinkedEntities"/> 
    14     <ownedOperation xmi:type="uml:Operation" xmi:id="_6TAMQBZcEeSVxMc4KdphRg" name="listUnlinkedEntities"/> 
     6  <packagedElement xmi:type="uml:Interface" xmi:id="_OdlF4CRYEeS7ONCnthfEow" name="rlus"> 
     7    <ownedOperation xmi:type="uml:Operation" xmi:id="_Wp5AACRYEeS7ONCnthfEow" name="get"/> 
     8    <ownedOperation xmi:type="uml:Operation" xmi:id="_Xo0tcCRYEeS7ONCnthfEow" name="put"/> 
     9    <ownedOperation xmi:type="uml:Operation" xmi:id="_YPSQgCRYEeS7ONCnthfEow" name="list"/> 
     10    <ownedOperation xmi:type="uml:Operation" xmi:id="_eNhJgCRYEeS7ONCnthfEow" name="discard"/> 
     11    <ownedOperation xmi:type="uml:Operation" xmi:id="_f7d5ECRYEeS7ONCnthfEow" name="locate"/> 
     12    <ownedOperation xmi:type="uml:Operation" xmi:id="_gwVEgCRYEeS7ONCnthfEow" name="initialize"/> 
     13    <ownedOperation xmi:type="uml:Operation" xmi:id="_3Xe3kCRYEeS7ONCnthfEow" name="describe"/> 
    1514  </packagedElement> 
    16   <packagedElement xmi:type="uml:Class" xmi:id="_9LnYIBZcEeSVxMc4KdphRg" name="rlus"> 
    17     <ownedOperation xmi:type="uml:Operation" xmi:id="_m-fZMBZdEeSVxMc4KdphRg" name="get"/> 
    18     <ownedOperation xmi:type="uml:Operation" xmi:id="_nonUQBZdEeSVxMc4KdphRg" name="list"/> 
    19     <ownedOperation xmi:type="uml:Operation" xmi:id="_obRgQBZdEeSVxMc4KdphRg" name="put"/> 
    20     <ownedOperation xmi:type="uml:Operation" xmi:id="_ppx6wBZdEeSVxMc4KdphRg" name="discard"/> 
    21     <ownedOperation xmi:type="uml:Operation" xmi:id="_qTNSQBZdEeSVxMc4KdphRg" name="locate"/> 
    22     <ownedOperation xmi:type="uml:Operation" xmi:id="_q7CuUBZdEeSVxMc4KdphRg" name="initialize"/> 
    23     <ownedOperation xmi:type="uml:Operation" xmi:id="_rzk40BZdEeSVxMc4KdphRg" name="describe"/> 
     15  <packagedElement xmi:type="uml:Interface" xmi:id="_-9-H0CRYEeS7ONCnthfEow" name="ixsmq"> 
     16    <ownedOperation xmi:type="uml:Operation" xmi:id="_djsT8CRZEeS7ONCnthfEow" name="removeIdentity"/> 
     17    <ownedOperation xmi:type="uml:Operation" xmi:id="_fmAxACRZEeS7ONCnthfEow" name="registerEntityWithIdentity"/> 
     18    <ownedOperation xmi:type="uml:Operation" xmi:id="_hgAYgCRZEeS7ONCnthfEow" name="createIdentityFromEntity"/> 
     19    <ownedOperation xmi:type="uml:Operation" xmi:id="_lERwgCRZEeS7ONCnthfEow" name="updateEntityTraitValues"/> 
     20    <ownedOperation xmi:type="uml:Operation" xmi:id="_oWGGkCRZEeS7ONCnthfEow" name="getEntityTraitValues"/> 
     21    <ownedOperation xmi:type="uml:Operation" xmi:id="_CgldgCRaEeS7ONCnthfEow" name="findIdentitiesByTraits"/> 
     22    <ownedOperation xmi:type="uml:Operation" xmi:id="_IYzOECRaEeS7ONCnthfEow" name="listedLinkedEntities"/> 
     23    <ownedOperation xmi:type="uml:Operation" xmi:id="_K8rgECRaEeS7ONCnthfEow" name="listedUnlinkedEntities"/> 
    2424  </packagedElement> 
    25   <packagedElement xmi:type="uml:Class" xmi:id="_QK3v0Bb_EeSVxMc4KdphRg" name="user"> 
    26     <ownedAttribute xmi:type="uml:Property" xmi:id="_TB2kABb_EeSVxMc4KdphRg" name="rlus" type="_9LnYIBZcEeSVxMc4KdphRg" association="_TB4ZMBb_EeSVxMc4KdphRg"> 
    27       <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_TB2kARb_EeSVxMc4KdphRg" value="1"/> 
    28       <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_TB2kAhb_EeSVxMc4KdphRg" value="1"/> 
     25  <packagedElement xmi:type="uml:Component" xmi:id="_MBWsUCReEeS7ONCnthfEow" name="TestContext"> 
     26    <ownedAttribute xmi:type="uml:Property" xmi:id="_e_S9ACReEeS7ONCnthfEow" name="rlus_property" visibility="public" type="_vFOpUCRfEeS7ONCnthfEow"> 
     27      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_fXwgUCReEeS7ONCnthfEow" value="1"/> 
     28      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_fXxHYCReEeS7ONCnthfEow" value="1"/> 
    2929    </ownedAttribute> 
    30     <ownedAttribute xmi:type="uml:Property" xmi:id="_UH_ssBb_EeSVxMc4KdphRg" name="ixsmq" type="_Wh3rMBZcEeSVxMc4KdphRg" association="_UIA60Bb_EeSVxMc4KdphRg"> 
    31       <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_UIATwBb_EeSVxMc4KdphRg" value="1"/> 
    32       <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_UIATwRb_EeSVxMc4KdphRg" value="1"/> 
     30    <ownedAttribute xmi:type="uml:Property" xmi:id="_mwuR8CReEeS7ONCnthfEow" name="ixsmq_property" visibility="public" type="_w3q3UCRfEeS7ONCnthfEow"> 
     31      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_nLN1kCReEeS7ONCnthfEow" value="1"/> 
     32      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_nLOcoCReEeS7ONCnthfEow" value="1"/> 
     33    </ownedAttribute> 
     34    <ownedAttribute xmi:type="uml:Property" xmi:id="_IBEI4CRtEeS7ONCnthfEow" name="user" type="_E5BZ4CRtEeS7ONCnthfEow"/> 
     35    <ownedConnector xmi:type="uml:Connector" xmi:id="_Mkge4CRtEeS7ONCnthfEow" name="Connector1"> 
     36      <end xmi:type="uml:ConnectorEnd" xmi:id="_Mkge4SRtEeS7ONCnthfEow" partWithPort="_e_S9ACReEeS7ONCnthfEow" role="_9zoXcCRfEeS7ONCnthfEow"> 
     37        <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_Mkge4iRtEeS7ONCnthfEow" value="1"/> 
     38        <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_Mkge4yRtEeS7ONCnthfEow" value="1"/> 
     39      </end> 
     40      <end xmi:type="uml:ConnectorEnd" xmi:id="_MkhF8CRtEeS7ONCnthfEow" partWithPort="_IBEI4CRtEeS7ONCnthfEow" role="_I39UoCRtEeS7ONCnthfEow"> 
     41        <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_MkhF8SRtEeS7ONCnthfEow" value="1"/> 
     42        <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_MkhF8iRtEeS7ONCnthfEow" value="1"/> 
     43      </end> 
     44    </ownedConnector> 
     45    <ownedConnector xmi:type="uml:Connector" xmi:id="_oqbnwCRtEeS7ONCnthfEow" name="Connector2"> 
     46      <end xmi:type="uml:ConnectorEnd" xmi:id="_oqbnwSRtEeS7ONCnthfEow" partWithPort="_mwuR8CReEeS7ONCnthfEow" role="_CqD64CRgEeS7ONCnthfEow"> 
     47        <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_oqbnwiRtEeS7ONCnthfEow" value="1"/> 
     48        <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_oqbnwyRtEeS7ONCnthfEow" value="1"/> 
     49      </end> 
     50      <end xmi:type="uml:ConnectorEnd" xmi:id="_oqcO0CRtEeS7ONCnthfEow" partWithPort="_IBEI4CRtEeS7ONCnthfEow" role="_lgPjsCRtEeS7ONCnthfEow"> 
     51        <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_oqcO0SRtEeS7ONCnthfEow" value="1"/> 
     52        <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_oqcO0iRtEeS7ONCnthfEow" value="1"/> 
     53      </end> 
     54    </ownedConnector> 
     55  </packagedElement> 
     56  <packagedElement xmi:type="uml:Component" xmi:id="_vFOpUCRfEeS7ONCnthfEow" name="rlus"> 
     57    <ownedAttribute xmi:type="uml:Port" xmi:id="_9zoXcCRfEeS7ONCnthfEow" name="p_rlus" visibility="public" type="_LP9HwCRiEeS7ONCnthfEow" aggregation="composite"> 
     58      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_-F3-ACRfEeS7ONCnthfEow" value="1"/> 
     59      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_-F4lECRfEeS7ONCnthfEow" value="1"/> 
     60    </ownedAttribute> 
     61    <nestedClassifier xmi:type="uml:Component" xmi:id="_LP9HwCRiEeS7ONCnthfEow" clientDependency="_3Fl_4CRkEeS7ONCnthfEow" name="p_rlus_PortConfiguration"> 
     62      <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_3Fl_4CRkEeS7ONCnthfEow" name="realization" client="_LP9HwCRiEeS7ONCnthfEow" supplier="_OdlF4CRYEeS7ONCnthfEow" contract="_OdlF4CRYEeS7ONCnthfEow"/> 
     63    </nestedClassifier> 
     64  </packagedElement> 
     65  <packagedElement xmi:type="uml:Component" xmi:id="_w3q3UCRfEeS7ONCnthfEow" name="ixsmq"> 
     66    <ownedAttribute xmi:type="uml:Port" xmi:id="_CqD64CRgEeS7ONCnthfEow" name="p_ixsmq" visibility="public" type="_Rjka4CRiEeS7ONCnthfEow" aggregation="composite"> 
     67      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_C9P8oCRgEeS7ONCnthfEow" value="1"/> 
     68      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_C9RKwCRgEeS7ONCnthfEow" value="1"/> 
     69    </ownedAttribute> 
     70    <nestedClassifier xmi:type="uml:Component" xmi:id="_Rjka4CRiEeS7ONCnthfEow" clientDependency="_E-V4YCRlEeS7ONCnthfEow" name="p_ixsmq_PortConfiguration"> 
     71      <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_E-V4YCRlEeS7ONCnthfEow" name="realization" client="_Rjka4CRiEeS7ONCnthfEow" supplier="_-9-H0CRYEeS7ONCnthfEow" contract="_-9-H0CRYEeS7ONCnthfEow"/> 
     72    </nestedClassifier> 
     73  </packagedElement> 
     74  <packagedElement xmi:type="uml:Component" xmi:id="_E5BZ4CRtEeS7ONCnthfEow" name="User"> 
     75    <ownedAttribute xmi:type="uml:Port" xmi:id="_I39UoCRtEeS7ONCnthfEow" name="p_user_rlus" visibility="public" type="_LP9HwCRiEeS7ONCnthfEow" aggregation="composite" isConjugated="true"> 
     76      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_JDqOUCRtEeS7ONCnthfEow" value="1"/> 
     77      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_JDq1YCRtEeS7ONCnthfEow" value="1"/> 
     78    </ownedAttribute> 
     79    <ownedAttribute xmi:type="uml:Port" xmi:id="_lgPjsCRtEeS7ONCnthfEow" name="r_user_isxmq" visibility="public" type="_Rjka4CRiEeS7ONCnthfEow" aggregation="composite" isConjugated="true"> 
     80      <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_l1ASwCRtEeS7ONCnthfEow" value="1"/> 
     81      <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_l1Bg4CRtEeS7ONCnthfEow" value="1"/> 
    3382    </ownedAttribute> 
    3483  </packagedElement> 
    35   <packagedElement xmi:type="uml:Association" xmi:id="_TB4ZMBb_EeSVxMc4KdphRg" name="user_rlus" memberEnd="_TB4ZMRb_EeSVxMc4KdphRg _TB2kABb_EeSVxMc4KdphRg"> 
    36     <ownedEnd xmi:type="uml:Property" xmi:id="_TB4ZMRb_EeSVxMc4KdphRg" name="user" type="_QK3v0Bb_EeSVxMc4KdphRg" association="_TB4ZMBb_EeSVxMc4KdphRg"> 
    37       <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_TB4ZMhb_EeSVxMc4KdphRg" value="1"/> 
    38       <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_TB4ZMxb_EeSVxMc4KdphRg" value="1"/> 
    39     </ownedEnd> 
    40   </packagedElement> 
    41   <packagedElement xmi:type="uml:Association" xmi:id="_UIA60Bb_EeSVxMc4KdphRg" name="user_ixsmq" memberEnd="_UIA60Rb_EeSVxMc4KdphRg _UH_ssBb_EeSVxMc4KdphRg"> 
    42     <ownedEnd xmi:type="uml:Property" xmi:id="_UIA60Rb_EeSVxMc4KdphRg" name="user" type="_QK3v0Bb_EeSVxMc4KdphRg" association="_UIA60Bb_EeSVxMc4KdphRg"> 
    43       <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_UIA60hb_EeSVxMc4KdphRg" value="1"/> 
    44       <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_UIA60xb_EeSVxMc4KdphRg" value="1"/> 
    45     </ownedEnd> 
     84  <packagedElement xmi:type="uml:Interaction" xmi:id="_fH4hMCRyEeS7ONCnthfEow" name="Interaction1"> 
     85    <lifeline xmi:type="uml:Lifeline" xmi:id="_g20vQCRyEeS7ONCnthfEow" name="Lifeline" represents="_9zoXcCRfEeS7ONCnthfEow"/> 
    4686  </packagedElement> 
    4787</uml:Model> 
  • trunk/autoquest-plugin-uml/src/main/java/de/ugoe/cs/autoquest/plugin/uml/UMLUtils.java

    r1643 r1752  
    2424 
    2525import org.eclipse.emf.common.util.EList; 
    26 import org.eclipse.uml2.uml.Association; 
    27 import org.eclipse.uml2.uml.Class; 
    2826import org.eclipse.uml2.uml.Comment; 
     27import org.eclipse.uml2.uml.Component; 
     28import org.eclipse.uml2.uml.Connector; 
     29import org.eclipse.uml2.uml.ConnectorEnd; 
    2930import org.eclipse.uml2.uml.Element; 
    3031import org.eclipse.uml2.uml.Interaction; 
    3132import org.eclipse.uml2.uml.InteractionFragment; 
     33import org.eclipse.uml2.uml.Interface; 
    3234import org.eclipse.uml2.uml.Lifeline; 
    3335import org.eclipse.uml2.uml.Message; 
    3436import org.eclipse.uml2.uml.MessageOccurrenceSpecification; 
     37import org.eclipse.uml2.uml.MessageSort; 
    3538import org.eclipse.uml2.uml.Model; 
    3639import org.eclipse.uml2.uml.Operation; 
     40import org.eclipse.uml2.uml.Port; 
    3741import org.eclipse.uml2.uml.Region; 
    3842import org.eclipse.uml2.uml.StateMachine; 
     
    258262                                                          String interactionName) 
    259263    { 
    260         Map<String, Class> classMap = new HashMap<>(); 
     264        Map<String, Interface> interfaceMap = new HashMap<>(); 
     265        Map<String, Port> portMap = new HashMap<>(); 
    261266 
    262267        EList<Element> elements = model.getOwnedElements(); 
    263268        for (Element element : elements) { 
    264             if (element instanceof Class) { 
    265                 classMap.put(((Class) element).getName(), (Class) element); 
     269            if (element instanceof Interface) { 
     270                interfaceMap.put(((Interface) element).getName(), (Interface) element); 
    266271            } 
    267272        } 
     
    272277 
    273278        Lifeline userLifeline = interaction.createLifeline("user"); 
    274  
     279         
     280        Component testContext = (Component) model.getPackagedElement("TestContext", true, UMLPackage.Literals.COMPONENT, true); 
     281        userLifeline.setRepresents(testContext.getAttribute("user", null)); 
     282         
     283        Component userComponent = (Component) model.getPackagedElement("User", true, UMLPackage.Literals.COMPONENT, true); 
     284        Port userPort = (Port) userComponent.getAttribute("p_user_rlus", null); 
     285         
    275286        int i = 0; 
    276287        for (Event event : sequence) { 
     
    279290                String methodName = getCalledMethodFromEvent(event); 
    280291 
    281                 Class targetClass = classMap.get(serviceName); 
    282                 if (targetClass == null) { 
     292                Interface targetInterface = interfaceMap.get(serviceName); 
     293                if (targetInterface == null) { 
    283294                    throw new RuntimeException( 
    284                                                "Could not find class in the UML model that belong to the service: " + 
     295                                               "Could not find interface in the UML model that belong to the service: " + 
    285296                                                   serviceName); 
    286297                } 
     
    289300                if (targetLifeline == null) { 
    290301                    targetLifeline = interaction.createLifeline(serviceName); 
    291                     Association association = 
    292                         (Association) model.getPackagedElement("user_" + serviceName, true, 
    293                                                                UMLPackage.Literals.ASSOCIATION, 
    294                                                                true); 
    295                     targetLifeline 
    296                         .setRepresents(association.getMemberEnd(serviceName, 
    297                                                                 classMap.get(serviceName))); 
     302                     
     303                     
     304                    targetLifeline.setRepresents(testContext.getAttribute(serviceName+"_property", null)); 
     305 
     306                    Component component = (Component) model.getPackagedElement(serviceName, true, UMLPackage.Literals.COMPONENT, true); 
     307                    portMap.put(serviceName, (Port) component.getAttribute("p_" + serviceName, null)); 
    298308                } 
    299309                MessageOccurrenceSpecification sendFragment = 
     
    310320 
    311321                Message message = interaction.createMessage(methodName); 
    312                 message.setSignature(getOperationFromName(targetClass.getOperations(), methodName)); 
     322                if( getOperationFromName(targetInterface.getOperations(), methodName)==null ) { 
     323                    System.out.println("operation not found: " + methodName); 
     324                } 
     325                message.setSignature(getOperationFromName(targetInterface.getOperations(), methodName)); 
     326                message.setMessageSort(MessageSort.ASYNCH_CALL_LITERAL); 
    313327                message.setSendEvent(sendFragment); 
    314328                message.setReceiveEvent(recvFragment); 
    315  
     329                                 
     330                EList<ConnectorEnd> sourceEnds = userPort.getEnds(); 
     331                EList<ConnectorEnd> targetEnds = portMap.get(serviceName).getEnds(); 
     332                 
     333                for( ConnectorEnd sourceEnd : sourceEnds ) { 
     334                    Connector sourceConnector = (Connector) sourceEnd.eContainer(); 
     335                    for( ConnectorEnd targetEnd : targetEnds ) { 
     336                        Connector targetConnector =  (Connector) targetEnd.eContainer(); 
     337                        if( targetConnector==sourceConnector ) { 
     338                            message.setConnector(targetConnector); 
     339                        } 
     340                    } 
     341                }                
     342                 
    316343                sendFragment.setMessage(message); 
    317344                recvFragment.setMessage(message); 
Note: See TracChangeset for help on using the changeset viewer.