Index: trunk/autoquest-plugin-jfc-test/src/test/java/de/ugoe/cs/autoquest/plugin/jfc/JFCLogParserTest.java
===================================================================
--- trunk/autoquest-plugin-jfc-test/src/test/java/de/ugoe/cs/autoquest/plugin/jfc/JFCLogParserTest.java	(revision 922)
+++ trunk/autoquest-plugin-jfc-test/src/test/java/de/ugoe/cs/autoquest/plugin/jfc/JFCLogParserTest.java	(revision 922)
@@ -0,0 +1,98 @@
+package de.ugoe.cs.autoquest.plugin.jfc;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+import java.util.logging.Level;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.eventcore.Event;
+import de.ugoe.cs.autoquest.eventcore.guimodel.GUIModel;
+import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement;
+import de.ugoe.cs.autoquest.plugin.jfc.JFCLogParser;
+import de.ugoe.cs.autoquest.plugin.jfc.guimodel.JFCGUIElement;
+import de.ugoe.cs.util.console.TextConsole;
+
+/**
+ * TODO comment
+ * 
+ * @version $Revision: $ $Date: $
+ * @author 2011, last modified by $Author: $
+ */
+public class JFCLogParserTest {
+
+    /**
+     *
+     */
+    @Before
+    public void setUp() {
+        new TextConsole(Level.FINEST);
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void test() throws Exception {
+        JFCLogParser parser = new JFCLogParser(null);
+        parser.parseFile(new File(ClassLoader.getSystemResource("trace.xml").getFile()));
+        Collection<List<Event>> events = parser.getSequences();
+
+        assertNotNull(events);
+        assertTrue(events.size() > 0);
+
+        System.err.println("{");
+        for (List<Event> session : events) {
+            System.err.println("  {");
+            for (Event event : session) {
+                System.err.print("    ");
+                System.err.print(event);
+                System.err.println(",");
+            }
+            System.err.println("  }");
+        }
+        System.err.println("}");
+        System.err.println("\n\n");
+
+        GUIModel guiModel = parser.getGuiModel();
+        assertNotNull(guiModel);
+
+        for (IGUIElement root : guiModel.getRootElements()) {
+            dumpGUIElement(root, guiModel, "");
+        }
+    }
+
+    /**
+     * TODO: comment
+     * 
+     * @param root
+     * @param guiModel
+     */
+    private void dumpGUIElement(IGUIElement guiElement, GUIModel guiModel, String indent) {
+        assertTrue(guiElement instanceof JFCGUIElement);
+
+        System.err.print(indent);
+        System.err.print(guiElement);
+
+        List<IGUIElement> children = guiModel.getChildren(guiElement);
+
+        if ((children != null) && (children.size() > 0)) {
+            System.err.println(" {");
+
+            for (IGUIElement child : children) {
+                dumpGUIElement(child, guiModel, indent + "  ");
+            }
+
+            System.err.print(indent);
+            System.err.print("}");
+        }
+
+        System.err.println();
+    }
+
+}
Index: trunk/autoquest-plugin-jfc-test/src/test/java/de/ugoe/cs/autoquest/plugin/jfc/JFCReplayIDCalculatorTest.java
===================================================================
--- trunk/autoquest-plugin-jfc-test/src/test/java/de/ugoe/cs/autoquest/plugin/jfc/JFCReplayIDCalculatorTest.java	(revision 922)
+++ trunk/autoquest-plugin-jfc-test/src/test/java/de/ugoe/cs/autoquest/plugin/jfc/JFCReplayIDCalculatorTest.java	(revision 922)
@@ -0,0 +1,303 @@
+package de.ugoe.cs.autoquest.plugin.jfc;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+
+import junit.framework.TestCase;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.mockito.Mockito.*;
+
+import de.ugoe.cs.autoquest.eventcore.Event;
+import de.ugoe.cs.autoquest.eventcore.IEventTarget;
+import de.ugoe.cs.autoquest.eventcore.IEventType;
+import de.ugoe.cs.autoquest.plugin.jfc.JFCLogParser;
+import de.ugoe.cs.autoquest.plugin.jfc.JFCReplayIDCalculator;
+import de.ugoe.cs.autoquest.plugin.jfc.JFCReplayIDValidator;
+import de.ugoe.cs.autoquest.plugin.jfc.eventcore.JFCEventId;
+import de.ugoe.cs.autoquest.plugin.jfc.guimodel.JFCGUIElement;
+import de.ugoe.cs.autoquest.plugin.jfc.guimodel.JFCGUIElementSpec;
+import de.ugoe.cs.util.console.TextConsole;
+
+/**
+ * The class <code>EFGReplayIDCalculatorTest</code> contains tests for the class
+ * {@link <code>EFGReplayIDCalculator</code>}
+ *
+ * @pattern JUnit Test Case
+ *
+ * @author fabian.glaser
+ *
+ * @version $Revision$
+ */
+public class JFCReplayIDCalculatorTest extends TestCase {
+	
+	Set<String> knownIDs = new HashSet<String>();
+
+	/**
+	 * Construct new test instance
+	 *
+	 * @param name the test name
+	 */
+	public JFCReplayIDCalculatorTest(String name) {
+		super(name);
+	}
+
+	/**
+	 * Run the String calculateReplayID(JFCEvent) method test.
+	 *
+	 * @throws Exception
+	 *
+	 * @generatedBy CodePro at 7/30/12 4:58 PM
+	 */
+	@Test
+	public void testCalculateReplayIDwithEvent()
+		throws Exception {
+		Collection<JFCEventId> ignoredEvents = new HashSet<JFCEventId>();
+		ignoredEvents.add(JFCEventId.FOCUS_GAINED);
+		JFCLogParser parser = new JFCLogParser(ignoredEvents);
+		parser.parseFile(new File(ClassLoader.getSystemResource("freemind_trace.xml").getFile()));
+		
+		Collection<List<Event>> sequences = parser.getSequences();
+		Event event = sequences.iterator().next().get(0);
+		
+		String result = new JFCReplayIDCalculator().calculateReplayID(event);
+		assertEquals("e3561778462", result);
+	}
+	
+	/**
+	 * Run the String calculateReplayID(List<JFCGUIElementSpec>) method test.
+	 *
+	 * @throws Exception
+	 */
+	@Test
+	public void testCalculateReplayIDwithGuiElementPath()
+		throws Exception {
+		Collection<JFCEventId> ignoredEvents = new HashSet<JFCEventId>();
+		ignoredEvents.add(JFCEventId.FOCUS_GAINED);
+		JFCLogParser parser = new JFCLogParser(ignoredEvents);
+		parser.parseFile(new File(ClassLoader.getSystemResource("freemind_trace.xml").getFile()));
+		
+		Collection<List<Event>> sequences = parser.getSequences();
+		Event event = sequences.iterator().next().get(0);
+		
+		List<JFCGUIElementSpec> guiElementPath = new ArrayList<JFCGUIElementSpec>();
+		
+		IEventTarget target = event.getTarget();
+		JFCGUIElement jfcTarget = (JFCGUIElement) target;
+		
+		// extract element path
+		JFCGUIElement currentTarget = jfcTarget;
+		while (currentTarget != null){
+			JFCGUIElementSpec currentSpec = (JFCGUIElementSpec) currentTarget.getSpecification();
+			guiElementPath.add(0, currentSpec);
+			currentTarget = (JFCGUIElement) currentTarget.getParent();
+		}
+		
+		String result = new JFCReplayIDCalculator().calculateReplayID(guiElementPath);
+		assertEquals("e3561778462", result);
+	}
+	
+	/**
+	 * Method to test if calculated IDs are included in guitar efg file.
+	 * If not more than 75 % can be matched, test fails. 
+	 *
+	 * @throws Exception
+	 */
+	@Test
+	public void testCalculateReplayIDAllEvents()
+		throws Exception {
+		// generate list of known replayIDs from guitar efg file
+		File guiFile = new File(ClassLoader.getSystemResource("freemind.xml").getFile());
+		JFCReplayIDValidator validator = new JFCReplayIDValidator(guiFile);
+		
+		// calculate replayIDs from trace file
+		Collection<JFCEventId> ignoredEvents = new HashSet<JFCEventId>();
+		ignoredEvents.add(JFCEventId.FOCUS_GAINED);
+		JFCLogParser parser = new JFCLogParser(ignoredEvents);
+		parser.parseFile(new File(ClassLoader.getSystemResource("freemind_trace3_corrected.xml").getFile()));
+		JFCReplayIDCalculator calculator = new JFCReplayIDCalculator(validator);
+		
+		Set<String> generatedIDs = new HashSet<String>(); 
+		
+		Collection<List<Event>> sequences = parser.getSequences();
+		
+		assertTrue(sequences.size() > 0);
+		
+		Set<Event> seenEvents = new HashSet<Event>();
+		
+		for (List<Event> currentSequence: sequences){
+			seenEvents.addAll(currentSequence);
+		}
+		
+		for (Event currentEvent: seenEvents){
+			String replayID = calculator.calculateReplayID(currentEvent);
+			generatedIDs.add(replayID);
+			System.out.println("Generated ID: " + replayID);
+			System.out.println();
+		}
+		
+		System.out.println();
+		
+		// check if generatedIDs are known
+		int known = 0;
+		for (String replayID: generatedIDs){
+			if (validator.validateReplayID("w" + replayID.substring(1))){
+				System.out.println(replayID + "\t is known.");
+				known++;
+			}
+			else
+				System.out.println(replayID + "\t is unknown.");
+		}
+		System.out.println();
+		
+		float percentage = (float) known/generatedIDs.size()*100;
+		System.out.println(percentage + "% of the generated IDs are known.");
+		
+		assertTrue(percentage > 75);	
+	}
+	
+	/**
+	 * Method to test if calculated IDs are included in guitar efg file.
+	 * If not more than 75 % can be matched, test fails.  
+	 *
+	 * @throws Exception
+	 */
+	@Test
+	public void testCalculateReplayIDAllEventsArgo()
+		throws Exception {
+		// generate list of known replayIDs from guitar efg file
+		File guiFile = new File(ClassLoader.getSystemResource("argo.xml").getFile());
+		JFCReplayIDValidator validator = new JFCReplayIDValidator(guiFile);
+		
+		// calculate replayIDs from trace file
+		Collection<JFCEventId> ignoredEvents = new HashSet<JFCEventId>();
+		ignoredEvents.add(JFCEventId.FOCUS_GAINED);
+		JFCLogParser parser = new JFCLogParser(ignoredEvents);
+		parser.parseFile(new File(ClassLoader.getSystemResource("argouml_trace1_corrected.xml").getFile()));
+		JFCReplayIDCalculator calculator = new JFCReplayIDCalculator(validator);
+		
+		Set<String> generatedIDs = new HashSet<String>(); 
+		
+		Collection<List<Event>> sequences = parser.getSequences();
+		
+		assertTrue(sequences.size() > 0);
+		
+		Set<Event> seenEvents = new HashSet<Event>();
+		
+		for (List<Event> currentSequence: sequences){
+			seenEvents.addAll(currentSequence);
+		}
+		
+		for (Event currentEvent: seenEvents){
+			String replayID = calculator.calculateReplayID(currentEvent);
+			generatedIDs.add(replayID);
+			System.out.println("Generated ID: " + replayID);
+			System.out.println();
+		}
+		
+		System.out.println();
+		
+		// check if generatedIDs are known
+		int known = 0;
+		for (String replayID: generatedIDs){
+			if (validator.validateReplayID("w" + replayID.substring(1))){
+				System.out.println(replayID + "\t is known.");
+				known++;
+			}
+			else
+				System.out.println(replayID + "\t is unknown.");
+		}
+		System.out.println();
+		
+		float percentage = (float) known/generatedIDs.size()*100;
+		System.out.println(percentage + "% of the generated IDs are known.");
+		
+		assertTrue(percentage > 75);	
+	}
+	
+	
+	/**
+	 * Method to test if calculateReplayID throws the right exception when
+	 * it is called with a target of the wrong type.
+	 */
+	@Test
+	public void testCalculateReplayIDIllegalArgumentException(){
+		try{
+			JFCReplayIDCalculator calculator = new JFCReplayIDCalculator();
+			Event event = new Event(mock(IEventType.class), mock(IEventTarget.class));
+			
+			calculator.calculateReplayID(event);
+		
+			fail("Expected IllegalArgumentException!");
+		}
+		catch(IllegalArgumentException e){
+			System.out.println("Expected exception thrown.");
+		}
+	}
+
+	/**
+	 * Perform pre-test initialization.
+	 *
+	 * @throws Exception
+	 *         if the initialization fails for some reason
+	 *
+	 * @generatedBy CodePro at 7/30/12 4:58 PM
+	 */
+	@Before
+	public void setUp()
+		throws Exception {
+		    new TextConsole(Level.FINEST);
+	}
+
+	/**
+	 * Perform post-test clean-up.
+	 *
+	 * @throws Exception
+	 *         if the clean-up fails for some reason
+	 *
+	 * @generatedBy CodePro at 7/30/12 4:58 PM
+	 */
+	@After
+	public void tearDown()
+		throws Exception {
+		// Add additional tear down code here
+	}
+
+	/**
+	 * Launch the test.
+	 *
+	 * @param args the command line arguments
+	 *
+	 * @generatedBy CodePro at 7/30/12 4:58 PM
+	 */
+	public static void main(String[] args) {
+		new org.junit.runner.JUnitCore().run(JFCReplayIDCalculatorTest.class);
+	}
+}
+
+/*$CPS$ This comment was generated by CodePro. Do not edit it.
+ * patternId = com.instantiations.assist.eclipse.pattern.testCasePattern
+ * strategyId = com.instantiations.assist.eclipse.pattern.testCasePattern.junitTestCase
+ * additionalTestNames = 
+ * assertTrue = false
+ * callTestMethod = true
+ * createMain = false
+ * createSetUp = false
+ * createTearDown = false
+ * createTestFixture = false
+ * createTestStubs = false
+ * methods = 
+ * package = de.ugoe.cs.eventbench.efg
+ * package.sourceFolder = EventBenchConsoleTest/src
+ * superclassType = junit.framework.TestCase
+ * testCase = EFGEventIDCalculatorTest
+ * testClassType = de.ugoe.cs.eventbench.efg.EFGEventIDCalculator
+ */
Index: trunk/autoquest-plugin-jfc-test/src/test/java/de/ugoe/cs/autoquest/plugin/jfc/JFCTraceCorrectorTest.java
===================================================================
--- trunk/autoquest-plugin-jfc-test/src/test/java/de/ugoe/cs/autoquest/plugin/jfc/JFCTraceCorrectorTest.java	(revision 922)
+++ trunk/autoquest-plugin-jfc-test/src/test/java/de/ugoe/cs/autoquest/plugin/jfc/JFCTraceCorrectorTest.java	(revision 922)
@@ -0,0 +1,96 @@
+package de.ugoe.cs.autoquest.plugin.jfc;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.util.logging.Level;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.plugin.jfc.JFCTraceCorrector;
+import de.ugoe.cs.util.console.TextConsole;
+
+/**
+ * TODO comment
+ * 
+ * @version $Revision: $ $Date: $
+ * @author 2011, last modified by $Author: $
+ */
+public class JFCTraceCorrectorTest {
+
+    /** */
+    private File outputFile = new File("tmp_output.xml");
+    
+    /**
+     *
+     */
+    @Before
+    public void setUp() {
+        new TextConsole(Level.FINEST);
+    }
+
+    /**
+     *
+     */
+    @After
+    public void tearDown() {
+        if ((outputFile != null) && (outputFile.exists())) {
+            outputFile.delete();
+        }
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void test() throws Exception {
+        JFCTraceCorrector corrector = new JFCTraceCorrector();
+        corrector.correctFile(getTestFile("uncorrected_trace.xml"), outputFile);
+        
+        BufferedReader reader1 = null;
+        BufferedReader reader2 = null;
+
+        try {
+            reader1 = new BufferedReader(new FileReader(getTestFile("corrected_trace.xml")));
+            reader2 = new BufferedReader(new FileReader(outputFile));
+            
+            String line;
+            do {
+                line = reader1.readLine();
+                if (line != null) {
+                    assertEquals(line, reader2.readLine());
+                }
+                else {
+                    assertNull(reader2.readLine());
+                }
+            }
+            while (line != null);
+        }
+        finally {
+            if (reader1 != null) {
+                reader1.close();
+            }
+            if (reader2 != null) {
+                reader2.close();
+            }
+        }
+    }
+
+    /**
+     * <p>
+     * TODO: comment
+     * </p>
+     *
+     * @param string
+     * @return
+     */
+    private File getTestFile(String name) {
+        return new File(ClassLoader.getSystemResource(name).getFile());
+    }
+
+}
