[java-idp-integration-tests COMMIT] /trunk/src/test/java/net/shibboleth/idp/test/localstorage/LocalStorageTest.java
noreply at shibboleth.net
noreply at shibboleth.net
Tue Jun 9 14:11:22 EDT 2015
Author: tzeller
Date: Tue Jun 9 14:11:22 2015
New Revision: 65
URL: http://svn.shibboleth.net/view/java-idp-integration-tests?rev=65&view=rev
Log:
IDP-594 Instead of storing the version as a local storage item, concatenate it with the local storage value.
Modified:
trunk/src/test/java/net/shibboleth/idp/test/localstorage/LocalStorageTest.java
Modified: trunk/src/test/java/net/shibboleth/idp/test/localstorage/LocalStorageTest.java
URL: http://svn.shibboleth.net/view/java-idp-integration-tests/trunk/src/test/java/net/shibboleth/idp/test/localstorage/LocalStorageTest.java?rev=65&r1=64&r2=65&view=diff
==============================================================================
--- trunk/src/test/java/net/shibboleth/idp/test/localstorage/LocalStorageTest.java (original)
+++ trunk/src/test/java/net/shibboleth/idp/test/localstorage/LocalStorageTest.java Tue Jun 9 14:11:22 2015
@@ -45,8 +45,8 @@
*/
public class LocalStorageTest extends BaseIntegrationTest {
- /** Title of local storage test view page. */
- public final static String LOCAL_STORAGE_TEST_VIEW_PAGE_TITLE = "Local Storage Test View";
+ /** Title of local storage test view. */
+ public final static String LOCAL_STORAGE_TEST_VIEW_TITLE = "Local Storage Test View";
/** Local storage exception identifier. */
@Nonnull public final static String LOCAL_STORAGE_EXCEPTION_ID = "localStorageException";
@@ -66,6 +66,9 @@
/** Local storage version identifier. */
@Nonnull public final static String LOCAL_STORAGE_VERSION_ID = "localStorageVersion";
+ /** Delimiter used to separate the version and value of a versioned item. */
+ @Nonnull public final static String LOCAL_STORAGE_VALUE_DELIMITER = ":";
+
/** Class logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(LocalStorageTest.class);
@@ -99,14 +102,15 @@
}
/**
- * Wait for page with title {@link #LOCAL_STORAGE_TEST_VIEW_PAGE_TITLE}.
- */
- protected void waitForLocalStorageTestViewPage() {
+ * Wait for page with title {@link #LOCAL_STORAGE_TEST_VIEW_TITLE}.
+ */
+ protected void waitForLocalStorageTestView() {
(new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver d) {
- return d.getTitle().equals(LOCAL_STORAGE_TEST_VIEW_PAGE_TITLE);
+ return d.getTitle().equals(LOCAL_STORAGE_TEST_VIEW_TITLE);
}
});
+ log.debug("{} source:\n'{}'", LOCAL_STORAGE_TEST_VIEW_TITLE, driver.getPageSource());
}
/**
@@ -247,7 +251,7 @@
/**
* Assert that reading from local storage was successful.
*
- * Must be called after {@link #waitForLocalStorageTestViewPage()}.
+ * Must be called after {@link #waitForLocalStorageTestView()}.
*
* @param itemKey the local storage item key
* @param itemValue the expected local storage item value
@@ -266,7 +270,7 @@
/**
* Assert that writing to local storage was successful.
*
- * Must be called after {@link #waitForLocalStorageTestViewPage()}.
+ * Must be called after {@link #waitForLocalStorageTestView()}.
*
* @param itemKey the local storage item key
* @param itemValue the expected local storage item value
@@ -279,28 +283,49 @@
Assert.assertEquals(getLocalStorageSuccess(), "true");
Assert.assertEquals(getLocalStorageSupported(), ""); // Not returned from write flow
Assert.assertEquals(getLocalStorageValue(), itemValue);
- Assert.assertEquals(getLocalStorageValueViaGetItem(), itemValue);
- Assert.assertEquals(getLocalStorageValueViaWrapper(itemKey), itemValue);
Assert.assertEquals(getLocalStorageVersion(), version);
- }
-
+
+ final String versionedValue = version + LOCAL_STORAGE_VALUE_DELIMITER + itemValue;
+ Assert.assertEquals(getLocalStorageValueViaGetItem(), versionedValue);
+ Assert.assertEquals(getLocalStorageValueViaWrapper(itemKey), versionedValue);
+ }
+
+ /**
+ * Write to local storage and assert that the write was successful via the test view.
+ *
+ * @param itemKey the local storage item key
+ * @param itemValue the local storage item value
+ * @param version the item version
+ * @throws MalformedURLException
+ */
protected void writeAndAssert(@Nullable final String itemKey, @Nullable final String itemValue,
@Nullable final String version) throws MalformedURLException {
driver.get(buildWriteURL(itemKey, itemValue, version));
- waitForLocalStorageTestViewPage();
+ waitForLocalStorageTestView();
assertSuccessfulWrite(itemKey, itemValue, version);
}
+ /**
+ * Construct the versioned value written to local storage as a concatenation of the version, delimiter, and value.
+ *
+ * @param value the local storage item value
+ * @param version the item version
+ * @return the versioned value as a concatenation of the version, delimiter, and value
+ */
[... 108 lines stripped ...]
More information about the commits
mailing list