Ignore:
Timestamp:
07/07/15 08:36:28 (9 years ago)
Author:
sherbold
Message:
  • updated EqualSOAPDataMap: not a singleton anymore, now each event has a reference to the map. the map is created when the SOAPEvents are converted to SimpleSOAPEvents using the appropriate method from the SOAPUtils
  • the logic for deciding if random SOAP requests are selected or the one of the event itself was changed within the SimpleSOAPEvents. Now methods for both are offered and the caller has to decide which method to choose
  • the test case generation in the model utils now has a parameter to decide if random data or the data of the SimpleSOAPEvents is used
File:
1 edited

Legend:

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

    r1986 r1988  
    1515package de.ugoe.cs.autoquest.plugin.http.eventcore; 
    1616 
    17 import java.io.IOException; 
    18 import java.io.ObjectInputStream; 
    19 import java.io.ObjectOutputStream; 
    2017import java.io.Serializable; 
    2118import java.util.Collections; 
     
    3835    /**  */ 
    3936    private static final long serialVersionUID = 1L; 
    40  
    41     /** 
    42      * Singleton. Handle to only instance of this class 
    43      */ 
    44     transient private static EqualSOAPDataMap INSTANCE = new EqualSOAPDataMap(); 
    4537     
    4638    /** 
     
    5244     * random number generator for picking a random request body 
    5345     */ 
    54     transient private final Random random; 
    55      
    56     /** 
    57      * <p> 
    58      * return the instance of the class 
    59      * </p> 
    60      * 
    61      * @return 
    62      */ 
    63     public static EqualSOAPDataMap getInstance() { 
    64         return INSTANCE; 
    65     } 
    66      
    67     private EqualSOAPDataMap() { 
    68         // private constructor to avoid initialization 
    69         random = new Random(); 
    70     } 
    71      
    72     /** 
    73      * <p> 
    74      * Manual serialization of the object. Necessary to guarantee the singleton 
    75      * property. 
    76      * </p> 
    77      *  
    78      * @param s 
    79      *            output stream for the serialization 
    80      * @throws IOException 
    81      *             thrown if there is problem writing to the output stream 
    82      */ 
    83     private void writeObject(ObjectOutputStream s) throws IOException { 
    84             s.defaultWriteObject(); 
    85             s.writeObject(soapRequestBodies); 
    86     } 
     46    private final Random random = new Random(); 
    8747 
    8848    /** 
    8949     * <p> 
    90      * Manual de-serialization of the object. Necessary to guarantee the 
    91      * singleton property. 
    92      *  
    93      * @param s 
    94      *            input stream for the de-serialization 
    95      * @throws IOException 
    96      *             thrown if there is problem reading from the input stream 
    97      * @throws ClassNotFoundException 
    98      *             thrown if there is a problem reading from the input stream 
     50     * Default constructor.  
     51     * </p> 
    9952     */ 
    100     @SuppressWarnings("unchecked") 
    101     private void readObject(ObjectInputStream s) throws IOException, 
    102                     ClassNotFoundException { 
    103             s.defaultReadObject(); 
    104             if (INSTANCE == null) { 
    105                 INSTANCE = new EqualSOAPDataMap(); 
    106             } 
    107             INSTANCE.soapRequestBodies = (Map<SimpleSOAPEventType, ListOrderedSet<String>>) s.readObject(); 
     53    public EqualSOAPDataMap() { 
     54         
    10855    } 
    109  
    110     /** 
    111      * <p> 
    112      * Manual de-serialization to guarantee the singleton property. 
    113      * </p> 
    114      *  
    115      * @return instance of the container 
    116      */ 
    117     private Object readResolve() { 
    118             return INSTANCE; 
    119     } 
    120  
     56     
    12157    /** 
    12258     * <p> 
     
    175111        soapRequestBodies = new HashMap<>(); 
    176112    } 
     113     
     114    /** 
     115     * <p> 
     116     * returns is the current data map is empty 
     117     * </p> 
     118     * 
     119     * @return true if empty; false otherwise 
     120     */ 
     121    public boolean isEmpty() { 
     122        return soapRequestBodies.isEmpty(); 
     123    } 
    177124} 
Note: See TracChangeset for help on using the changeset viewer.