X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=releng%2Forg.eclipse.tracecompass.integration.swtbot.tests%2Fsrc%2Forg%2Feclipse%2Ftracecompass%2Fintegration%2Fswtbot%2Ftests%2Fprojectexplorer%2FProjectExplorerTracesFolderTest.java;h=e870b936f926b9a61c1e6c4b82bce3eaa1922438;hb=d7ac629472e9ad6be2c5ecff41b0b74751cd2844;hp=050947dd3376d4aee7eb8f2126d68c2ab52091ab;hpb=f0beeb4aa356d812661dfa658bfd15a4a1e76e30;p=deliverable%2Ftracecompass.git diff --git a/releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTracesFolderTest.java b/releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTracesFolderTest.java index 050947dd33..e870b936f9 100644 --- a/releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTracesFolderTest.java +++ b/releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTracesFolderTest.java @@ -43,6 +43,7 @@ import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers; import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils; import org.eclipse.tracecompass.tmf.ui.tests.shared.WaitUtils; import org.eclipse.ui.IPageLayout; +import org.junit.After; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.FixMethodOrder; @@ -91,6 +92,7 @@ public class ProjectExplorerTracesFolderTest { LTTNG_KERNEL_TRACE.getFirstEventTimestamp()); private static final @NonNull TestTraceInfo UNRECOGNIZED_LOG = new TestTraceInfo("unrecognized.log", "", 0, ""); private static final @NonNull TestTraceInfo CUSTOM_XML_LOG_AS_TEXT = new TestTraceInfo("ExampleCustomXml.xml", CUSTOM_TEXT_TRACE_TYPE, 0, ""); + 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, ""); private static final TestTraceInfo[] ALL_TRACEINFOS = new TestTraceInfo[] { CUSTOM_TEXT_LOG, @@ -169,6 +171,14 @@ public class ProjectExplorerTracesFolderTest { fLogger.removeAllAppenders(); } + /** + * Test tear down method. + */ + @After + public void afterTest() { + SWTBotUtils.closeSecondaryShells(fBot); + } + private static void test3_01Preparation() { // FIXME: We can't use Manage Custom Parsers > Import because it uses a native dialog. We'll still check that they show up in the dialog CustomTxtTraceDefinition[] txtDefinitions = CustomTxtTraceDefinition.loadAll(getPath("customParsers/ExampleCustomTxtParser.xml")); @@ -699,7 +709,7 @@ public class ProjectExplorerTracesFolderTest { * type "Generic CTF Trace" . Make sure that these traces can be opened */ @Test - public void test3_17ImportRecursiveSpecityTraceTypeCTF() { + public void test3_17ImportRecursiveSpecifyTraceTypeCTF() { SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; @@ -738,7 +748,7 @@ public class ProjectExplorerTracesFolderTest { * trace type "LTTng Kernel Trace". Make sure that this trace can be opened. */ @Test - public void test3_18ImportRecursiveSpecityTraceTypeKernel() { + public void test3_18ImportRecursiveSpecifyTraceTypeKernel() { SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; @@ -769,7 +779,7 @@ public class ProjectExplorerTracesFolderTest { * trace type "LTTng UST Trace". Make sure that these traces can be opened. */ @Test - public void test3_19ImportRecursiveSpecityTraceTypeUST() { + public void test3_19ImportRecursiveSpecifyTraceTypeUST() { SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; @@ -809,7 +819,7 @@ public class ProjectExplorerTracesFolderTest { * show any events in the table. */ @Test - public void test3_20ImportRecursiveSpecityTraceTypeCustomText() { + public void test3_20ImportRecursiveSpecifyTraceTypeCustomText() { SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE; @@ -833,12 +843,333 @@ public class ProjectExplorerTracesFolderTest { verifyTrace(traceInfo, importOptionFlags, traceInfo.getTraceName()); } + /** + *
+ * Action : Recursive import with preserved folder structure + *
+ * + *
+ * Procedure : 0) Delete all traces in project + * 1) Open Import wizard + * 2) Browse to directory ${local}/traces/import/ + * 3) Select directory import + * 4) Select trace type "Tmf Generic", unselect "Overwrite existing without warning", select "Create Links to workspace" and select "Preserve Folder Structure" + * 5) press Finish + *+ *
+ * Expected Results: All matching traces are imported with trace type set. + * The folder "clashes" is imported with traces inside. Make sure that the + * traces can be opened. + */ + @Test + public void test3_29ImportRecursivePreserve() { + SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); + + int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE | ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE; + importTrace(CUSTOM_TEXT_TRACE_TYPE, optionFlags, ImportConfirmation.CONTINUE, ""); + + verifyTrace(CUSTOM_TEXT_LOG, optionFlags, CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE); + verifyTrace(CUSTOM_XML_LOG_AS_TEXT, optionFlags, CUSTOM_XML_LOG_AS_TEXT.getTraceName(), CUSTOM_TEXT_TRACE_TYPE); + verifyTrace(UNRECOGNIZED_LOG, optionFlags, UNRECOGNIZED_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE); + verifyTrace(CLASHES_CUSTOM_TEXT_LOG, optionFlags, CLASHES_CUSTOM_TEXT_LOG.getTracePath(), CUSTOM_TEXT_TRACE_TYPE); + verifyTrace(CLASHES_CUSTOM_XML_LOG_AS_TEXT, optionFlags, CLASHES_CUSTOM_XML_LOG_AS_TEXT.getTracePath(), CUSTOM_TEXT_TRACE_TYPE); + + SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); + assertEquals(4, tracesFolderItem.getItems().length); + SWTBotTreeItem clashesFolderItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolderItem, CLASHES_DIR_NAME); + assertEquals(2, clashesFolderItem.getItems().length); + } + + /** + *
+ * Action : Recursive import with preserved folder structure (Skip All) + *
+ * + *
+ * Procedure : 1) Open Import wizard + * 2) Browse to directory ${local}/traces/import/ + * 3) Select directory import + * 4) Select trace type "Tmf Generic", unselect "Overwrite existing without warning", select "Create Links to workspace" and select "Preserve Folder Structure" + * 5) press Finish + * 6) When dialog appears select "Skip All" + *+ *
+ * Expected Results: The wizard should finish quickly as no trace will be + * imported. Make sure that the traces can be opened. + */ + @Test + public void test3_30ImportRecursivePreserveSkipAll() { + int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE | ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE; + importTrace(CUSTOM_TEXT_TRACE_TYPE, optionFlags, ImportConfirmation.SKIP_ALL, ""); + + verifyTrace(CUSTOM_TEXT_LOG, optionFlags, CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE); + verifyTrace(CUSTOM_XML_LOG_AS_TEXT, optionFlags, CUSTOM_XML_LOG_AS_TEXT.getTraceName(), CUSTOM_TEXT_TRACE_TYPE); + verifyTrace(UNRECOGNIZED_LOG, optionFlags, UNRECOGNIZED_LOG.getTraceName(), CUSTOM_TEXT_TRACE_TYPE); + verifyTrace(CLASHES_CUSTOM_TEXT_LOG, optionFlags, CLASHES_CUSTOM_TEXT_LOG.getTracePath(), CUSTOM_TEXT_TRACE_TYPE); + verifyTrace(CLASHES_CUSTOM_XML_LOG_AS_TEXT, optionFlags, CLASHES_CUSTOM_XML_LOG_AS_TEXT.getTracePath(), CUSTOM_TEXT_TRACE_TYPE); + + SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); + assertEquals(4, tracesFolderItem.getItems().length); + SWTBotTreeItem clashesFolderItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolderItem, CLASHES_DIR_NAME); + assertEquals(2, clashesFolderItem.getItems().length); + //TOOD: verify that traces were actually skipped + } + + /** + *
+ * Action : Recursive import with preserved folder structure (Rename All) + *
+ * + *
+ * Procedure : 1) Open Import wizard + * 2) Browse to directory ${local}/traces/import/ + * 3) Select directory import + * 4) Select trace type "Tmf Generic", unselect "Overwrite existing without warning", select "Create Links to workspace" and select "Preserve Folder Structure" + * 5) press Finish + * 6) When dialog appears select "Rename All" + *+ *
+ * Expected Results: All matching traces are imported with trace type set. + * The traces are renamed with suffix (2). The folder "clashes" is imported + * with traces inside. Make sure that the traces can be opened. + */ + @Test + public void test3_31ImportRecursivePreserveRenameAll() { + int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE | ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE; + importTrace(CUSTOM_TEXT_TRACE_TYPE, optionFlags, ImportConfirmation.RENAME_ALL, ""); + + verifyTrace(CUSTOM_TEXT_LOG, optionFlags, toRenamedName(CUSTOM_TEXT_LOG.getTraceName()), CUSTOM_TEXT_TRACE_TYPE); + verifyTrace(CUSTOM_XML_LOG_AS_TEXT, optionFlags, toRenamedName(CUSTOM_XML_LOG_AS_TEXT.getTraceName()), CUSTOM_TEXT_TRACE_TYPE); + verifyTrace(UNRECOGNIZED_LOG, optionFlags, toRenamedName(UNRECOGNIZED_LOG.getTraceName()), CUSTOM_TEXT_TRACE_TYPE); + verifyTrace(CLASHES_CUSTOM_TEXT_LOG, optionFlags, toRenamedName(CLASHES_CUSTOM_TEXT_LOG.getTracePath()), CUSTOM_TEXT_TRACE_TYPE); + verifyTrace(CLASHES_CUSTOM_XML_LOG_AS_TEXT, optionFlags, toRenamedName(CLASHES_CUSTOM_XML_LOG_AS_TEXT.getTracePath()), CUSTOM_TEXT_TRACE_TYPE); + + SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); + assertEquals(7, tracesFolderItem.getItems().length); + SWTBotTreeItem clashesFolderItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolderItem, CLASHES_DIR_NAME); + assertEquals(4, clashesFolderItem.getItems().length); + } + + /** + *
+ * Action : Import from zip archive with preserved folder structure + *
+ * + *
+ * Procedure : 0) Delete all traces in project + * 1) Open Import wizard + * 2) Select archive file: traces.zip + * 3) Select archive root directory + * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and select "Preserve Folder Structure" + * 5) press Finish + *+ *
+ * Expected Results: All traces are imported with trace type set. The folder + * "clashes" is imported with traces inside. Make sure that the traces can + * be opened. + */ + @Test + public void test3_36ImportZipArchivePreserve() { + SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); + + int optionFlags = ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE; + importTrace("traces.zip", null, optionFlags, ImportConfirmation.CONTINUE, ""); + + for (TestTraceInfo info : ALL_TRACEINFOS) { + verifyTrace(info, optionFlags, info.getTracePath()); + } + + SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); + assertEquals(7, tracesFolderItem.getItems().length); + SWTBotTreeItem clashesFolderItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolderItem, CLASHES_DIR_NAME); + assertEquals(6, clashesFolderItem.getItems().length); + } + + /** + *
+ * Action : Import from zip archive without preserved folder structure + * (Rename All) + *
+ * + *
+ * Procedure : 0) Delete all traces in project + * 1) Open Import wizard + * 2) Select archive file: traces.zip + * 3) Select archive root directory + * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and unselect "Preserve Folder Structure" + * 5) press Finish + * 6) When dialog appears select "Rename All" + *+ *
+ * Expected Results: All traces are imported with trace type set. The traces + * from folder "clashes" are renamed with suffix (2). Make sure that the + * traces can be opened. + */ + @Test + public void test3_37ImportZipArchiveNoPreserve() { + SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); + + int optionFlags = 0; + importTrace("traces.zip", null, optionFlags, ImportConfirmation.RENAME_ALL, ""); + + for (TestTraceInfo info : ALL_TRACEINFOS) { + String traceName = info.getTraceName(); + if (CLASHING_TRACEINFOS.contains(info)) { + traceName = toRenamedName(traceName); + } + verifyTrace(info, optionFlags, traceName); + } + + SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); + assertEquals(12, tracesFolderItem.getItems().length); + } + + /** + *
+ * Action : Import from zip archive specific traces + *
+ * + *
+ * Procedure : 0) Delete all traces in project + * 1) Open Import wizard + * 2) Select archive file: traces.zip + * 3) Select file z-clashes/ExampleCustomTxt.log and directory kernel-overlap-testing/ + * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and select "Preserve Folder Structure" + * 5) press Finish + *+ *
+ * Expected Results: The specified traces are imported with trace type set. + * Make sure that the traces can be opened. + */ + @Test + public void test3_38ImportZipArchiveSpecificTraces() { + SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); + + int optionFlags = ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE; + importTrace("traces.zip", null, optionFlags, ImportConfirmation.CONTINUE, "z-clashes/ExampleCustomTxt.log", "kernel-overlap-testing/"); + + verifyTrace(CLASHES_CUSTOM_TEXT_LOG, optionFlags, CLASHES_CUSTOM_TEXT_LOG.getTracePath()); + verifyTrace(LTTNG_KERNEL_TRACE, optionFlags, LTTNG_KERNEL_TRACE.getTracePath()); + + SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); + assertEquals(2, tracesFolderItem.getItems().length); + SWTBotTreeItem clashesFolderItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolderItem, CLASHES_DIR_NAME); + assertEquals(1, clashesFolderItem.getItems().length); + } + + /** + *
+ * Action : Import from tar.gz archive with preserved folder structure + *
+ * + *
+ * Procedure : 0) Delete all traces in project + * 1) Open Import wizard + * 2) Select archive file: traces.tar.gz + * 3) Select archive root directory + * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and select "Preserve Folder Structure" + * 5) press Finish + *+ *
+ * Expected Results: All traces are imported with trace type set. The folder + * "clashes" is imported with traces inside. Make sure that the traces can + * be opened. + */ + @Test + public void test3_39ImportTarGzipArchivePreserve() { + SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); + + int optionFlags = ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE; + importTrace("traces.tar.gz", null, optionFlags, ImportConfirmation.CONTINUE, ""); + + for (TestTraceInfo info : ALL_TRACEINFOS) { + verifyTrace(info, optionFlags, info.getTracePath()); + } + + SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); + assertEquals(7, tracesFolderItem.getItems().length); + SWTBotTreeItem clashesFolderItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolderItem, CLASHES_DIR_NAME); + assertEquals(6, clashesFolderItem.getItems().length); + } + + /** + *
+ * Action : Import from tar.gz archive without preserved folder structure (Rename All) + *
+ * + *
+ * Procedure : 0) Delete all traces in project + * 1) Open Import wizard + * 2) Select archive file: traces.tar.gz + * 3) Select archive root directory + * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and unselect "Preserve Folder Structure" + * 5) press Finish + * 6) When dialog appears select "Rename All" + *+ *
+ * Expected Results: All traces are imported with trace type set. The traces + * from folder "clashes" are renamed with suffix (2). Make sure that the + * traces can be opened. + */ + @Test + public void test3_40ImportTarGzipArchiveNoPreserve() { + SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME); + + int optionFlags = 0; + importTrace("traces.tar.gz", null, optionFlags, ImportConfirmation.RENAME_ALL, ""); + + for (TestTraceInfo info : ALL_TRACEINFOS) { + String traceName = info.getTraceName(); + if (CLASHING_TRACEINFOS.contains(info)) { + traceName = toRenamedName(traceName); + } + verifyTrace(info, optionFlags, traceName); + } + + SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); + assertEquals(12, tracesFolderItem.getItems().length); + } + + /** + *
+ * Action : Import from tar.gz archive specific traces + *
+ * + *
+ * Procedure : 0) Delete all traces in project + * 1) Open Import wizard + * 2) Select archive file: traces.tar.gz + * 3) Select file z-clashes/ExampleCustomTxt.log and directory kernel-overlap-testing/ + * 4) Select trace type "Automatic", unselect "Overwrite existing without warning", and select "Preserve Folder Structure" + * 5) press Finish + *+ *
+ * Expected Results: The specified traces are imported with trace type set.
+ * Make sure that the traces can be opened.
+ */
+ @Test
+ public void test3_41ImportTarGzipArchiveSpecificTraces() {
+ SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
+
+ int optionFlags = ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE;
+ importTrace("traces.tar.gz", null, optionFlags, ImportConfirmation.CONTINUE, "z-clashes/ExampleCustomTxt.log", "kernel-overlap-testing/");
+
+ verifyTrace(CLASHES_CUSTOM_TEXT_LOG, optionFlags, CLASHES_CUSTOM_TEXT_LOG.getTracePath());
+ verifyTrace(LTTNG_KERNEL_TRACE, optionFlags, LTTNG_KERNEL_TRACE.getTracePath());
+
+ SWTBotTreeItem tracesFolderItem = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME);
+ assertEquals(2, tracesFolderItem.getItems().length);
+ SWTBotTreeItem clashesFolderItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolderItem, CLASHES_DIR_NAME);
+ assertEquals(1, clashesFolderItem.getItems().length);
+ }
+
private static void verifyTrace(TestTraceInfo traceInfo, int importOptionFlags, String traceName) {
verifyTrace(traceInfo, importOptionFlags, traceName, traceInfo.getTraceType());
}
private static void verifyTrace(TestTraceInfo traceInfo, int importOptionFlags, String traceName, String traceType) {
- SWTBotTreeItem traceItem = SWTBotUtils.getTreeItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), traceName);
+ String[] tracePath = new Path(traceName).segments();
+ SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), tracePath);
checkTraceType(traceItem, traceType);
openTrace(traceItem);
if (traceType != null && !traceType.isEmpty()) {
@@ -875,7 +1206,11 @@ public class ProjectExplorerTracesFolderTest {
}
private static void importTrace(String traceType, int optionFlags, ImportConfirmation confirmationMode, String ... tracePaths) {
- importTrace(traceType, optionFlags, new Supplier