Changeset 2000 for trunk/autoquest-plugin-uml/src/main/java/de
- Timestamp:
- 07/09/15 16:03:41 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-uml/src/main/java/de/ugoe/cs/autoquest/plugin/uml/UMLUtils.java
r1999 r2000 30 30 import java.util.logging.Level; 31 31 32 import org.apache.commons.lang.mutable.MutableInt; 32 33 import org.eclipse.emf.common.util.EList; 33 34 import org.eclipse.uml2.uml.Activity; … … 59 60 import org.eclipse.uml2.uml.MessageSort; 60 61 import org.eclipse.uml2.uml.Model; 61 import org.eclipse.uml2.uml.NamedElement;62 62 import org.eclipse.uml2.uml.Operation; 63 63 import org.eclipse.uml2.uml.Package; … … 561 561 callMessage.setSignature(calledOperation); 562 562 setMessageParameters(callMessage, calledOperation, event, 563 563 useRandomRequestBodies, prefix); 564 564 callMessage.setConnector(connector); 565 565 callMessage.setSendEvent(callSendFragment); … … 611 611 replyMessage.setMessageSort(MessageSort.REPLY_LITERAL); 612 612 replyMessage.setSignature(calledOperation); 613 //setReplyMessageParameters(replyMessage, calledOperation); 614 setMessageParameters(replyMessage, calledOperation, event, useRandomRequestBodies, prefix); 613 // setReplyMessageParameters(replyMessage, calledOperation); 614 setMessageParameters(replyMessage, calledOperation, event, 615 useRandomRequestBodies, prefix); 615 616 replyMessage.setConnector(connector); 616 617 replyMessage.setSendEvent(replySendFragment); … … 649 650 Message message = 650 651 ((MessageOccurrenceSpecification) interactionFragment).getMessage(); 651 // if (message.getReceiveEvent().equals(interactionFragment) && isCallMessage(message))652 if (message.getReceiveEvent().equals(interactionFragment))653 {652 // if (message.getReceiveEvent().equals(interactionFragment) && 653 // isCallMessage(message)) 654 if (message.getReceiveEvent().equals(interactionFragment)) { 654 655 String clientName; 655 656 String serviceName; 656 657 String methodName = message.getSignature().getName(); 657 658 CallType callType; 658 if ( isCallMessage(message)) {659 if (isCallMessage(message)) { 659 660 clientName = 660 661 661 ((MessageOccurrenceSpecification) message.getSendEvent()).getCovereds() 662 .get(0).getName(); 662 663 serviceName = 663 ((MessageOccurrenceSpecification) message.getReceiveEvent()).getCovereds()664 664 ((MessageOccurrenceSpecification) message.getReceiveEvent()) 665 .getCovereds().get(0).getName(); 665 666 callType = CallType.REQUEST; 666 } else { 667 } 668 else { 667 669 clientName = 668 ((MessageOccurrenceSpecification) message.getReceiveEvent()).getCovereds()669 670 ((MessageOccurrenceSpecification) message.getReceiveEvent()) 671 .getCovereds().get(0).getName(); 670 672 serviceName = 671 672 673 ((MessageOccurrenceSpecification) message.getSendEvent()).getCovereds() 674 .get(0).getName(); 673 675 callType = CallType.RESPONSE; 674 676 } 675 677 eventSequence.add(new Event(new SimpleSOAPEventType(methodName, serviceName, 676 clientName, null, null, callType))); 678 clientName, null, null, 679 callType))); 677 680 } 678 681 } … … 1063 1066 */ 1064 1067 private static void setMessageParameters(Message message, 1065 1066 1067 1068 1068 Operation calledOperation, 1069 Event event, 1070 boolean useRandomMsgBodies, 1071 String prefix) 1069 1072 { 1070 1073 org.w3c.dom.Element requestBody; 1071 if (SOAPUtils.isSOAPRequest(event)) {1074 if (SOAPUtils.isSOAPRequest(event)) { 1072 1075 requestBody = 1073 1076 SOAPUtils.getSoapBodyFromEvent(event, useRandomMsgBodies, CallType.REQUEST); 1074 } else { 1077 } 1078 else { 1075 1079 requestBody = 1076 1080 SOAPUtils.getSoapBodyFromEvent(event, useRandomMsgBodies, CallType.RESPONSE); 1077 1081 } 1078 1082 Package instSpecPkg = null; 1083 MutableInt instSpecNumber = new MutableInt(0); 1079 1084 1080 1085 // FOR DEBUGGING … … 1108 1113 for (Parameter param : calledOperation.getOwnedParameters()) { 1109 1114 if (instSpecPkg == null) { 1110 instSpecPkg = 1111 getOrCreateInstanceSpecificationPackage(message.getModel(), event); 1115 instSpecPkg = getOrCreateInstanceSpecificationPackage(message.getModel(), event); 1112 1116 } 1113 1117 … … 1118 1122 // (Expression) callMessage.createArgument(param.getName(), param.getType(), 1119 1123 // UMLPackage.Literals.EXPRESSION); 1120 if ( (isInParameter(param) && SOAPUtils.isSOAPRequest(event)) || 1121 (isOutParameter(param) && SOAPUtils.isSOAPResponse(event))) { 1124 if ((isInParameter(param) && SOAPUtils.isSOAPRequest(event)) || 1125 (isOutParameter(param) && SOAPUtils.isSOAPResponse(event))) 1126 { 1122 1127 1123 1128 // create parameters node … … 1127 1132 DataType parametersNode = (DataType) param.getType(); 1128 1133 InstanceSpecification instSpecParameters = 1129 (InstanceSpecification) instSpecPkg.createPackagedElement(prefix + "instspec _" +1134 (InstanceSpecification) instSpecPkg.createPackagedElement(prefix + "instspec" + instSpecNumber.intValue() + "_" + 1130 1135 param.getType().getName(), UMLPackage.Literals.INSTANCE_SPECIFICATION); 1131 1136 instSpecParameters.getClassifiers().add((DataType) param.getType()); 1137 instSpecNumber.setValue(instSpecNumber.intValue()+1); 1132 1138 // InstanceValue parametersValue = 1133 1139 // (InstanceValue) argument … … 1137 1143 InstanceValue instanceValue = 1138 1144 (InstanceValue) message.createArgument(param.getName(), param.getType(), 1139 1145 UMLPackage.Literals.INSTANCE_VALUE); 1140 1146 instanceValue.setInstance(instSpecParameters); 1141 1147 … … 1178 1184 .setInstance(createInstanceSpecification((DataType) internalParameter 1179 1185 .getType(), 1180 instSpecPkg, prefix, 1186 instSpecPkg, prefix, instSpecNumber, 1181 1187 paramNode, path)); 1182 1188 /* … … 1197 1203 // argument.createOperand(null, param.getType(), UMLPackage.Literals.LITERAL_NULL); 1198 1204 message.createArgument(param.getName(), param.getType(), 1199 1205 UMLPackage.Literals.LITERAL_NULL); 1200 1206 } 1201 1207 } … … 1225 1231 Package pkg, 1226 1232 String prefix, 1233 MutableInt instSpecNumber, 1227 1234 org.w3c.dom.Element currentNode, 1228 1235 String path) … … 1234 1241 InstanceSpecification instSpec = 1235 1242 (InstanceSpecification) pkg 1236 .createPackagedElement(prefix + "instspec _" + type.getName(),1243 .createPackagedElement(prefix + "instspec" + instSpecNumber.intValue() + "_" + type.getName(), 1237 1244 UMLPackage.Literals.INSTANCE_SPECIFICATION); 1238 1245 instSpec.getClassifiers().add(type); 1246 instSpecNumber.setValue(instSpecNumber.intValue()+1); 1239 1247 for (Property prop : type.getAllAttributes()) { 1240 1248 if (prop.getType() instanceof PrimitiveType) { … … 1277 1285 UMLPackage.Literals.INSTANCE_VALUE); 1278 1286 value.setInstance(createInstanceSpecification((DataType) prop.getType(), pkg, 1279 prefix, attributeNode, path +1287 prefix, instSpecNumber, attributeNode, path + 1280 1288 "." + prop.getName())); 1281 1289 } … … 1518 1526 LiteralNull argument = 1519 1527 (LiteralNull) replyMessage.createArgument(param.getName(), param.getType(), 1520 UMLPackage.Literals.LITERAL_NULL);1521 1528 UMLPackage.Literals.LITERAL_NULL); 1529 1522 1530 if (isOutParameter(param)) { 1523 1531 argument.applyStereotype(UTPUtils.getLiteralAnyStereotype(replyMessage.getModel()));
Note: See TracChangeset
for help on using the changeset viewer.