package org.eclipse.tracecompass.tmf.ui.swtbot.tests.parsers.custom;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
import org.junit.Test;
private static final String TRACE = "trace";
private static final String XML_TRACE1 = "<trace>\n\t<event time=\"100\" msg=\"hello\"/>\n\t<event time=\"200\" msg=\"world\"/></trace>";
private static final String MANAGE_CUSTOM_PARSERS_SHELL_TITLE = "Manage Custom Parsers";
+ private static final String CUSTOM_XML_PARSER_SHELL_TITLE = "Custom XML Parser";
private static final String PROJECT_NAME = "TestXML";
private static final String CATEGORY_NAME = "Test Category";
private static final String TRACETYPE_NAME = "Test Trace";
"<TimeStampOutputFormat>ss</TimeStampOutputFormat>\n" +
"<InputElement name=\"trace\">\n" +
"<InputElement logentry=\"true\" name=\"event\">\n" +
- "<InputData action=\"0\" format=\"\" name=\"Ignore\"/>\n" +
+ "<InputData action=\"0\" name=\"Ignore\" tag=\"IGNORE\"/>\n" +
"<Attribute name=\"msg\">\n" +
- "<InputData action=\"0\" name=\"msg\"/>\n" +
+ "<InputData action=\"0\" name=\"msg\" tag=\"OTHER\"/>\n" +
"</Attribute>\n" +
"<Attribute name=\"time\">\n" +
- "<InputData action=\"0\" name=\"time\"/>\n" +
+ "<InputData action=\"0\" name=\"time\" tag=\"OTHER\"/>\n" +
"</Attribute>\n" +
"</InputElement>\n" +
"</InputElement>\n" +
- "<OutputColumn name=\"msg\"/>\n" +
- "<OutputColumn name=\"time\"/>\n";
+ "<OutputColumn name=\"msg\" tag=\"OTHER\"/>\n" +
+ "<OutputColumn name=\"time\" tag=\"OTHER\"/>\n";
/**
* Test to create a custom XML trace and compare the XML generated
public void testNew() throws FileNotFoundException, IOException {
File xmlFile = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(".metadata/.plugins/org.eclipse.tracecompass.tmf.core/custom_xml_parsers.xml").toFile();
SWTBotUtils.createProject(PROJECT_NAME);
- SWTBotView proejctExplorerBot = fBot.viewByTitle("Project Explorer");
- proejctExplorerBot.show();
- SWTBotTreeItem treeItem = proejctExplorerBot.bot().tree().getTreeItem(PROJECT_NAME);
- treeItem.select();
- treeItem.expand();
- SWTBotTreeItem treeNode = null;
- for (String node : treeItem.getNodes()) {
- if (node.startsWith("Trace")) {
- treeNode = treeItem.getNode(node);
- break;
- }
-
- }
- assertNotNull(treeNode);
+ SWTBotTreeItem treeNode = SWTBotUtils.selectTracesFolder(fBot, PROJECT_NAME);
treeNode.contextMenu("Manage Custom Parsers...").click();
+ fBot.waitUntil(Conditions.shellIsActive(MANAGE_CUSTOM_PARSERS_SHELL_TITLE));
fBot.shell(MANAGE_CUSTOM_PARSERS_SHELL_TITLE).setFocus();
fBot.radio("XML").click();
fBot.button("New...").click();
+ fBot.waitUntil(Conditions.shellIsActive(CUSTOM_XML_PARSER_SHELL_TITLE));
fBot.textWithLabel("Category:").setText(CATEGORY_NAME);
fBot.textWithLabel("Trace type:").setText(TRACETYPE_NAME);
fBot.textWithLabel("Time Stamp format:").setText("ss");