source: trunk/autoquest-plugin-http-test/src/test/java/de/ugoe/cs/autoquest/http/SOAPUtilsTest.java @ 1988

Last change on this file since 1988 was 1988, checked in by sherbold, 9 years ago
  • 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
  • Property svn:mime-type set to text/plain
File size: 3.3 KB
Line 
1//   Copyright 2012 Georg-August-Universität Göttingen, Germany
2//
3//   Licensed under the Apache License, Version 2.0 (the "License");
4//   you may not use this file except in compliance with the License.
5//   You may obtain a copy of the License at
6//
7//       http://www.apache.org/licenses/LICENSE-2.0
8//
9//   Unless required by applicable law or agreed to in writing, software
10//   distributed under the License is distributed on an "AS IS" BASIS,
11//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//   See the License for the specific language governing permissions and
13//   limitations under the License.
14
15package de.ugoe.cs.autoquest.http;
16
17import static org.junit.Assert.*;
18
19import java.io.File;
20import java.util.Collection;
21import java.util.Iterator;
22import java.util.List;
23
24import org.junit.Test;
25
26import de.ugoe.cs.autoquest.eventcore.Event;
27import de.ugoe.cs.autoquest.plugin.http.HTTPLogParser;
28import de.ugoe.cs.autoquest.plugin.http.SOAPUtils;
29import de.ugoe.cs.autoquest.plugin.http.eventcore.SOAPEventType;
30import de.ugoe.cs.autoquest.plugin.http.eventcore.SimpleSOAPEventType;
31
32/**
33 * <p>
34 * Tests for the SOAPUtils
35 * </p>
36 *
37 * @author Steffen Herbold
38 */
39public class SOAPUtilsTest {
40
41    @Test
42    public void testConvertToSimpleSOAPEvent_1() throws Exception {
43        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>> sequences = parser.getSequences();
49
50        assertNotNull(sequences);
51        assertFalse(sequences.isEmpty());
52
53        Collection<List<Event>> newSequences = SOAPUtils.convertToSimpleSOAPEvent(sequences, false);
54       
55        assertNotNull(newSequences);
56        assertEquals(sequences.size(), newSequences.size());
57
58        // compare sequences
59        Iterator<List<Event>> oldIter = sequences.iterator();
60        Iterator<List<Event>> newIter = newSequences.iterator();
61       
62        while( oldIter.hasNext() ) {
63            Iterator<Event> oldSeqIter = oldIter.next().iterator();
64            Iterator<Event> newSeqIter = newIter.next().iterator();
65   
66            while (oldSeqIter.hasNext()) {
67                Event oldEvent = oldSeqIter.next();
68                Event newEvent = newSeqIter.next();
69   
70                if (oldEvent.getType() instanceof SOAPEventType) {
71                    assertTrue(newEvent.getType() instanceof SimpleSOAPEventType);
72                    SOAPEventType oldEventType = (SOAPEventType) oldEvent.getType();
73                    SimpleSOAPEventType newEventType = (SimpleSOAPEventType) newEvent.getType();
74                    assertEquals(oldEventType.getCalledMethod(), newEventType.getCalledMethod());
75                    assertEquals(oldEventType.getServiceName(), newEventType.getServiceName());
76                    assertEquals(oldEventType.getClientName(), newEventType.getClientName());
77                    assertNull(newEvent.getTarget());
78                }
79                else {
80                    assertSame(oldEvent, newEvent);
81                }
82            }
83        }
84
85    }
86
87}
Note: See TracBrowser for help on using the repository browser.