Commit | Line | Data |
---|---|---|
ab18f69a MAL |
1 | /****************************************************************************** |
2 | * Copyright (c) 2016 Ericsson | |
3 | * | |
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 | *******************************************************************************/ | |
9 | ||
10 | package org.eclipse.tracecompass.integration.swtbot.tests.projectexplorer; | |
11 | ||
12 | import static org.junit.Assert.assertEquals; | |
13 | import static org.junit.Assert.assertNotEquals; | |
14 | ||
15 | import java.io.File; | |
16 | import java.io.IOException; | |
17 | import java.util.List; | |
18 | import java.util.Set; | |
19 | import java.util.function.Supplier; | |
20 | ||
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; | |
d2fbf6b6 | 35 | import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; |
ab18f69a MAL |
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; | |
f0beeb4a | 45 | import org.eclipse.tracecompass.tmf.ui.tests.shared.WaitUtils; |
ab18f69a | 46 | import org.eclipse.ui.IPageLayout; |
d7ac6294 | 47 | import org.junit.After; |
ab18f69a MAL |
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; | |
54 | ||
55 | import com.google.common.collect.ImmutableList; | |
56 | import com.google.common.collect.ImmutableSet; | |
d2fbf6b6 | 57 | import com.google.common.collect.Lists; |
ab18f69a MAL |
58 | |
59 | /** | |
60 | * SWTBot test for testing Project Explorer trace folders (context-menu, | |
61 | * import, etc). | |
62 | */ | |
63 | @RunWith(SWTBotJunit4ClassRunner.class) | |
64 | @FixMethodOrder(MethodSorters.NAME_ASCENDING) | |
65 | @SuppressWarnings({"restriction", "javadoc"}) | |
66 | public class ProjectExplorerTracesFolderTest { | |
67 | ||
d2fbf6b6 PT |
68 | private static final class ImportConfirmationSupplier implements Supplier<ImportConfirmation> { |
69 | List<ImportConfirmation> fConfirmations = Lists.newArrayList(ImportConfirmation.CONTINUE); | |
70 | ||
71 | public ImportConfirmationSupplier(ImportConfirmation... confirmations) { | |
72 | fConfirmations = Lists.newArrayList(confirmations); | |
73 | } | |
74 | ||
75 | @Override | |
76 | public ImportConfirmation get() { | |
77 | return fConfirmations.isEmpty() ? null : fConfirmations.remove(0); | |
78 | } | |
79 | } | |
80 | ||
ab18f69a MAL |
81 | private static final String PROP_LAST_MODIFIED_PROPERTY = "last modified"; |
82 | private static final String TEXT_EDITOR_ID = "org.eclipse.ui.DefaultTextEditor"; | |
83 | ||
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"; | |
89 | ||
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"); | |
96 | ||
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"); | |
104 | ||
105 | ||
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, ""); | |
cdfe10e7 | 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, ""); |
ab18f69a MAL |
111 | |
112 | private static final TestTraceInfo[] ALL_TRACEINFOS = new TestTraceInfo[] { | |
113 | CUSTOM_TEXT_LOG, | |
114 | CUSTOM_XML_LOG, | |
115 | LTTNG_KERNEL_TRACE, | |
116 | SIMPLE_SERVER1_UST_TRACE, | |
117 | SIMPLE_SERVER2_UST_TRACE, | |
118 | UST_OVERLAP_TESTING_UST_TRACE, | |
119 | ||
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 | |
126 | }; | |
127 | ||
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); | |
135 | ||
136 | // All normal traces plus the unrecognized trace | |
137 | private static final int NUM_UNIQUE_TRACES = CLASHING_TRACEINFOS.size() + 1; | |
138 | ||
139 | ||
140 | private static final File TEST_TRACES_PATH = new File(new Path(TmfTraceManager.getTemporaryDirPath()).append("testtraces").toOSString()); | |
d2fbf6b6 | 141 | private static final String DEFAULT_PROJECT_NAME = "Tracing"; |
ab18f69a MAL |
142 | private static final String TRACE_PROJECT_NAME = "test"; |
143 | private static final String MANAGE_CUSTOM_PARSERS_SHELL_TITLE = "Manage Custom Parsers"; | |
144 | ||
145 | private static SWTWorkbenchBot fBot; | |
146 | ||
147 | /** The Log4j logger instance. */ | |
148 | private static final Logger fLogger = Logger.getRootLogger(); | |
149 | ||
150 | private static String getPath(String relativePath) { | |
151 | return new Path(TEST_TRACES_PATH.getAbsolutePath()).append(relativePath).toOSString(); | |
152 | } | |
153 | ||
154 | /** | |
155 | * Test Class setup | |
156 | * | |
157 | * @throws IOException | |
158 | */ | |
159 | @BeforeClass | |
160 | public static void init() throws IOException { | |
161 | TestDirectoryStructureUtil.generateTraceStructure(TEST_TRACES_PATH); | |
162 | ||
163 | SWTBotUtils.initialize(); | |
164 | ||
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(); | |
171 | ||
172 | SWTBotUtils.closeView("Welcome", fBot); | |
173 | ||
174 | SWTBotUtils.switchToTracingPerspective(); | |
175 | ||
176 | /* Finish waiting for eclipse to load */ | |
f0beeb4a | 177 | WaitUtils.waitForJobs(); |
ab18f69a MAL |
178 | SWTBotUtils.createProject(TRACE_PROJECT_NAME); |
179 | } | |
180 | ||
181 | /** | |
182 | * Test class tear down method. | |
183 | */ | |
184 | @AfterClass | |
185 | public static void tearDown() { | |
186 | SWTBotUtils.deleteProject(TRACE_PROJECT_NAME, fBot); | |
d2fbf6b6 | 187 | SWTBotUtils.deleteProject(DEFAULT_PROJECT_NAME, fBot); |
ab18f69a MAL |
188 | fLogger.removeAllAppenders(); |
189 | } | |
190 | ||
d7ac6294 MAL |
191 | /** |
192 | * Test tear down method. | |
193 | */ | |
194 | @After | |
195 | public void afterTest() { | |
196 | SWTBotUtils.closeSecondaryShells(fBot); | |
197 | } | |
198 | ||
d2fbf6b6 | 199 | private static void test3_00Preparation() { |
ab18f69a MAL |
200 | // 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 |
201 | CustomTxtTraceDefinition[] txtDefinitions = CustomTxtTraceDefinition.loadAll(getPath("customParsers/ExampleCustomTxtParser.xml")); | |
202 | txtDefinitions[0].save(); | |
203 | CustomXmlTraceDefinition[] xmlDefinitions = CustomXmlTraceDefinition.loadAll(getPath("customParsers/ExampleCustomXmlParser.xml")); | |
204 | xmlDefinitions[0].save(); | |
205 | ||
206 | SWTBotTreeItem traceFolder = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
207 | traceFolder.contextMenu("Manage Custom Parsers...").click(); | |
208 | fBot.waitUntil(Conditions.shellIsActive(MANAGE_CUSTOM_PARSERS_SHELL_TITLE)); | |
209 | SWTBotShell shell = fBot.shell(MANAGE_CUSTOM_PARSERS_SHELL_TITLE); | |
210 | SWTBot shellBot = shell.bot(); | |
211 | ||
212 | // Make sure the custom text trace type is imported | |
213 | shellBot.list().select(CUSTOM_TEXT_LOG.getTraceType()); | |
214 | ||
215 | // Make sure the custom xml trace type is imported | |
216 | shellBot.radio("XML").click(); | |
217 | shellBot.list().select(CUSTOM_XML_LOG.getTraceType()); | |
218 | shellBot.button("Close").click(); | |
219 | shellBot.waitUntil(Conditions.shellCloses(shell)); | |
220 | } | |
221 | ||
222 | /** | |
223 | * Test that the expected context menu items are there | |
224 | * <p> | |
225 | * Action : Trace Folder menu | |
226 | * <p> | |
227 | * Procedure :Select the Traces folder and open its context menu | |
228 | * <p> | |
229 | * Expected Results: Correct menu opens (Import, Refresh, etc) | |
230 | */ | |
231 | @Test | |
232 | public void test3_01ContextMenuPresence() { | |
d2fbf6b6 | 233 | test3_00Preparation(); |
ab18f69a MAL |
234 | |
235 | SWTBotTreeItem traceItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
236 | ||
237 | final List<String> EXPECTED_MENU_LABELS = ImmutableList.of( | |
238 | "Open Trace...", | |
239 | "", | |
240 | "Import...", | |
241 | "", | |
242 | "New Folder...", | |
243 | "Clear", | |
244 | "", | |
245 | "Import Trace Package...", | |
246 | "Fetch Remote Traces...", | |
247 | "", | |
248 | "Export Trace Package...", | |
249 | "", | |
250 | "Manage Custom Parsers...", | |
251 | "Manage XML analyses...", | |
252 | "", | |
253 | "Apply Time Offset...", | |
254 | "Clear Time Offset", | |
255 | "", | |
256 | "Refresh"); | |
257 | ||
258 | List<String> menuLabels = traceItem.contextMenu().menuItems(); | |
259 | for (int i = 0; i < menuLabels.size(); i++) { | |
260 | assertEquals(EXPECTED_MENU_LABELS.get(i), menuLabels.get(i)); | |
261 | } | |
262 | ||
263 | fBot.closeAllEditors(); | |
264 | } | |
265 | ||
266 | /** | |
267 | * Test that the trace import wizard appears | |
268 | * <p> | |
269 | * Action : Trace Import Wizard | |
270 | * <p> | |
271 | * Procedure : Select Import | |
272 | * <p> | |
273 | * Expected Results: Trace Import Wizard appears | |
274 | */ | |
275 | @Test | |
276 | public void test3_02Import() { | |
277 | SWTBotTreeItem traceItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
278 | ||
279 | SWTBotShell shell = openTraceFoldersImport(traceItem); | |
280 | shell.bot().button("Cancel").click(); | |
281 | } | |
282 | ||
283 | /** | |
284 | * Test that the trace import wizard can import a single custom text trace | |
285 | * <p> | |
286 | * Action : Import single custom text trace (link to workspace) | |
287 | * <p> | |
288 | * <pre> | |
289 | * Procedure : 1) Browse to directory ${local}/traces/import/ | |
290 | * 2) Select trace ExampleCustomTxt.log | |
291 | * 3) Keep <Auto Detection>, Select "Import unrecognized traces", unselect "Overwrite existing without warning" and select "Create Links to workspace" and | |
292 | * 4) press Finish | |
293 | * </pre> | |
294 | * <p> | |
295 | * Expected Results: Imported trace appear in Traces Folder and the Trace Type Tmf Generic is set. Make sure trace can be opened | |
296 | */ | |
297 | @Test | |
298 | public void test3_03SingleCustomTextTrace() { | |
299 | int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; | |
300 | testSingleTrace(CUSTOM_TEXT_LOG, optionFlags); | |
301 | } | |
302 | ||
303 | /** | |
304 | * <p> | |
305 | * Action : Import Single custom XML trace (link to workspace) | |
306 | * <p> | |
307 | * | |
308 | * <pre> | |
309 | * Procedure : redo 3.1-3.3 but this time select ExampleCustomXml.xml | |
310 | * </pre> | |
311 | * <p> | |
312 | * Expected Results: Imported trace appear in Traces Folder and the Trace | |
313 | * Type "Custom XML log" is set. Make sure that trace can be opened | |
314 | */ | |
315 | @Test | |
316 | public void test3_04SingleCustomXmlTrace() { | |
317 | int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; | |
318 | testSingleTrace(CUSTOM_XML_LOG, optionFlags); | |
319 | } | |
320 | ||
321 | /** | |
322 | * <p> | |
323 | * Action : Import LTTng Kernel CTF trace (link to workspace) | |
324 | * <p> | |
325 | * | |
326 | * <pre> | |
327 | * Procedure : redo 3.1-3.3 but this time select directory kernel-overlap-testing/ | |
328 | * </pre> | |
329 | * <p> | |
330 | * Expected Results: Imported trace appear in Traces Folder and the Trace | |
331 | * Type "LTTng Kernel" is set. Make sure that trace can be opened | |
332 | */ | |
333 | @Test | |
334 | public void test3_05SingleCtfTrace() { | |
335 | int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; | |
336 | testSingleTrace(LTTNG_KERNEL_TRACE, optionFlags); | |
337 | } | |
338 | ||
339 | /** | |
340 | * <p> | |
341 | * Action : Rename + copy import | |
342 | * <p> | |
343 | * | |
344 | * <pre> | |
345 | * Procedure : 1) redo 3.3, 3.4, 3.5. However, Unselect "Create Links to workspace" | |
346 | * 2) When dialog box appear select Rename | |
347 | * </pre> | |
348 | * <p> | |
349 | * Expected Results: Traces are imported with new name that has a suffix (2) | |
350 | * at the end. Make sure that imported traces are copied to the project. | |
351 | */ | |
352 | @Test | |
353 | public void test3_06RenameCopyImport() { | |
354 | testRenameCopyImport(CUSTOM_TEXT_LOG); | |
355 | testRenameCopyImport(CUSTOM_XML_LOG); | |
356 | testRenameCopyImport(LTTNG_KERNEL_TRACE); | |
357 | } | |
358 | ||
359 | private static void testRenameCopyImport(TestTraceInfo traceInfo) { | |
360 | int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES; | |
361 | importTrace(optionFlags, ImportConfirmation.RENAME, traceInfo.getTraceName()); | |
362 | String renamed = toRenamedName(traceInfo.getTraceName()); | |
363 | verifyTrace(traceInfo, optionFlags, renamed); | |
364 | } | |
365 | ||
366 | /** | |
367 | * <p> | |
368 | * Action : Overwrite + copy import | |
369 | * <p> | |
370 | * | |
371 | * <pre> | |
372 | * Procedure : 1) redo 3.3, 3.4, 3.5. However, Unselect "Create Links to workspace" | |
373 | * 2) When dialog box appear select Overwrite | |
374 | * </pre> | |
375 | * <p> | |
376 | * Expected Results: Existing traces are deleted and new traces are | |
377 | * imported. Make sure that imported traces are copied to the project and | |
378 | * can be opened | |
379 | */ | |
380 | @Test | |
381 | public void test3_07OverwriteCopyImport() { | |
382 | testOverwriteCopyImport(CUSTOM_TEXT_LOG); | |
383 | testOverwriteCopyImport(CUSTOM_XML_LOG); | |
384 | testOverwriteCopyImport(LTTNG_KERNEL_TRACE); | |
385 | } | |
386 | ||
387 | private static void testOverwriteCopyImport(TestTraceInfo traceInfo) { | |
388 | String traceName = traceInfo.getTraceName(); | |
389 | SWTBotTreeItem traceItem = SWTBotUtils.getTreeItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), traceName); | |
390 | String lastModified = getTraceProperty(traceItem, PROP_LAST_MODIFIED_PROPERTY); | |
391 | int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES; | |
392 | importTrace(optionFlags, ImportConfirmation.OVERWRITE, traceName); | |
393 | verifyTrace(traceInfo, optionFlags); | |
394 | ||
395 | assertNotEquals(lastModified, getTraceProperty(traceItem, PROP_LAST_MODIFIED_PROPERTY)); | |
396 | } | |
397 | ||
398 | /** | |
399 | * <p> | |
400 | * Action : Skip | |
401 | * <p> | |
402 | * | |
403 | * <pre> | |
404 | * Procedure : 1) redo 3.3, 3.4, 3.5. However, Unselect "Create Links to workspace" | |
405 | * 2) When dialog box appear select Skip | |
406 | * </pre> | |
407 | * <p> | |
408 | * Expected Results: Make sure that no new trace is imported | |
409 | */ | |
410 | @Test | |
411 | public void test3_08SkipImport() { | |
412 | testSkipImport(CUSTOM_TEXT_LOG); | |
413 | testSkipImport(CUSTOM_XML_LOG); | |
414 | testSkipImport(LTTNG_KERNEL_TRACE); | |
415 | } | |
416 | ||
417 | private static void testSkipImport(TestTraceInfo traceInfo) { | |
418 | String traceName = traceInfo.getTraceName(); | |
419 | SWTBotTreeItem traceItem = SWTBotUtils.getTreeItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), traceName); | |
420 | String lastModified = getTraceProperty(traceItem, PROP_LAST_MODIFIED_PROPERTY); | |
421 | int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES; | |
422 | importTrace(optionFlags, ImportConfirmation.SKIP, traceName); | |
423 | verifyTrace(traceInfo, optionFlags); | |
424 | ||
425 | assertEquals(lastModified, getTraceProperty(traceItem, PROP_LAST_MODIFIED_PROPERTY)); | |
426 | } | |
427 | ||
428 | /** | |
429 | * <p> | |
430 | * Action : Default overwrite | |
431 | * <p> | |
432 | * | |
433 | * <pre> | |
434 | * Procedure : 1) redo 3.3, 3.4, 3.5. However, Unselect "Create Links to workspace" and select "Overwrite existing without warning" | |
435 | * </pre> | |
436 | * <p> | |
437 | * Expected Results: Make sure that no dialog box appears (for renaming, | |
438 | * overwriting, skipping) and existing traces are overwritten). Make sure | |
439 | * trace can be opened | |
440 | */ | |
441 | @Test | |
442 | public void test3_09OverwriteOptionImport() { | |
443 | testOverwriteOptionImport(CUSTOM_TEXT_LOG); | |
444 | testOverwriteOptionImport(CUSTOM_XML_LOG); | |
445 | testOverwriteOptionImport(LTTNG_KERNEL_TRACE); | |
446 | } | |
447 | ||
448 | private static void testOverwriteOptionImport(TestTraceInfo traceInfo) { | |
449 | String traceName = traceInfo.getTraceName(); | |
450 | SWTBotTreeItem traceItem = SWTBotUtils.getTreeItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), traceName); | |
451 | String lastModified = getTraceProperty(traceItem, PROP_LAST_MODIFIED_PROPERTY); | |
452 | ||
453 | int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES; | |
454 | importTrace(optionFlags, ImportConfirmation.CONTINUE, traceName); | |
455 | verifyTrace(traceInfo, optionFlags); | |
456 | ||
457 | assertNotEquals(lastModified, getTraceProperty(traceItem, PROP_LAST_MODIFIED_PROPERTY)); | |
458 | } | |
459 | ||
460 | /** | |
461 | * <p> | |
462 | * Action : Import unrecognized | |
463 | * <p> | |
464 | * | |
465 | * <pre> | |
466 | * Procedure : 1) Open Import wizard (see 3.1-3.2) | |
467 | * 2) Browse to directory ${local}/traces/import | |
468 | * 3) Select trace unrecognized.log | |
469 | * 4) Keep <Auto Detection>, Select "Import unrecognized traces", unselect "Overwrite existing without warning" and select "Create Links to workspace" and | |
470 | * 5) press Finish | |
471 | * </pre> | |
472 | * <p> | |
473 | * Expected Results: unrecognized.log is imported with trace type unknown. | |
474 | * The default text file icon is displayed. The trace, when opened, is | |
475 | * displayed in the text editor. | |
476 | */ | |
477 | @Test | |
478 | public void test3_10ImportUnrecognized() { | |
479 | String traceName = UNRECOGNIZED_LOG.getTraceName(); | |
480 | int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; | |
481 | importTrace(optionFlags, traceName); | |
482 | verifyTrace(UNRECOGNIZED_LOG, optionFlags); | |
483 | } | |
484 | ||
485 | /** | |
486 | * <p> | |
487 | * Action : Import unrecognized (ignore) | |
488 | * <p> | |
489 | * | |
490 | * <pre> | |
491 | * Procedure : 1) redo 3.10, however unselect "Import unrecognized traces" | |
492 | * </pre> | |
493 | * <p> | |
494 | * Expected Results: unrecognized.log is not imported | |
495 | */ | |
496 | @Test | |
497 | public void test3_11ImportUnrecognizedIgnore() { | |
498 | String traceName = UNRECOGNIZED_LOG.getTraceName(); | |
499 | SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
500 | int numTraces = tracesFolderItem.getItems().length; | |
501 | ||
502 | SWTBotTreeItem traceItem = SWTBotUtils.getTreeItem(fBot, tracesFolderItem, traceName); | |
503 | String lastModified = getTraceProperty(traceItem, PROP_LAST_MODIFIED_PROPERTY); | |
504 | ||
505 | int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; | |
506 | importTrace(optionFlags, traceName); | |
507 | verifyTrace(UNRECOGNIZED_LOG, optionFlags); | |
508 | ||
509 | assertEquals(lastModified, getTraceProperty(traceItem, PROP_LAST_MODIFIED_PROPERTY)); | |
510 | assertEquals(numTraces, tracesFolderItem.getItems().length); | |
511 | } | |
512 | ||
513 | /** | |
514 | * <p> | |
515 | * Action : Import CTF trace by selection metadata file only | |
516 | * <p> | |
517 | * | |
518 | * <pre> | |
519 | * Procedure : 1) Redo 3.5, However only select metadata file instead of directory trace | |
520 | * </pre> | |
521 | * <p> | |
522 | * Expected Results: Imported trace appear in Traces Folder and the Trace | |
523 | * Type "LTTng Kernel" is set. Make sure that trace can be opened | |
524 | */ | |
525 | @Test | |
526 | public void test3_12ImportCtfWithMetadataSelection() { | |
527 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); | |
528 | testSingleTrace(LTTNG_KERNEL_TRACE_METADATA, ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE); | |
529 | } | |
530 | ||
531 | /** | |
532 | * <p> | |
533 | * Action : Recursive import with auto-detection (Rename All) | |
534 | * <p> | |
535 | * | |
536 | * <pre> | |
537 | * Procedure : 1) Open Import wizard (see 3.1-3.2) | |
538 | * 2) Browse to directory ${local}/traces/import | |
539 | * 3) select directory import | |
540 | * 4) Keep <Auto Detection>, Select "Import unrecognized traces", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure" | |
541 | * 5) press Finish | |
542 | * 6) When dialog appears select "Rename All" | |
543 | * </pre> | |
544 | * <p> | |
545 | * Expected Results: All Traces are imported with respective trace type set. | |
546 | * Traces with name clashes are imported with suffix (2). 1 trace | |
547 | * (unrecognized.log) is imported with trace type unknown. Make sure that | |
548 | * traces can be opened which have a trace type set. The unknown trace type | |
549 | * should open with the text editor. | |
550 | */ | |
551 | @Test | |
552 | public void test3_13ImportRecursiveAutoRenameAll() { | |
553 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); | |
554 | ||
555 | int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; | |
556 | importTrace(optionFlags, ImportConfirmation.RENAME_ALL, ""); | |
557 | ||
558 | for (TestTraceInfo info : ALL_TRACEINFOS) { | |
559 | String traceName = info.getTraceName(); | |
560 | if (CLASHING_TRACEINFOS.contains(info)) { | |
561 | traceName = toRenamedName(traceName); | |
562 | } | |
563 | verifyTrace(info, optionFlags, traceName); | |
564 | } | |
565 | ||
566 | // Also check unrecognized file | |
567 | verifyTrace(UNRECOGNIZED_LOG, optionFlags); | |
568 | } | |
569 | ||
570 | /** | |
571 | * <p> | |
572 | * Action : Recursive import with auto-detection (Overwrite All) | |
573 | * <p> | |
574 | * | |
575 | * <pre> | |
576 | * Procedure : 1) Open Import wizard (see 3.1-3.2) | |
577 | * 2) Browse to directory ${local}/traces/import/ | |
578 | * 3) select directory import | |
579 | * 4) Keep <Auto Detection>, Select "Import unrecognized traces", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure" | |
580 | * 5) press Finish | |
581 | * 6) When dialog appears select Overwrite All" | |
582 | * </pre> | |
583 | * <p> | |
584 | * Expected Results: All Traces are imported with respective trace type set. | |
585 | * Traces with name clashes are overwritten . 1 trace (unrecognized.log) is | |
586 | * imported with trace type unknown. Make sure that traces can be opened | |
587 | * which have a trace type set. The unknown trace type should open with the | |
588 | * text editor. | |
589 | */ | |
590 | @Test | |
591 | public void test3_14ImportRecursiveAutoOverwriteAll() { | |
592 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); | |
593 | ||
594 | int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; | |
595 | importTrace(optionFlags, ImportConfirmation.OVERWRITE_ALL, ""); | |
596 | ||
597 | for (TestTraceInfo info : CLASHING_TRACEINFOS) { | |
598 | verifyTrace(info, optionFlags); | |
599 | } | |
600 | ||
601 | // All traces should have clashed/overwritten (plus the unrecognized trace) | |
602 | SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
603 | assertEquals(NUM_UNIQUE_TRACES, tracesFolderItem.getItems().length); | |
604 | ||
605 | // Also check unrecognized file | |
606 | verifyTrace(UNRECOGNIZED_LOG, optionFlags); | |
607 | } | |
608 | ||
609 | /** | |
610 | * <p> | |
611 | * Action : Recursive import with auto-detection (Skip All) | |
612 | * <p> | |
613 | * | |
614 | * <pre> | |
615 | * Procedure : 1) Open Import wizard (see 3.1-3.2) | |
616 | * 2) Browse to directory ${local}/traces/import/ | |
617 | * 3) select directory import | |
618 | * 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 | * 5) press Finish | |
620 | * 6) When dialog appears select Skip All" | |
621 | * </pre> | |
622 | * <p> | |
623 | * Expected Results: All Traces are imported with respective trace type set. Traces with name | |
624 | * clashes are not imported. 1 trace (unrecognized.log) is imported with | |
625 | * trace type unknown. The unknown trace type should open with the text | |
626 | * editor. | |
627 | */ | |
628 | @Test | |
629 | public void test3_15ImportRecursiveAutoSkipAll() { | |
630 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); | |
631 | ||
632 | int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; | |
633 | importTrace(optionFlags, ImportConfirmation.SKIP_ALL, ""); | |
634 | ||
635 | SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
636 | for (TestTraceInfo info : ALL_TRACEINFOS) { | |
637 | if (!CLASHING_TRACEINFOS.contains(info)) { | |
638 | verifyTrace(info, optionFlags); | |
639 | } | |
640 | } | |
641 | ||
642 | // All traces should have skipped (plus the unrecognized trace) | |
643 | assertEquals(NUM_UNIQUE_TRACES, tracesFolderItem.getItems().length); | |
644 | ||
645 | // Also check unrecognized file | |
646 | verifyTrace(UNRECOGNIZED_LOG, optionFlags); | |
647 | } | |
648 | ||
649 | /** | |
650 | * <p> | |
651 | * Action : Recursive import with auto-detection (test rename, overwrite and | |
652 | * skip) | |
653 | * <p> | |
654 | * | |
655 | * <pre> | |
656 | * Procedure : 1) Open Import wizard (see 3.1-3.2) | |
657 | * 2) Browse to directory ${local}/traces/import/ | |
658 | * 3) select directory import | |
659 | * 4) Keep <Auto Detection>, Select "Import unrecognized traces", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure" | |
660 | * 5) press Finish | |
661 | * 6) When dialog appears select "Rename" | |
662 | * 7) When dialog appears select "Overwrite" | |
663 | * 8) When dialog appears select "Skip" | |
664 | * </pre> | |
665 | * <p> | |
666 | * Expected Results: All Traces are imported with respective trace type set. Traces with name | |
667 | * clashes are either renamed, overwritten or skipped as per dialog action. | |
668 | * Make sure that traces can be opened which have trace type set. The | |
669 | * unknown trace type should open with the text editor. | |
670 | */ | |
671 | @Test | |
672 | public void test3_16ImportRecursiveAutoRenameOverwriteSkip() { | |
673 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); | |
674 | ||
d2fbf6b6 PT |
675 | Supplier<ImportConfirmation> confirmationSupplier = new ImportConfirmationSupplier( |
676 | ImportConfirmation.RENAME, ImportConfirmation.OVERWRITE, ImportConfirmation.SKIP); | |
ab18f69a MAL |
677 | int optionFlags = ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES | ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; |
678 | importTrace(optionFlags, confirmationSupplier, LTTNG_KERNEL_TRACE.getTracePath(), CLASHES_LTTNG_KERNEL_TRACE.getTracePath(), SIMPLE_SERVER1_UST_TRACE.getTracePath(), CLASHES_SIMPLE_SERVER1_UST_TRACE.getTracePath(), | |
679 | SIMPLE_SERVER2_UST_TRACE.getTracePath(), CLASHES_SIMPLE_SERVER2_UST_TRACE.getTracePath(), UNRECOGNIZED_LOG.getTracePath()); | |
680 | ||
681 | verifyTrace(LTTNG_KERNEL_TRACE, optionFlags); | |
682 | ||
683 | // Renamed trace | |
684 | String renamed = toRenamedName(CLASHES_LTTNG_KERNEL_TRACE.getTraceName()); | |
685 | verifyTrace(CLASHES_LTTNG_KERNEL_TRACE, optionFlags, renamed); | |
686 | ||
687 | // Overwritten trace | |
688 | verifyTrace(CLASHES_SIMPLE_SERVER1_UST_TRACE, optionFlags); | |
689 | ||
690 | // Skipped trace | |
691 | verifyTrace(SIMPLE_SERVER2_UST_TRACE, optionFlags); | |
692 | ||
693 | // Also check unrecognized file | |
694 | verifyTrace(UNRECOGNIZED_LOG, optionFlags); | |
695 | } | |
696 | ||
697 | /** | |
698 | * <p> | |
699 | * Action : Recursive import with specific trace type 1 (Skip All) skip) | |
700 | * <p> | |
701 | * | |
702 | * <pre> | |
703 | * Procedure : 1) Open Import wizard | |
704 | * 2) Browse to directory ${local}/traces/import/ | |
705 | * 3) Select directory import | |
706 | * 4) Select trace type "Generic CTF Trace", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure"and | |
707 | * 5) press Finish | |
708 | * 6) When dialog appears select Skip All" | |
709 | * </pre> | |
710 | * <p> | |
711 | * Expected Results: After selecting trace type, verify that button "Import | |
712 | * unrecognized traces" is disabled. 4 CTF traces are imported with trace | |
713 | * type "Generic CTF Trace" . Make sure that these traces can be opened | |
714 | */ | |
715 | @Test | |
cdfe10e7 | 716 | public void test3_17ImportRecursiveSpecifyTraceTypeCTF() { |
ab18f69a MAL |
717 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); |
718 | ||
719 | int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; | |
720 | importTrace(GENERIC_CTF_TRACE_TYPE, optionFlags, ImportConfirmation.SKIP_ALL, ""); | |
721 | ||
722 | final TestTraceInfo[] CTF_TRACEINFOS = new TestTraceInfo[] { | |
723 | LTTNG_KERNEL_TRACE, | |
724 | SIMPLE_SERVER1_UST_TRACE, | |
725 | SIMPLE_SERVER2_UST_TRACE, | |
726 | UST_OVERLAP_TESTING_UST_TRACE | |
727 | }; | |
728 | for (TestTraceInfo info : CTF_TRACEINFOS) { | |
729 | verifyTrace(info, optionFlags, info.getTraceName(), GENERIC_CTF_TRACE_TYPE); | |
730 | } | |
731 | ||
732 | SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
733 | assertEquals(CTF_TRACEINFOS.length, tracesFolderItem.getItems().length); | |
734 | } | |
735 | ||
736 | /** | |
737 | * <p> | |
738 | * Action : Recursive import with specific trace type 2 (Skip All) | |
739 | * <p> | |
740 | * | |
741 | * <pre> | |
742 | * Procedure : 1) Open Import wizard (see 3.1-3.2) | |
743 | * 2) Browse to directory ${local}/traces/import/ | |
744 | * 3) Select directory import | |
745 | * 4) Select trace type "LTTng Kernel Trace", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure" | |
746 | * 5) Press Finish | |
747 | * 6) When dialog appears select Skip All" | |
748 | * </pre> | |
749 | * <p> | |
750 | * Expected Results: After selecting trace type, verify that button "Import | |
751 | * unrecognized traces" is disabled. One LTTng Kernel trace is imported with | |
752 | * trace type "LTTng Kernel Trace". Make sure that this trace can be opened. | |
753 | */ | |
754 | @Test | |
cdfe10e7 | 755 | public void test3_18ImportRecursiveSpecifyTraceTypeKernel() { |
ab18f69a MAL |
756 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); |
757 | ||
758 | int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; | |
759 | importTrace(LTTNG_KERNEL_TRACE_TYPE, optionFlags, ImportConfirmation.SKIP_ALL, ""); | |
760 | ||
761 | verifyTrace(LTTNG_KERNEL_TRACE, optionFlags); | |
762 | ||
763 | SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
764 | assertEquals(1, tracesFolderItem.getItems().length); | |
765 | } | |
766 | ||
767 | /** | |
768 | * <p> | |
769 | * Action : Recursive import with specific trace type 3 (Skip All) | |
770 | * <p> | |
771 | * | |
772 | * <pre> | |
773 | * Procedure : 1) Open Import wizard | |
774 | * 2) Browse to directory ${local}/traces/import/ | |
775 | * 3) Select directory import | |
776 | * 4) Select trace type "LTTng UST Trace", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure" | |
777 | * 5) Press Finish | |
778 | * 6) When dialog appears select Skip All" | |
779 | * </pre> | |
780 | * <p> | |
781 | * Expected Results: After selecting trace type, verify that button "Import | |
782 | * unrecognized traces" is disabled. 3 LTTng UST traces are imported with | |
783 | * trace type "LTTng UST Trace". Make sure that these traces can be opened. | |
784 | */ | |
785 | @Test | |
cdfe10e7 | 786 | public void test3_19ImportRecursiveSpecifyTraceTypeUST() { |
ab18f69a MAL |
787 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); |
788 | ||
789 | int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; | |
790 | importTrace(LTTNG_UST_TRACE_TYPE, optionFlags, ImportConfirmation.SKIP_ALL, ""); | |
791 | ||
792 | final TestTraceInfo[] UST_TRACEINFOS = new TestTraceInfo[] { | |
793 | SIMPLE_SERVER1_UST_TRACE, | |
794 | SIMPLE_SERVER2_UST_TRACE, | |
795 | UST_OVERLAP_TESTING_UST_TRACE | |
796 | }; | |
797 | for (TestTraceInfo info : UST_TRACEINFOS) { | |
798 | verifyTrace(info, optionFlags); | |
799 | } | |
800 | ||
801 | SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
802 | assertEquals(UST_TRACEINFOS.length, tracesFolderItem.getItems().length); | |
803 | } | |
804 | ||
805 | /** | |
806 | * <p> | |
807 | * Action : Recursive import with specific trace type 4 (Skip All) | |
808 | * <p> | |
809 | * | |
810 | * <pre> | |
811 | * Procedure : 1) Open Import wizard (see 3.1-3.2) | |
812 | * 2) Browse to directory ${local}/traces/import/ | |
813 | * 3) select directory import | |
814 | * 4) Select trace type "Tmf Generic", unselect "Overwrite existing without warning", select "Create Links to workspace" and unselect "Preserve Folder Structure" | |
815 | * 5) press Finish | |
816 | * 6) When dialog appears select Skip All" | |
817 | * </pre> | |
818 | * <p> | |
819 | * Expected Results: All text files in directories are imported as trace and | |
820 | * trace type "Tmf Generic" is set. Note that trace type validation only | |
821 | * checks for file exists and that file is not a directory. Make sure that | |
822 | * these traces can be opened. However traces with wrong trace type won't | |
823 | * show any events in the table. | |
824 | */ | |
825 | @Test | |
cdfe10e7 | 826 | public void test3_20ImportRecursiveSpecifyTraceTypeCustomText() { |
ab18f69a MAL |
827 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); |
828 | ||
829 | int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; | |
830 | importTrace(CUSTOM_TEXT_TRACE_TYPE, optionFlags, ImportConfirmation.SKIP_ALL, ""); | |
831 | verifyTrace(CUSTOM_TEXT_LOG, optionFlags); | |
832 | ||
833 | final TestTraceInfo[] TEXT_BASED_TRACEINFOS = new TestTraceInfo[] { | |
834 | CUSTOM_TEXT_LOG, | |
835 | CUSTOM_XML_LOG_AS_TEXT, | |
836 | UNRECOGNIZED_LOG | |
837 | }; | |
838 | for (TestTraceInfo info : TEXT_BASED_TRACEINFOS) { | |
839 | verifyTrace(info, optionFlags, info.getTraceName(), CUSTOM_TEXT_TRACE_TYPE); | |
840 | } | |
841 | ||
842 | SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
843 | assertEquals(TEXT_BASED_TRACEINFOS.length, tracesFolderItem.getItems().length); | |
844 | } | |
845 | ||
d2fbf6b6 PT |
846 | /** |
847 | * Action : Test the import wizard from workbench menu with project selected | |
848 | * <p> | |
849 | * <pre> | |
850 | * Procedure : 1) Select Project "Test" in Project Explorer view | |
851 | * 2) Open import wizard from menu File > Import... > Tracing > Trace Import | |
852 | * 3) Browse to directory ${local}/traces/import/ | |
853 | * 4) Select trace ExampleCustomTxt.log | |
854 | * 5) Keep <Auto Detection>, select "Create Links to workspace" and | |
855 | * 6) press Finish | |
856 | * </pre> | |
857 | * <p> | |
858 | * Expected Results: Verify that trace is imported to "Test" project and can be opened. | |
859 | */ | |
860 | @Test | |
861 | public void test3_21ImportFromMenuProjectSelected() { | |
862 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); | |
863 | ||
864 | SWTBotUtils.selectProject(fBot, TRACE_PROJECT_NAME); | |
865 | SWTBotShell shell = openWorkbenchMenuImport(); | |
866 | int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; | |
867 | importTrace(shell, null, null, optionFlags, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG.getTracePath()); | |
868 | verifyTrace(CUSTOM_TEXT_LOG, optionFlags); | |
869 | } | |
870 | ||
871 | /** | |
872 | * Action : Test the import wizard from workbench menu with no project selected | |
873 | * <p> | |
874 | * <pre> | |
875 | * Procedure : 1) Clear selection in Project Explorer view | |
876 | * 2) Open import wizard from menu File > Import... > Tracing > Trace Import | |
877 | * 3) Browse to directory ${local}/traces/import/ | |
878 | * 4) Select trace ExampleCustomTxt.log | |
879 | * 5) Keep <Auto Detection>, select "Create Links to workspace" and | |
880 | * 6) press Finish | |
881 | * </pre> | |
882 | * <p> | |
883 | * Expected Results: Verify that trace is imported to default "Tracing" project and can be opened. | |
884 | */ | |
885 | @Test | |
886 | public void test3_22ImportFromMenuProjectNotSelected() { | |
887 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); | |
888 | ||
889 | SWTBotView projectExplorerBot = fBot.viewByTitle("Project Explorer"); | |
890 | projectExplorerBot.show(); | |
891 | projectExplorerBot.bot().waitUntil(Conditions.widgetIsEnabled(projectExplorerBot.bot().tree())); | |
892 | projectExplorerBot.bot().tree().unselect(); | |
893 | SWTBotShell shell = openWorkbenchMenuImport(); | |
894 | int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; | |
895 | importTrace(shell, null, null, optionFlags, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG.getTracePath()); | |
896 | verifyTrace(CUSTOM_TEXT_LOG, optionFlags, CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_LOG.getTraceType(), DEFAULT_PROJECT_NAME); | |
897 | SWTBotUtils.deleteProject(DEFAULT_PROJECT_NAME, fBot); | |
ab18f69a MAL |
898 | } |
899 | ||
cdfe10e7 PT |
900 | /** |
901 | * <p> | |
902 | * Action : Recursive import with preserved folder structure | |
903 | * <p> | |
904 | * | |
905 | * <pre> | |
906 | * Procedure : 0) Delete all traces in project | |
907 | * 1) Open Import wizard | |
908 | * 2) Browse to directory ${local}/traces/import/ | |
909 | * 3) Select directory import | |
910 | * 4) Select trace type "Tmf Generic", unselect "Overwrite existing without warning", select "Create Links to workspace" and select "Preserve Folder Structure" | |
911 | * 5) press Finish | |
912 | * </pre> | |
913 | * <p> | |
914 | * Expected Results: All matching traces are imported with trace type set. | |
915 | * The folder "clashes" is imported with traces inside. Make sure that the | |
916 | * traces can be opened. | |
917 | */ | |
918 | @Test | |
919 | public void test3_29ImportRecursivePreserve() { | |
920 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); | |
921 | ||
922 | int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE | ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE; | |
923 | importTrace(CUSTOM_TEXT_TRACE_TYPE, optionFlags, ImportConfirmation.CONTINUE, ""); | |
924 | ||
925 | verifyTrace(CUSTOM_TEXT_LOG, optionFlags, CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE); | |
926 | verifyTrace(CUSTOM_XML_LOG_AS_TEXT, optionFlags, CUSTOM_XML_LOG_AS_TEXT.getTraceName(), CUSTOM_TEXT_TRACE_TYPE); | |
927 | verifyTrace(UNRECOGNIZED_LOG, optionFlags, UNRECOGNIZED_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE); | |
928 | verifyTrace(CLASHES_CUSTOM_TEXT_LOG, optionFlags, CLASHES_CUSTOM_TEXT_LOG.getTracePath(), CUSTOM_TEXT_TRACE_TYPE); | |
929 | verifyTrace(CLASHES_CUSTOM_XML_LOG_AS_TEXT, optionFlags, CLASHES_CUSTOM_XML_LOG_AS_TEXT.getTracePath(), CUSTOM_TEXT_TRACE_TYPE); | |
930 | ||
931 | SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
932 | assertEquals(4, tracesFolderItem.getItems().length); | |
933 | SWTBotTreeItem clashesFolderItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolderItem, CLASHES_DIR_NAME); | |
934 | assertEquals(2, clashesFolderItem.getItems().length); | |
935 | } | |
936 | ||
937 | /** | |
938 | * <p> | |
939 | * Action : Recursive import with preserved folder structure (Skip All) | |
940 | * <p> | |
941 | * | |
942 | * <pre> | |
943 | * Procedure : 1) Open Import wizard | |
944 | * 2) Browse to directory ${local}/traces/import/ | |
945 | * 3) Select directory import | |
946 | * 4) Select trace type "Tmf Generic", unselect "Overwrite existing without warning", select "Create Links to workspace" and select "Preserve Folder Structure" | |
947 | * 5) press Finish | |
948 | * 6) When dialog appears select "Skip All" | |
949 | * </pre> | |
950 | * <p> | |
951 | * Expected Results: The wizard should finish quickly as no trace will be | |
952 | * imported. Make sure that the traces can be opened. | |
953 | */ | |
954 | @Test | |
955 | public void test3_30ImportRecursivePreserveSkipAll() { | |
956 | int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE | ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE; | |
957 | importTrace(CUSTOM_TEXT_TRACE_TYPE, optionFlags, ImportConfirmation.SKIP_ALL, ""); | |
958 | ||
959 | verifyTrace(CUSTOM_TEXT_LOG, optionFlags, CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE); | |
960 | verifyTrace(CUSTOM_XML_LOG_AS_TEXT, optionFlags, CUSTOM_XML_LOG_AS_TEXT.getTraceName(), CUSTOM_TEXT_TRACE_TYPE); | |
961 | verifyTrace(UNRECOGNIZED_LOG, optionFlags, UNRECOGNIZED_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE); | |
962 | verifyTrace(CLASHES_CUSTOM_TEXT_LOG, optionFlags, CLASHES_CUSTOM_TEXT_LOG.getTracePath(), CUSTOM_TEXT_TRACE_TYPE); | |
963 | verifyTrace(CLASHES_CUSTOM_XML_LOG_AS_TEXT, optionFlags, CLASHES_CUSTOM_XML_LOG_AS_TEXT.getTracePath(), CUSTOM_TEXT_TRACE_TYPE); | |
964 | ||
965 | SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
966 | assertEquals(4, tracesFolderItem.getItems().length); | |
967 | SWTBotTreeItem clashesFolderItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolderItem, CLASHES_DIR_NAME); | |
968 | assertEquals(2, clashesFolderItem.getItems().length); | |
969 | //TOOD: verify that traces were actually skipped | |
970 | } | |
971 | ||
972 | /** | |
973 | * <p> | |
974 | * Action : Recursive import with preserved folder structure (Rename All) | |
975 | * <p> | |
976 | * | |
977 | * <pre> | |
978 | * Procedure : 1) Open Import wizard | |
979 | * 2) Browse to directory ${local}/traces/import/ | |
980 | * 3) Select directory import | |
981 | * 4) Select trace type "Tmf Generic", unselect "Overwrite existing without warning", select "Create Links to workspace" and select "Preserve Folder Structure" | |
982 | * 5) press Finish | |
983 | * 6) When dialog appears select "Rename All" | |
984 | * </pre> | |
985 | * <p> | |
986 | * Expected Results: All matching traces are imported with trace type set. | |
987 | * The traces are renamed with suffix (2). The folder "clashes" is imported | |
988 | * with traces inside. Make sure that the traces can be opened. | |
989 | */ | |
990 | @Test | |
991 | public void test3_31ImportRecursivePreserveRenameAll() { | |
992 | int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE | ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE; | |
993 | importTrace(CUSTOM_TEXT_TRACE_TYPE, optionFlags, ImportConfirmation.RENAME_ALL, ""); | |
994 | ||
995 | verifyTrace(CUSTOM_TEXT_LOG, optionFlags, toRenamedName(CUSTOM_TEXT_LOG.getTraceName()), CUSTOM_TEXT_TRACE_TYPE); | |
996 | verifyTrace(CUSTOM_XML_LOG_AS_TEXT, optionFlags, toRenamedName(CUSTOM_XML_LOG_AS_TEXT.getTraceName()), CUSTOM_TEXT_TRACE_TYPE); | |
997 | verifyTrace(UNRECOGNIZED_LOG, optionFlags, toRenamedName(UNRECOGNIZED_LOG.getTraceName()), CUSTOM_TEXT_TRACE_TYPE); | |
998 | verifyTrace(CLASHES_CUSTOM_TEXT_LOG, optionFlags, toRenamedName(CLASHES_CUSTOM_TEXT_LOG.getTracePath()), CUSTOM_TEXT_TRACE_TYPE); | |
999 | verifyTrace(CLASHES_CUSTOM_XML_LOG_AS_TEXT, optionFlags, toRenamedName(CLASHES_CUSTOM_XML_LOG_AS_TEXT.getTracePath()), CUSTOM_TEXT_TRACE_TYPE); | |
1000 | ||
1001 | SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
1002 | assertEquals(7, tracesFolderItem.getItems().length); | |
1003 | SWTBotTreeItem clashesFolderItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolderItem, CLASHES_DIR_NAME); | |
1004 | assertEquals(4, clashesFolderItem.getItems().length); | |
1005 | } | |
1006 | ||
d2fbf6b6 PT |
1007 | /** |
1008 | * <p> | |
1009 | * Action : Delete with mixed selection of traces and folder | |
1010 | * <p> | |
1011 | * | |
1012 | * <pre> | |
1013 | * Procedure : 0) Delete all traces in project | |
1014 | * 1) Create two trace folders under the "Traces" folder | |
1015 | * 2) Import 2 traces under each folder | |
1016 | * 3) Open all 4 traces. | |
1017 | * 4) Select the trace in the first folder and the second folder in the Project Explorer view | |
1018 | * 5) Right-click, Delete. Click Yes. | |
1019 | * </pre> | |
1020 | * <p> | |
1021 | * Expected Results: A dialog should ask the user to confirm deletion of the | |
1022 | * selected elements. Clicking OK should remove all that was selected. The | |
1023 | * editor of the 3 deleted traces should be closed automatically with one | |
1024 | * remaining editor opened. | |
1025 | */ | |
1026 | @Test | |
1027 | public void test3_32DeleteTraceAndFolder() { | |
1028 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); | |
1029 | ||
1030 | SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
1031 | tracesFolder.contextMenu().menu("New Folder...").click(); | |
1032 | SWTBot newFolderShellBot = fBot.shell("New Folder").bot(); | |
1033 | newFolderShellBot.text().setText("FolderA"); | |
1034 | newFolderShellBot.button("OK").click(); | |
1035 | tracesFolder.contextMenu().menu("New Folder...").click(); | |
1036 | newFolderShellBot = fBot.shell("New Folder").bot(); | |
1037 | newFolderShellBot.text().setText("FolderB"); | |
1038 | newFolderShellBot.button("OK").click(); | |
1039 | ||
1040 | int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; | |
1041 | SWTBotTreeItem traceFolder = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, "FolderA"); | |
1042 | SWTBotShell shell = openTraceFoldersImport(traceFolder); | |
1043 | importTrace(shell, null, null, optionFlags, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG.getTracePath(), LTTNG_KERNEL_TRACE.getTracePath()); | |
1044 | verifyTrace(CUSTOM_TEXT_LOG, optionFlags, "FolderA/" + CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE); | |
1045 | verifyTrace(LTTNG_KERNEL_TRACE, optionFlags, "FolderA/" + LTTNG_KERNEL_TRACE.getTraceName(), LTTNG_KERNEL_TRACE_TYPE); | |
1046 | ||
1047 | traceFolder = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, "FolderB"); | |
1048 | shell = openTraceFoldersImport(traceFolder); | |
1049 | importTrace(shell, null, null, optionFlags, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG.getTracePath(), LTTNG_KERNEL_TRACE.getTracePath()); | |
1050 | verifyTrace(CUSTOM_TEXT_LOG, optionFlags, "FolderB/" + CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE); | |
1051 | verifyTrace(LTTNG_KERNEL_TRACE, optionFlags, "FolderB/" + LTTNG_KERNEL_TRACE.getTraceName(), LTTNG_KERNEL_TRACE_TYPE); | |
1052 | ||
1053 | SWTBotTree tree = fBot.viewByTitle("Project Explorer").bot().tree(); | |
1054 | SWTBotTreeItem folderAItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, "FolderA"); | |
1055 | SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, folderAItem, CUSTOM_TEXT_LOG.getTraceName()); | |
1056 | SWTBotTreeItem folderBItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, "FolderB"); | |
1057 | tree.select(traceItem, folderBItem); | |
1058 | tree.contextMenu().menu("Delete").click(); | |
1059 | SWTBot deleteConfirmationShellBot = fBot.shell("Confirm Delete").bot(); | |
1060 | deleteConfirmationShellBot.button("Yes").click(); | |
1061 | fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, "FolderA/" + CUSTOM_TEXT_LOG.getTraceName())); | |
1062 | fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, "FolderB/" + CUSTOM_TEXT_LOG.getTraceName())); | |
1063 | fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, "FolderB/" + LTTNG_KERNEL_TRACE.getTraceName())); | |
1064 | fBot.waitUntil(ConditionHelpers.isEditorOpened(fBot, "FolderA/" + LTTNG_KERNEL_TRACE.getTraceName())); | |
1065 | assertEquals(1, tracesFolder.getNodes().size()); | |
1066 | assertEquals(1, folderAItem.getNodes().size()); | |
1067 | } | |
1068 | ||
1069 | /** | |
1070 | * <p> | |
1071 | * Action : Delete with multiple folders | |
1072 | * <p> | |
1073 | * | |
1074 | * <pre> | |
1075 | * Procedure : 0) Delete all traces in project | |
1076 | * 1) Create two trace folders under the "Traces" folder | |
1077 | * 2) Import a trace under each folder | |
1078 | * 3) Open both traces. | |
1079 | * 4) Select both folders in the Project Explorer view | |
1080 | * 5) Right-click, Delete. Click Yes. | |
1081 | * </pre> | |
1082 | * <p> | |
1083 | * Expected Results: A dialog should ask the user to confirm deletion of the | |
1084 | * selected elements. Clicking OK should remove all that was selected. The | |
1085 | * editor of the 3 deleted traces should be closed automatically with one | |
1086 | * remaining editor opened. | |
1087 | */ | |
1088 | @Test | |
1089 | public void test3_33DeleteMultipleFolders() { | |
1090 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); | |
1091 | ||
1092 | SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
1093 | tracesFolder.contextMenu().menu("New Folder...").click(); | |
1094 | SWTBot newFolderShellBot = fBot.shell("New Folder").bot(); | |
1095 | newFolderShellBot.text().setText("FolderA"); | |
1096 | newFolderShellBot.button("OK").click(); | |
1097 | tracesFolder.contextMenu().menu("New Folder...").click(); | |
1098 | newFolderShellBot = fBot.shell("New Folder").bot(); | |
1099 | newFolderShellBot.text().setText("FolderB"); | |
1100 | newFolderShellBot.button("OK").click(); | |
1101 | ||
1102 | int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; | |
1103 | SWTBotTreeItem traceFolder = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, "FolderA"); | |
1104 | SWTBotShell shell = openTraceFoldersImport(traceFolder); | |
1105 | importTrace(shell, null, null, optionFlags, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG.getTracePath()); | |
1106 | verifyTrace(CUSTOM_TEXT_LOG, optionFlags, "FolderA/" + CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE); | |
1107 | ||
1108 | traceFolder = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, "FolderB"); | |
1109 | shell = openTraceFoldersImport(traceFolder); | |
1110 | importTrace(shell, null, null, optionFlags, new ImportConfirmationSupplier(), LTTNG_KERNEL_TRACE.getTracePath()); | |
1111 | verifyTrace(LTTNG_KERNEL_TRACE, optionFlags, "FolderB/" + LTTNG_KERNEL_TRACE.getTraceName(), LTTNG_KERNEL_TRACE_TYPE); | |
1112 | ||
1113 | SWTBotTree tree = fBot.viewByTitle("Project Explorer").bot().tree(); | |
1114 | SWTBotTreeItem folderAItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, "FolderA"); | |
1115 | SWTBotTreeItem folderBItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, "FolderB"); | |
1116 | tree.select(folderAItem, folderBItem); | |
1117 | tree.contextMenu().menu("Delete").click(); | |
1118 | SWTBot deleteConfirmationShellBot = fBot.shell("Confirm Delete").bot(); | |
1119 | deleteConfirmationShellBot.button("Yes").click(); | |
1120 | fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, "FolderA/" + CUSTOM_TEXT_LOG.getTraceName())); | |
1121 | fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, "FolderB/" + LTTNG_KERNEL_TRACE.getTraceName())); | |
1122 | assertEquals(0, tracesFolder.getNodes().size()); | |
1123 | } | |
1124 | ||
1125 | /** | |
1126 | * <p> | |
1127 | * Action : Clear single Traces folder | |
1128 | * <p> | |
1129 | * | |
1130 | * <pre> | |
1131 | * Procedure : 1) Import 2 traces from different folders preserving folder structure | |
1132 | * 2) Open both traces. | |
1133 | * 3) Select the Traces folder | |
1134 | * 4) Right-click, Clear. Click Yes. | |
1135 | * </pre> | |
1136 | * <p> | |
1137 | * Expected Results: A dialog should ask the user to confirm clearing of the | |
1138 | * folder. Clicking Yes should remove everything under the selected folder | |
1139 | * and close the traces. | |
1140 | */ | |
1141 | @Test | |
1142 | public void test3_34ClearSingleTracesFolder() { | |
1143 | int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE | ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE; | |
1144 | importTrace(CUSTOM_TEXT_TRACE_TYPE, optionFlags, ImportConfirmation.CONTINUE, CUSTOM_TEXT_LOG.getTraceName(), CLASHES_CUSTOM_TEXT_LOG.getTracePath()); | |
1145 | ||
1146 | verifyTrace(CUSTOM_TEXT_LOG, optionFlags, CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE); | |
1147 | verifyTrace(CLASHES_CUSTOM_TEXT_LOG, optionFlags, CLASHES_CUSTOM_TEXT_LOG.getTracePath(), CUSTOM_TEXT_TRACE_TYPE); | |
1148 | ||
1149 | SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
1150 | tracesFolder.contextMenu().menu("Clear").click(); | |
1151 | SWTBot deleteConfirmationShellBot = fBot.shell("Confirm Clear").bot(); | |
1152 | deleteConfirmationShellBot.button("Yes").click(); | |
1153 | fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, CUSTOM_TEXT_LOG.getTraceName())); | |
1154 | fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, CLASHES_CUSTOM_TEXT_LOG.getTracePath())); | |
1155 | assertEquals(0, tracesFolder.getNodes().size()); | |
1156 | } | |
1157 | ||
1158 | /** | |
1159 | * <p> | |
1160 | * Action : Clear multiple Traces folder | |
1161 | * <p> | |
1162 | * | |
1163 | * <pre> | |
1164 | * Procedure : 1) Import 2 traces to different projects | |
1165 | * 2) Open both traces. | |
1166 | * 3) Select both Traces folders | |
1167 | * 4) Right-click, Clear. Click Yes. | |
1168 | * </pre> | |
1169 | * <p> | |
1170 | * Expected Results: A dialog should ask the user to confirm clearing of the | |
1171 | * folders. Clicking Yes should remove everything under the selected folders | |
1172 | * and close the traces. | |
1173 | */ | |
1174 | @Test | |
1175 | public void test3_35ClearMultipleTracesFolder() { | |
1176 | int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; | |
1177 | SWTBotTreeItem tracesFolder1 = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
1178 | SWTBotShell shell = openTraceFoldersImport(tracesFolder1); | |
1179 | importTrace(shell, null, null, optionFlags, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG.getTracePath()); | |
1180 | verifyTrace(CUSTOM_TEXT_LOG, optionFlags, CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE, TRACE_PROJECT_NAME); | |
1181 | ||
1182 | SWTBotUtils.createProject(DEFAULT_PROJECT_NAME); | |
1183 | SWTBotTreeItem tracesFolder2 = SWTBotUtils.selectTracesFolder(fBot, DEFAULT_PROJECT_NAME); | |
1184 | shell = openTraceFoldersImport(tracesFolder2); | |
1185 | importTrace(shell, null, null, optionFlags, new ImportConfirmationSupplier(), LTTNG_KERNEL_TRACE.getTracePath()); | |
1186 | verifyTrace(LTTNG_KERNEL_TRACE, optionFlags, LTTNG_KERNEL_TRACE.getTraceName(), LTTNG_KERNEL_TRACE_TYPE, DEFAULT_PROJECT_NAME); | |
1187 | ||
1188 | SWTBotTree tree = fBot.viewByTitle("Project Explorer").bot().tree(); | |
1189 | tree.select(tracesFolder1, tracesFolder2); | |
1190 | tree.contextMenu().menu("Clear").click(); | |
1191 | SWTBot deleteConfirmationShellBot = fBot.shell("Confirm Clear").bot(); | |
1192 | deleteConfirmationShellBot.button("Yes").click(); | |
1193 | fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, CUSTOM_TEXT_LOG.getTraceName())); | |
1194 | fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, LTTNG_KERNEL_TRACE.getTraceName())); | |
1195 | assertEquals(0, tracesFolder1.getNodes().size()); | |
1196 | assertEquals(0, tracesFolder2.getNodes().size()); | |
1197 | ||
1198 | SWTBotUtils.deleteProject(DEFAULT_PROJECT_NAME, fBot); | |
1199 | } | |
1200 | ||
cdfe10e7 PT |
1201 | /** |
1202 | * <p> | |
1203 | * Action : Import from zip archive with preserved folder structure | |
1204 | * <p> | |
1205 | * | |
1206 | * <pre> | |
1207 | * Procedure : 0) Delete all traces in project | |
1208 | * 1) Open Import wizard | |
1209 | * 2) Select archive file: traces.zip | |
1210 | * 3) Select archive root directory | |
1211 | * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and select "Preserve Folder Structure" | |
1212 | * 5) press Finish | |
1213 | * </pre> | |
1214 | * <p> | |
1215 | * Expected Results: All traces are imported with trace type set. The folder | |
1216 | * "clashes" is imported with traces inside. Make sure that the traces can | |
1217 | * be opened. | |
1218 | */ | |
1219 | @Test | |
1220 | public void test3_36ImportZipArchivePreserve() { | |
1221 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); | |
1222 | ||
1223 | int optionFlags = ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE; | |
1224 | importTrace("traces.zip", null, optionFlags, ImportConfirmation.CONTINUE, ""); | |
1225 | ||
1226 | for (TestTraceInfo info : ALL_TRACEINFOS) { | |
1227 | verifyTrace(info, optionFlags, info.getTracePath()); | |
1228 | } | |
1229 | ||
1230 | SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
1231 | assertEquals(7, tracesFolderItem.getItems().length); | |
1232 | SWTBotTreeItem clashesFolderItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolderItem, CLASHES_DIR_NAME); | |
1233 | assertEquals(6, clashesFolderItem.getItems().length); | |
1234 | } | |
1235 | ||
1236 | /** | |
1237 | * <p> | |
1238 | * Action : Import from zip archive without preserved folder structure | |
1239 | * (Rename All) | |
1240 | * <p> | |
1241 | * | |
1242 | * <pre> | |
1243 | * Procedure : 0) Delete all traces in project | |
1244 | * 1) Open Import wizard | |
1245 | * 2) Select archive file: traces.zip | |
1246 | * 3) Select archive root directory | |
1247 | * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and unselect "Preserve Folder Structure" | |
1248 | * 5) press Finish | |
1249 | * 6) When dialog appears select "Rename All" | |
1250 | * </pre> | |
1251 | * <p> | |
1252 | * Expected Results: All traces are imported with trace type set. The traces | |
1253 | * from folder "clashes" are renamed with suffix (2). Make sure that the | |
1254 | * traces can be opened. | |
1255 | */ | |
1256 | @Test | |
1257 | public void test3_37ImportZipArchiveNoPreserve() { | |
1258 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); | |
1259 | ||
1260 | int optionFlags = 0; | |
1261 | importTrace("traces.zip", null, optionFlags, ImportConfirmation.RENAME_ALL, ""); | |
1262 | ||
1263 | for (TestTraceInfo info : ALL_TRACEINFOS) { | |
1264 | String traceName = info.getTraceName(); | |
1265 | if (CLASHING_TRACEINFOS.contains(info)) { | |
1266 | traceName = toRenamedName(traceName); | |
1267 | } | |
1268 | verifyTrace(info, optionFlags, traceName); | |
1269 | } | |
1270 | ||
1271 | SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
1272 | assertEquals(12, tracesFolderItem.getItems().length); | |
1273 | } | |
1274 | ||
1275 | /** | |
1276 | * <p> | |
1277 | * Action : Import from zip archive specific traces | |
1278 | * <p> | |
1279 | * | |
1280 | * <pre> | |
1281 | * Procedure : 0) Delete all traces in project | |
1282 | * 1) Open Import wizard | |
1283 | * 2) Select archive file: traces.zip | |
1284 | * 3) Select file z-clashes/ExampleCustomTxt.log and directory kernel-overlap-testing/ | |
1285 | * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and select "Preserve Folder Structure" | |
1286 | * 5) press Finish | |
1287 | * </pre> | |
1288 | * <p> | |
1289 | * Expected Results: The specified traces are imported with trace type set. | |
1290 | * Make sure that the traces can be opened. | |
1291 | */ | |
1292 | @Test | |
1293 | public void test3_38ImportZipArchiveSpecificTraces() { | |
1294 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); | |
1295 | ||
1296 | int optionFlags = ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE; | |
1297 | importTrace("traces.zip", null, optionFlags, ImportConfirmation.CONTINUE, "z-clashes/ExampleCustomTxt.log", "kernel-overlap-testing/"); | |
1298 | ||
1299 | verifyTrace(CLASHES_CUSTOM_TEXT_LOG, optionFlags, CLASHES_CUSTOM_TEXT_LOG.getTracePath()); | |
1300 | verifyTrace(LTTNG_KERNEL_TRACE, optionFlags, LTTNG_KERNEL_TRACE.getTracePath()); | |
1301 | ||
1302 | SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
1303 | assertEquals(2, tracesFolderItem.getItems().length); | |
1304 | SWTBotTreeItem clashesFolderItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolderItem, CLASHES_DIR_NAME); | |
1305 | assertEquals(1, clashesFolderItem.getItems().length); | |
1306 | } | |
1307 | ||
1308 | /** | |
1309 | * <p> | |
1310 | * Action : Import from tar.gz archive with preserved folder structure | |
1311 | * <p> | |
1312 | * | |
1313 | * <pre> | |
1314 | * Procedure : 0) Delete all traces in project | |
1315 | * 1) Open Import wizard | |
1316 | * 2) Select archive file: traces.tar.gz | |
1317 | * 3) Select archive root directory | |
1318 | * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and select "Preserve Folder Structure" | |
1319 | * 5) press Finish | |
1320 | * </pre> | |
1321 | * <p> | |
1322 | * Expected Results: All traces are imported with trace type set. The folder | |
1323 | * "clashes" is imported with traces inside. Make sure that the traces can | |
1324 | * be opened. | |
1325 | */ | |
1326 | @Test | |
1327 | public void test3_39ImportTarGzipArchivePreserve() { | |
1328 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); | |
1329 | ||
1330 | int optionFlags = ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE; | |
1331 | importTrace("traces.tar.gz", null, optionFlags, ImportConfirmation.CONTINUE, ""); | |
1332 | ||
1333 | for (TestTraceInfo info : ALL_TRACEINFOS) { | |
1334 | verifyTrace(info, optionFlags, info.getTracePath()); | |
1335 | } | |
1336 | ||
1337 | SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
1338 | assertEquals(7, tracesFolderItem.getItems().length); | |
1339 | SWTBotTreeItem clashesFolderItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolderItem, CLASHES_DIR_NAME); | |
1340 | assertEquals(6, clashesFolderItem.getItems().length); | |
1341 | } | |
1342 | ||
1343 | /** | |
1344 | * <p> | |
1345 | * Action : Import from tar.gz archive without preserved folder structure (Rename All) | |
1346 | * <p> | |
1347 | * | |
1348 | * <pre> | |
1349 | * Procedure : 0) Delete all traces in project | |
1350 | * 1) Open Import wizard | |
1351 | * 2) Select archive file: traces.tar.gz | |
1352 | * 3) Select archive root directory | |
1353 | * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and unselect "Preserve Folder Structure" | |
1354 | * 5) press Finish | |
1355 | * 6) When dialog appears select "Rename All" | |
1356 | * </pre> | |
1357 | * <p> | |
1358 | * Expected Results: All traces are imported with trace type set. The traces | |
1359 | * from folder "clashes" are renamed with suffix (2). Make sure that the | |
1360 | * traces can be opened. | |
1361 | */ | |
1362 | @Test | |
1363 | public void test3_40ImportTarGzipArchiveNoPreserve() { | |
1364 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); | |
1365 | ||
1366 | int optionFlags = 0; | |
1367 | importTrace("traces.tar.gz", null, optionFlags, ImportConfirmation.RENAME_ALL, ""); | |
1368 | ||
1369 | for (TestTraceInfo info : ALL_TRACEINFOS) { | |
1370 | String traceName = info.getTraceName(); | |
1371 | if (CLASHING_TRACEINFOS.contains(info)) { | |
1372 | traceName = toRenamedName(traceName); | |
1373 | } | |
1374 | verifyTrace(info, optionFlags, traceName); | |
1375 | } | |
1376 | ||
1377 | SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
1378 | assertEquals(12, tracesFolderItem.getItems().length); | |
1379 | } | |
1380 | ||
1381 | /** | |
1382 | * <p> | |
1383 | * Action : Import from tar.gz archive specific traces | |
1384 | * <p> | |
1385 | * | |
1386 | * <pre> | |
1387 | * Procedure : 0) Delete all traces in project | |
1388 | * 1) Open Import wizard | |
1389 | * 2) Select archive file: traces.tar.gz | |
1390 | * 3) Select file z-clashes/ExampleCustomTxt.log and directory kernel-overlap-testing/ | |
1391 | * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and select "Preserve Folder Structure" | |
1392 | * 5) press Finish | |
1393 | * </pre> | |
1394 | * <p> | |
1395 | * Expected Results: The specified traces are imported with trace type set. | |
1396 | * Make sure that the traces can be opened. | |
1397 | */ | |
1398 | @Test | |
1399 | public void test3_41ImportTarGzipArchiveSpecificTraces() { | |
1400 | SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); | |
1401 | ||
1402 | int optionFlags = ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE; | |
1403 | importTrace("traces.tar.gz", null, optionFlags, ImportConfirmation.CONTINUE, "z-clashes/ExampleCustomTxt.log", "kernel-overlap-testing/"); | |
1404 | ||
1405 | verifyTrace(CLASHES_CUSTOM_TEXT_LOG, optionFlags, CLASHES_CUSTOM_TEXT_LOG.getTracePath()); | |
1406 | verifyTrace(LTTNG_KERNEL_TRACE, optionFlags, LTTNG_KERNEL_TRACE.getTracePath()); | |
1407 | ||
1408 | SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); | |
1409 | assertEquals(2, tracesFolderItem.getItems().length); | |
1410 | SWTBotTreeItem clashesFolderItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolderItem, CLASHES_DIR_NAME); | |
1411 | assertEquals(1, clashesFolderItem.getItems().length); | |
1412 | } | |
1413 | ||
d2fbf6b6 PT |
1414 | private static void verifyTrace(TestTraceInfo traceInfo, int importOptionFlags) { |
1415 | verifyTrace(traceInfo, importOptionFlags, traceInfo.getTraceName()); | |
1416 | } | |
1417 | ||
ab18f69a MAL |
1418 | private static void verifyTrace(TestTraceInfo traceInfo, int importOptionFlags, String traceName) { |
1419 | verifyTrace(traceInfo, importOptionFlags, traceName, traceInfo.getTraceType()); | |
1420 | } | |
1421 | ||
1422 | private static void verifyTrace(TestTraceInfo traceInfo, int importOptionFlags, String traceName, String traceType) { | |
d2fbf6b6 PT |
1423 | verifyTrace(traceInfo, importOptionFlags, traceName, traceType, TRACE_PROJECT_NAME); |
1424 | } | |
1425 | ||
1426 | private static void verifyTrace(TestTraceInfo traceInfo, int importOptionFlags, String traceName, String traceType, String projectName) { | |
cdfe10e7 | 1427 | String[] tracePath = new Path(traceName).segments(); |
d2fbf6b6 | 1428 | SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, projectName), tracePath); |
ab18f69a MAL |
1429 | checkTraceType(traceItem, traceType); |
1430 | openTrace(traceItem); | |
1431 | if (traceType != null && !traceType.isEmpty()) { | |
1432 | SWTBotImportWizardUtils.testEventsTable(fBot, traceName, traceInfo.getNbEvents(), traceInfo.getFirstEventTimestamp()); | |
1433 | } else { | |
1434 | // If there is no trace type, make sure it can be opened with the text editor | |
1435 | fBot.waitUntil(ConditionHelpers.isEditorOpened(fBot, traceName)); | |
1436 | SWTBotEditor editor = fBot.editorByTitle(traceName); | |
1437 | assertEquals(TEXT_EDITOR_ID, editor.getReference().getId()); | |
1438 | } | |
1439 | checkTraceLinked(traceItem, (importOptionFlags & ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE) != 0); | |
1440 | } | |
1441 | ||
1442 | private static String toRenamedName(String traceName) { | |
1443 | return traceName + "(2)"; | |
1444 | } | |
1445 | ||
1446 | private static void openTrace(SWTBotTreeItem traceItem) { | |
1447 | traceItem.select(); | |
1448 | traceItem.doubleClick(); | |
1449 | } | |
1450 | ||
1451 | private static void testSingleTrace(TestTraceInfo traceInfo, int optionFlags) { | |
1452 | importTrace(optionFlags, traceInfo.getTracePath()); | |
1453 | verifyTrace(traceInfo, optionFlags); | |
1454 | } | |
1455 | ||
1456 | private static void importTrace(int optionFlags, String ... tracePaths) { | |
1457 | importTrace(optionFlags, ImportConfirmation.CONTINUE, tracePaths); | |
1458 | } | |
1459 | ||
1460 | private static void importTrace(int optionFlags, ImportConfirmation confirmationMode, String ... tracePaths) { | |
1461 | importTrace(null, optionFlags, confirmationMode, tracePaths); | |
1462 | } | |
1463 | ||
1464 | private static void importTrace(String traceType, int optionFlags, ImportConfirmation confirmationMode, String ... tracePaths) { | |
cdfe10e7 PT |
1465 | importTrace(null, traceType, optionFlags, confirmationMode, tracePaths); |
1466 | } | |
1467 | ||
1468 | private static void importTrace(String archiveFile, String traceType, int optionFlags, ImportConfirmation confirmationMode, String ... tracePaths) { | |
d2fbf6b6 | 1469 | importTrace(archiveFile, traceType, optionFlags, new ImportConfirmationSupplier(confirmationMode), tracePaths); |
ab18f69a MAL |
1470 | } |
1471 | ||
1472 | private static void importTrace(int optionFlags, Supplier<ImportConfirmation> confirmationSuplier, String ... tracePaths) { | |
cdfe10e7 | 1473 | importTrace(null, null, optionFlags, confirmationSuplier, tracePaths); |
ab18f69a MAL |
1474 | } |
1475 | ||
cdfe10e7 | 1476 | private static void importTrace(String archiveFile, String traceType, int optionFlags, Supplier<ImportConfirmation> confirmationSuplier, String ... tracePaths) { |
ab18f69a | 1477 | SWTBotTreeItem traceFolder = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); |
ab18f69a | 1478 | SWTBotShell shell = openTraceFoldersImport(traceFolder); |
d2fbf6b6 PT |
1479 | importTrace(shell, archiveFile, traceType, optionFlags, confirmationSuplier, tracePaths); |
1480 | } | |
1481 | ||
1482 | /** | |
1483 | * @param tracePaths relative to parent test traces folder | |
1484 | */ | |
1485 | private static void importTrace(SWTBotShell shell, String archiveFile, String traceType, int optionFlags, Supplier<ImportConfirmation> confirmationSuplier, String ... tracePaths) { | |
ab18f69a | 1486 | SWTBot bot = shell.bot(); |
cdfe10e7 PT |
1487 | String rootFolderName; |
1488 | if (archiveFile == null) { | |
1489 | rootFolderName = "import"; | |
1490 | String importDirectoryFullPath = getPath(rootFolderName); | |
1491 | SWTBotImportWizardUtils.selectImportFromDirectory(bot, importDirectoryFullPath); | |
1492 | } else { | |
1493 | rootFolderName = "/"; | |
1494 | String importArchiveFullPath = getPath("archives" + File.separator + archiveFile); | |
1495 | SWTBotImportWizardUtils.selectImportFromArchive(bot, importArchiveFullPath); | |
1496 | } | |
ab18f69a MAL |
1497 | |
1498 | for (String tracePath : tracePaths) { | |
cdfe10e7 PT |
1499 | IPath somePath = new Path(rootFolderName).append(tracePath); |
1500 | String[] treePath = somePath.segments(); | |
1501 | if (archiveFile != null) { | |
1502 | String[] newPath = new String[treePath.length + 1]; | |
1503 | newPath[0] = "/"; | |
1504 | System.arraycopy(treePath, 0, newPath, 1, treePath.length); | |
1505 | treePath = newPath; | |
ab18f69a | 1506 | } |
cdfe10e7 | 1507 | SWTBotImportWizardUtils.selectItem(fBot, treePath); |
ab18f69a MAL |
1508 | } |
1509 | ||
1510 | SWTBotImportWizardUtils.setOptions(bot, optionFlags, traceType); | |
1511 | bot.button("Finish").click(); | |
1512 | ||
1513 | ImportConfirmation importConfirmation = confirmationSuplier.get(); | |
1514 | while (importConfirmation != null) { | |
1515 | if (importConfirmation != ImportConfirmation.CONTINUE) { | |
1516 | fBot.waitUntil(Conditions.shellIsActive("Confirmation")); | |
1517 | SWTBotShell shell2 = fBot.activeShell(); | |
1518 | SWTBotButton button = shell2.bot().button(importConfirmation.getInName()); | |
1519 | button.click(); | |
1520 | } | |
1521 | importConfirmation = confirmationSuplier.get(); | |
1522 | } | |
1523 | ||
1524 | fBot.waitUntil(Conditions.shellCloses(shell)); | |
1525 | } | |
1526 | ||
1527 | private static void checkTraceType(SWTBotTreeItem traceItem, String traceType) { | |
1528 | assertEquals(traceType, getTraceProperty(traceItem, "type")); | |
1529 | } | |
1530 | ||
1531 | private static void checkTraceLinked(SWTBotTreeItem traceItem, boolean linked) { | |
1532 | assertEquals(Boolean.toString(linked), getTraceProperty(traceItem, "linked")); | |
1533 | } | |
1534 | ||
1535 | private static String getTraceProperty(SWTBotTreeItem traceItem, String property) { | |
1536 | SWTBotUtils.openView(IPageLayout.ID_PROP_SHEET); | |
1537 | SWTBotView view = fBot.viewById(IPageLayout.ID_PROP_SHEET); | |
1538 | view.show(); | |
1539 | traceItem.select(); | |
1540 | SWTBotTreeItem traceTypeItem = SWTBotUtils.getTreeItem(view.bot(), view.bot().tree(), "Resource properties", property); | |
1541 | return traceTypeItem.cell(1); | |
1542 | } | |
1543 | ||
1544 | private static SWTBotShell openTraceFoldersImport(SWTBotTreeItem traceItem) { | |
1545 | traceItem.contextMenu().menu("Import...").click(); | |
1546 | fBot.waitUntil(Conditions.shellIsActive("Trace Import")); | |
1547 | ||
1548 | SWTBotShell shell = fBot.shell("Trace Import"); | |
1549 | return shell; | |
1550 | } | |
d2fbf6b6 PT |
1551 | |
1552 | private static SWTBotShell openWorkbenchMenuImport() { | |
1553 | fBot.menu().menu("File", "Import...").click(); | |
1554 | fBot.waitUntil(Conditions.shellIsActive("Import")); | |
1555 | ||
1556 | SWTBot shellBot = fBot.shell("Import").bot(); | |
1557 | SWTBotTree tree = shellBot.tree(); | |
1558 | SWTBotUtils.getTreeItem(fBot, tree, "Tracing", "Trace Import").select(); | |
1559 | shellBot.button("Next >").click(); | |
1560 | SWTBotShell shell = fBot.shell("Trace Import"); | |
1561 | return shell; | |
1562 | } | |
ab18f69a | 1563 | } |