Changeset 1987 for trunk/autoquest-plugin-http-test/src/test
- Timestamp:
- 07/06/15 12:08:37 (9 years ago)
- Location:
- trunk/autoquest-plugin-http-test/src/test/java/de/ugoe/cs/autoquest/http
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-http-test/src/test/java/de/ugoe/cs/autoquest/http/SOAPUtilsTest.java
r1925 r1987 38 38 */ 39 39 public class SOAPUtilsTest { 40 40 41 41 @Test 42 42 public void testConvertToSimpleSOAPEvent_1() throws Exception { 43 43 HTTPLogParser parser = 44 45 46 47 48 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(); 49 49 50 51 50 assertNotNull(events); 51 assertEquals(1, events.size()); 52 52 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()); 78 75 } 79 76 else { 77 assertSame(oldEvent, newEvent); 78 } 79 } 80 80 81 } 81 82 -
trunk/autoquest-plugin-http-test/src/test/java/de/ugoe/cs/autoquest/http/eventcore/EqualSOAPDataMapTest.java
r1986 r1987 52 52 parser.parseFile(new File(ClassLoader.getSystemResource("testParseFile_3_logfile.log") 53 53 .getFile())); 54 for ( List<Event> sequence : parser.getSequences()) {54 for (List<Event> sequence : parser.getSequences()) { 55 55 SOAPUtils.convertToSimpleSOAPEvent(sequence, true); 56 56 } 57 58 Field privateStringField = EqualSOAPDataMap.class. 59 getDeclaredField("soapRequestBodies"); 57 58 Field privateStringField = EqualSOAPDataMap.class.getDeclaredField("soapRequestBodies"); 60 59 61 60 privateStringField.setAccessible(true); 62 61 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 65 66 // serialize 66 67 ByteArrayOutputStream out = new ByteArrayOutputStream(); … … 70 71 71 72 EqualSOAPDataMap.getInstance().reset(); 72 73 73 74 // deserialize 74 75 byte[] pickled = out.toByteArray(); … … 77 78 ois.readObject(); 78 79 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 82 85 assertNotSame(internalMapExpected, internalMapResult); 83 86 assertEquals(internalMapExpected, internalMapResult);
Note: See TracChangeset
for help on using the changeset viewer.