diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/Abstract4diacUITests.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/Abstract4diacUITests.java index a5326096c8..b5feb094ee 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/Abstract4diacUITests.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/Abstract4diacUITests.java @@ -68,7 +68,7 @@ public class Abstract4diacUITests { protected static void beforeAll() { bot = new SWT4diacGefBot(); bot.viewByTitle("Welcome").close(); //$NON-NLS-1$ - SWTBotPreferences.TIMEOUT = 30000; + SWTBotPreferences.TIMEOUT = 8000; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; //$NON-NLS-1$ createProject(); } diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotConnection.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotConnection.java index f177c0164e..c2e766eacb 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotConnection.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotConnection.java @@ -42,7 +42,7 @@ public class SWTBotConnection { - private static SWT4diacGefBot bot; + private final SWT4diacGefBot bot; @SuppressWarnings("static-access") public SWTBotConnection(final SWT4diacGefBot bot) { @@ -60,7 +60,7 @@ public SWTBotConnection(final SWT4diacGefBot bot) { * @param pin2 One of the two pins between a connection is (tried to) create. * @return SWTBot4diacGefViewer */ - public static SWTBot4diacGefViewer createConnection(final String pin1, final String pin2) { + public SWTBot4diacGefViewer createConnection(final String pin1, final String pin2) { final SWTBotGefEditor editor = bot.gefEditor(UITestNamesHelper.PROJECT_NAME); assertNotNull(editor); final SWTBot4diacGefViewer viewer = (SWTBot4diacGefViewer) editor.getSWTBotGefViewer(); @@ -86,11 +86,11 @@ public static SWTBot4diacGefViewer createConnection(final String pin1, final Str return viewer; } - public static boolean checkIfConnectionCanBeFound(final String srcPinName, final String dstPinName) { + public boolean checkIfConnectionCanBeFound(final String srcPinName, final String dstPinName) { return findConnection(srcPinName, dstPinName) != null; } - public static ConnectionEditPart findConnection(final String srcPinName, final String dstPinName) { + public ConnectionEditPart findConnection(final String srcPinName, final String dstPinName) { final SWTBotGefEditor editor = bot.gefEditor(UITestNamesHelper.PROJECT_NAME); final SWTBot4diacGefViewer viewer = (SWTBot4diacGefViewer) editor.getSWTBotGefViewer(); final GraphicalViewer graphicalViewer = viewer.getGraphicalViewer(); @@ -129,7 +129,7 @@ public static ConnectionEditPart findConnection(final String srcPinName, final S * @param pin2 Name of pin2. * @param editor Selected Gef Editor */ - public static void createConnectionWithinFBTypeWithPropertySheet(final String pin1, final String pin2, + public void createConnectionWithinFBTypeWithPropertySheet(final String pin1, final String pin2, final SWTBot4diacGefEditor editor) { final SWTBotGefEditPart port1 = editor.getEditPart(pin1); @@ -163,7 +163,7 @@ public static void createConnectionWithinFBTypeWithPropertySheet(final String pi * @param pin2 Name of pin2. * @param editor Selected Gef Editor */ - public static void removeConnectionWithinFBTypeWithPropertySheet(final String pin1, final String pin2, + public void removeConnectionWithinFBTypeWithPropertySheet(final String pin1, final String pin2, final SWTBot4diacGefEditor editor) { final SWTBotGefEditPart port1 = editor.getEditPart(pin1); diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotFB.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotFB.java index cb6457d56a..417bfa5830 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotFB.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotFB.java @@ -40,7 +40,7 @@ public class SWTBotFB { - private static SWT4diacGefBot bot; + private final SWT4diacGefBot bot; @SuppressWarnings("static-access") public SWTBotFB(final SWT4diacGefBot bot) { @@ -54,7 +54,7 @@ public SWTBotFB(final SWT4diacGefBot bot) { * @param point The Position of the FB on the canvas. */ @SuppressWarnings("static-access") - public static void dragAndDropEventsFB(final String fbName, final Point point) { + public void dragAndDropEventsFB(final String fbName, final Point point) { final SWTBotSystemExplorer sysEx = new SWTBotSystemExplorer(bot); final SWTBotTreeItem typeLibraryNode = sysEx.expandTypeLibraryTreeItemInSystemExplorer(); bot.waitUntil(treeItemHasNode(typeLibraryNode, UITestNamesHelper.EVENTS_NODE)); @@ -85,8 +85,8 @@ public static void dragAndDropEventsFB(final String fbName, final Point point) { * @param editor * @param name */ - public static SWTBot4diacGefEditor selectFBWithFBNameInEditor(final SWTBot4diacGefEditor editor, - final String name) { + @SuppressWarnings("static-method") + public SWTBot4diacGefEditor selectFBWithFBNameInEditor(final SWTBot4diacGefEditor editor, final String name) { assertNotNull(editor); assertNotNull(editor.getEditPart(name)); editor.click(name); @@ -103,7 +103,7 @@ public static SWTBot4diacGefEditor selectFBWithFBNameInEditor(final SWTBot4diacG * instance name should be deleted. * @param FbInstanceName The instance name of the FB */ - public static void deleteFB(final SWTBot4diacGefEditor editor, final String FbInstanceName) { + public void deleteFB(final SWTBot4diacGefEditor editor, final String FbInstanceName) { editor.setFocus(); final SWTBotGefEditPart fb = editor.getEditPart(FbInstanceName).parent(); fb.select().click(); @@ -118,7 +118,8 @@ public static void deleteFB(final SWTBot4diacGefEditor editor, final String FbIn * @param fbName The FB that is searched for. * @return true if fbName is in the List, otherwise false. */ - public static boolean isFbSelected(final List selectedEditParts, final String fbName) { + @SuppressWarnings("static-method") + public boolean isFbSelected(final List selectedEditParts, final String fbName) { return selectedEditParts.stream().filter(p -> p.part() instanceof FBEditPart).map(p -> (FBEditPart) p.part()) .anyMatch(fb -> fb.getModel().getName().equals(fbName)); } @@ -131,7 +132,8 @@ public static boolean isFbSelected(final List selectedEditPar * @param fbName The String of the FB instance name searched for * @return true if FB is onto editing area, false if not */ - public static boolean isFBNamePresendOnEditingArea(final SWTBot4diacGefEditor editor, final String fbName) { + @SuppressWarnings("static-method") + public boolean isFBNamePresendOnEditingArea(final SWTBot4diacGefEditor editor, final String fbName) { final List editParts = editor.editParts(new BaseMatcher() { @Override public boolean matches(final Object item) { @@ -148,18 +150,6 @@ public void describeTo(final Description description) { .anyMatch(fb -> fb.getModel().getName().equals(fbName)); } -// // TODO duplicate method - check also getBoundsOfFB!!! -// protected static Rectangle getAbsolutePosition(final SWTBotGefEditor editor, final String fb) { -// final SWTBotGefEditPart parent = editor.getEditPart(fb).parent(); -// assertNotNull(parent); -// final IFigure figurePos = ((GraphicalEditPart) parent.part()).getFigure(); -// assertNotNull(figurePos); -// final Rectangle fbBounds = figurePos.getBounds().getCopy(); -// assertNotNull(fbBounds); -// figurePos.translateToAbsolute(fbBounds); -// return fbBounds; -// } - /** * Returns the bounds of the searched function block * @@ -167,8 +157,8 @@ public void describeTo(final Description description) { * @param fBname * @return The rectangle with the bounds of the function block searched for */ - // TODO duplicate method - check also getAbsolutePosition!!! - public static Rectangle getBoundsOfFB(final SWTBotGefEditor editor, final String fBname) { + @SuppressWarnings("static-method") + public Rectangle getBoundsOfFB(final SWTBotGefEditor editor, final String fBname) { editor.getEditPart(fBname); editor.click(fBname); final SWTBotGefEditPart parent = editor.getEditPart(fBname).parent(); diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotSubapp.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotSubapp.java index 687fa412e2..6e0a07fedf 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotSubapp.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotSubapp.java @@ -25,9 +25,8 @@ public class SWTBotSubapp { - private static SWT4diacGefBot bot; + private final SWT4diacGefBot bot; - @SuppressWarnings("static-access") public SWTBotSubapp(final SWT4diacGefBot bot) { this.bot = bot; } @@ -40,13 +39,13 @@ public SWTBotSubapp(final SWT4diacGefBot bot) { * @param fromYPosition the y value of the starting point * @param toXPosition the x value of the target point * @param toYPosition the y value of the target point + * @return */ - public static void createSubappWithDragRectangle(final int fromXPosition, final int fromYPosition, - final int toXPosition, final int toYPosition) { + public void createSubappWithDragRectangle(final int fromXPosition, final int fromYPosition, final int toXPosition, + final int toYPosition) { final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(UITestNamesHelper.PROJECT_NAME); editor.drag(fromXPosition, fromYPosition, toXPosition, toYPosition); bot.menu(UITestNamesHelper.SOURCE).menu(UITestNamesHelper.NEW_SUBAPPLICATION).click(); - } /** @@ -57,7 +56,8 @@ public static void createSubappWithDragRectangle(final int fromXPosition, final * @param subAppName The Subapplication that is searched for. * @return true if Subapplication is in the List, otherwise false. */ - public static boolean isSubappSelected(final List selectedEditParts, final String subAppName) { + @SuppressWarnings("static-method") + public boolean isSubappSelected(final List selectedEditParts, final String subAppName) { return selectedEditParts.stream().filter(p -> p.part() instanceof SubAppForFBNetworkEditPart) .map(p -> (SubAppForFBNetworkEditPart) p.part()) .anyMatch(fb -> subAppName.equals(fb.getModel().getName())); diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotSystemExplorer.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotSystemExplorer.java index d477fb34a0..d18e7c395c 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotSystemExplorer.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotSystemExplorer.java @@ -31,9 +31,9 @@ public class SWTBotSystemExplorer { - private static SWT4diacGefBot bot; + private final SWT4diacGefBot bot; private final SWTBotView systemExplorerView; - private static SWTBotTree tree; + private final SWTBotTree tree; /** * Creates an instance of {@code SWTBotSystemExplorer} for interacting with the @@ -48,7 +48,6 @@ public class SWTBotSystemExplorer { * @throws AssertionError if the tree widget within the System Explorer view * cannot be found */ - @SuppressWarnings("static-access") public SWTBotSystemExplorer(final SWT4diacGefBot bot) { this.bot = bot; this.systemExplorerView = bot.viewById(UITestNamesHelper.SYSTEM_EXPLORER_ID); @@ -69,7 +68,7 @@ public SWTBotSystemExplorer(final SWT4diacGefBot bot) { * tree. * @return {@code true} if node is visible in tree; {@code false} otherwise */ - public static boolean isElementInApplicationOfSystemInSystemExplorer(final String element) { + public boolean isElementInApplicationOfSystemInSystemExplorer(final String element) { final SWTBotTreeItem appNode = expandApplicationTreeItemInSystemExplorer(); bot.waitUntil(treeItemHasNode(appNode, element)); final SWTBotTreeItem elementNode = appNode.getNode(element); @@ -86,7 +85,7 @@ public static boolean isElementInApplicationOfSystemInSystemExplorer(final Strin * of the Application in the System in the SystemExplorer tree., * @return {@code true} if FB is visible in tree; {@code false} otherwise */ - public static boolean isFBInSubAppOfSystemInSystemExplorer(final String fbName) { + public boolean isFBInSubAppOfSystemInSystemExplorer(final String fbName) { final SWTBotTreeItem subAppNode = expandSubAppTreeItemInSystemExplorer(); final SWTBotTreeItem fbNode = subAppNode.getNode(fbName); assertNotNull(fbNode); @@ -102,7 +101,7 @@ public static boolean isFBInSubAppOfSystemInSystemExplorer(final String fbName) * @author Andrea Zoitl * @return {@code true} if node has no children; {@code false} otherwise */ - public static boolean isSubAppNodeInSystemExplorerEmpty() { + public boolean isSubAppNodeInSystemExplorerEmpty() { final SWTBotTreeItem subAppNode = expandSubAppTreeItemInSystemExplorer(); final List subAppChildren = subAppNode.getNodes(); return subAppChildren.isEmpty(); @@ -114,7 +113,7 @@ public static boolean isSubAppNodeInSystemExplorerEmpty() { * @author Andrea Zoitl * @return treeProjectItem The expanded Project node */ - private static SWTBotTreeItem expandProjectTreeItemInSystemExplorer() { + private SWTBotTreeItem expandProjectTreeItemInSystemExplorer() { final SWTBotTreeItem treeProjectItem = tree.getTreeItem(UITestNamesHelper.PROJECT_NAME); return treeProjectItem.select().expand(); @@ -127,7 +126,7 @@ private static SWTBotTreeItem expandProjectTreeItemInSystemExplorer() { * @return The expanded {@code SWTBotTreeItem} representing the system node in * the System Explorer */ - private static SWTBotTreeItem expandSystemTreeItemInSystemExplorer() { + private SWTBotTreeItem expandSystemTreeItemInSystemExplorer() { final SWTBotTreeItem treeProjectItem = expandProjectTreeItemInSystemExplorer(); bot.waitUntil(treeItemHasNode(treeProjectItem, UITestNamesHelper.PROJECT_NAME_TREE_ITEM)); final SWTBotTreeItem systemNode = treeProjectItem.getNode(UITestNamesHelper.PROJECT_NAME_TREE_ITEM); @@ -141,7 +140,7 @@ private static SWTBotTreeItem expandSystemTreeItemInSystemExplorer() { * @return The expanded {@code SWTBotTreeItem} representing the Type Library * node in the System Explorer */ - public static SWTBotTreeItem expandTypeLibraryTreeItemInSystemExplorer() { + public SWTBotTreeItem expandTypeLibraryTreeItemInSystemExplorer() { final SWTBotTreeItem treeProjectItem = expandProjectTreeItemInSystemExplorer(); bot.waitUntil(treeItemHasNode(treeProjectItem, UITestNamesHelper.TYPE_LIBRARY_NODE)); final SWTBotTreeItem typeLibraryNode = treeProjectItem.getNode(UITestNamesHelper.TYPE_LIBRARY_NODE); @@ -155,7 +154,7 @@ public static SWTBotTreeItem expandTypeLibraryTreeItemInSystemExplorer() { * @return The expanded {@code SWTBotTreeItem} representing the Application node * in the System Explorer */ - public static SWTBotTreeItem expandApplicationTreeItemInSystemExplorer() { + public SWTBotTreeItem expandApplicationTreeItemInSystemExplorer() { final SWTBotTreeItem systemNode = expandSystemTreeItemInSystemExplorer(); bot.waitUntil(treeItemHasNode(systemNode, UITestNamesHelper.PROJECT_NAME_APP)); final SWTBotTreeItem appNode = systemNode.getNode(UITestNamesHelper.PROJECT_NAME_APP); @@ -171,7 +170,7 @@ public static SWTBotTreeItem expandApplicationTreeItemInSystemExplorer() { * @return The expanded {@code SWTBotTreeItem} representing the Subapplication * (SubApp) node in the System Explorer */ - private static SWTBotTreeItem expandSubAppTreeItemInSystemExplorer() { + private SWTBotTreeItem expandSubAppTreeItemInSystemExplorer() { final SWTBotTreeItem appNode = expandApplicationTreeItemInSystemExplorer(); final SWTBotTreeItem subAppNode = appNode.getNode(UITestNamesHelper.SUBAPP); assertNotNull(subAppNode); diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/networkediting/subapp_compsite/SubapplicationTests.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/networkediting/subapp_compsite/SubapplicationTests.java index d50a75d448..5a40131c80 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/networkediting/subapp_compsite/SubapplicationTests.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/networkediting/subapp_compsite/SubapplicationTests.java @@ -41,7 +41,7 @@ public class SubapplicationTests extends Abstract4diacUITests { * Checks if a subapplication can be created via menu by selecting the * Application editor breadcrumb. */ - @SuppressWarnings({ "static-method", "static-access" }) + @SuppressWarnings("static-method") @Test public void createEmptySubappViaMenu() { final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(UITestNamesHelper.PROJECT_NAME); @@ -61,7 +61,7 @@ public void createEmptySubappViaMenu() { * is drawn over the FBs. Then a subapplication is created via menu entry * "Source" -> "New subapplication" */ - @SuppressWarnings({ "static-method", "static-access" }) + @SuppressWarnings("static-method") @Test public void createSubappViaMenu() { final SWTBotFB fbBot = new SWTBotFB(bot); @@ -138,7 +138,7 @@ public void createSubappViaMenuWithConnectionBetweenFBs() { * a FB outside of the selection. Then a subapplication is created via menu * entry "Source" -> "New subapplication" */ - @SuppressWarnings({ "static-method", "static-access" }) + @SuppressWarnings("static-method") @Test public void createSubappViaMenuWithExistingConnectionOutsideSubapp() { final SWTBotFB fbBot = new SWTBotFB(bot); @@ -177,7 +177,7 @@ public void createSubappViaMenuWithExistingConnectionOutsideSubapp() { * subapplication is created with them. afterwards it is checked if connection * can be created in the subapplication. */ - @SuppressWarnings({ "static-method", "static-access" }) + @SuppressWarnings("static-method") @Test public void createSubappViaMenuThenCreatingConnection() { final SWTBotFB fbBot = new SWTBotFB(bot);