Changeset 1987


Ignore:
Timestamp:
07/06/15 12:08:37 (9 years ago)
Author:
sherbold
Message:
  • code formatting
Location:
trunk
Files:
3 edited

Legend:

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

    r1925 r1987  
    3838 */ 
    3939public class SOAPUtilsTest { 
    40      
     40 
    4141    @Test 
    4242    public void testConvertToSimpleSOAPEvent_1() throws Exception { 
    4343        HTTPLogParser parser = 
    44                 new HTTPLogParser(new File(ClassLoader 
    45                     .getSystemResource("testParseFile_3_properties.txt").getFile())); 
    46             parser.parseFile(new File(ClassLoader.getSystemResource("testParseFile_3_logfile.log") 
    47                 .getFile())); 
    48             Collection<List<Event>> events = parser.getSequences(); 
     44            new HTTPLogParser(new File(ClassLoader 
     45                .getSystemResource("testParseFile_3_properties.txt").getFile())); 
     46        parser.parseFile(new File(ClassLoader.getSystemResource("testParseFile_3_logfile.log") 
     47            .getFile())); 
     48        Collection<List<Event>> events = parser.getSequences(); 
    4949 
    50             assertNotNull(events); 
    51             assertEquals(1, events.size()); 
     50        assertNotNull(events); 
     51        assertEquals(1, events.size()); 
    5252 
    53             List<Event> sequence = events.iterator().next(); 
    54              
    55             List<Event> newSequence = SOAPUtils.convertToSimpleSOAPEvent(sequence, false); 
    56              
    57             assertNotNull(newSequence); 
    58             assertEquals(sequence.size(), newSequence.size()); 
    59              
    60             Iterator<Event> oldSeqIter = sequence.iterator(); 
    61             Iterator<Event> newSeqIter = newSequence.iterator(); 
    62              
    63             while(oldSeqIter.hasNext()) { 
    64                 Event oldEvent = oldSeqIter.next(); 
    65                 Event newEvent = newSeqIter.next(); 
    66                  
    67                 if( oldEvent.getType() instanceof SOAPEventType ) { 
    68                     assertTrue(newEvent.getType() instanceof SimpleSOAPEventType); 
    69                     SOAPEventType oldEventType = (SOAPEventType) oldEvent.getType(); 
    70                     SimpleSOAPEventType newEventType = (SimpleSOAPEventType) newEvent.getType(); 
    71                     assertEquals(oldEventType.getCalledMethod(), newEventType.getCalledMethod()); 
    72                     assertEquals(oldEventType.getServiceName(), newEventType.getServiceName()); 
    73                     assertEquals(oldEventType.getClientName(), newEventType.getClientName()); 
    74                     assertNull(newEvent.getTarget()); 
    75                 } else { 
    76                     assertSame(oldEvent, newEvent); 
    77                 } 
     53        List<Event> sequence = events.iterator().next(); 
     54 
     55        List<Event> newSequence = SOAPUtils.convertToSimpleSOAPEvent(sequence, false); 
     56 
     57        assertNotNull(newSequence); 
     58        assertEquals(sequence.size(), newSequence.size()); 
     59 
     60        Iterator<Event> oldSeqIter = sequence.iterator(); 
     61        Iterator<Event> newSeqIter = newSequence.iterator(); 
     62 
     63        while (oldSeqIter.hasNext()) { 
     64            Event oldEvent = oldSeqIter.next(); 
     65            Event newEvent = newSeqIter.next(); 
     66 
     67            if (oldEvent.getType() instanceof SOAPEventType) { 
     68                assertTrue(newEvent.getType() instanceof SimpleSOAPEventType); 
     69                SOAPEventType oldEventType = (SOAPEventType) oldEvent.getType(); 
     70                SimpleSOAPEventType newEventType = (SimpleSOAPEventType) newEvent.getType(); 
     71                assertEquals(oldEventType.getCalledMethod(), newEventType.getCalledMethod()); 
     72                assertEquals(oldEventType.getServiceName(), newEventType.getServiceName()); 
     73                assertEquals(oldEventType.getClientName(), newEventType.getClientName()); 
     74                assertNull(newEvent.getTarget()); 
    7875            } 
    79              
     76            else { 
     77                assertSame(oldEvent, newEvent); 
     78            } 
     79        } 
     80 
    8081    } 
    8182 
  • trunk/autoquest-plugin-http-test/src/test/java/de/ugoe/cs/autoquest/http/eventcore/EqualSOAPDataMapTest.java

    r1986 r1987  
    5252        parser.parseFile(new File(ClassLoader.getSystemResource("testParseFile_3_logfile.log") 
    5353            .getFile())); 
    54         for( List<Event> sequence : parser.getSequences() ) { 
     54        for (List<Event> sequence : parser.getSequences()) { 
    5555            SOAPUtils.convertToSimpleSOAPEvent(sequence, true); 
    5656        } 
    57          
    58         Field privateStringField = EqualSOAPDataMap.class. 
    59                     getDeclaredField("soapRequestBodies"); 
     57 
     58        Field privateStringField = EqualSOAPDataMap.class.getDeclaredField("soapRequestBodies"); 
    6059 
    6160        privateStringField.setAccessible(true); 
    6261 
    63         Map<SimpleSOAPEventType, ListOrderedSet<String>> internalMapExpected = (Map<SimpleSOAPEventType, ListOrderedSet<String>>) privateStringField.get(EqualSOAPDataMap.getInstance()); 
    64          
     62        Map<SimpleSOAPEventType, ListOrderedSet<String>> internalMapExpected = 
     63            (Map<SimpleSOAPEventType, ListOrderedSet<String>>) privateStringField 
     64                .get(EqualSOAPDataMap.getInstance()); 
     65 
    6566        // serialize 
    6667        ByteArrayOutputStream out = new ByteArrayOutputStream(); 
     
    7071 
    7172        EqualSOAPDataMap.getInstance().reset(); 
    72          
     73 
    7374        // deserialize 
    7475        byte[] pickled = out.toByteArray(); 
     
    7778        ois.readObject(); 
    7879        ois.close(); 
    79          
    80         Map<SimpleSOAPEventType, ListOrderedSet<String>> internalMapResult = (Map<SimpleSOAPEventType, ListOrderedSet<String>>) privateStringField.get(EqualSOAPDataMap.getInstance()); 
    81          
     80 
     81        Map<SimpleSOAPEventType, ListOrderedSet<String>> internalMapResult = 
     82            (Map<SimpleSOAPEventType, ListOrderedSet<String>>) privateStringField 
     83                .get(EqualSOAPDataMap.getInstance()); 
     84 
    8285        assertNotSame(internalMapExpected, internalMapResult); 
    8386        assertEquals(internalMapExpected, internalMapResult); 
  • trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http/eventcore/SimpleSOAPEventType.java

    r1986 r1987  
    4040    /**  */ 
    4141    private static final long serialVersionUID = 1L; 
    42      
     42 
    4343    /** 
    4444     * see {@link RequestBodyMode} 
     
    137137    /** 
    138138     * <p> 
    139      * returns the body of the SOAP request; how the body is determined is defined by the {@link RequestBodyMode}.  
    140      * </p> 
    141      * 
     139     * returns the body of the SOAP request; how the body is determined is defined by the 
     140     * {@link RequestBodyMode}. 
     141     * </p> 
     142     *  
    142143     * @return body of the SOAP request 
    143144     */ 
     
    155156                throw new RuntimeException("undefined RequestBodyMode"); 
    156157        } 
    157         if( requestBody==null ) { 
     158        if (requestBody == null) { 
    158159            System.err.println("foobar" + this); 
    159160            System.err.println(EqualSOAPDataMap.getInstance().getAll(this)); 
     
    167168        } 
    168169    } 
    169      
    170      
    171170 
    172171    /* 
     
    220219        return "SimpleSOAPEventType(" + serviceName + ", " + calledMethod + ")"; 
    221220    } 
    222      
     221 
    223222    /** 
    224223     * <p> 
    225224     * returns the current {@link RequestBodyMode} 
    226225     * </p> 
    227      * 
     226     *  
    228227     * @return the requestBodyMode 
    229228     */ 
     
    231230        return requestBodyMode; 
    232231    } 
    233      
     232 
    234233    /** 
    235234     * <p> 
    236235     * sets the {@link RequestBodyMode} 
    237236     * </p> 
    238      * 
     237     *  
    239238     * @param new requestBodyMode 
    240239     */ 
     
    242241        SimpleSOAPEventType.requestBodyMode = requestBodyMode; 
    243242    } 
    244      
     243 
    245244    /** 
    246245     * <p> 
     
    248247     * <ul> 
    249248     * <li>LOCALEVENT: returns the request body of the event type itself</li> 
    250      * <li>RANDOM: returns a randomly draw request body for the called method using {@link EqualSOAPDataMap#getRandom(SimpleSOAPEventType)}. 
    251      * </ul>  
     249     * <li>RANDOM: returns a randomly draw request body for the called method using 
     250     * {@link EqualSOAPDataMap#getRandom(SimpleSOAPEventType)}. 
     251     * </ul> 
    252252     * </p> 
    253253     *  
    254254     * @author Steffen Herbold 
    255255     */ 
    256     public static enum RequestBodyMode {LOCALEVENT, RANDOM} 
     256    public static enum RequestBodyMode { 
     257        LOCALEVENT, RANDOM 
     258    } 
    257259} 
Note: See TracChangeset for help on using the changeset viewer.