Repository: zeppelin Updated Branches: refs/heads/branch-0.7 ec8cbd55a -> b9d8323b7
[hotfix] Improve Session #2302 fix ### What is this PR for? After the merge of #2302 breaks authentication. ### What type of PR is it? [Hot Fix] ### Todos * [x] - Fix selenium logout issue (flaky test) ### Questions: * Does the licenses files need update? * Is there breaking changes for older versions? * Does this needs documentation? Author: Prabhjyot Singh <prabhjyotsi...@gmail.com> Closes #2304 from prabhjyotsingh/hotfix/ImproveSession and squashes the following commits: 94ba9e774 [Prabhjyot Singh] check if modal window is present, and then close it f993b59fa [Prabhjyot Singh] improve session (cherry picked from commit 6c4ccf331e7e5aa3f17cef40d340c29930887413) Signed-off-by: Prabhjyot Singh <prabhjyotsi...@gmail.com> Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/b9d8323b Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/b9d8323b Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/b9d8323b Branch: refs/heads/branch-0.7 Commit: b9d8323b76bcc7692cf6fce8a1fe6df3d7375553 Parents: ec8cbd5 Author: Prabhjyot Singh <prabhjyotsi...@gmail.com> Authored: Mon May 1 02:11:47 2017 +0530 Committer: Prabhjyot Singh <prabhjyotsi...@gmail.com> Committed: Tue May 2 09:53:06 2017 +0530 ---------------------------------------------------------------------- .../main/java/org/apache/zeppelin/rest/LoginRestApi.java | 3 ++- .../apache/zeppelin/integration/AuthenticationIT.java | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/b9d8323b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/LoginRestApi.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/LoginRestApi.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/LoginRestApi.java index c9b24b1..e909541 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/LoginRestApi.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/LoginRestApi.java @@ -74,9 +74,10 @@ public class LoginRestApi { try { UsernamePasswordToken token = new UsernamePasswordToken(userName, password); // token.setRememberMe(true); - currentUser.login(token); + currentUser.getSession().stop(); currentUser.getSession(true); + currentUser.login(token); HashSet<String> roles = SecurityUtils.getRoles(); String principal = SecurityUtils.getPrincipal(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/b9d8323b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java index 24e3480..9abbe28 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertTrue; import java.io.File; import java.io.IOException; import java.net.URI; +import java.net.URISyntaxException; import java.util.List; import org.apache.commons.io.FileUtils; @@ -146,14 +147,20 @@ public class AuthenticationIT extends AbstractZeppelinIT { } } - private void logoutUser(String userName) { + private void logoutUser(String userName) throws URISyntaxException { ZeppelinITUtils.sleep(500, false); driver.findElement(By.xpath("//div[contains(@class, 'navbar-collapse')]//li[contains(.,'" + userName + "')]")).click(); ZeppelinITUtils.sleep(500, false); driver.findElement(By.xpath("//div[contains(@class, 'navbar-collapse')]//li[contains(.,'" + userName + "')]//a[@ng-click='navbar.logout()']")).click(); - ZeppelinITUtils.sleep(5000, false); + ZeppelinITUtils.sleep(2000, false); + if (driver.findElement(By.xpath("//*[@id='loginModal']//div[contains(@class, 'modal-header')]/button")) + .isDisplayed()) { + driver.findElement(By.xpath("//*[@id='loginModal']//div[contains(@class, 'modal-header')]/button")).click(); + } + driver.get(new URI(driver.getCurrentUrl()).resolve("/#/").toString()); + ZeppelinITUtils.sleep(500, false); } // @Test