+
+ private void testStateSystemExplorer() {
+ // Set up
+ SWTWorkbenchBot bot = new SWTWorkbenchBot();
+ List<String> expectedAnalyses = new ArrayList<>();
+ expectedAnalyses.addAll(EXPECTED_ANALYSES);
+ // Open the view
+ SWTBotUtils.openView(TmfStateSystemExplorer.ID);
+ SWTBotView sseBot = bot.viewByTitle("State System Explorer");
+ sseBot.show();
+ // get the list and compare it.
+ List<String> actual = getSSNames(sseBot);
+ assertTrue("State systems are not what expected : " + EXPECTED_ANALYSES + " instead " + actual, actual.containsAll(EXPECTED_ANALYSES));
+ // Re-open the view and make sure it has the same results
+ sseBot.close();
+ SWTBotUtils.openView(TmfStateSystemExplorer.ID);
+ sseBot = bot.viewByTitle("State System Explorer");
+ sseBot.show();
+ List<String> secondOpen = getSSNames(sseBot);
+ assertEquals("Test reopen view", actual, secondOpen);
+ // Close the trace, and re-open it, let's compare one last time
+ bot.closeAllEditors();
+ bot.waitUntil(treeHasRows(sseBot.bot().tree(), 0));
+ // re-open the trace
+ before();
+ secondOpen = getSSNames(sseBot);
+ assertEquals("Test reopen trace", actual, secondOpen);
+ sseBot.close();
+ }
+
+ private static List<String> getSSNames(SWTBotView bot) {
+ SWTBotTree tree = bot.bot().tree();
+ bot.bot().waitWhile(treeHasRows(tree, 0));
+ SWTBotTreeItem item = tree.getTreeItem("synthetic-trace").expand();
+ List<String> strings = new ArrayList<>();
+ strings.addAll(item.getNodes());
+ // The items may be out of order, is this a bug?
+ strings.sort(null);
+ return strings;
+ }
+