Ignore:
Timestamp:
07/06/15 08:50:26 (9 years ago)
Author:
sherbold
Message:
  • added method normalizeOperationNames() for treatment of pre- and suffixes
File:
1 edited

Legend:

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

    r1929 r1983  
    289289        return attributeValues; 
    290290    } 
     291     
     292    /** 
     293     * <p> 
     294     * Allows the removal of pre- and suffixes from SOAP operation names in {@link SimpleSOAPEventType}.  
     295     * </p> 
     296     * 
     297     * @param sequence sequences where the operation names are normalized 
     298     */ 
     299    public static List<Event> normalizeOperationNames(List<Event> sequence, String prefixToRemove, String suffixToRemove) { 
     300        List<Event> normalizedSequence = new LinkedList<>(); 
     301        for (Iterator<Event> eventIter = sequence.iterator(); eventIter.hasNext();) { 
     302            Event event = eventIter.next(); 
     303            if ((event.getType() instanceof SimpleSOAPEventType)) { 
     304                SimpleSOAPEventType eventType = (SimpleSOAPEventType) event.getType(); 
     305                String methodName = eventType.getCalledMethod(); 
     306                if( prefixToRemove!=null && methodName.startsWith(prefixToRemove) ) { 
     307                    methodName = methodName.substring(prefixToRemove.length(), methodName.length()); 
     308                    // remove prefix 
     309                }  
     310                if( suffixToRemove!=null && methodName.endsWith(suffixToRemove) ) { 
     311                    methodName = methodName.substring(0, methodName.length()-suffixToRemove.length()); 
     312                } 
     313                event = new Event(new SimpleSOAPEventType(methodName, eventType.getServiceName(), eventType.getClientName(), eventType.getSoapRequestBody()), event.getTarget()); 
     314            } 
     315            normalizedSequence.add(event); 
     316        } 
     317        return normalizedSequence; 
     318    } 
    291319 
    292320    /** 
Note: See TracChangeset for help on using the changeset viewer.