use of org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceDefinition in project tracecompass by tracecompass.
the class CustomTxtIndexTest method createTrace.
@Override
protected TestTrace createTrace() throws Exception {
CustomTxtTraceDefinition definition = createDefinition();
final File file = new File(TRACE_PATH);
try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
for (int i = 0; i < NB_EVENTS; ++i) {
SimpleDateFormat f = new SimpleDateFormat(TIMESTAMP_FORMAT);
String eventStr = f.format(new Date(i)) + " hello world\n";
writer.write(eventStr);
int extra = i % 3;
for (int j = 0; j < extra; j++) {
writer.write("extra line\n");
}
}
}
return new TestTxtTrace(file.toString(), definition, BLOCK_SIZE);
}
use of org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceDefinition in project tracecompass by tracecompass.
the class ProjectExplorerTraceActionsTest method init.
/**
* Test Class setup
*
* @throws IOException
* on error
*/
@BeforeClass
public static void init() throws IOException {
TestDirectoryStructureUtil.generateTraceStructure(TEST_TRACES_PATH);
SWTBotUtils.initialize();
/*
* FIXME: We can't use Manage Custom Parsers > Import because it uses a native
* dialog. We'll still check that they show up in the dialog
*/
CustomTxtTraceDefinition[] txtDefinitions = CustomTxtTraceDefinition.loadAll(getPath("customParsers/ExampleCustomTxtParser.xml"));
txtDefinitions[0].save();
/* set up test trace */
fTestFile = new File(getPath(new Path("import").append(CUSTOM_TEXT_LOG.getTracePath()).toString()));
assertTrue(fTestFile.exists());
/* Set up for swtbot */
SWTBotPreferences.TIMEOUT = 20000;
/* 20 second timeout */
SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
fLogger.removeAllAppenders();
fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
fBot = new SWTWorkbenchBot();
/* Finish waiting for eclipse to load */
WaitUtils.waitForJobs();
SWTBotUtils.createProject(TRACE_PROJECT_NAME);
}
use of org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceDefinition in project tracecompass by tracecompass.
the class ProjectExplorerTracesFolderTest method importCustomParsers.
private static void importCustomParsers() {
// FIXME: We can't use Manage Custom Parsers > Import because it uses a native dialog. We'll still check that they show up in the dialog
CustomTxtTraceDefinition[] txtDefinitions = CustomTxtTraceDefinition.loadAll(getPath("customParsers/ExampleCustomTxtParser.xml"));
txtDefinitions[0].save();
CustomXmlTraceDefinition[] xmlDefinitions = CustomXmlTraceDefinition.loadAll(getPath("customParsers/ExampleCustomXmlParser.xml"));
xmlDefinitions[0].save();
SWTBotTreeItem traceFolder = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
traceFolder.contextMenu("Manage Custom Parsers...").click();
SWTBotShell shell = fBot.shell(MANAGE_CUSTOM_PARSERS_SHELL_TITLE).activate();
SWTBot shellBot = shell.bot();
// Make sure the custom text trace type is imported
shellBot.list().select(CUSTOM_TEXT_LOG.getTraceType());
// Make sure the custom xml trace type is imported
shellBot.radio("XML").click();
shellBot.list().select(CUSTOM_XML_LOG.getTraceType());
shellBot.button("Close").click();
shellBot.waitUntil(Conditions.shellCloses(shell), DISK_ACCESS_TIMEOUT);
}
use of org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceDefinition in project tracecompass by tracecompass.
the class TestRefreshCustomTextTrace method createDefinition.
private static void createDefinition() throws URISyntaxException, IOException {
File file = getBundleFile(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DEFINITION_PATH));
CustomTxtTraceDefinition[] definitions = CustomTxtTraceDefinition.loadAll(file.toString());
for (CustomTxtTraceDefinition text : definitions) {
text.save();
}
}
use of org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceDefinition in project tracecompass by tracecompass.
the class ManageCustomParsersDialog method fillParserList.
private void fillParserList() {
parserList.removeAll();
if (txtButton.getSelection()) {
for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll(false)) {
parserList.add(def.categoryName + SEP + def.definitionName);
}
} else if (xmlButton.getSelection()) {
for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll(false)) {
parserList.add(def.categoryName + SEP + def.definitionName);
}
}
editButton.setEnabled(false);
deleteButton.setEnabled(false);
exportButton.setEnabled(false);
}
Aggregations