Ignore:
Timestamp:
07/14/15 13:20:26 (9 years ago)
Author:
sherbold
Message:
  • UMLInteractionCreator now caches instance specifications and reuses them is possible
  • UMLUtil.createInteractionFromEventSequence now works with a collection of sequences instead of single sequence; this allows the enforcement of the instance specification caching
  • updated tests to comply with new interface of UMLUtils
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-plugin-uml/src/main/java/de/ugoe/cs/autoquest/plugin/uml/UMLInteractionCreator.java

    r2008 r2009  
    1515package de.ugoe.cs.autoquest.plugin.uml; 
    1616 
     17import java.util.HashMap; 
    1718import java.util.Iterator; 
    1819import java.util.List; 
     20import java.util.Map; 
    1921import java.util.Set; 
    2022import java.util.logging.Level; 
     
    4547import org.eclipse.uml2.uml.Slot; 
    4648import org.eclipse.uml2.uml.UMLPackage; 
     49import org.w3c.dom.Element; 
    4750 
    4851import de.ugoe.cs.autoquest.eventcore.Event; 
     
    7578     */ 
    7679    private final boolean useRandomMsgBodies; 
    77  
     80     
     81    /** 
     82     * TODO 
     83     */ 
     84    private final Map<String, InstanceSpecification> instanceSpecificationCache; 
     85     
    7886    /** 
    7987     * <p> 
     
    93101        this.testContextName = testContextName; 
    94102        this.useRandomMsgBodies = useRandomMsgBodies; 
     103        instanceSpecificationCache = new HashMap<String, InstanceSpecification>(); 
    95104    } 
    96105 
     
    316325                                      String prefix) 
    317326    { 
    318         org.w3c.dom.Element requestBody; 
     327        Element requestBody; 
    319328        if (SOAPUtils.isSOAPRequest(event)) { 
    320329            requestBody = 
     
    388397                                                 internalParameter.getType(), 
    389398                                                 UMLPackage.Literals.INSTANCE_VALUE); 
    390                             value 
    391                                 .setInstance(createInstanceSpecification((DataType) internalParameter 
    392                                                                              .getType(), 
    393                                                                          instSpecPkg, prefix, 
    394                                                                          instSpecNumber, paramNode, 
    395                                                                          path)); 
     399                            InstanceSpecification instSpec = createInstanceSpecification((DataType) internalParameter 
     400                                                                                        .getType(), 
     401                                                                                        instSpecPkg, prefix, 
     402                                                                                        instSpecNumber, paramNode, 
     403                                                                                        path); 
     404                            value.setInstance(instSpec); 
    396405                            /* 
    397406                             * InstanceValue value = (InstanceValue) argument .createOperand(null, 
     
    443452                                                              String path) 
    444453    { 
     454        if( instanceSpecificationCache.containsKey(SOAPUtils.getSerialization(currentNode)) ) { 
     455            return instanceSpecificationCache.get(SOAPUtils.getSerialization(currentNode)); 
     456        } 
    445457        if ("".equals(path)) { 
    446458            path = type.getName(); 
     
    505517            } 
    506518        } 
     519        instanceSpecificationCache.put(SOAPUtils.getSerialization(currentNode), instSpec); 
    507520        return instSpec; 
    508521    } 
Note: See TracChangeset for help on using the changeset viewer.