Author: dgolovin
Date: 2009-08-15 04:42:11 -0400 (Sat, 15 Aug 2009)
New Revision: 17099
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsBase.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java
Log:
Memory Consumption problem was fixed for hibernate console tests
https://jira.jboss.org/jira/browse/JBIDE-4740
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsBase.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsBase.java 2009-08-15
00:01:20 UTC (rev 17098)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsBase.java 2009-08-15
08:42:11 UTC (rev 17099)
@@ -11,6 +11,8 @@
package org.hibernate.eclipse.console.test.mappingproject;
import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.regex.Pattern;
import org.eclipse.core.runtime.CoreException;
@@ -22,6 +24,7 @@
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.hibernate.eclipse.console.HibernateConsolePerspectiveFactory;
@@ -143,6 +146,14 @@
int prev_failCount = result.failureCount();
int prev_errCount = result.errorCount();
+ Method m = null;
+ try {
+ m = Display.getCurrent().getClass().getDeclaredMethod("runAsyncMessages",
boolean.class);
+ m.setAccessible(true);
+ } catch (SecurityException e) {
+ } catch (NoSuchMethodException e) {
+ }
+
TestSuite suite = TestSet.createTestSuite(consoleConfigName, testPackage,
testProject);
customizeCfgXml(testPackage);
@@ -152,8 +163,24 @@
for (int k = 0; k < suite.testCount(); k++) {
Test test = suite.testAt(k);
test.run(result);
+// ----------------------------------------------
+//
https://jira.jboss.org/jira/browse/JBIDE-4740
+// first way to fix OutOfMemory problems
+ closeAllEditors();
+ int LIMIT = 50,
+ ii = 0;
+ while(ii<LIMIT && Display.getCurrent().readAndDispatch()) {
+ //Display.getCurrent().sleep();
+ ii++;
+ }
}
- closeAllEditors();
+ // Second way
+ try {
+ m.invoke(Display.getCurrent(), Boolean.TRUE);
+ } catch (IllegalArgumentException e) {
+ } catch (IllegalAccessException e) {
+ } catch (InvocationTargetException e) {
+ }
//==============================
executions++;
if (Customization.USE_CONSOLE_OUTPUT) {
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java 2009-08-15
00:01:20 UTC (rev 17098)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java 2009-08-15
08:42:11 UTC (rev 17099)
@@ -16,6 +16,7 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
import org.hibernate.InvalidMappingException;
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
@@ -49,7 +50,8 @@
protected void tearDown() throws Exception {
consoleConfigName = null;
- testPackage = null;
+ testPackage = null;
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
}
public void testOpenMappingDiagram() {
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java 2009-08-15
00:01:20 UTC (rev 17098)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java 2009-08-15
08:42:11 UTC (rev 17099)
@@ -19,6 +19,7 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
import org.hibernate.InvalidMappingException;
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
@@ -55,7 +56,8 @@
protected void tearDown() throws Exception {
consoleConfigName = null;
- testPackage = null;
+ testPackage = null;
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
}
public void testOpenMappingFileTest() {
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java 2009-08-15
00:01:20 UTC (rev 17098)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java 2009-08-15
08:42:11 UTC (rev 17099)
@@ -19,6 +19,7 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
import org.hibernate.InvalidMappingException;
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
@@ -56,7 +57,8 @@
protected void tearDown() throws Exception {
consoleConfigName = null;
- testPackage = null;
+ testPackage = null;
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
}
public void testOpenSourceFileTest() {