+ /**
+ * <p>
+ * Action : Delete with mixed selection of traces and folder
+ * <p>
+ *
+ * <pre>
+ * Procedure : 0) Delete all traces in project
+ * 1) Create two trace folders under the "Traces" folder
+ * 2) Import 2 traces under each folder
+ * 3) Open all 4 traces.
+ * 4) Select the trace in the first folder and the second folder in the Project Explorer view
+ * 5) Right-click, Delete. Click Yes.
+ * </pre>
+ * <p>
+ * Expected Results: A dialog should ask the user to confirm deletion of the
+ * selected elements. Clicking OK should remove all that was selected. The
+ * editor of the 3 deleted traces should be closed automatically with one
+ * remaining editor opened.
+ */
+ @Test
+ public void test3_32DeleteTraceAndFolder() {
+ SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
+
+ SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
+ tracesFolder.contextMenu().menu("New Folder...").click();
+ SWTBot newFolderShellBot = fBot.shell("New Folder").bot();
+ newFolderShellBot.text().setText("FolderA");
+ newFolderShellBot.button("OK").click();
+ tracesFolder.contextMenu().menu("New Folder...").click();
+ newFolderShellBot = fBot.shell("New Folder").bot();
+ newFolderShellBot.text().setText("FolderB");
+ newFolderShellBot.button("OK").click();
+
+ int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
+ SWTBotTreeItem traceFolder = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, "FolderA");
+ SWTBotShell shell = openTraceFoldersImport(traceFolder);
+ importTrace(shell, null, null, optionFlags, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG.getTracePath(), LTTNG_KERNEL_TRACE.getTracePath());
+ verifyTrace(CUSTOM_TEXT_LOG, optionFlags, "FolderA/" + CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE);
+ verifyTrace(LTTNG_KERNEL_TRACE, optionFlags, "FolderA/" + LTTNG_KERNEL_TRACE.getTraceName(), LTTNG_KERNEL_TRACE_TYPE);
+
+ traceFolder = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, "FolderB");
+ shell = openTraceFoldersImport(traceFolder);
+ importTrace(shell, null, null, optionFlags, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG.getTracePath(), LTTNG_KERNEL_TRACE.getTracePath());
+ verifyTrace(CUSTOM_TEXT_LOG, optionFlags, "FolderB/" + CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE);
+ verifyTrace(LTTNG_KERNEL_TRACE, optionFlags, "FolderB/" + LTTNG_KERNEL_TRACE.getTraceName(), LTTNG_KERNEL_TRACE_TYPE);
+
+ SWTBotTree tree = fBot.viewByTitle("Project Explorer").bot().tree();
+ SWTBotTreeItem folderAItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, "FolderA");
+ SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, folderAItem, CUSTOM_TEXT_LOG.getTraceName());
+ SWTBotTreeItem folderBItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, "FolderB");
+ tree.select(traceItem, folderBItem);
+ tree.contextMenu().menu("Delete").click();
+ SWTBot deleteConfirmationShellBot = fBot.shell("Confirm Delete").bot();
+ deleteConfirmationShellBot.button("Yes").click();
+ fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, "FolderA/" + CUSTOM_TEXT_LOG.getTraceName()));
+ fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, "FolderB/" + CUSTOM_TEXT_LOG.getTraceName()));
+ fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, "FolderB/" + LTTNG_KERNEL_TRACE.getTraceName()));
+ fBot.waitUntil(ConditionHelpers.isEditorOpened(fBot, "FolderA/" + LTTNG_KERNEL_TRACE.getTraceName()));
+ assertEquals(1, tracesFolder.getNodes().size());
+ assertEquals(1, folderAItem.getNodes().size());
+ }
+
+ /**
+ * <p>
+ * Action : Delete with multiple folders
+ * <p>
+ *
+ * <pre>
+ * Procedure : 0) Delete all traces in project
+ * 1) Create two trace folders under the "Traces" folder
+ * 2) Import a trace under each folder
+ * 3) Open both traces.
+ * 4) Select both folders in the Project Explorer view
+ * 5) Right-click, Delete. Click Yes.
+ * </pre>
+ * <p>
+ * Expected Results: A dialog should ask the user to confirm deletion of the
+ * selected elements. Clicking OK should remove all that was selected. The
+ * editor of the 3 deleted traces should be closed automatically with one
+ * remaining editor opened.
+ */
+ @Test
+ public void test3_33DeleteMultipleFolders() {
+ SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
+
+ SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
+ tracesFolder.contextMenu().menu("New Folder...").click();
+ SWTBot newFolderShellBot = fBot.shell("New Folder").bot();
+ newFolderShellBot.text().setText("FolderA");
+ newFolderShellBot.button("OK").click();
+ tracesFolder.contextMenu().menu("New Folder...").click();
+ newFolderShellBot = fBot.shell("New Folder").bot();
+ newFolderShellBot.text().setText("FolderB");
+ newFolderShellBot.button("OK").click();
+
+ int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
+ SWTBotTreeItem traceFolder = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, "FolderA");
+ SWTBotShell shell = openTraceFoldersImport(traceFolder);
+ importTrace(shell, null, null, optionFlags, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG.getTracePath());
+ verifyTrace(CUSTOM_TEXT_LOG, optionFlags, "FolderA/" + CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE);
+
+ traceFolder = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, "FolderB");
+ shell = openTraceFoldersImport(traceFolder);
+ importTrace(shell, null, null, optionFlags, new ImportConfirmationSupplier(), LTTNG_KERNEL_TRACE.getTracePath());
+ verifyTrace(LTTNG_KERNEL_TRACE, optionFlags, "FolderB/" + LTTNG_KERNEL_TRACE.getTraceName(), LTTNG_KERNEL_TRACE_TYPE);
+
+ SWTBotTree tree = fBot.viewByTitle("Project Explorer").bot().tree();
+ SWTBotTreeItem folderAItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, "FolderA");
+ SWTBotTreeItem folderBItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, "FolderB");
+ tree.select(folderAItem, folderBItem);
+ tree.contextMenu().menu("Delete").click();
+ SWTBot deleteConfirmationShellBot = fBot.shell("Confirm Delete").bot();
+ deleteConfirmationShellBot.button("Yes").click();
+ fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, "FolderA/" + CUSTOM_TEXT_LOG.getTraceName()));
+ fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, "FolderB/" + LTTNG_KERNEL_TRACE.getTraceName()));
+ assertEquals(0, tracesFolder.getNodes().size());
+ }
+
+ /**
+ * <p>
+ * Action : Clear single Traces folder
+ * <p>
+ *
+ * <pre>
+ * Procedure : 1) Import 2 traces from different folders preserving folder structure
+ * 2) Open both traces.
+ * 3) Select the Traces folder
+ * 4) Right-click, Clear. Click Yes.
+ * </pre>
+ * <p>
+ * Expected Results: A dialog should ask the user to confirm clearing of the
+ * folder. Clicking Yes should remove everything under the selected folder
+ * and close the traces.
+ */
+ @Test
+ public void test3_34ClearSingleTracesFolder() {
+ int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE | ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE;
+ importTrace(CUSTOM_TEXT_TRACE_TYPE, optionFlags, ImportConfirmation.CONTINUE, CUSTOM_TEXT_LOG.getTraceName(), CLASHES_CUSTOM_TEXT_LOG.getTracePath());
+
+ verifyTrace(CUSTOM_TEXT_LOG, optionFlags, CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE);
+ verifyTrace(CLASHES_CUSTOM_TEXT_LOG, optionFlags, CLASHES_CUSTOM_TEXT_LOG.getTracePath(), CUSTOM_TEXT_TRACE_TYPE);
+
+ SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
+ tracesFolder.contextMenu().menu("Clear").click();
+ SWTBot deleteConfirmationShellBot = fBot.shell("Confirm Clear").bot();
+ deleteConfirmationShellBot.button("Yes").click();
+ fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, CUSTOM_TEXT_LOG.getTraceName()));
+ fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, CLASHES_CUSTOM_TEXT_LOG.getTracePath()));
+ assertEquals(0, tracesFolder.getNodes().size());
+ }
+
+ /**
+ * <p>
+ * Action : Clear multiple Traces folder
+ * <p>
+ *
+ * <pre>
+ * Procedure : 1) Import 2 traces to different projects
+ * 2) Open both traces.
+ * 3) Select both Traces folders
+ * 4) Right-click, Clear. Click Yes.
+ * </pre>
+ * <p>
+ * Expected Results: A dialog should ask the user to confirm clearing of the
+ * folders. Clicking Yes should remove everything under the selected folders
+ * and close the traces.
+ */
+ @Test
+ public void test3_35ClearMultipleTracesFolder() {
+ int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
+ SWTBotTreeItem tracesFolder1 = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
+ SWTBotShell shell = openTraceFoldersImport(tracesFolder1);
+ importTrace(shell, null, null, optionFlags, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG.getTracePath());
+ verifyTrace(CUSTOM_TEXT_LOG, optionFlags, CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE, TRACE_PROJECT_NAME);
+
+ SWTBotUtils.createProject(DEFAULT_PROJECT_NAME);
+ SWTBotTreeItem tracesFolder2 = SWTBotUtils.selectTracesFolder(fBot, DEFAULT_PROJECT_NAME);
+ shell = openTraceFoldersImport(tracesFolder2);
+ importTrace(shell, null, null, optionFlags, new ImportConfirmationSupplier(), LTTNG_KERNEL_TRACE.getTracePath());
+ verifyTrace(LTTNG_KERNEL_TRACE, optionFlags, LTTNG_KERNEL_TRACE.getTraceName(), LTTNG_KERNEL_TRACE_TYPE, DEFAULT_PROJECT_NAME);
+
+ SWTBotTree tree = fBot.viewByTitle("Project Explorer").bot().tree();
+ tree.select(tracesFolder1, tracesFolder2);
+ tree.contextMenu().menu("Clear").click();
+ SWTBot deleteConfirmationShellBot = fBot.shell("Confirm Clear").bot();
+ deleteConfirmationShellBot.button("Yes").click();
+ fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, CUSTOM_TEXT_LOG.getTraceName()));
+ fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, LTTNG_KERNEL_TRACE.getTraceName()));
+ assertEquals(0, tracesFolder1.getNodes().size());
+ assertEquals(0, tracesFolder2.getNodes().size());
+
+ SWTBotUtils.deleteProject(DEFAULT_PROJECT_NAME, fBot);
+ }
+