Changeset 836 for trunk/quest-plugin-jfc-test/src/test/java/de
- Timestamp:
- 09/20/12 11:04:28 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-plugin-jfc-test/src/test/java/de/ugoe/cs/quest/plugin/jfc/JFCReplayIDCalculatorTest.java
r810 r836 120 120 ignoredEvents.add(JFCEventId.FOCUS_GAINED); 121 121 JFCLogParser parser = new JFCLogParser(ignoredEvents); 122 parser.parseFile(new File(ClassLoader.getSystemResource("freemind_trace3 .xml").getFile()));122 parser.parseFile(new File(ClassLoader.getSystemResource("freemind_trace3_corrected.xml").getFile())); 123 123 JFCReplayIDCalculator calculator = new JFCReplayIDCalculator(validator); 124 124 … … 129 129 assertTrue(sequences.size() > 0); 130 130 131 Set<Event> seenEvents = new HashSet<Event>(); 132 131 133 for (List<Event> currentSequence: sequences){ 132 for (Event currentEvent: currentSequence){ 133 String replayID = calculator.calculateReplayID(currentEvent); 134 generatedIDs.add(replayID); 135 System.out.println("Generated ID: " + replayID); 136 System.out.println(); 134 seenEvents.addAll(currentSequence); 135 } 136 137 for (Event currentEvent: seenEvents){ 138 String replayID = calculator.calculateReplayID(currentEvent); 139 generatedIDs.add(replayID); 140 System.out.println("Generated ID: " + replayID); 141 System.out.println(); 142 } 143 144 System.out.println(); 145 146 // check if generatedIDs are known 147 int known = 0; 148 for (String replayID: generatedIDs){ 149 if (validator.validateReplayID("w" + replayID.substring(1))){ 150 System.out.println(replayID + "\t is known."); 151 known++; 137 152 } 153 else 154 System.out.println(replayID + "\t is unknown."); 155 } 156 System.out.println(); 157 158 float percentage = (float) known/generatedIDs.size()*100; 159 System.out.println(percentage + "% of the generated IDs are known."); 160 161 assertTrue(percentage > 75); 162 } 163 164 /** 165 * Method to test if calculated IDs are included in guitar efg file. 166 * If not more than 75 % can be matched, test fails. 167 * 168 * @throws Exception 169 */ 170 @Test 171 public void testCalculateReplayIDAllEventsArgo() 172 throws Exception { 173 // generate list of known replayIDs from guitar efg file 174 File guiFile = new File(ClassLoader.getSystemResource("argo.xml").getFile()); 175 JFCReplayIDValidator validator = new JFCReplayIDValidator(guiFile); 176 177 // calculate replayIDs from trace file 178 Collection<JFCEventId> ignoredEvents = new HashSet<JFCEventId>(); 179 ignoredEvents.add(JFCEventId.FOCUS_GAINED); 180 JFCLogParser parser = new JFCLogParser(ignoredEvents); 181 parser.parseFile(new File(ClassLoader.getSystemResource("argouml_trace1_corrected.xml").getFile())); 182 JFCReplayIDCalculator calculator = new JFCReplayIDCalculator(validator); 183 184 Set<String> generatedIDs = new HashSet<String>(); 185 186 Collection<List<Event>> sequences = parser.getSequences(); 187 188 assertTrue(sequences.size() > 0); 189 190 Set<Event> seenEvents = new HashSet<Event>(); 191 192 for (List<Event> currentSequence: sequences){ 193 seenEvents.addAll(currentSequence); 194 } 195 196 for (Event currentEvent: seenEvents){ 197 String replayID = calculator.calculateReplayID(currentEvent); 198 generatedIDs.add(replayID); 199 System.out.println("Generated ID: " + replayID); 200 System.out.println(); 138 201 } 139 202
Note: See TracChangeset
for help on using the changeset viewer.