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 2017/02/05 05:42:50 UTC

svn commit: r1781720 - in /openmeetings/application: branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java

Author: solomax
Date: Sun Feb  5 05:42:50 2017
New Revision: 1781720

URL: http://svn.apache.org/viewvc?rev=1781720&view=rev
Log:
[OPENMEETINGS-1549] admin --drop is fixed

Modified:
    openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java
    openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java

Modified: openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java?rev=1781720&r1=1781719&r2=1781720&view=diff
==============================================================================
--- openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java (original)
+++ openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java Sun Feb  5 05:42:50 2017
@@ -55,15 +55,15 @@ public class ApplicationHelper {
 	public static WicketTester getWicketTester() {
 		return getWicketTester(-1);
 	}
-	
+
 	public static WicketTester getWicketTester(long langId) {
 		WebApplication app = (WebApplication)ensureApplication(langId);
-		
+
 		WicketTester tester = new WicketTester(app, app.getServletContext());
 		InitializationContainer.initComplete = true;
 		return tester;
 	}
-	
+
 	public static void destroy(WicketTester tester) {
 		if (tester != null) {
 			ServletContext sc = tester.getServletContext();
@@ -75,11 +75,11 @@ public class ApplicationHelper {
 			tester.destroy();
 		}
 	}
-	
+
 	public static IApplication ensureApplication() {
 		return ensureApplication(-1L);
 	}
-	
+
 	public static IApplication ensureApplication(Long langId) {
 		IApplication a = null;
 		if (Application.exists()) {
@@ -114,7 +114,7 @@ public class ApplicationHelper {
 		}
 		if (ThreadContext.getRequestCycle() == null) {
 			ServletWebRequest req = new ServletWebRequest(new MockHttpServletRequest((Application)a, new MockHttpSession(a.getServletContext()), a.getServletContext()), "");
-			RequestCycleContext rctx = new RequestCycleContext(req, new MockWebResponse(), a.getRootRequestMapper(), a.getExceptionMapperProvider().get()); 
+			RequestCycleContext rctx = new RequestCycleContext(req, new MockWebResponse(), a.getRootRequestMapper(), a.getExceptionMapperProvider().get());
 			ThreadContext.setRequestCycle(new RequestCycle(rctx));
 		}
 		if (ThreadContext.getSession() == null) {
@@ -125,9 +125,11 @@ public class ApplicationHelper {
 		}
 		return a;
 	}
-	
+
 	public static void destroyApplication() {
-		WebApplicationContext ctx = getWebApplicationContext(((WebApplication)ensureApplication()).getServletContext());
+		WebApplication app = (WebApplication)Application.get(wicketApplicationName);
+		app.internalDestroy(); //need to be called to
+		WebApplicationContext ctx = getWebApplicationContext(app.getServletContext());
 		((XmlWebApplicationContext)ctx).destroy();
 		ThreadContext.setApplication(null);
 		ThreadContext.setRequestCycle(null);

Modified: openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java?rev=1781720&r1=1781719&r2=1781720&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java (original)
+++ openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java Sun Feb  5 05:42:50 2017
@@ -55,15 +55,15 @@ public class ApplicationHelper {
 	public static WicketTester getWicketTester() {
 		return getWicketTester(-1);
 	}
-	
+
 	public static WicketTester getWicketTester(long langId) {
 		WebApplication app = (WebApplication)ensureApplication(langId);
-		
+
 		WicketTester tester = new WicketTester(app, app.getServletContext());
 		InitializationContainer.initComplete = true;
 		return tester;
 	}
-	
+
 	public static void destroy(WicketTester tester) {
 		if (tester != null) {
 			ServletContext sc = tester.getServletContext();
@@ -75,11 +75,11 @@ public class ApplicationHelper {
 			tester.destroy();
 		}
 	}
-	
+
 	public static IApplication ensureApplication() {
 		return ensureApplication(-1L);
 	}
-	
+
 	public static IApplication ensureApplication(Long langId) {
 		IApplication a = null;
 		if (Application.exists()) {
@@ -114,7 +114,7 @@ public class ApplicationHelper {
 		}
 		if (ThreadContext.getRequestCycle() == null) {
 			ServletWebRequest req = new ServletWebRequest(new MockHttpServletRequest((Application)a, new MockHttpSession(a.getServletContext()), a.getServletContext()), "");
-			RequestCycleContext rctx = new RequestCycleContext(req, new MockWebResponse(), a.getRootRequestMapper(), a.getExceptionMapperProvider().get()); 
+			RequestCycleContext rctx = new RequestCycleContext(req, new MockWebResponse(), a.getRootRequestMapper(), a.getExceptionMapperProvider().get());
 			ThreadContext.setRequestCycle(new RequestCycle(rctx));
 		}
 		if (ThreadContext.getSession() == null) {
@@ -125,9 +125,11 @@ public class ApplicationHelper {
 		}
 		return a;
 	}
-	
+
 	public static void destroyApplication() {
-		WebApplicationContext ctx = getWebApplicationContext(((WebApplication)ensureApplication()).getServletContext());
+		WebApplication app = (WebApplication)Application.get(wicketApplicationName);
+		app.internalDestroy(); //need to be called to
+		WebApplicationContext ctx = getWebApplicationContext(app.getServletContext());
 		((XmlWebApplicationContext)ctx).destroy();
 		ThreadContext.setApplication(null);
 		ThreadContext.setRequestCycle(null);