You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2018/09/17 05:40:18 UTC
[openmeetings] branch 4.0.x updated: [OPENMEETINGS-1928] tests
should be fixed
This is an automated email from the ASF dual-hosted git repository.
solomax pushed a commit to branch 4.0.x
in repository https://gitbox.apache.org/repos/asf/openmeetings.git
The following commit(s) were added to refs/heads/4.0.x by this push:
new 3dda205 [OPENMEETINGS-1928] tests should be fixed
3dda205 is described below
commit 3dda205ec5e69f908b6b3045040ea88539bcde70
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Mon Sep 17 12:40:04 2018 +0700
[OPENMEETINGS-1928] tests should be fixed
---
openmeetings-db/pom.xml | 5 +++++
.../org/apache/openmeetings/db/util/ApplicationHelper.java | 13 +++++++++++--
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/openmeetings-db/pom.xml b/openmeetings-db/pom.xml
index e8b0359..b26d783 100644
--- a/openmeetings-db/pom.xml
+++ b/openmeetings-db/pom.xml
@@ -67,6 +67,11 @@
<version>${spring.version}</version>
</dependency>
<dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.simpleframework</groupId>
<artifactId>simple-xml</artifactId>
</dependency>
diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java
index 57a7ef5..969bf14 100644
--- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java
+++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java
@@ -26,6 +26,7 @@ import static org.springframework.web.context.support.WebApplicationContextUtils
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
+import javax.servlet.SessionCookieConfig;
import org.apache.openmeetings.IApplication;
import org.apache.openmeetings.IWebSession;
@@ -44,6 +45,7 @@ import org.apache.wicket.protocol.http.servlet.ServletWebRequest;
import org.apache.wicket.request.cycle.RequestCycle;
import org.apache.wicket.request.cycle.RequestCycleContext;
import org.slf4j.Logger;
+import org.springframework.mock.web.MockSessionCookieConfig;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.XmlWebApplicationContext;
@@ -74,7 +76,14 @@ public class ApplicationHelper {
log.error("Failed to create Application");
return null;
}
- app.setServletContext(new MockServletContext(app, null));
+ app.setServletContext(new MockServletContext(app, null) {
+ @Override
+ public SessionCookieConfig getSessionCookieConfig() {
+ SessionCookieConfig cfg = new MockSessionCookieConfig();
+ cfg.setName("_ensureApplication");
+ return cfg;
+ }
+ });
app.setName(getWicketApplicationName());
ServletContext sc = app.getServletContext();
OMContextListener omcl = new OMContextListener();
@@ -115,7 +124,7 @@ public class ApplicationHelper {
WebApplicationContext ctx = getWebApplicationContext(app.getServletContext());
app.internalDestroy(); //need to be called to
if (ctx != null) {
- ((XmlWebApplicationContext)ctx).destroy();
+ ((XmlWebApplicationContext)ctx).close();
}
ThreadContext.setApplication(null);
ThreadContext.setRequestCycle(null);