From 8db38095b3da4ee1cab95672f6006b51cb7620ab Mon Sep 17 00:00:00 2001 From: "U-BASIS\\zhaohui" Date: Mon, 15 May 2017 13:53:05 -0400 Subject: [PATCH] 2640: Add a convenient function so regression test can change different timeouts --- .../autopsy/testing/AutopsyTestCases.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Testing/src/org/sleuthkit/autopsy/testing/AutopsyTestCases.java b/Testing/src/org/sleuthkit/autopsy/testing/AutopsyTestCases.java index 2ba740ecb6..236c9afecd 100755 --- a/Testing/src/org/sleuthkit/autopsy/testing/AutopsyTestCases.java +++ b/Testing/src/org/sleuthkit/autopsy/testing/AutopsyTestCases.java @@ -59,7 +59,6 @@ public class AutopsyTestCases { private static final Logger logger = Logger.getLogger(AutopsyTestCases.class.getName()); private long start; - private Timeouts timeouts; //Set a new timeout value for WizardOpertor /** * Escapes the slashes in a file or directory path. @@ -81,12 +80,6 @@ public class AutopsyTestCases { public AutopsyTestCases() { start = 0; - /* - * Nightly test failed at this point because of TimeoutExpiredException. So we set 4 minutes (This number is based on test experience) for WizardOperator - * to override the default WaitWindowTimeouts=60000 - */ - timeouts = JemmyProperties.getCurrentTimeouts(); - timeouts.setTimeout("WindowWaiter.WaitWindowTimeOut", 240000); } public void testNewCaseWizardOpen(String title) { @@ -119,7 +112,7 @@ public class AutopsyTestCases { new Timeout("pausing", 120000).sleep(); logger.info("Starting Add Image process"); WizardOperator wo = new WizardOperator("Add Data Source"); - wo.setTimeouts(timeouts); + wo.setTimeouts(resetTimeouts("WindowWaiter.WaitWindowTimeOut", 240000)); while(!wo.btNext().isEnabled()){ new Timeout("pausing", 1000).sleep(); // give it a second till the Add Data Source dialog enabled } @@ -143,7 +136,7 @@ public class AutopsyTestCases { new Timeout("pausing", 120000).sleep(); logger.info("Starting Add Logical Files process"); WizardOperator wo = new WizardOperator("Add Data Source"); - wo.setTimeouts(timeouts); + wo.setTimeouts(resetTimeouts("WindowWaiter.WaitWindowTimeOut", 240000)); while(!wo.btNext().isEnabled()){ new Timeout("pausing", 1000).sleep(); // give it a second till the Add Data Source dialog enabled } @@ -336,4 +329,15 @@ public class AutopsyTestCases { } } + + /* + * Nightly test failed at WindowWaiter.WaitWindowTimeOut because of TimeoutExpiredException. So we + * use this conveninent method to override the default Jemmy Timeouts value. + */ + + private Timeouts resetTimeouts(String name, int value) { + Timeouts timeouts = JemmyProperties.getCurrentTimeouts(); + timeouts.setTimeout(name, value); + return timeouts; + } }