Changeset 1998 for trunk/autoquest-plugin-uml/src/main/java/de/ugoe
- Timestamp:
- 07/09/15 15:33:02 (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
r1995 r1998 26 26 import java.util.Map; 27 27 import java.util.Map.Entry; 28 import java.util.logging.Level;29 28 import java.util.Set; 30 29 import java.util.TreeSet; 30 import java.util.logging.Level; 31 31 32 32 import org.eclipse.emf.common.util.EList; … … 59 59 import org.eclipse.uml2.uml.MessageSort; 60 60 import org.eclipse.uml2.uml.Model; 61 import org.eclipse.uml2.uml.NamedElement; 61 62 import org.eclipse.uml2.uml.Operation; 62 63 import org.eclipse.uml2.uml.Package; … … 73 74 import org.eclipse.uml2.uml.Trigger; 74 75 import org.eclipse.uml2.uml.UMLPackage; 75 import org.eclipse.uml2.uml.ValueSpecification;76 76 import org.eclipse.uml2.uml.Vertex; 77 77 78 78 import de.ugoe.cs.autoquest.eventcore.Event; 79 import de.ugoe.cs.autoquest.eventcore.EventUtils; 79 80 import de.ugoe.cs.autoquest.plugin.http.SOAPUtils; 80 81 import de.ugoe.cs.autoquest.plugin.http.eventcore.SOAPEventType; … … 559 560 Message callMessage = interaction.createMessage(prefix + "call"); 560 561 callMessage.setSignature(calledOperation); 561 set CallMessageParameters(callMessage, calledOperation, event,562 setMessageParameters(callMessage, calledOperation, event, 562 563 useRandomRequestBodies, prefix); 563 564 callMessage.setConnector(connector); … … 610 611 replyMessage.setMessageSort(MessageSort.REPLY_LITERAL); 611 612 replyMessage.setSignature(calledOperation); 612 setReplyMessageParameters(replyMessage, calledOperation); 613 //setReplyMessageParameters(replyMessage, calledOperation); 614 setMessageParameters(replyMessage, calledOperation, event, useRandomRequestBodies, prefix); 613 615 replyMessage.setConnector(connector); 614 616 replyMessage.setSendEvent(replySendFragment); … … 647 649 Message message = 648 650 ((MessageOccurrenceSpecification) interactionFragment).getMessage(); 649 if (message.getReceiveEvent().equals(interactionFragment) && isCallMessage(message)) 651 //if (message.getReceiveEvent().equals(interactionFragment) && isCallMessage(message)) 652 if (message.getReceiveEvent().equals(interactionFragment)) 650 653 { 651 String clientName = 652 ((MessageOccurrenceSpecification) message.getSendEvent()).getCovereds() 653 .get(0).getName(); 654 String serviceName = 655 ((MessageOccurrenceSpecification) message.getReceiveEvent()).getCovereds() 656 .get(0).getName(); 654 String clientName; 655 String serviceName; 657 656 String methodName = message.getSignature().getName(); 658 // TODO must be updated 657 CallType callType; 658 if( isCallMessage(message) ) { 659 clientName = 660 ((MessageOccurrenceSpecification) message.getSendEvent()).getCovereds() 661 .get(0).getName(); 662 serviceName = 663 ((MessageOccurrenceSpecification) message.getReceiveEvent()).getCovereds() 664 .get(0).getName(); 665 callType = CallType.REQUEST; 666 } else { 667 clientName = 668 ((MessageOccurrenceSpecification) message.getReceiveEvent()).getCovereds() 669 .get(0).getName(); 670 serviceName = 671 ((MessageOccurrenceSpecification) message.getSendEvent()).getCovereds() 672 .get(0).getName(); 673 callType = CallType.RESPONSE; 674 } 659 675 eventSequence.add(new Event(new SimpleSOAPEventType(methodName, serviceName, 660 clientName, null, null, null)));676 clientName, null, null, callType))); 661 677 } 662 678 } … … 838 854 Set<Interface> interfaces = new HashSet<>(); 839 855 // Interface myInterface = null; 840 for (Property property : component.getA ttributes()) {856 for (Property property : component.getAllAttributes()) { 841 857 if (property instanceof Port) { 842 858 Port port = (Port) property; … … 1035 1051 * </p> 1036 1052 * 1037 * @param callMessage1053 * @param message 1038 1054 * call message for which the parameters are set 1039 1055 * @param calledOperation … … 1041 1057 * @param event 1042 1058 * event that provides the parameters; in case of null, default values are assumed 1043 * @param useRandom RequestBodies1059 * @param useRandomMsgBodies 1044 1060 * defines is random request bodies are used or the body of the associated event 1045 1061 * @param prefix 1046 1062 * prefix of the call message; used to create good warnings and debugging information 1047 1063 */ 1048 private static void set CallMessageParameters(Message callMessage,1064 private static void setMessageParameters(Message message, 1049 1065 Operation calledOperation, 1050 1066 Event event, 1051 boolean useRandom RequestBodies,1067 boolean useRandomMsgBodies, 1052 1068 String prefix) 1053 1069 { 1054 org.w3c.dom.Element requestBody = 1055 SOAPUtils.getSoapBodyFromEvent(event, useRandomRequestBodies, CallType.REQUEST); 1070 org.w3c.dom.Element requestBody; 1071 if(SOAPUtils.isSOAPRequest(event)) { 1072 requestBody = 1073 SOAPUtils.getSoapBodyFromEvent(event, useRandomMsgBodies, CallType.REQUEST); 1074 } else { 1075 requestBody = 1076 SOAPUtils.getSoapBodyFromEvent(event, useRandomMsgBodies, CallType.RESPONSE); 1077 } 1056 1078 Package instSpecPkg = null; 1057 1079 … … 1087 1109 if (instSpecPkg == null) { 1088 1110 instSpecPkg = 1089 getOrCreateInstanceSpecificationPackage( callMessage.getModel(), event);1111 getOrCreateInstanceSpecificationPackage(message.getModel(), event); 1090 1112 } 1091 1113 … … 1096 1118 // (Expression) callMessage.createArgument(param.getName(), param.getType(), 1097 1119 // UMLPackage.Literals.EXPRESSION); 1098 if (isInParameter(param)) { 1120 if ( (isInParameter(param) && SOAPUtils.isSOAPRequest(event)) || 1121 (!isInParameter(param) && SOAPUtils.isSOAPResponse(event))) { 1099 1122 1100 1123 // create parameters node … … 1113 1136 // parametersValue.setInstance(instSpecParameters); 1114 1137 InstanceValue instanceValue = 1115 (InstanceValue) callMessage.createArgument(param.getName(), param.getType(),1138 (InstanceValue) message.createArgument(param.getName(), param.getType(), 1116 1139 UMLPackage.Literals.INSTANCE_VALUE); 1117 1140 instanceValue.setInstance(instSpecParameters); … … 1173 1196 // set literalNull for out and return parameters 1174 1197 // argument.createOperand(null, param.getType(), UMLPackage.Literals.LITERAL_NULL); 1175 callMessage.createArgument(param.getName(), param.getType(),1198 message.createArgument(param.getName(), param.getType(), 1176 1199 UMLPackage.Literals.LITERAL_NULL); 1177 1200 }
Note: See TracChangeset
for help on using the changeset viewer.