[575] | 1 | // Module : $RCSfile: ReplayReaderTest.java,v $
|
---|
| 2 | // Version : $Revision: 0.0 $ $Author: Patrick $ $Date: 26.11.2011 15:10:08 $
|
---|
| 3 | // Project : TaskTreePerformanceTest
|
---|
| 4 | // Creation : 2011 by Patrick
|
---|
| 5 | // Copyright : Patrick Harms, 2011
|
---|
| 6 |
|
---|
| 7 | package de.ugoe.cs.quest.plugin.jfc;
|
---|
| 8 |
|
---|
| 9 | import static org.junit.Assert.assertNotNull;
|
---|
| 10 | import static org.junit.Assert.assertTrue;
|
---|
| 11 |
|
---|
| 12 | import java.io.File;
|
---|
| 13 | import java.util.Collection;
|
---|
| 14 | import java.util.List;
|
---|
| 15 |
|
---|
| 16 | import org.junit.Before;
|
---|
| 17 | import org.junit.Test;
|
---|
| 18 |
|
---|
| 19 | import de.ugoe.cs.quest.eventcore.Event;
|
---|
| 20 | import de.ugoe.cs.quest.eventcore.guimodel.GUIModel;
|
---|
| 21 | import de.ugoe.cs.quest.eventcore.guimodel.IGUIElement;
|
---|
| 22 | import de.ugoe.cs.quest.plugin.jfc.guimodel.JFCGUIElement;
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * TODO comment
|
---|
| 26 | *
|
---|
| 27 | * @version $Revision: $ $Date: $
|
---|
| 28 | * @author 2011, last modified by $Author: $
|
---|
| 29 | */
|
---|
[601] | 30 | public class JFCLogParserTest {
|
---|
[575] | 31 |
|
---|
| 32 | /**
|
---|
[601] | 33 | *
|
---|
| 34 | */
|
---|
[575] | 35 | @Before
|
---|
[601] | 36 | public void setUp() {
|
---|
| 37 | // Logger.getLogger("").getHandlers()[0].setFormatter(new SimpleLogFormatter());
|
---|
[575] | 38 | }
|
---|
| 39 |
|
---|
| 40 | /**
|
---|
[601] | 41 | *
|
---|
| 42 | */
|
---|
[575] | 43 | @Test
|
---|
[601] | 44 | public void test() throws Exception {
|
---|
[575] | 45 | JFCLogParser parser = new JFCLogParser(null);
|
---|
| 46 | parser.parseFile(new File(ClassLoader.getSystemResource("trace.xml").getFile()));
|
---|
| 47 | Collection<List<Event>> events = parser.getSequences();
|
---|
| 48 |
|
---|
| 49 | assertNotNull(events);
|
---|
| 50 | assertTrue(events.size() > 0);
|
---|
| 51 |
|
---|
| 52 | System.err.println("{");
|
---|
| 53 | for (List<Event> session : events) {
|
---|
| 54 | System.err.println(" {");
|
---|
| 55 | for (Event event : session) {
|
---|
| 56 | System.err.print(" ");
|
---|
| 57 | System.err.print(event);
|
---|
| 58 | System.err.println(",");
|
---|
| 59 | }
|
---|
| 60 | System.err.println(" }");
|
---|
| 61 | }
|
---|
| 62 | System.err.println("}");
|
---|
| 63 | System.err.println("\n\n");
|
---|
[601] | 64 |
|
---|
[575] | 65 | GUIModel guiModel = parser.getGuiModel();
|
---|
| 66 | assertNotNull(guiModel);
|
---|
| 67 |
|
---|
| 68 | for (IGUIElement root : guiModel.getRootElements()) {
|
---|
| 69 | dumpGUIElement(root, guiModel, "");
|
---|
| 70 | }
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | /**
|
---|
| 74 | * TODO: comment
|
---|
[601] | 75 | *
|
---|
[575] | 76 | * @param root
|
---|
| 77 | * @param guiModel
|
---|
| 78 | */
|
---|
[601] | 79 | private void dumpGUIElement(IGUIElement guiElement, GUIModel guiModel, String indent) {
|
---|
[575] | 80 | assertTrue(guiElement instanceof JFCGUIElement);
|
---|
[601] | 81 |
|
---|
[575] | 82 | System.err.print(indent);
|
---|
| 83 | System.err.print(guiElement);
|
---|
[601] | 84 |
|
---|
[575] | 85 | List<IGUIElement> children = guiModel.getChildren(guiElement);
|
---|
[601] | 86 |
|
---|
| 87 | if ((children != null) && (children.size() > 0)) {
|
---|
[575] | 88 | System.err.println(" {");
|
---|
[601] | 89 |
|
---|
| 90 | for (IGUIElement child : children) {
|
---|
[575] | 91 | dumpGUIElement(child, guiModel, indent + " ");
|
---|
| 92 | }
|
---|
[601] | 93 |
|
---|
[575] | 94 | System.err.print(indent);
|
---|
| 95 | System.err.print("}");
|
---|
| 96 | }
|
---|
[601] | 97 |
|
---|
[575] | 98 | System.err.println();
|
---|
| 99 | }
|
---|
| 100 |
|
---|
| 101 | }
|
---|