1 /******************************************************************************
2 * Copyright (c) 2016 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.integration
.swtbot
.tests
.projectexplorer
;
12 import static org
.junit
.Assert
.assertEquals
;
13 import static org
.junit
.Assert
.assertNotEquals
;
16 import java
.io
.IOException
;
17 import java
.util
.List
;
19 import java
.util
.function
.Supplier
;
21 import org
.apache
.log4j
.Logger
;
22 import org
.apache
.log4j
.varia
.NullAppender
;
23 import org
.eclipse
.core
.runtime
.IPath
;
24 import org
.eclipse
.core
.runtime
.Path
;
25 import org
.eclipse
.jdt
.annotation
.NonNull
;
26 import org
.eclipse
.swtbot
.eclipse
.finder
.SWTWorkbenchBot
;
27 import org
.eclipse
.swtbot
.eclipse
.finder
.widgets
.SWTBotEditor
;
28 import org
.eclipse
.swtbot
.eclipse
.finder
.widgets
.SWTBotView
;
29 import org
.eclipse
.swtbot
.swt
.finder
.SWTBot
;
30 import org
.eclipse
.swtbot
.swt
.finder
.junit
.SWTBotJunit4ClassRunner
;
31 import org
.eclipse
.swtbot
.swt
.finder
.utils
.SWTBotPreferences
;
32 import org
.eclipse
.swtbot
.swt
.finder
.waits
.Conditions
;
33 import org
.eclipse
.swtbot
.swt
.finder
.widgets
.SWTBotButton
;
34 import org
.eclipse
.swtbot
.swt
.finder
.widgets
.SWTBotShell
;
35 import org
.eclipse
.swtbot
.swt
.finder
.widgets
.SWTBotTree
;
36 import org
.eclipse
.swtbot
.swt
.finder
.widgets
.SWTBotTreeItem
;
37 import org
.eclipse
.tracecompass
.internal
.tmf
.ui
.project
.wizards
.importtrace
.ImportConfirmation
;
38 import org
.eclipse
.tracecompass
.internal
.tmf
.ui
.project
.wizards
.importtrace
.ImportTraceWizardPage
;
39 import org
.eclipse
.tracecompass
.tmf
.core
.parsers
.custom
.CustomTxtTraceDefinition
;
40 import org
.eclipse
.tracecompass
.tmf
.core
.parsers
.custom
.CustomXmlTraceDefinition
;
41 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfTraceManager
;
42 import org
.eclipse
.tracecompass
.tmf
.ctf
.ui
.swtbot
.tests
.SWTBotImportWizardUtils
;
43 import org
.eclipse
.tracecompass
.tmf
.ui
.swtbot
.tests
.shared
.ConditionHelpers
;
44 import org
.eclipse
.tracecompass
.tmf
.ui
.swtbot
.tests
.shared
.SWTBotUtils
;
45 import org
.eclipse
.tracecompass
.tmf
.ui
.tests
.shared
.WaitUtils
;
46 import org
.eclipse
.ui
.IPageLayout
;
47 import org
.junit
.After
;
48 import org
.junit
.AfterClass
;
49 import org
.junit
.BeforeClass
;
50 import org
.junit
.FixMethodOrder
;
51 import org
.junit
.Test
;
52 import org
.junit
.runner
.RunWith
;
53 import org
.junit
.runners
.MethodSorters
;
55 import com
.google
.common
.collect
.ImmutableList
;
56 import com
.google
.common
.collect
.ImmutableSet
;
57 import com
.google
.common
.collect
.Lists
;
60 * SWTBot test for testing Project Explorer trace folders (context-menu,
63 @RunWith(SWTBotJunit4ClassRunner
.class)
64 @FixMethodOrder(MethodSorters
.NAME_ASCENDING
)
65 @SuppressWarnings({"restriction", "javadoc"})
66 public class ProjectExplorerTracesFolderTest
{
68 private static final class ImportConfirmationSupplier
implements Supplier
<ImportConfirmation
> {
69 List
<ImportConfirmation
> fConfirmations
= Lists
.newArrayList(ImportConfirmation
.CONTINUE
);
71 public ImportConfirmationSupplier(ImportConfirmation
... confirmations
) {
72 fConfirmations
= Lists
.newArrayList(confirmations
);
76 public ImportConfirmation
get() {
77 return fConfirmations
.isEmpty() ?
null : fConfirmations
.remove(0);
81 private static final String PROP_LAST_MODIFIED_PROPERTY
= "last modified";
82 private static final String TEXT_EDITOR_ID
= "org.eclipse.ui.DefaultTextEditor";
84 private static final String GENERIC_CTF_TRACE_TYPE
= "Common Trace Format : Generic CTF Trace";
85 private static final String LTTNG_KERNEL_TRACE_TYPE
= "Common Trace Format : Linux Kernel Trace";
86 private static final String LTTNG_UST_TRACE_TYPE
= "Common Trace Format : LTTng UST Trace";
87 private static final String CUSTOM_TEXT_TRACE_TYPE
= "Custom Text : TmfGeneric";
88 private static final String CUSTOM_XML_TRACE_TYPE
= "Custom XML : Custom XML Log";
90 private static final @NonNull TestTraceInfo CUSTOM_TEXT_LOG
= new TestTraceInfo("ExampleCustomTxt.log", CUSTOM_TEXT_TRACE_TYPE
, 10, "29:52.034");
91 private static final @NonNull TestTraceInfo CUSTOM_XML_LOG
= new TestTraceInfo("ExampleCustomXml.xml", CUSTOM_XML_TRACE_TYPE
, 6, "22:01:20");
92 private static final @NonNull TestTraceInfo LTTNG_KERNEL_TRACE
= new TestTraceInfo("kernel-overlap-testing", LTTNG_KERNEL_TRACE_TYPE
, 1000, "04:32.650 993 664");
93 private static final @NonNull TestTraceInfo SIMPLE_SERVER1_UST_TRACE
= new TestTraceInfo("simple_server-thread1", LTTNG_UST_TRACE_TYPE
, 1000, "04:32.650 993 664");
94 private static final @NonNull TestTraceInfo SIMPLE_SERVER2_UST_TRACE
= new TestTraceInfo("simple_server-thread2", LTTNG_UST_TRACE_TYPE
, 1000, "04:32.650 993 664");
95 private static final @NonNull TestTraceInfo UST_OVERLAP_TESTING_UST_TRACE
= new TestTraceInfo("ust-overlap-testing", LTTNG_UST_TRACE_TYPE
, 1000, "04:32.650 993 664");
97 private static final String CLASHES_DIR_NAME
= "z-clashes";
98 private static final @NonNull TestTraceInfo CLASHES_CUSTOM_TEXT_LOG
= new TestTraceInfo("ExampleCustomTxt.log", CLASHES_DIR_NAME
+ "/ExampleCustomTxt.log", CUSTOM_TEXT_TRACE_TYPE
, 11, "29:52.034");
99 private static final @NonNull TestTraceInfo CLASHES_CUSTOM_XML_LOG
= new TestTraceInfo("ExampleCustomXml.xml", CLASHES_DIR_NAME
+ "/ExampleCustomXml.xml", CUSTOM_XML_TRACE_TYPE
, 7, "22:01:20");
100 private static final @NonNull TestTraceInfo CLASHES_LTTNG_KERNEL_TRACE
= new TestTraceInfo("kernel-overlap-testing", CLASHES_DIR_NAME
+ "/kernel-overlap-testing", LTTNG_KERNEL_TRACE_TYPE
, 1001, "04:32.650 993 664");
101 private static final @NonNull TestTraceInfo CLASHES_SIMPLE_SERVER1_UST_TRACE
= new TestTraceInfo("simple_server-thread1", CLASHES_DIR_NAME
+ "/simple_server-thread1", LTTNG_UST_TRACE_TYPE
, 1001, "04:32.650 993 664");
102 private static final @NonNull TestTraceInfo CLASHES_SIMPLE_SERVER2_UST_TRACE
= new TestTraceInfo("simple_server-thread2", CLASHES_DIR_NAME
+ "/simple_server-thread2", LTTNG_UST_TRACE_TYPE
, 1001, "04:32.650 993 664");
103 private static final @NonNull TestTraceInfo CLASHES_UST_OVERLAP_TESTING_UST_TRACE
= new TestTraceInfo("ust-overlap-testing", CLASHES_DIR_NAME
+ "/ust-overlap-testing", LTTNG_UST_TRACE_TYPE
, 1001, "04:32.650 993 664");
106 private static final @NonNull TestTraceInfo LTTNG_KERNEL_TRACE_METADATA
= new TestTraceInfo(LTTNG_KERNEL_TRACE
.getTraceName(), LTTNG_KERNEL_TRACE
.getTraceName() + "/metadata", LTTNG_KERNEL_TRACE
.getTraceType(), LTTNG_KERNEL_TRACE
.getNbEvents(),
107 LTTNG_KERNEL_TRACE
.getFirstEventTimestamp());
108 private static final @NonNull TestTraceInfo UNRECOGNIZED_LOG
= new TestTraceInfo("unrecognized.log", "", 0, "");
109 private static final @NonNull TestTraceInfo CUSTOM_XML_LOG_AS_TEXT
= new TestTraceInfo("ExampleCustomXml.xml", CUSTOM_TEXT_TRACE_TYPE
, 0, "");
110 private static final @NonNull TestTraceInfo CLASHES_CUSTOM_XML_LOG_AS_TEXT
= new TestTraceInfo("ExampleCustomXml.xml", CLASHES_DIR_NAME
+ "/ExampleCustomXml.xml", CUSTOM_TEXT_TRACE_TYPE
, 0, "");
112 private static final TestTraceInfo
[] ALL_TRACEINFOS
= new TestTraceInfo
[] {
116 SIMPLE_SERVER1_UST_TRACE
,
117 SIMPLE_SERVER2_UST_TRACE
,
118 UST_OVERLAP_TESTING_UST_TRACE
,
120 CLASHES_CUSTOM_TEXT_LOG
,
121 CLASHES_CUSTOM_XML_LOG
,
122 CLASHES_LTTNG_KERNEL_TRACE
,
123 CLASHES_SIMPLE_SERVER1_UST_TRACE
,
124 CLASHES_SIMPLE_SERVER2_UST_TRACE
,
125 CLASHES_UST_OVERLAP_TESTING_UST_TRACE
128 private static final Set
<TestTraceInfo
> CLASHING_TRACEINFOS
= ImmutableSet
.of(
129 CLASHES_CUSTOM_TEXT_LOG
,
130 CLASHES_CUSTOM_XML_LOG
,
131 CLASHES_LTTNG_KERNEL_TRACE
,
132 CLASHES_SIMPLE_SERVER1_UST_TRACE
,
133 CLASHES_SIMPLE_SERVER2_UST_TRACE
,
134 CLASHES_UST_OVERLAP_TESTING_UST_TRACE
);
136 // All normal traces plus the unrecognized trace
137 private static final int NUM_UNIQUE_TRACES
= CLASHING_TRACEINFOS
.size() + 1;
140 private static final File TEST_TRACES_PATH
= new File(new Path(TmfTraceManager
.getTemporaryDirPath()).append("testtraces").toOSString());
141 private static final String DEFAULT_PROJECT_NAME
= "Tracing";
142 private static final String TRACE_PROJECT_NAME
= "test";
143 private static final String MANAGE_CUSTOM_PARSERS_SHELL_TITLE
= "Manage Custom Parsers";
145 private static SWTWorkbenchBot fBot
;
147 /** The Log4j logger instance. */
148 private static final Logger fLogger
= Logger
.getRootLogger();
150 private static String
getPath(String relativePath
) {
151 return new Path(TEST_TRACES_PATH
.getAbsolutePath()).append(relativePath
).toOSString();
157 * @throws IOException
160 public static void init() throws IOException
{
161 TestDirectoryStructureUtil
.generateTraceStructure(TEST_TRACES_PATH
);
163 SWTBotUtils
.initialize();
165 /* Set up for swtbot */
166 SWTBotPreferences
.TIMEOUT
= 20000; /* 20 second timeout */
167 SWTBotPreferences
.KEYBOARD_LAYOUT
= "EN_US";
168 fLogger
.removeAllAppenders();
169 fLogger
.addAppender(new NullAppender());
170 fBot
= new SWTWorkbenchBot();
172 SWTBotUtils
.closeView("Welcome", fBot
);
174 SWTBotUtils
.switchToTracingPerspective();
176 /* Finish waiting for eclipse to load */
177 WaitUtils
.waitForJobs();
178 SWTBotUtils
.createProject(TRACE_PROJECT_NAME
);
179 importCustomParsers();
183 * Test class tear down method.
186 public static void tearDown() {
187 SWTBotUtils
.deleteProject(TRACE_PROJECT_NAME
, fBot
);
188 SWTBotUtils
.deleteProject(DEFAULT_PROJECT_NAME
, fBot
);
189 fLogger
.removeAllAppenders();
193 * Test tear down method.
196 public void afterTest() {
197 SWTBotUtils
.closeSecondaryShells(fBot
);
200 private static void importCustomParsers() {
201 // 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
202 CustomTxtTraceDefinition
[] txtDefinitions
= CustomTxtTraceDefinition
.loadAll(getPath("customParsers/ExampleCustomTxtParser.xml"));
203 txtDefinitions
[0].save();
204 CustomXmlTraceDefinition
[] xmlDefinitions
= CustomXmlTraceDefinition
.loadAll(getPath("customParsers/ExampleCustomXmlParser.xml"));
205 xmlDefinitions
[0].save();
207 SWTBotTreeItem traceFolder
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
208 traceFolder
.contextMenu("Manage Custom Parsers...").click();
209 fBot
.waitUntil(Conditions
.shellIsActive(MANAGE_CUSTOM_PARSERS_SHELL_TITLE
));
210 SWTBotShell shell
= fBot
.shell(MANAGE_CUSTOM_PARSERS_SHELL_TITLE
);
211 SWTBot shellBot
= shell
.bot();
213 // Make sure the custom text trace type is imported
214 shellBot
.list().select(CUSTOM_TEXT_LOG
.getTraceType());
216 // Make sure the custom xml trace type is imported
217 shellBot
.radio("XML").click();
218 shellBot
.list().select(CUSTOM_XML_LOG
.getTraceType());
219 shellBot
.button("Close").click();
220 shellBot
.waitUntil(Conditions
.shellCloses(shell
));
224 * Test that the expected context menu items are there
226 * Action : Trace Folder menu
228 * Procedure :Select the Traces folder and open its context menu
230 * Expected Results: Correct menu opens (Import, Refresh, etc)
233 public void test3_01ContextMenuPresence() {
234 SWTBotTreeItem traceItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
236 final List
<String
> EXPECTED_MENU_LABELS
= ImmutableList
.of(
244 "Import Trace Package...",
245 "Fetch Remote Traces...",
247 "Export Trace Package...",
249 "Manage Custom Parsers...",
250 "Manage XML analyses...",
252 "Apply Time Offset...",
257 List
<String
> menuLabels
= traceItem
.contextMenu().menuItems();
258 for (int i
= 0; i
< menuLabels
.size(); i
++) {
259 assertEquals(EXPECTED_MENU_LABELS
.get(i
), menuLabels
.get(i
));
262 fBot
.closeAllEditors();
266 * Test that the trace import wizard appears
268 * Action : Trace Import Wizard
270 * Procedure : Select Import
272 * Expected Results: Trace Import Wizard appears
275 public void test3_02Import() {
276 SWTBotTreeItem traceItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
278 SWTBotShell shell
= openTraceFoldersImport(traceItem
);
279 shell
.bot().button("Cancel").click();
283 * Test that the trace import wizard can import a single custom text trace
285 * Action : Import single custom text trace (link to workspace)
288 * Procedure : 1) Browse to directory ${local}/traces/import/
289 * 2) Select trace ExampleCustomTxt.log
290 * 3) Keep <Auto Detection>, Select "Import unrecognized traces", unselect "Overwrite existing without warning" and select "Create Links to workspace" and
294 * Expected Results: Imported trace appear in Traces Folder and the Trace Type Tmf Generic is set. Make sure trace can be opened
297 public void test3_03SingleCustomTextTrace() {
298 int optionFlags
= ImportTraceWizardPage
.OPTION_IMPORT_UNRECOGNIZED_TRACES
| ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
299 testSingleTrace(CUSTOM_TEXT_LOG
, optionFlags
);
304 * Action : Import Single custom XML trace (link to workspace)
308 * Procedure : redo 3.1-3.3 but this time select ExampleCustomXml.xml
311 * Expected Results: Imported trace appear in Traces Folder and the Trace
312 * Type "Custom XML log" is set. Make sure that trace can be opened
315 public void test3_04SingleCustomXmlTrace() {
316 int optionFlags
= ImportTraceWizardPage
.OPTION_IMPORT_UNRECOGNIZED_TRACES
| ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
317 testSingleTrace(CUSTOM_XML_LOG
, optionFlags
);
322 * Action : Import LTTng Kernel CTF trace (link to workspace)
326 * Procedure : redo 3.1-3.3 but this time select directory kernel-overlap-testing/
329 * Expected Results: Imported trace appear in Traces Folder and the Trace
330 * Type "LTTng Kernel" is set. Make sure that trace can be opened
333 public void test3_05SingleCtfTrace() {
334 int optionFlags
= ImportTraceWizardPage
.OPTION_IMPORT_UNRECOGNIZED_TRACES
| ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
335 testSingleTrace(LTTNG_KERNEL_TRACE
, optionFlags
);
340 * Action : Rename + copy import
344 * Procedure : 1) redo 3.3, 3.4, 3.5. However, Unselect "Create Links to workspace"
345 * 2) When dialog box appear select Rename
348 * Expected Results: Traces are imported with new name that has a suffix (2)
349 * at the end. Make sure that imported traces are copied to the project.
352 public void test3_06RenameCopyImport() {
353 testRenameCopyImport(CUSTOM_TEXT_LOG
);
354 testRenameCopyImport(CUSTOM_XML_LOG
);
355 testRenameCopyImport(LTTNG_KERNEL_TRACE
);
358 private static void testRenameCopyImport(TestTraceInfo traceInfo
) {
359 int optionFlags
= ImportTraceWizardPage
.OPTION_IMPORT_UNRECOGNIZED_TRACES
;
360 importTrace(optionFlags
, ImportConfirmation
.RENAME
, traceInfo
.getTraceName());
361 String renamed
= toRenamedName(traceInfo
.getTraceName());
362 verifyTrace(traceInfo
, optionFlags
, renamed
);
367 * Action : Overwrite + copy import
371 * Procedure : 1) redo 3.3, 3.4, 3.5. However, Unselect "Create Links to workspace"
372 * 2) When dialog box appear select Overwrite
375 * Expected Results: Existing traces are deleted and new traces are
376 * imported. Make sure that imported traces are copied to the project and
380 public void test3_07OverwriteCopyImport() {
381 testOverwriteCopyImport(CUSTOM_TEXT_LOG
);
382 testOverwriteCopyImport(CUSTOM_XML_LOG
);
383 testOverwriteCopyImport(LTTNG_KERNEL_TRACE
);
386 private static void testOverwriteCopyImport(TestTraceInfo traceInfo
) {
387 String traceName
= traceInfo
.getTraceName();
388 SWTBotTreeItem traceItem
= SWTBotUtils
.getTreeItem(fBot
, SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
), traceName
);
389 String lastModified
= getTraceProperty(traceItem
, PROP_LAST_MODIFIED_PROPERTY
);
390 int optionFlags
= ImportTraceWizardPage
.OPTION_IMPORT_UNRECOGNIZED_TRACES
;
391 importTrace(optionFlags
, ImportConfirmation
.OVERWRITE
, traceName
);
392 verifyTrace(traceInfo
, optionFlags
);
394 assertNotEquals(lastModified
, getTraceProperty(traceItem
, PROP_LAST_MODIFIED_PROPERTY
));
403 * Procedure : 1) redo 3.3, 3.4, 3.5. However, Unselect "Create Links to workspace"
404 * 2) When dialog box appear select Skip
407 * Expected Results: Make sure that no new trace is imported
410 public void test3_08SkipImport() {
411 testSkipImport(CUSTOM_TEXT_LOG
);
412 testSkipImport(CUSTOM_XML_LOG
);
413 testSkipImport(LTTNG_KERNEL_TRACE
);
416 private static void testSkipImport(TestTraceInfo traceInfo
) {
417 String traceName
= traceInfo
.getTraceName();
418 SWTBotTreeItem traceItem
= SWTBotUtils
.getTreeItem(fBot
, SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
), traceName
);
419 String lastModified
= getTraceProperty(traceItem
, PROP_LAST_MODIFIED_PROPERTY
);
420 int optionFlags
= ImportTraceWizardPage
.OPTION_IMPORT_UNRECOGNIZED_TRACES
;
421 importTrace(optionFlags
, ImportConfirmation
.SKIP
, traceName
);
422 verifyTrace(traceInfo
, optionFlags
);
424 assertEquals(lastModified
, getTraceProperty(traceItem
, PROP_LAST_MODIFIED_PROPERTY
));
429 * Action : Default overwrite
433 * Procedure : 1) redo 3.3, 3.4, 3.5. However, Unselect "Create Links to workspace" and select "Overwrite existing without warning"
436 * Expected Results: Make sure that no dialog box appears (for renaming,
437 * overwriting, skipping) and existing traces are overwritten). Make sure
438 * trace can be opened
441 public void test3_09OverwriteOptionImport() {
442 testOverwriteOptionImport(CUSTOM_TEXT_LOG
);
443 testOverwriteOptionImport(CUSTOM_XML_LOG
);
444 testOverwriteOptionImport(LTTNG_KERNEL_TRACE
);
447 private static void testOverwriteOptionImport(TestTraceInfo traceInfo
) {
448 String traceName
= traceInfo
.getTraceName();
449 SWTBotTreeItem traceItem
= SWTBotUtils
.getTreeItem(fBot
, SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
), traceName
);
450 String lastModified
= getTraceProperty(traceItem
, PROP_LAST_MODIFIED_PROPERTY
);
452 int optionFlags
= ImportTraceWizardPage
.OPTION_IMPORT_UNRECOGNIZED_TRACES
| ImportTraceWizardPage
.OPTION_OVERWRITE_EXISTING_RESOURCES
;
453 importTrace(optionFlags
, ImportConfirmation
.CONTINUE
, traceName
);
454 verifyTrace(traceInfo
, optionFlags
);
456 assertNotEquals(lastModified
, getTraceProperty(traceItem
, PROP_LAST_MODIFIED_PROPERTY
));
461 * Action : Import unrecognized
465 * Procedure : 1) Open Import wizard (see 3.1-3.2)
466 * 2) Browse to directory ${local}/traces/import
467 * 3) Select trace unrecognized.log
468 * 4) Keep <Auto Detection>, Select "Import unrecognized traces", unselect "Overwrite existing without warning" and select "Create Links to workspace" and
472 * Expected Results: unrecognized.log is imported with trace type unknown.
473 * The default text file icon is displayed. The trace, when opened, is
474 * displayed in the text editor.
477 public void test3_10ImportUnrecognized() {
478 String traceName
= UNRECOGNIZED_LOG
.getTraceName();
479 int optionFlags
= ImportTraceWizardPage
.OPTION_IMPORT_UNRECOGNIZED_TRACES
| ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
480 importTrace(optionFlags
, traceName
);
481 verifyTrace(UNRECOGNIZED_LOG
, optionFlags
);
486 * Action : Import unrecognized (ignore)
490 * Procedure : 1) redo 3.10, however unselect "Import unrecognized traces"
493 * Expected Results: unrecognized.log is not imported
496 public void test3_11ImportUnrecognizedIgnore() {
497 String traceName
= UNRECOGNIZED_LOG
.getTraceName();
498 SWTBotTreeItem tracesFolderItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
499 int numTraces
= tracesFolderItem
.getItems().length
;
501 SWTBotTreeItem traceItem
= SWTBotUtils
.getTreeItem(fBot
, tracesFolderItem
, traceName
);
502 String lastModified
= getTraceProperty(traceItem
, PROP_LAST_MODIFIED_PROPERTY
);
504 int optionFlags
= ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
505 importTrace(optionFlags
, traceName
);
506 verifyTrace(UNRECOGNIZED_LOG
, optionFlags
);
508 assertEquals(lastModified
, getTraceProperty(traceItem
, PROP_LAST_MODIFIED_PROPERTY
));
509 assertEquals(numTraces
, tracesFolderItem
.getItems().length
);
514 * Action : Import CTF trace by selection metadata file only
518 * Procedure : 1) Redo 3.5, However only select metadata file instead of directory trace
521 * Expected Results: Imported trace appear in Traces Folder and the Trace
522 * Type "LTTng Kernel" is set. Make sure that trace can be opened
525 public void test3_12ImportCtfWithMetadataSelection() {
526 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
527 testSingleTrace(LTTNG_KERNEL_TRACE_METADATA
, ImportTraceWizardPage
.OPTION_IMPORT_UNRECOGNIZED_TRACES
| ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
);
532 * Action : Recursive import with auto-detection (Rename All)
536 * Procedure : 1) Open Import wizard (see 3.1-3.2)
537 * 2) Browse to directory ${local}/traces/import
538 * 3) select directory import
539 * 4) Keep <Auto Detection>, Select "Import unrecognized traces", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure"
541 * 6) When dialog appears select "Rename All"
544 * Expected Results: All Traces are imported with respective trace type set.
545 * Traces with name clashes are imported with suffix (2). 1 trace
546 * (unrecognized.log) is imported with trace type unknown. Make sure that
547 * traces can be opened which have a trace type set. The unknown trace type
548 * should open with the text editor.
551 public void test3_13ImportRecursiveAutoRenameAll() {
552 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
554 int optionFlags
= ImportTraceWizardPage
.OPTION_IMPORT_UNRECOGNIZED_TRACES
| ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
555 importTrace(optionFlags
, ImportConfirmation
.RENAME_ALL
, "");
557 for (TestTraceInfo info
: ALL_TRACEINFOS
) {
558 String traceName
= info
.getTraceName();
559 if (CLASHING_TRACEINFOS
.contains(info
)) {
560 traceName
= toRenamedName(traceName
);
562 verifyTrace(info
, optionFlags
, traceName
);
565 // Also check unrecognized file
566 verifyTrace(UNRECOGNIZED_LOG
, optionFlags
);
571 * Action : Recursive import with auto-detection (Overwrite All)
575 * Procedure : 1) Open Import wizard (see 3.1-3.2)
576 * 2) Browse to directory ${local}/traces/import/
577 * 3) select directory import
578 * 4) Keep <Auto Detection>, Select "Import unrecognized traces", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure"
580 * 6) When dialog appears select Overwrite All"
583 * Expected Results: All Traces are imported with respective trace type set.
584 * Traces with name clashes are overwritten . 1 trace (unrecognized.log) is
585 * imported with trace type unknown. Make sure that traces can be opened
586 * which have a trace type set. The unknown trace type should open with the
590 public void test3_14ImportRecursiveAutoOverwriteAll() {
591 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
593 int optionFlags
= ImportTraceWizardPage
.OPTION_IMPORT_UNRECOGNIZED_TRACES
| ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
594 importTrace(optionFlags
, ImportConfirmation
.OVERWRITE_ALL
, "");
596 for (TestTraceInfo info
: CLASHING_TRACEINFOS
) {
597 verifyTrace(info
, optionFlags
);
600 // All traces should have clashed/overwritten (plus the unrecognized trace)
601 SWTBotTreeItem tracesFolderItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
602 assertEquals(NUM_UNIQUE_TRACES
, tracesFolderItem
.getItems().length
);
604 // Also check unrecognized file
605 verifyTrace(UNRECOGNIZED_LOG
, optionFlags
);
610 * Action : Recursive import with auto-detection (Skip All)
614 * Procedure : 1) Open Import wizard (see 3.1-3.2)
615 * 2) Browse to directory ${local}/traces/import/
616 * 3) select directory import
617 * 4) Keep <Auto Detection>, Select "Import unrecognized traces", unselect "Overwrite existing without warning" and select "Create Links to workspace" and uncheck "preserve folder structure"
619 * 6) When dialog appears select Skip All"
622 * Expected Results: All Traces are imported with respective trace type set. Traces with name
623 * clashes are not imported. 1 trace (unrecognized.log) is imported with
624 * trace type unknown. The unknown trace type should open with the text
628 public void test3_15ImportRecursiveAutoSkipAll() {
629 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
631 int optionFlags
= ImportTraceWizardPage
.OPTION_IMPORT_UNRECOGNIZED_TRACES
| ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
632 importTrace(optionFlags
, ImportConfirmation
.SKIP_ALL
, "");
634 SWTBotTreeItem tracesFolderItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
635 for (TestTraceInfo info
: ALL_TRACEINFOS
) {
636 if (!CLASHING_TRACEINFOS
.contains(info
)) {
637 verifyTrace(info
, optionFlags
);
641 // All traces should have skipped (plus the unrecognized trace)
642 assertEquals(NUM_UNIQUE_TRACES
, tracesFolderItem
.getItems().length
);
644 // Also check unrecognized file
645 verifyTrace(UNRECOGNIZED_LOG
, optionFlags
);
650 * Action : Recursive import with auto-detection (test rename, overwrite and
655 * Procedure : 1) Open Import wizard (see 3.1-3.2)
656 * 2) Browse to directory ${local}/traces/import/
657 * 3) select directory import
658 * 4) Keep <Auto Detection>, Select "Import unrecognized traces", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure"
660 * 6) When dialog appears select "Rename"
661 * 7) When dialog appears select "Overwrite"
662 * 8) When dialog appears select "Skip"
665 * Expected Results: All Traces are imported with respective trace type set. Traces with name
666 * clashes are either renamed, overwritten or skipped as per dialog action.
667 * Make sure that traces can be opened which have trace type set. The
668 * unknown trace type should open with the text editor.
671 public void test3_16ImportRecursiveAutoRenameOverwriteSkip() {
672 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
674 Supplier
<ImportConfirmation
> confirmationSupplier
= new ImportConfirmationSupplier(
675 ImportConfirmation
.RENAME
, ImportConfirmation
.OVERWRITE
, ImportConfirmation
.SKIP
);
676 int optionFlags
= ImportTraceWizardPage
.OPTION_IMPORT_UNRECOGNIZED_TRACES
| ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
677 importTrace(optionFlags
, confirmationSupplier
, LTTNG_KERNEL_TRACE
.getTracePath(), CLASHES_LTTNG_KERNEL_TRACE
.getTracePath(), SIMPLE_SERVER1_UST_TRACE
.getTracePath(), CLASHES_SIMPLE_SERVER1_UST_TRACE
.getTracePath(),
678 SIMPLE_SERVER2_UST_TRACE
.getTracePath(), CLASHES_SIMPLE_SERVER2_UST_TRACE
.getTracePath(), UNRECOGNIZED_LOG
.getTracePath());
680 verifyTrace(LTTNG_KERNEL_TRACE
, optionFlags
);
683 String renamed
= toRenamedName(CLASHES_LTTNG_KERNEL_TRACE
.getTraceName());
684 verifyTrace(CLASHES_LTTNG_KERNEL_TRACE
, optionFlags
, renamed
);
687 verifyTrace(CLASHES_SIMPLE_SERVER1_UST_TRACE
, optionFlags
);
690 verifyTrace(SIMPLE_SERVER2_UST_TRACE
, optionFlags
);
692 // Also check unrecognized file
693 verifyTrace(UNRECOGNIZED_LOG
, optionFlags
);
698 * Action : Recursive import with specific trace type 1 (Skip All) skip)
702 * Procedure : 1) Open Import wizard
703 * 2) Browse to directory ${local}/traces/import/
704 * 3) Select directory import
705 * 4) Select trace type "Generic CTF Trace", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure"and
707 * 6) When dialog appears select Skip All"
710 * Expected Results: After selecting trace type, verify that button "Import
711 * unrecognized traces" is disabled. 4 CTF traces are imported with trace
712 * type "Generic CTF Trace" . Make sure that these traces can be opened
715 public void test3_17ImportRecursiveSpecifyTraceTypeCTF() {
716 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
718 int optionFlags
= ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
719 importTrace(GENERIC_CTF_TRACE_TYPE
, optionFlags
, ImportConfirmation
.SKIP_ALL
, "");
721 final TestTraceInfo
[] CTF_TRACEINFOS
= new TestTraceInfo
[] {
723 SIMPLE_SERVER1_UST_TRACE
,
724 SIMPLE_SERVER2_UST_TRACE
,
725 UST_OVERLAP_TESTING_UST_TRACE
727 for (TestTraceInfo info
: CTF_TRACEINFOS
) {
728 verifyTrace(info
, optionFlags
, info
.getTraceName(), GENERIC_CTF_TRACE_TYPE
);
731 SWTBotTreeItem tracesFolderItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
732 assertEquals(CTF_TRACEINFOS
.length
, tracesFolderItem
.getItems().length
);
737 * Action : Recursive import with specific trace type 2 (Skip All)
741 * Procedure : 1) Open Import wizard (see 3.1-3.2)
742 * 2) Browse to directory ${local}/traces/import/
743 * 3) Select directory import
744 * 4) Select trace type "LTTng Kernel Trace", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure"
746 * 6) When dialog appears select Skip All"
749 * Expected Results: After selecting trace type, verify that button "Import
750 * unrecognized traces" is disabled. One LTTng Kernel trace is imported with
751 * trace type "LTTng Kernel Trace". Make sure that this trace can be opened.
754 public void test3_18ImportRecursiveSpecifyTraceTypeKernel() {
755 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
757 int optionFlags
= ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
758 importTrace(LTTNG_KERNEL_TRACE_TYPE
, optionFlags
, ImportConfirmation
.SKIP_ALL
, "");
760 verifyTrace(LTTNG_KERNEL_TRACE
, optionFlags
);
762 SWTBotTreeItem tracesFolderItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
763 assertEquals(1, tracesFolderItem
.getItems().length
);
768 * Action : Recursive import with specific trace type 3 (Skip All)
772 * Procedure : 1) Open Import wizard
773 * 2) Browse to directory ${local}/traces/import/
774 * 3) Select directory import
775 * 4) Select trace type "LTTng UST Trace", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure"
777 * 6) When dialog appears select Skip All"
780 * Expected Results: After selecting trace type, verify that button "Import
781 * unrecognized traces" is disabled. 3 LTTng UST traces are imported with
782 * trace type "LTTng UST Trace". Make sure that these traces can be opened.
785 public void test3_19ImportRecursiveSpecifyTraceTypeUST() {
786 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
788 int optionFlags
= ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
789 importTrace(LTTNG_UST_TRACE_TYPE
, optionFlags
, ImportConfirmation
.SKIP_ALL
, "");
791 final TestTraceInfo
[] UST_TRACEINFOS
= new TestTraceInfo
[] {
792 SIMPLE_SERVER1_UST_TRACE
,
793 SIMPLE_SERVER2_UST_TRACE
,
794 UST_OVERLAP_TESTING_UST_TRACE
796 for (TestTraceInfo info
: UST_TRACEINFOS
) {
797 verifyTrace(info
, optionFlags
);
800 SWTBotTreeItem tracesFolderItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
801 assertEquals(UST_TRACEINFOS
.length
, tracesFolderItem
.getItems().length
);
806 * Action : Recursive import with specific trace type 4 (Skip All)
810 * Procedure : 1) Open Import wizard (see 3.1-3.2)
811 * 2) Browse to directory ${local}/traces/import/
812 * 3) select directory import
813 * 4) Select trace type "Tmf Generic", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure"
815 * 6) When dialog appears select Skip All"
818 * Expected Results: All text files in directories are imported as trace and
819 * trace type "Tmf Generic" is set. Note that trace type validation only
820 * checks for file exists and that file is not a directory. Make sure that
821 * these traces can be opened. However traces with wrong trace type won't
822 * show any events in the table.
825 public void test3_20ImportRecursiveSpecifyTraceTypeCustomText() {
826 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
828 int optionFlags
= ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
829 importTrace(CUSTOM_TEXT_TRACE_TYPE
, optionFlags
, ImportConfirmation
.SKIP_ALL
, "");
830 verifyTrace(CUSTOM_TEXT_LOG
, optionFlags
);
832 final TestTraceInfo
[] TEXT_BASED_TRACEINFOS
= new TestTraceInfo
[] {
834 CUSTOM_XML_LOG_AS_TEXT
,
837 for (TestTraceInfo info
: TEXT_BASED_TRACEINFOS
) {
838 verifyTrace(info
, optionFlags
, info
.getTraceName(), CUSTOM_TEXT_TRACE_TYPE
);
841 SWTBotTreeItem tracesFolderItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
842 assertEquals(TEXT_BASED_TRACEINFOS
.length
, tracesFolderItem
.getItems().length
);
846 * Action : Test the import wizard from workbench menu with project selected
849 * Procedure : 1) Select Project "Test" in Project Explorer view
850 * 2) Open import wizard from menu File > Import... > Tracing > Trace Import
851 * 3) Browse to directory ${local}/traces/import/
852 * 4) Select trace ExampleCustomTxt.log
853 * 5) Keep <Auto Detection>, select "Create Links to workspace" and
857 * Expected Results: Verify that trace is imported to "Test" project and can be opened.
860 public void test3_21ImportFromMenuProjectSelected() {
861 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
863 SWTBotUtils
.selectProject(fBot
, TRACE_PROJECT_NAME
);
864 SWTBotShell shell
= openWorkbenchMenuImport();
865 int optionFlags
= ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
866 importTrace(shell
, null, null, optionFlags
, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG
.getTracePath());
867 verifyTrace(CUSTOM_TEXT_LOG
, optionFlags
);
871 * Action : Test the import wizard from workbench menu with no project selected
874 * Procedure : 1) Clear selection in Project Explorer view
875 * 2) Open import wizard from menu File > Import... > Tracing > Trace Import
876 * 3) Browse to directory ${local}/traces/import/
877 * 4) Select trace ExampleCustomTxt.log
878 * 5) Keep <Auto Detection>, select "Create Links to workspace" and
882 * Expected Results: Verify that trace is imported to default "Tracing" project and can be opened.
885 public void test3_22ImportFromMenuProjectNotSelected() {
886 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
888 SWTBotView projectExplorerBot
= fBot
.viewByTitle("Project Explorer");
889 projectExplorerBot
.show();
890 projectExplorerBot
.bot().waitUntil(Conditions
.widgetIsEnabled(projectExplorerBot
.bot().tree()));
891 projectExplorerBot
.bot().tree().unselect();
892 SWTBotShell shell
= openWorkbenchMenuImport();
893 int optionFlags
= ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
894 importTrace(shell
, null, null, optionFlags
, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG
.getTracePath());
895 verifyTrace(CUSTOM_TEXT_LOG
, optionFlags
, CUSTOM_TEXT_LOG
.getTraceName(), CUSTOM_TEXT_LOG
.getTraceType(), DEFAULT_PROJECT_NAME
);
896 SWTBotUtils
.deleteProject(DEFAULT_PROJECT_NAME
, fBot
);
901 * Action : Recursive import with preserved folder structure
905 * Procedure : 0) Delete all traces in project
906 * 1) Open Import wizard
907 * 2) Browse to directory ${local}/traces/import/
908 * 3) Select directory import
909 * 4) Select trace type "Tmf Generic", unselect "Overwrite existing without warning", select "Create Links to workspace" and select "Preserve Folder Structure"
913 * Expected Results: All matching traces are imported with trace type set.
914 * The folder "clashes" is imported with traces inside. Make sure that the
915 * traces can be opened.
918 public void test3_29ImportRecursivePreserve() {
919 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
921 int optionFlags
= ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
| ImportTraceWizardPage
.OPTION_PRESERVE_FOLDER_STRUCTURE
;
922 importTrace(CUSTOM_TEXT_TRACE_TYPE
, optionFlags
, ImportConfirmation
.CONTINUE
, "");
924 verifyTrace(CUSTOM_TEXT_LOG
, optionFlags
, CUSTOM_TEXT_LOG
.getTraceName(), CUSTOM_TEXT_TRACE_TYPE
);
925 verifyTrace(CUSTOM_XML_LOG_AS_TEXT
, optionFlags
, CUSTOM_XML_LOG_AS_TEXT
.getTraceName(), CUSTOM_TEXT_TRACE_TYPE
);
926 verifyTrace(UNRECOGNIZED_LOG
, optionFlags
, UNRECOGNIZED_LOG
.getTraceName(), CUSTOM_TEXT_TRACE_TYPE
);
927 verifyTrace(CLASHES_CUSTOM_TEXT_LOG
, optionFlags
, CLASHES_CUSTOM_TEXT_LOG
.getTracePath(), CUSTOM_TEXT_TRACE_TYPE
);
928 verifyTrace(CLASHES_CUSTOM_XML_LOG_AS_TEXT
, optionFlags
, CLASHES_CUSTOM_XML_LOG_AS_TEXT
.getTracePath(), CUSTOM_TEXT_TRACE_TYPE
);
930 SWTBotTreeItem tracesFolderItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
931 assertEquals(4, tracesFolderItem
.getItems().length
);
932 SWTBotTreeItem clashesFolderItem
= SWTBotUtils
.getTraceProjectItem(fBot
, tracesFolderItem
, CLASHES_DIR_NAME
);
933 assertEquals(2, clashesFolderItem
.getItems().length
);
938 * Action : Recursive import with preserved folder structure (Skip All)
942 * Procedure : 1) Open Import wizard
943 * 2) Browse to directory ${local}/traces/import/
944 * 3) Select directory import
945 * 4) Select trace type "Tmf Generic", unselect "Overwrite existing without warning", select "Create Links to workspace" and select "Preserve Folder Structure"
947 * 6) When dialog appears select "Skip All"
950 * Expected Results: The wizard should finish quickly as no trace will be
951 * imported. Make sure that the traces can be opened.
954 public void test3_30ImportRecursivePreserveSkipAll() {
955 int optionFlags
= ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
| ImportTraceWizardPage
.OPTION_PRESERVE_FOLDER_STRUCTURE
;
956 importTrace(CUSTOM_TEXT_TRACE_TYPE
, optionFlags
, ImportConfirmation
.SKIP_ALL
, "");
958 verifyTrace(CUSTOM_TEXT_LOG
, optionFlags
, CUSTOM_TEXT_LOG
.getTraceName(), CUSTOM_TEXT_TRACE_TYPE
);
959 verifyTrace(CUSTOM_XML_LOG_AS_TEXT
, optionFlags
, CUSTOM_XML_LOG_AS_TEXT
.getTraceName(), CUSTOM_TEXT_TRACE_TYPE
);
960 verifyTrace(UNRECOGNIZED_LOG
, optionFlags
, UNRECOGNIZED_LOG
.getTraceName(), CUSTOM_TEXT_TRACE_TYPE
);
961 verifyTrace(CLASHES_CUSTOM_TEXT_LOG
, optionFlags
, CLASHES_CUSTOM_TEXT_LOG
.getTracePath(), CUSTOM_TEXT_TRACE_TYPE
);
962 verifyTrace(CLASHES_CUSTOM_XML_LOG_AS_TEXT
, optionFlags
, CLASHES_CUSTOM_XML_LOG_AS_TEXT
.getTracePath(), CUSTOM_TEXT_TRACE_TYPE
);
964 SWTBotTreeItem tracesFolderItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
965 assertEquals(4, tracesFolderItem
.getItems().length
);
966 SWTBotTreeItem clashesFolderItem
= SWTBotUtils
.getTraceProjectItem(fBot
, tracesFolderItem
, CLASHES_DIR_NAME
);
967 assertEquals(2, clashesFolderItem
.getItems().length
);
968 //TOOD: verify that traces were actually skipped
973 * Action : Recursive import with preserved folder structure (Rename All)
977 * Procedure : 1) Open Import wizard
978 * 2) Browse to directory ${local}/traces/import/
979 * 3) Select directory import
980 * 4) Select trace type "Tmf Generic", unselect "Overwrite existing without warning", select "Create Links to workspace" and select "Preserve Folder Structure"
982 * 6) When dialog appears select "Rename All"
985 * Expected Results: All matching traces are imported with trace type set.
986 * The traces are renamed with suffix (2). The folder "clashes" is imported
987 * with traces inside. Make sure that the traces can be opened.
990 public void test3_31ImportRecursivePreserveRenameAll() {
991 int optionFlags
= ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
| ImportTraceWizardPage
.OPTION_PRESERVE_FOLDER_STRUCTURE
;
992 importTrace(CUSTOM_TEXT_TRACE_TYPE
, optionFlags
, ImportConfirmation
.RENAME_ALL
, "");
994 verifyTrace(CUSTOM_TEXT_LOG
, optionFlags
, toRenamedName(CUSTOM_TEXT_LOG
.getTraceName()), CUSTOM_TEXT_TRACE_TYPE
);
995 verifyTrace(CUSTOM_XML_LOG_AS_TEXT
, optionFlags
, toRenamedName(CUSTOM_XML_LOG_AS_TEXT
.getTraceName()), CUSTOM_TEXT_TRACE_TYPE
);
996 verifyTrace(UNRECOGNIZED_LOG
, optionFlags
, toRenamedName(UNRECOGNIZED_LOG
.getTraceName()), CUSTOM_TEXT_TRACE_TYPE
);
997 verifyTrace(CLASHES_CUSTOM_TEXT_LOG
, optionFlags
, toRenamedName(CLASHES_CUSTOM_TEXT_LOG
.getTracePath()), CUSTOM_TEXT_TRACE_TYPE
);
998 verifyTrace(CLASHES_CUSTOM_XML_LOG_AS_TEXT
, optionFlags
, toRenamedName(CLASHES_CUSTOM_XML_LOG_AS_TEXT
.getTracePath()), CUSTOM_TEXT_TRACE_TYPE
);
1000 SWTBotTreeItem tracesFolderItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
1001 assertEquals(7, tracesFolderItem
.getItems().length
);
1002 SWTBotTreeItem clashesFolderItem
= SWTBotUtils
.getTraceProjectItem(fBot
, tracesFolderItem
, CLASHES_DIR_NAME
);
1003 assertEquals(4, clashesFolderItem
.getItems().length
);
1008 * Action : Delete with mixed selection of traces and folder
1012 * Procedure : 0) Delete all traces in project
1013 * 1) Create two trace folders under the "Traces" folder
1014 * 2) Import 2 traces under each folder
1015 * 3) Open all 4 traces.
1016 * 4) Select the trace in the first folder and the second folder in the Project Explorer view
1017 * 5) Right-click, Delete. Click Yes.
1020 * Expected Results: A dialog should ask the user to confirm deletion of the
1021 * selected elements. Clicking OK should remove all that was selected. The
1022 * editor of the 3 deleted traces should be closed automatically with one
1023 * remaining editor opened.
1026 public void test3_32DeleteTraceAndFolder() {
1027 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
1029 SWTBotTreeItem tracesFolder
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
1030 tracesFolder
.contextMenu().menu("New Folder...").click();
1031 SWTBot newFolderShellBot
= fBot
.shell("New Folder").bot();
1032 newFolderShellBot
.text().setText("FolderA");
1033 newFolderShellBot
.button("OK").click();
1034 tracesFolder
.contextMenu().menu("New Folder...").click();
1035 newFolderShellBot
= fBot
.shell("New Folder").bot();
1036 newFolderShellBot
.text().setText("FolderB");
1037 newFolderShellBot
.button("OK").click();
1039 int optionFlags
= ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
1040 SWTBotTreeItem traceFolder
= SWTBotUtils
.getTraceProjectItem(fBot
, tracesFolder
, "FolderA");
1041 SWTBotShell shell
= openTraceFoldersImport(traceFolder
);
1042 importTrace(shell
, null, null, optionFlags
, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG
.getTracePath(), LTTNG_KERNEL_TRACE
.getTracePath());
1043 verifyTrace(CUSTOM_TEXT_LOG
, optionFlags
, "FolderA/" + CUSTOM_TEXT_LOG
.getTraceName(), CUSTOM_TEXT_TRACE_TYPE
);
1044 verifyTrace(LTTNG_KERNEL_TRACE
, optionFlags
, "FolderA/" + LTTNG_KERNEL_TRACE
.getTraceName(), LTTNG_KERNEL_TRACE_TYPE
);
1046 traceFolder
= SWTBotUtils
.getTraceProjectItem(fBot
, tracesFolder
, "FolderB");
1047 shell
= openTraceFoldersImport(traceFolder
);
1048 importTrace(shell
, null, null, optionFlags
, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG
.getTracePath(), LTTNG_KERNEL_TRACE
.getTracePath());
1049 verifyTrace(CUSTOM_TEXT_LOG
, optionFlags
, "FolderB/" + CUSTOM_TEXT_LOG
.getTraceName(), CUSTOM_TEXT_TRACE_TYPE
);
1050 verifyTrace(LTTNG_KERNEL_TRACE
, optionFlags
, "FolderB/" + LTTNG_KERNEL_TRACE
.getTraceName(), LTTNG_KERNEL_TRACE_TYPE
);
1052 SWTBotTree tree
= fBot
.viewByTitle("Project Explorer").bot().tree();
1053 SWTBotTreeItem folderAItem
= SWTBotUtils
.getTraceProjectItem(fBot
, tracesFolder
, "FolderA");
1054 SWTBotTreeItem traceItem
= SWTBotUtils
.getTraceProjectItem(fBot
, folderAItem
, CUSTOM_TEXT_LOG
.getTraceName());
1055 SWTBotTreeItem folderBItem
= SWTBotUtils
.getTraceProjectItem(fBot
, tracesFolder
, "FolderB");
1056 tree
.select(traceItem
, folderBItem
);
1057 tree
.contextMenu().menu("Delete").click();
1058 SWTBot deleteConfirmationShellBot
= fBot
.shell("Confirm Delete").bot();
1059 deleteConfirmationShellBot
.button("Yes").click();
1060 fBot
.waitWhile(ConditionHelpers
.isEditorOpened(fBot
, "FolderA/" + CUSTOM_TEXT_LOG
.getTraceName()));
1061 fBot
.waitWhile(ConditionHelpers
.isEditorOpened(fBot
, "FolderB/" + CUSTOM_TEXT_LOG
.getTraceName()));
1062 fBot
.waitWhile(ConditionHelpers
.isEditorOpened(fBot
, "FolderB/" + LTTNG_KERNEL_TRACE
.getTraceName()));
1063 fBot
.waitUntil(ConditionHelpers
.isEditorOpened(fBot
, "FolderA/" + LTTNG_KERNEL_TRACE
.getTraceName()));
1064 assertEquals(1, tracesFolder
.getNodes().size());
1065 assertEquals(1, folderAItem
.getNodes().size());
1070 * Action : Delete with multiple folders
1074 * Procedure : 0) Delete all traces in project
1075 * 1) Create two trace folders under the "Traces" folder
1076 * 2) Import a trace under each folder
1077 * 3) Open both traces.
1078 * 4) Select both folders in the Project Explorer view
1079 * 5) Right-click, Delete. Click Yes.
1082 * Expected Results: A dialog should ask the user to confirm deletion of the
1083 * selected elements. Clicking OK should remove all that was selected. The
1084 * editor of the 3 deleted traces should be closed automatically with one
1085 * remaining editor opened.
1088 public void test3_33DeleteMultipleFolders() {
1089 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
1091 SWTBotTreeItem tracesFolder
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
1092 tracesFolder
.contextMenu().menu("New Folder...").click();
1093 SWTBot newFolderShellBot
= fBot
.shell("New Folder").bot();
1094 newFolderShellBot
.text().setText("FolderA");
1095 newFolderShellBot
.button("OK").click();
1096 tracesFolder
.contextMenu().menu("New Folder...").click();
1097 newFolderShellBot
= fBot
.shell("New Folder").bot();
1098 newFolderShellBot
.text().setText("FolderB");
1099 newFolderShellBot
.button("OK").click();
1101 int optionFlags
= ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
1102 SWTBotTreeItem traceFolder
= SWTBotUtils
.getTraceProjectItem(fBot
, tracesFolder
, "FolderA");
1103 SWTBotShell shell
= openTraceFoldersImport(traceFolder
);
1104 importTrace(shell
, null, null, optionFlags
, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG
.getTracePath());
1105 verifyTrace(CUSTOM_TEXT_LOG
, optionFlags
, "FolderA/" + CUSTOM_TEXT_LOG
.getTraceName(), CUSTOM_TEXT_TRACE_TYPE
);
1107 traceFolder
= SWTBotUtils
.getTraceProjectItem(fBot
, tracesFolder
, "FolderB");
1108 shell
= openTraceFoldersImport(traceFolder
);
1109 importTrace(shell
, null, null, optionFlags
, new ImportConfirmationSupplier(), LTTNG_KERNEL_TRACE
.getTracePath());
1110 verifyTrace(LTTNG_KERNEL_TRACE
, optionFlags
, "FolderB/" + LTTNG_KERNEL_TRACE
.getTraceName(), LTTNG_KERNEL_TRACE_TYPE
);
1112 SWTBotTree tree
= fBot
.viewByTitle("Project Explorer").bot().tree();
1113 SWTBotTreeItem folderAItem
= SWTBotUtils
.getTraceProjectItem(fBot
, tracesFolder
, "FolderA");
1114 SWTBotTreeItem folderBItem
= SWTBotUtils
.getTraceProjectItem(fBot
, tracesFolder
, "FolderB");
1115 tree
.select(folderAItem
, folderBItem
);
1116 tree
.contextMenu().menu("Delete").click();
1117 SWTBot deleteConfirmationShellBot
= fBot
.shell("Confirm Delete").bot();
1118 deleteConfirmationShellBot
.button("Yes").click();
1119 fBot
.waitWhile(ConditionHelpers
.isEditorOpened(fBot
, "FolderA/" + CUSTOM_TEXT_LOG
.getTraceName()));
1120 fBot
.waitWhile(ConditionHelpers
.isEditorOpened(fBot
, "FolderB/" + LTTNG_KERNEL_TRACE
.getTraceName()));
1121 assertEquals(0, tracesFolder
.getNodes().size());
1126 * Action : Clear single Traces folder
1130 * Procedure : 1) Import 2 traces from different folders preserving folder structure
1131 * 2) Open both traces.
1132 * 3) Select the Traces folder
1133 * 4) Right-click, Clear. Click Yes.
1136 * Expected Results: A dialog should ask the user to confirm clearing of the
1137 * folder. Clicking Yes should remove everything under the selected folder
1138 * and close the traces.
1141 public void test3_34ClearSingleTracesFolder() {
1142 int optionFlags
= ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
| ImportTraceWizardPage
.OPTION_PRESERVE_FOLDER_STRUCTURE
;
1143 importTrace(CUSTOM_TEXT_TRACE_TYPE
, optionFlags
, ImportConfirmation
.CONTINUE
, CUSTOM_TEXT_LOG
.getTraceName(), CLASHES_CUSTOM_TEXT_LOG
.getTracePath());
1145 verifyTrace(CUSTOM_TEXT_LOG
, optionFlags
, CUSTOM_TEXT_LOG
.getTraceName(), CUSTOM_TEXT_TRACE_TYPE
);
1146 verifyTrace(CLASHES_CUSTOM_TEXT_LOG
, optionFlags
, CLASHES_CUSTOM_TEXT_LOG
.getTracePath(), CUSTOM_TEXT_TRACE_TYPE
);
1148 SWTBotTreeItem tracesFolder
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
1149 tracesFolder
.contextMenu().menu("Clear").click();
1150 SWTBot deleteConfirmationShellBot
= fBot
.shell("Confirm Clear").bot();
1151 deleteConfirmationShellBot
.button("Yes").click();
1152 fBot
.waitWhile(ConditionHelpers
.isEditorOpened(fBot
, CUSTOM_TEXT_LOG
.getTraceName()));
1153 fBot
.waitWhile(ConditionHelpers
.isEditorOpened(fBot
, CLASHES_CUSTOM_TEXT_LOG
.getTracePath()));
1154 assertEquals(0, tracesFolder
.getNodes().size());
1159 * Action : Clear multiple Traces folder
1163 * Procedure : 1) Import 2 traces to different projects
1164 * 2) Open both traces.
1165 * 3) Select both Traces folders
1166 * 4) Right-click, Clear. Click Yes.
1169 * Expected Results: A dialog should ask the user to confirm clearing of the
1170 * folders. Clicking Yes should remove everything under the selected folders
1171 * and close the traces.
1174 public void test3_35ClearMultipleTracesFolder() {
1175 int optionFlags
= ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
;
1176 SWTBotTreeItem tracesFolder1
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
1177 SWTBotShell shell
= openTraceFoldersImport(tracesFolder1
);
1178 importTrace(shell
, null, null, optionFlags
, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG
.getTracePath());
1179 verifyTrace(CUSTOM_TEXT_LOG
, optionFlags
, CUSTOM_TEXT_LOG
.getTraceName(), CUSTOM_TEXT_TRACE_TYPE
, TRACE_PROJECT_NAME
);
1181 SWTBotUtils
.createProject(DEFAULT_PROJECT_NAME
);
1182 SWTBotTreeItem tracesFolder2
= SWTBotUtils
.selectTracesFolder(fBot
, DEFAULT_PROJECT_NAME
);
1183 shell
= openTraceFoldersImport(tracesFolder2
);
1184 importTrace(shell
, null, null, optionFlags
, new ImportConfirmationSupplier(), LTTNG_KERNEL_TRACE
.getTracePath());
1185 verifyTrace(LTTNG_KERNEL_TRACE
, optionFlags
, LTTNG_KERNEL_TRACE
.getTraceName(), LTTNG_KERNEL_TRACE_TYPE
, DEFAULT_PROJECT_NAME
);
1187 SWTBotTree tree
= fBot
.viewByTitle("Project Explorer").bot().tree();
1188 tree
.select(tracesFolder1
, tracesFolder2
);
1189 tree
.contextMenu().menu("Clear").click();
1190 SWTBot deleteConfirmationShellBot
= fBot
.shell("Confirm Clear").bot();
1191 deleteConfirmationShellBot
.button("Yes").click();
1192 fBot
.waitWhile(ConditionHelpers
.isEditorOpened(fBot
, CUSTOM_TEXT_LOG
.getTraceName()));
1193 fBot
.waitWhile(ConditionHelpers
.isEditorOpened(fBot
, LTTNG_KERNEL_TRACE
.getTraceName()));
1194 assertEquals(0, tracesFolder1
.getNodes().size());
1195 assertEquals(0, tracesFolder2
.getNodes().size());
1197 SWTBotUtils
.deleteProject(DEFAULT_PROJECT_NAME
, fBot
);
1202 * Action : Import from zip archive with preserved folder structure
1206 * Procedure : 0) Delete all traces in project
1207 * 1) Open Import wizard
1208 * 2) Select archive file: traces.zip
1209 * 3) Select archive root directory
1210 * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and select "Preserve Folder Structure"
1214 * Expected Results: All traces are imported with trace type set. The folder
1215 * "clashes" is imported with traces inside. Make sure that the traces can
1219 public void test3_36ImportZipArchivePreserve() {
1220 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
1222 int optionFlags
= ImportTraceWizardPage
.OPTION_PRESERVE_FOLDER_STRUCTURE
;
1223 importTrace("traces.zip", null, optionFlags
, ImportConfirmation
.CONTINUE
, "");
1225 for (TestTraceInfo info
: ALL_TRACEINFOS
) {
1226 verifyTrace(info
, optionFlags
, info
.getTracePath());
1229 SWTBotTreeItem tracesFolderItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
1230 assertEquals(7, tracesFolderItem
.getItems().length
);
1231 SWTBotTreeItem clashesFolderItem
= SWTBotUtils
.getTraceProjectItem(fBot
, tracesFolderItem
, CLASHES_DIR_NAME
);
1232 assertEquals(6, clashesFolderItem
.getItems().length
);
1237 * Action : Import from zip archive without preserved folder structure
1242 * Procedure : 0) Delete all traces in project
1243 * 1) Open Import wizard
1244 * 2) Select archive file: traces.zip
1245 * 3) Select archive root directory
1246 * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and unselect "Preserve Folder Structure"
1248 * 6) When dialog appears select "Rename All"
1251 * Expected Results: All traces are imported with trace type set. The traces
1252 * from folder "clashes" are renamed with suffix (2). Make sure that the
1253 * traces can be opened.
1256 public void test3_37ImportZipArchiveNoPreserve() {
1257 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
1259 int optionFlags
= 0;
1260 importTrace("traces.zip", null, optionFlags
, ImportConfirmation
.RENAME_ALL
, "");
1262 for (TestTraceInfo info
: ALL_TRACEINFOS
) {
1263 String traceName
= info
.getTraceName();
1264 if (CLASHING_TRACEINFOS
.contains(info
)) {
1265 traceName
= toRenamedName(traceName
);
1267 verifyTrace(info
, optionFlags
, traceName
);
1270 SWTBotTreeItem tracesFolderItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
1271 assertEquals(12, tracesFolderItem
.getItems().length
);
1276 * Action : Import from zip archive specific traces
1280 * Procedure : 0) Delete all traces in project
1281 * 1) Open Import wizard
1282 * 2) Select archive file: traces.zip
1283 * 3) Select file z-clashes/ExampleCustomTxt.log and directory kernel-overlap-testing/
1284 * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and select "Preserve Folder Structure"
1288 * Expected Results: The specified traces are imported with trace type set.
1289 * Make sure that the traces can be opened.
1292 public void test3_38ImportZipArchiveSpecificTraces() {
1293 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
1295 int optionFlags
= ImportTraceWizardPage
.OPTION_PRESERVE_FOLDER_STRUCTURE
;
1296 importTrace("traces.zip", null, optionFlags
, ImportConfirmation
.CONTINUE
, "z-clashes/ExampleCustomTxt.log", "kernel-overlap-testing/");
1298 verifyTrace(CLASHES_CUSTOM_TEXT_LOG
, optionFlags
, CLASHES_CUSTOM_TEXT_LOG
.getTracePath());
1299 verifyTrace(LTTNG_KERNEL_TRACE
, optionFlags
, LTTNG_KERNEL_TRACE
.getTracePath());
1301 SWTBotTreeItem tracesFolderItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
1302 assertEquals(2, tracesFolderItem
.getItems().length
);
1303 SWTBotTreeItem clashesFolderItem
= SWTBotUtils
.getTraceProjectItem(fBot
, tracesFolderItem
, CLASHES_DIR_NAME
);
1304 assertEquals(1, clashesFolderItem
.getItems().length
);
1309 * Action : Import from tar.gz archive with preserved folder structure
1313 * Procedure : 0) Delete all traces in project
1314 * 1) Open Import wizard
1315 * 2) Select archive file: traces.tar.gz
1316 * 3) Select archive root directory
1317 * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and select "Preserve Folder Structure"
1321 * Expected Results: All traces are imported with trace type set. The folder
1322 * "clashes" is imported with traces inside. Make sure that the traces can
1326 public void test3_39ImportTarGzipArchivePreserve() {
1327 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
1329 int optionFlags
= ImportTraceWizardPage
.OPTION_PRESERVE_FOLDER_STRUCTURE
;
1330 importTrace("traces.tar.gz", null, optionFlags
, ImportConfirmation
.CONTINUE
, "");
1332 for (TestTraceInfo info
: ALL_TRACEINFOS
) {
1333 verifyTrace(info
, optionFlags
, info
.getTracePath());
1336 SWTBotTreeItem tracesFolderItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
1337 assertEquals(7, tracesFolderItem
.getItems().length
);
1338 SWTBotTreeItem clashesFolderItem
= SWTBotUtils
.getTraceProjectItem(fBot
, tracesFolderItem
, CLASHES_DIR_NAME
);
1339 assertEquals(6, clashesFolderItem
.getItems().length
);
1344 * Action : Import from tar.gz archive without preserved folder structure (Rename All)
1348 * Procedure : 0) Delete all traces in project
1349 * 1) Open Import wizard
1350 * 2) Select archive file: traces.tar.gz
1351 * 3) Select archive root directory
1352 * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and unselect "Preserve Folder Structure"
1354 * 6) When dialog appears select "Rename All"
1357 * Expected Results: All traces are imported with trace type set. The traces
1358 * from folder "clashes" are renamed with suffix (2). Make sure that the
1359 * traces can be opened.
1362 public void test3_40ImportTarGzipArchiveNoPreserve() {
1363 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
1365 int optionFlags
= 0;
1366 importTrace("traces.tar.gz", null, optionFlags
, ImportConfirmation
.RENAME_ALL
, "");
1368 for (TestTraceInfo info
: ALL_TRACEINFOS
) {
1369 String traceName
= info
.getTraceName();
1370 if (CLASHING_TRACEINFOS
.contains(info
)) {
1371 traceName
= toRenamedName(traceName
);
1373 verifyTrace(info
, optionFlags
, traceName
);
1376 SWTBotTreeItem tracesFolderItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
1377 assertEquals(12, tracesFolderItem
.getItems().length
);
1382 * Action : Import from tar.gz archive specific traces
1386 * Procedure : 0) Delete all traces in project
1387 * 1) Open Import wizard
1388 * 2) Select archive file: traces.tar.gz
1389 * 3) Select file z-clashes/ExampleCustomTxt.log and directory kernel-overlap-testing/
1390 * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and select "Preserve Folder Structure"
1394 * Expected Results: The specified traces are imported with trace type set.
1395 * Make sure that the traces can be opened.
1398 public void test3_41ImportTarGzipArchiveSpecificTraces() {
1399 SWTBotUtils
.clearTracesFolderUI(fBot
, TRACE_PROJECT_NAME
);
1401 int optionFlags
= ImportTraceWizardPage
.OPTION_PRESERVE_FOLDER_STRUCTURE
;
1402 importTrace("traces.tar.gz", null, optionFlags
, ImportConfirmation
.CONTINUE
, "z-clashes/ExampleCustomTxt.log", "kernel-overlap-testing/");
1404 verifyTrace(CLASHES_CUSTOM_TEXT_LOG
, optionFlags
, CLASHES_CUSTOM_TEXT_LOG
.getTracePath());
1405 verifyTrace(LTTNG_KERNEL_TRACE
, optionFlags
, LTTNG_KERNEL_TRACE
.getTracePath());
1407 SWTBotTreeItem tracesFolderItem
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
1408 assertEquals(2, tracesFolderItem
.getItems().length
);
1409 SWTBotTreeItem clashesFolderItem
= SWTBotUtils
.getTraceProjectItem(fBot
, tracesFolderItem
, CLASHES_DIR_NAME
);
1410 assertEquals(1, clashesFolderItem
.getItems().length
);
1413 private static void verifyTrace(TestTraceInfo traceInfo
, int importOptionFlags
) {
1414 verifyTrace(traceInfo
, importOptionFlags
, traceInfo
.getTraceName());
1417 private static void verifyTrace(TestTraceInfo traceInfo
, int importOptionFlags
, String traceName
) {
1418 verifyTrace(traceInfo
, importOptionFlags
, traceName
, traceInfo
.getTraceType());
1421 private static void verifyTrace(TestTraceInfo traceInfo
, int importOptionFlags
, String traceName
, String traceType
) {
1422 verifyTrace(traceInfo
, importOptionFlags
, traceName
, traceType
, TRACE_PROJECT_NAME
);
1425 private static void verifyTrace(TestTraceInfo traceInfo
, int importOptionFlags
, String traceName
, String traceType
, String projectName
) {
1426 String
[] tracePath
= new Path(traceName
).segments();
1427 SWTBotTreeItem traceItem
= SWTBotUtils
.getTraceProjectItem(fBot
, SWTBotUtils
.selectTracesFolder(fBot
, projectName
), tracePath
);
1428 checkTraceType(traceItem
, traceType
);
1429 openTrace(traceItem
);
1430 if (traceType
!= null && !traceType
.isEmpty()) {
1431 SWTBotImportWizardUtils
.testEventsTable(fBot
, traceName
, traceInfo
.getNbEvents(), traceInfo
.getFirstEventTimestamp());
1433 // If there is no trace type, make sure it can be opened with the text editor
1434 fBot
.waitUntil(ConditionHelpers
.isEditorOpened(fBot
, traceName
));
1435 SWTBotEditor editor
= fBot
.editorByTitle(traceName
);
1436 assertEquals(TEXT_EDITOR_ID
, editor
.getReference().getId());
1438 checkTraceLinked(traceItem
, (importOptionFlags
& ImportTraceWizardPage
.OPTION_CREATE_LINKS_IN_WORKSPACE
) != 0);
1441 private static String
toRenamedName(String traceName
) {
1442 return traceName
+ "(2)";
1445 private static void openTrace(SWTBotTreeItem traceItem
) {
1447 traceItem
.doubleClick();
1450 private static void testSingleTrace(TestTraceInfo traceInfo
, int optionFlags
) {
1451 importTrace(optionFlags
, traceInfo
.getTracePath());
1452 verifyTrace(traceInfo
, optionFlags
);
1455 private static void importTrace(int optionFlags
, String
... tracePaths
) {
1456 importTrace(optionFlags
, ImportConfirmation
.CONTINUE
, tracePaths
);
1459 private static void importTrace(int optionFlags
, ImportConfirmation confirmationMode
, String
... tracePaths
) {
1460 importTrace(null, optionFlags
, confirmationMode
, tracePaths
);
1463 private static void importTrace(String traceType
, int optionFlags
, ImportConfirmation confirmationMode
, String
... tracePaths
) {
1464 importTrace(null, traceType
, optionFlags
, confirmationMode
, tracePaths
);
1467 private static void importTrace(String archiveFile
, String traceType
, int optionFlags
, ImportConfirmation confirmationMode
, String
... tracePaths
) {
1468 importTrace(archiveFile
, traceType
, optionFlags
, new ImportConfirmationSupplier(confirmationMode
), tracePaths
);
1471 private static void importTrace(int optionFlags
, Supplier
<ImportConfirmation
> confirmationSuplier
, String
... tracePaths
) {
1472 importTrace(null, null, optionFlags
, confirmationSuplier
, tracePaths
);
1475 private static void importTrace(String archiveFile
, String traceType
, int optionFlags
, Supplier
<ImportConfirmation
> confirmationSuplier
, String
... tracePaths
) {
1476 SWTBotTreeItem traceFolder
= SWTBotUtils
.selectTracesFolder(fBot
, TRACE_PROJECT_NAME
);
1477 SWTBotShell shell
= openTraceFoldersImport(traceFolder
);
1478 importTrace(shell
, archiveFile
, traceType
, optionFlags
, confirmationSuplier
, tracePaths
);
1482 * @param tracePaths relative to parent test traces folder
1484 private static void importTrace(SWTBotShell shell
, String archiveFile
, String traceType
, int optionFlags
, Supplier
<ImportConfirmation
> confirmationSuplier
, String
... tracePaths
) {
1485 SWTBot bot
= shell
.bot();
1486 String rootFolderName
;
1487 if (archiveFile
== null) {
1488 rootFolderName
= "import";
1489 String importDirectoryFullPath
= getPath(rootFolderName
);
1490 SWTBotImportWizardUtils
.selectImportFromDirectory(bot
, importDirectoryFullPath
);
1492 rootFolderName
= "/";
1493 String importArchiveFullPath
= getPath("archives" + File
.separator
+ archiveFile
);
1494 SWTBotImportWizardUtils
.selectImportFromArchive(bot
, importArchiveFullPath
);
1497 for (String tracePath
: tracePaths
) {
1498 IPath somePath
= new Path(rootFolderName
).append(tracePath
);
1499 String
[] treePath
= somePath
.segments();
1500 if (archiveFile
!= null) {
1501 String
[] newPath
= new String
[treePath
.length
+ 1];
1503 System
.arraycopy(treePath
, 0, newPath
, 1, treePath
.length
);
1506 SWTBotImportWizardUtils
.selectItem(fBot
, treePath
);
1509 SWTBotImportWizardUtils
.setOptions(bot
, optionFlags
, traceType
);
1510 bot
.button("Finish").click();
1512 ImportConfirmation importConfirmation
= confirmationSuplier
.get();
1513 while (importConfirmation
!= null) {
1514 if (importConfirmation
!= ImportConfirmation
.CONTINUE
) {
1515 fBot
.waitUntil(Conditions
.shellIsActive("Confirmation"));
1516 SWTBotShell shell2
= fBot
.activeShell();
1517 SWTBotButton button
= shell2
.bot().button(importConfirmation
.getInName());
1520 importConfirmation
= confirmationSuplier
.get();
1523 fBot
.waitUntil(Conditions
.shellCloses(shell
));
1526 private static void checkTraceType(SWTBotTreeItem traceItem
, String traceType
) {
1527 assertEquals(traceType
, getTraceProperty(traceItem
, "type"));
1530 private static void checkTraceLinked(SWTBotTreeItem traceItem
, boolean linked
) {
1531 assertEquals(Boolean
.toString(linked
), getTraceProperty(traceItem
, "linked"));
1534 private static String
getTraceProperty(SWTBotTreeItem traceItem
, String property
) {
1535 SWTBotUtils
.openView(IPageLayout
.ID_PROP_SHEET
);
1536 SWTBotView view
= fBot
.viewById(IPageLayout
.ID_PROP_SHEET
);
1539 SWTBotTreeItem traceTypeItem
= SWTBotUtils
.getTreeItem(view
.bot(), view
.bot().tree(), "Resource properties", property
);
1540 return traceTypeItem
.cell(1);
1543 private static SWTBotShell
openTraceFoldersImport(SWTBotTreeItem traceItem
) {
1544 traceItem
.contextMenu().menu("Import...").click();
1545 fBot
.waitUntil(Conditions
.shellIsActive("Trace Import"));
1547 SWTBotShell shell
= fBot
.shell("Trace Import");
1551 private static SWTBotShell
openWorkbenchMenuImport() {
1552 fBot
.menu().menu("File", "Import...").click();
1553 fBot
.waitUntil(Conditions
.shellIsActive("Import"));
1555 SWTBot shellBot
= fBot
.shell("Import").bot();
1556 SWTBotTree tree
= shellBot
.tree();
1557 SWTBotUtils
.getTreeItem(fBot
, tree
, "Tracing", "Trace Import").select();
1558 shellBot
.button("Next >").click();
1559 SWTBotShell shell
= fBot
.shell("Trace Import");