-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1739 from openequella/hotfix/2019.2.3
Hotfix/2019.2.3
- Loading branch information
Showing
431 changed files
with
15,330 additions
and
12,130 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...Tests/src/test/java/com/tle/webtests/test/contribute/bugs/VisibilityScriptingBugTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.tle.webtests.test.contribute.bugs; | ||
|
||
import static com.tle.webtests.framework.Assert.assertTrue; | ||
|
||
import com.tle.webtests.framework.TestInstitution; | ||
import com.tle.webtests.pageobject.searching.SearchPage; | ||
import com.tle.webtests.pageobject.viewitem.ItemXmlPage; | ||
import com.tle.webtests.pageobject.viewitem.SummaryPage; | ||
import com.tle.webtests.pageobject.wizard.ContributePage; | ||
import com.tle.webtests.pageobject.wizard.WizardPageTab; | ||
import com.tle.webtests.test.AbstractCleanupTest; | ||
import org.testng.annotations.Test; | ||
import retry.RetryTest; | ||
|
||
/** | ||
* This is a test to ensure that GH issue #1678 has not regressed. | ||
* | ||
* @see <a href="https://github.com/openequella/openEQUELLA/issues/1678">GitHub Issue 1678</a> | ||
*/ | ||
@TestInstitution("vanilla") | ||
public class VisibilityScriptingBugTest extends AbstractCleanupTest { | ||
private static final String METADATA_INPUT_USER = "cpddm"; | ||
private static final String TOGGLE_USER = "csme"; | ||
private static final String PASS = "tle010"; | ||
|
||
private static final String COLLECTION = "Test Wizard Issue"; | ||
private static final String ITEM_NAME = "VisibilityScriptingBugTest - Lost Metadata Test Item 1"; | ||
|
||
private static final String RADIO = "Yes"; | ||
|
||
private static final String XML_PATH = "item/"; | ||
|
||
@RetryTest | ||
@Test | ||
public void testLostMetadataBug() { | ||
// Login as cpddm and begin contribution to 'Test Wizard Issue' collection. | ||
logon(METADATA_INPUT_USER, PASS); | ||
WizardPageTab wizard = new ContributePage(context).load().openWizard(COLLECTION); | ||
|
||
// Insert a value into each control and publish the item. | ||
wizard.getControl(1).sendKeys(ITEM_NAME); | ||
wizard.save().publish(); | ||
|
||
// Login as csme and find the same item. | ||
logon(TOGGLE_USER, PASS); | ||
SearchPage searchPage = new SearchPage(context).load(); | ||
searchPage.search(ITEM_NAME); | ||
SummaryPage summaryPage = searchPage.resultsPageObject().viewFromTitle(ITEM_NAME); | ||
|
||
// If the item is in a locked state, unlock it | ||
// (this is mainly so that rerunning the test before it cleans up doesn't wrongly fail the test) | ||
if (summaryPage.isItemLocked()) { | ||
summaryPage.unlockAfterLogout(); | ||
} | ||
|
||
// Edit the item as csme. | ||
// This will open a different wizard page to the one cpddm sees, because of visibility | ||
// scripting. | ||
WizardPageTab newWizard = summaryPage.edit(1); | ||
|
||
// Make a change (this is where the metadata would become lost because of the bug) and save. | ||
newWizard.setCheckReload(1, RADIO, true).saveNoConfirm().checkLoaded(); | ||
// Open the item's xml page to view the metadata. | ||
ItemXmlPage xml = summaryPage.itemXml(); | ||
|
||
// Assert that all of the metadata has been retained. | ||
assertTrue(xml.nodeHasValue(XML_PATH + "name", ITEM_NAME)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
autotest/OldTests/src/test/java/retry/FailureRetryAnalyzer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package retry; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.testng.IRetryAnalyzer; | ||
import org.testng.ITestResult; | ||
|
||
public class FailureRetryAnalyzer implements IRetryAnalyzer { | ||
int currentRetry = 0; | ||
Logger LOGGER = LoggerFactory.getLogger(FailureRetryAnalyzer.class.getName()); | ||
|
||
@Override | ||
public boolean retry(ITestResult result) { | ||
RetryTest failureRetryCount = | ||
result.getMethod().getConstructorOrMethod().getMethod().getAnnotation(RetryTest.class); | ||
int maxRetryCount = (failureRetryCount == null) ? 0 : failureRetryCount.value(); | ||
if (++currentRetry > maxRetryCount) { | ||
return false; | ||
} else { | ||
logRetryInfo(result, maxRetryCount); | ||
return true; | ||
} | ||
} | ||
|
||
private void logRetryInfo(ITestResult result, int maxRetryCount) { | ||
// print failure stack trace | ||
LOGGER.debug("Stack trace of failure to be retried:", result.getThrowable()); | ||
LOGGER.warn( | ||
String.format( | ||
"Running retry %d/%d for test '%s' in class %s", | ||
currentRetry, | ||
maxRetryCount, | ||
result.getName(), | ||
result.getTestClass().getRealClass().getSimpleName())); | ||
} | ||
} |
Oops, something went wrong.