Author: vyemialyanchyk
Date: 2009-06-03 11:35:39 -0400 (Wed, 03 Jun 2009)
New Revision: 15681
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/Utils.java
Removed:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ProjectUtil.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/TestUtilsCommon.java
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/META-INF/MANIFEST.MF
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/JavaFormattingTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/Customization.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HbmExportExceptionTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.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
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSet.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/ConfigurableTestProject.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/SimpleTestProject.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/FilesTransfer.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/mapper/HBMInfoExtractorTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest2.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/hbmexporter/HbmExporterTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4366 - code refactoring
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/META-INF/MANIFEST.MF
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/META-INF/MANIFEST.MF 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/META-INF/MANIFEST.MF 2009-06-03
15:35:39 UTC (rev 15681)
@@ -22,8 +22,8 @@
Bundle-Localization: plugin
Export-Package: org.hibernate.eclipse.console.test,
org.hibernate.eclipse.console.test.project,
+ org.hibernate.eclipse.console.test.project.xpl,
org.hibernate.eclipse.console.test.utils,
- org.hibernate.eclipse.console.test.xpl,
org.hibernate.eclipse.hqleditor.preferences,
org.jmock,
org.jmock.api,
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsolePluginAllTests.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -3,7 +3,9 @@
import java.io.IOException;
import org.hibernate.eclipse.console.test.mappingproject.HibernateAllMappingTests;
+import org.hibernate.eclipse.console.views.test.QueryPageViewerTest;
import org.hibernate.eclipse.hqleditor.preferences.HQLEditorPreferencePageTest;
+import org.hibernate.eclipse.mapper.HBMInfoExtractorTest;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -23,6 +25,9 @@
suite.addTestSuite( HibernateAllMappingTests.class );
suite.addTestSuite(HQLEditorPreferencePageTest.class);
+
+ suite.addTestSuite(QueryPageViewerTest.class);
+ suite.addTestSuite(HBMInfoExtractorTest.class);
// core tests
//Properties properties = new Properties();
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/JavaFormattingTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/JavaFormattingTest.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/JavaFormattingTest.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -23,6 +23,7 @@
protected void tearDown() throws Exception {
}
+ @SuppressWarnings("unchecked")
public void testJavaFormatting() throws JavaModelException, MalformedTreeException,
BadLocationException {
/*
IFile file = ResourcesPlugin
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/Customization.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/Customization.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/Customization.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -34,11 +34,6 @@
public static final boolean STOP_AFTER_MISSING_PACK = false;
/**
- * Shows each test run as individual
- */
- public static final boolean SHOW_EACH_TEST = true;
-
- /**
* Delay in milliseconds after each package
*/
public static final int EACTH_PACK_TEST_DELAY = 0;
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HbmExportExceptionTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HbmExportExceptionTest.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HbmExportExceptionTest.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -41,13 +41,35 @@
* @author Dmitry Geraskov
*
*/
+@SuppressWarnings("restriction")
public class HbmExportExceptionTest extends TestCase {
+ protected String consoleConfigName = null;
+
+ protected IPackageFragment testPackage = null;
+
+ protected ConfigurableTestProject testProject = null;
+
+ public HbmExportExceptionTest() {
+ }
+
+ public HbmExportExceptionTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ testProject = null;
+ consoleConfigName = null;
+ testPackage = null;
+ }
+
public void testHbmExportExceptionTest() throws Exception {
- IPackageFragment pack = HibernateAllMappingTests.getActivePackage();
- try{
+ try {
KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
- final ConsoleConfiguration consCFG =
knownConfigurations.find(ConsoleConfigUtils.ConsoleCFGName);
+ final ConsoleConfiguration consCFG = knownConfigurations.find(consoleConfigName);
assertNotNull(consCFG);
consCFG.reset();
consCFG.build();
@@ -64,9 +86,9 @@
Configuration config = consCFG.getConfiguration();
//delete old hbm files
- assertNotNull( pack );
- if (pack.getNonJavaResources().length > 0){
- Object[] ress = pack.getNonJavaResources();
+ assertNotNull( testPackage );
+ if (testPackage.getNonJavaResources().length > 0){
+ Object[] ress = testPackage.getNonJavaResources();
for (int i = 0; i < ress.length; i++) {
if (ress[i] instanceof IFile){
IFile res = (IFile)ress[i];
@@ -90,9 +112,9 @@
collector.formatFiles();
try {//build generated configuration
- pack.getResource().refreshLocal(IResource.DEPTH_INFINITE, null);
- pack.getJavaProject().getProject().build(IncrementalProjectBuilder.FULL_BUILD, new
NullProgressMonitor());
- ConsoleConfigUtils.customizeCfgXmlForPack(pack);
+ testPackage.getResource().refreshLocal(IResource.DEPTH_INFINITE, null);
+ testPackage.getJavaProject().getProject().build(IncrementalProjectBuilder.FULL_BUILD,
new NullProgressMonitor());
+ ConsoleConfigUtils.customizeCfgXmlForPack(testPackage);
assertNotNull(consCFG);
consCFG.reset();
@@ -110,22 +132,21 @@
config = consCFG.getConfiguration();
} catch (CoreException e) {
String out =
NLS.bind(ConsoleTestMessages.UpdateConfigurationTest_error_customising_file_for_package,
- new Object[] { ConsoleConfigUtils.CFG_FILE_NAME, pack.getPath(), e.getMessage() }
);
+ new Object[] { ConsoleConfigUtils.CFG_FILE_NAME, testPackage.getPath(),
e.getMessage() } );
fail(out);
}
} catch (ExporterException e){
throw (Exception)e.getCause();
}
} catch (Exception e){
- String newMessage = "\nPackage " + pack.getElementName() + ":";
+ String newMessage = "\nPackage " + testPackage.getElementName() +
":"; //$NON-NLS-1$ //$NON-NLS-2$
throw new WripperException(newMessage, e);
}
}
private File getSrcFolder() throws JavaModelException{
- ConfigurableTestProject mapProject = ConfigurableTestProject.getTestProject();
PackageFragmentRoot packageFragmentRoot = null;
- IPackageFragmentRoot[] roots =
mapProject.getIJavaProject().getAllPackageFragmentRoots();
+ IPackageFragmentRoot[] roots =
testProject.getIJavaProject().getAllPackageFragmentRoots();
for (int i = 0; i < roots.length && packageFragmentRoot == null; i++) {
if (roots[i].getClass() == PackageFragmentRoot.class) {
packageFragmentRoot = (PackageFragmentRoot) roots[i];
@@ -134,10 +155,35 @@
assertNotNull(packageFragmentRoot);
return packageFragmentRoot.getResource().getLocation().toFile();
}
+
+ public String getConsoleConfigName() {
+ return consoleConfigName;
+ }
+
+ public void setConsoleConfigName(String consoleConfigName) {
+ this.consoleConfigName = consoleConfigName;
+ }
+
+ public IPackageFragment getTestPackage() {
+ return testPackage;
+ }
+
+ public void setTestPackage(IPackageFragment testPackage) {
+ this.testPackage = testPackage;
+ }
+
+ public ConfigurableTestProject getTestProject() {
+ return testProject;
+ }
+
+ public void setTestProject(ConfigurableTestProject testProject) {
+ this.testProject = testProject;
+ }
}
class WripperException extends Exception {
+ private static final long serialVersionUID = 8192540921613389467L;
private String message;
public WripperException(String message, Exception cause){
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HibernateAllMappingTests.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.hibernate.eclipse.console.test.mappingproject;
+import java.io.File;
import java.util.regex.Pattern;
import junit.framework.Test;
@@ -34,25 +35,33 @@
import org.hibernate.eclipse.console.HibernateConsolePerspectiveFactory;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
import org.hibernate.eclipse.console.test.project.ConfigurableTestProject;
+import org.hibernate.eclipse.console.test.project.TestProject;
import org.hibernate.eclipse.console.test.utils.ConsoleConfigUtils;
-import org.hibernate.eclipse.console.test.utils.FilesTransfer;
import org.hibernate.eclipse.console.utils.ProjectUtils;
+/**
+ *
+ */
+@SuppressWarnings("restriction")
public class HibernateAllMappingTests extends TestCase {
- private ConfigurableTestProject project;
+ protected String consoleConfigName = null;
+
+ protected IPackageFragment testPackage = null;
- private static IPackageFragment activePackage;
+ protected ConfigurableTestProject testProject = null;
+ protected TestResult result = null;
+
public HibernateAllMappingTests(String name) {
super(name);
}
- private TestResult result = null;
-
protected void setUp() throws Exception {
super.setUp();
- this.project = ConfigurableTestProject.getTestProject();
+ testProject = new ConfigurableTestProject("JUnitTestProj"); //$NON-NLS-1$
+ consoleConfigName = testProject.getIProject().getName();
+ testPackage = null;
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().setPerspective(
PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId("org.eclipse.ui.resourcePerspective"));
//$NON-NLS-1$
@@ -65,18 +74,18 @@
throw new RuntimeException(e);
}
- packageExplorer.selectAndReveal(project.getIJavaProject());
+ packageExplorer.selectAndReveal(testProject.getIJavaProject());
PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().setPerspective(
PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(HibernateConsolePerspectiveFactory.ID_CONSOLE_PERSPECTIVE));
- IPath cfgFilePath = new Path(ConfigurableTestProject.PROJECT_NAME + "/" +
//$NON-NLS-1$
- FilesTransfer.SRC_FOLDER + "/" + ConsoleConfigUtils.CFG_FILE_NAME);
//$NON-NLS-1$
- ConsoleConfigUtils.createConsoleConfig(ConsoleConfigUtils.ConsoleCFGName,
- cfgFilePath, ConfigurableTestProject.PROJECT_NAME);
- ProjectUtils.toggleHibernateOnProject(project.getIProject(), true,
ConsoleConfigUtils.ConsoleCFGName);
- project.getIProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
+ IPath cfgFilePath = new Path(testProject.getIProject().getName() + File.separator +
+ TestProject.SRC_FOLDER + File.separator + ConsoleConfigUtils.CFG_FILE_NAME);
+ ConsoleConfigUtils.createConsoleConfig(consoleConfigName,
+ cfgFilePath, testProject.getIProject().getName());
+ ProjectUtils.toggleHibernateOnProject(testProject.getIProject(), true,
consoleConfigName);
+ testProject.getIProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
}
/* (non-Javadoc)
@@ -89,22 +98,19 @@
}
public void tearDown() throws Exception {
- ProjectUtils.toggleHibernateOnProject(project.getIProject(), false,
ConsoleConfigUtils.ConsoleCFGName);
- ConsoleConfigUtils.deleteConsoleConfig(ConsoleConfigUtils.ConsoleCFGName);
- project.deleteIProject(false);
- project = null;
+ ProjectUtils.toggleHibernateOnProject(testProject.getIProject(), false,
consoleConfigName);
+ ConsoleConfigUtils.deleteConsoleConfig(consoleConfigName);
+ testProject.deleteIProject(false);
+ testProject = null;
+ consoleConfigName = null;
+ testPackage = null;
super.tearDown();
}
- protected ConfigurableTestProject getProject() {
- return this.project;
- }
-
public void testEachPackWithTestSet() throws JavaModelException {
long start_time = System.currentTimeMillis();
- TestSuite suite = TestSet.getTests();
int pack_count = 0;
- IPackageFragmentRoot[] roots = project.getIJavaProject().getAllPackageFragmentRoots();
+ IPackageFragmentRoot[] roots =
testProject.getIJavaProject().getAllPackageFragmentRoots();
for (int i = 0; i < roots.length; i++) {
if (roots[i].getClass() != PackageFragmentRoot.class) {
continue;
@@ -116,9 +122,9 @@
if (!(javaElement instanceof IPackageFragment)) {
continue;
}
- IPackageFragment pack = (IPackageFragment)javaElement;
+ testPackage = (IPackageFragment)javaElement;
// use packages only with compilation units
- if (pack.getCompilationUnits().length == 0) {
+ if (testPackage.getCompilationUnits().length == 0) {
continue;
}
if (Customization.U_TEST_PACKS_PATTERN) {
@@ -131,13 +137,9 @@
int prev_failCount = result.failureCount();
int prev_errCount = result.errorCount();
- if (Customization.SHOW_EACH_TEST) {
- // this display result for each test in JUinit view
- suite = TestSet.getTests();
- }
+ TestSuite suite = TestSet.createTestSuite(consoleConfigName, testPackage,
testProject);
- activePackage = pack;
- customizeCfgXml(pack);
+ customizeCfgXml(testPackage);
//==============================
//run all tests for package
//suite.run(result);
@@ -148,23 +150,25 @@
closeAllEditors();
//==============================
pack_count++;
- if (Customization.USE_CONSOLE_OUTPUT){
- System.out.print( result.errorCount() - prev_errCount +
ConsoleTestMessages.HibernateAllMappingTests_errors + " \t"); //$NON-NLS-1$
- System.out.print( result.failureCount() - prev_failCount +
ConsoleTestMessages.HibernateAllMappingTests_fails + "\t"); //$NON-NLS-1$
+ if (Customization.USE_CONSOLE_OUTPUT) {
+ System.out.print(result.errorCount() - prev_errCount +
ConsoleTestMessages.HibernateAllMappingTests_errors + " \t"); //$NON-NLS-1$
+ System.out.print(result.failureCount() - prev_failCount +
ConsoleTestMessages.HibernateAllMappingTests_fails + "\t"); //$NON-NLS-1$
long period = System.currentTimeMillis() - st_pack_time;
String time = period / 1000 + "." + (period % 1000) / 100; //$NON-NLS-1$
System.out.println( time +ConsoleTestMessages.HibernateAllMappingTests_seconds +
" {" + javaElement.getElementName() + "}");
//$NON-NLS-1$//$NON-NLS-2$
}
- if (Customization.STOP_AFTER_MISSING_PACK){
- if (result.failureCount() > prev_failCount) break;
+ if (Customization.STOP_AFTER_MISSING_PACK) {
+ if (result.failureCount() > prev_failCount) {
+ break;
+ }
}
prev_failCount = result.failureCount();
prev_errCount = result.errorCount();
}
}
- if (Customization.USE_CONSOLE_OUTPUT){
+ if (Customization.USE_CONSOLE_OUTPUT) {
System.out.println(
"====================================================="); //$NON-NLS-1$
System.out.print( result.errorCount() +
ConsoleTestMessages.HibernateAllMappingTests_errors + " \t"); //$NON-NLS-1$
System.out.print( result.failureCount() +
ConsoleTestMessages.HibernateAllMappingTests_fails + "\t"); //$NON-NLS-1$
@@ -187,11 +191,28 @@
protected void closeAllEditors() {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
}
-
- /**
- * @return the activePackage
- */
- public static synchronized IPackageFragment getActivePackage() {
- return activePackage;
+
+ public String getConsoleConfigName() {
+ return consoleConfigName;
}
+
+ public void setConsoleConfigName(String consoleConfigName) {
+ this.consoleConfigName = consoleConfigName;
+ }
+
+ public IPackageFragment getTestPackage() {
+ return testPackage;
+ }
+
+ public void setTestPackage(IPackageFragment testPackage) {
+ this.testPackage = testPackage;
+ }
+
+ public ConfigurableTestProject getTestProject() {
+ return testProject;
+ }
+
+ public void setTestProject(ConfigurableTestProject testProject) {
+ this.testProject = testProject;
+ }
}
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-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -12,6 +12,7 @@
import junit.framework.TestCase;
+import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
@@ -20,8 +21,7 @@
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
-import org.hibernate.eclipse.console.test.utils.ConsoleConfigUtils;
-import org.hibernate.eclipse.console.test.utils.ProjectUtil;
+import org.hibernate.eclipse.console.test.utils.Utils;
import org.hibernate.eclipse.console.workbench.ConfigurationWorkbenchAdapter;
import org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter;
import org.hibernate.mapping.PersistentClass;
@@ -32,9 +32,29 @@
*
*/
public class OpenMappingDiagramTest extends TestCase {
+
+ protected String consoleConfigName = null;
+
+ protected IPackageFragment testPackage = null;
+
+ public OpenMappingDiagramTest() {
+ }
+
+ public OpenMappingDiagramTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ consoleConfigName = null;
+ testPackage = null;
+ }
+
public void testOpenMappingDiagram() {
KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
- final ConsoleConfiguration consCFG =
knownConfigurations.find(ConsoleConfigUtils.ConsoleCFGName);
+ final ConsoleConfiguration consCFG = knownConfigurations.find(consoleConfigName);
assertNotNull(consCFG);
consCFG.reset();
Object[] configs = null;
@@ -45,7 +65,7 @@
persClasses = new ConfigurationWorkbenchAdapter().getChildren(configs[0]);
} catch (InvalidMappingException ex){
String out =
NLS.bind(ConsoleTestMessages.OpenMappingDiagramTest_mapping_diagrams_for_package_cannot_be_opened,
- new Object[]{HibernateAllMappingTests.getActivePackage().getElementName(),
ex.getMessage()});
+ new Object[]{testPackage.getElementName(), ex.getMessage()});
fail(out);
}
@@ -61,7 +81,7 @@
} catch (PartInitException e) {
ex = e;
}
- if (ex == null ) ex = ProjectUtil.getExceptionIfItOccured(editor);
+ if (ex == null ) ex = Utils.getExceptionIfItOccured(editor);
if (ex != null) {
String out =
NLS.bind(ConsoleTestMessages.OpenMappingDiagramTest_mapping_diagram_for_not_opened,
new Object[]{persClass.getClassName(), ex.getMessage()});
@@ -72,5 +92,19 @@
//close all editors
}
+ public String getConsoleConfigName() {
+ return consoleConfigName;
+ }
+ public void setConsoleConfigName(String consoleConfigName) {
+ this.consoleConfigName = consoleConfigName;
+ }
+
+ public IPackageFragment getTestPackage() {
+ return testPackage;
+ }
+
+ public void setTestPackage(IPackageFragment testPackage) {
+ this.testPackage = testPackage;
+ }
}
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-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -14,6 +14,7 @@
import junit.framework.TestCase;
+import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IEditorPart;
@@ -24,8 +25,7 @@
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.console.actions.OpenMappingAction;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
-import org.hibernate.eclipse.console.test.utils.ConsoleConfigUtils;
-import org.hibernate.eclipse.console.test.utils.ProjectUtil;
+import org.hibernate.eclipse.console.test.utils.Utils;
import org.hibernate.eclipse.console.workbench.ConfigurationWorkbenchAdapter;
import org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter;
import org.hibernate.eclipse.console.workbench.PersistentClassWorkbenchAdapter;
@@ -39,9 +39,28 @@
*/
public class OpenMappingFileTest extends TestCase {
+ protected String consoleConfigName = null;
+
+ protected IPackageFragment testPackage = null;
+
+ public OpenMappingFileTest() {
+ }
+
+ public OpenMappingFileTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ consoleConfigName = null;
+ testPackage = null;
+ }
+
public void testOpenMappingFileTest() {
KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
- final ConsoleConfiguration consCFG =
knownConfigurations.find(ConsoleConfigUtils.ConsoleCFGName);
+ final ConsoleConfiguration consCFG = knownConfigurations.find(consoleConfigName);
assertNotNull(consCFG);
consCFG.reset();
Object[] configs = null;
@@ -53,7 +72,7 @@
persClasses = new ConfigurationWorkbenchAdapter().getChildren(configs[0]);
} catch (InvalidMappingException ex){
String out =
NLS.bind(ConsoleTestMessages.OpenMappingFileTest_mapping_files_for_package_cannot_be_opened,
- new Object[]{HibernateAllMappingTests.getActivePackage().getElementName(),
ex.getMessage()});
+ new Object[]{testPackage.getElementName(), ex.getMessage()});
fail(out);
}
if (persClasses.length > 0){
@@ -82,10 +101,10 @@
Throwable ex = null;
try {
editor = OpenMappingAction.run(consCFG, compositeProperty, parentProperty);
- boolean highlighted = ProjectUtil.checkHighlighting(editor);
+ boolean highlighted = Utils.hasSelection(editor);
if (!highlighted) {
String out =
NLS.bind(ConsoleTestMessages.OpenMappingFileTest_highlighted_region_for_property_is_empty_package,
- new Object[]{compositeProperty.getNodeName(),
HibernateAllMappingTests.getActivePackage().getElementName()});
+ new Object[]{compositeProperty.getNodeName(), testPackage.getElementName()});
fail(out);
}
Object[] compProperties = new
PropertyWorkbenchAdapter().getChildren(compositeProperty);
@@ -102,10 +121,10 @@
} catch (FileNotFoundException e) {
ex = e;
}
- if (ex == null ) ex = ProjectUtil.getExceptionIfItOccured(editor);
+ if (ex == null ) ex = Utils.getExceptionIfItOccured(editor);
if (ex != null) {
String out =
NLS.bind(ConsoleTestMessages.OpenMappingFileTest_mapping_file_for_property_not_opened_package,
- new Object[]{compositeProperty.getNodeName(),
HibernateAllMappingTests.getActivePackage().getElementName(), ex.getMessage()});
+ new Object[]{compositeProperty.getNodeName(), testPackage.getElementName(),
ex.getMessage()});
fail(out);
}
}
@@ -115,10 +134,10 @@
Throwable ex = null;
try {
editor = OpenMappingAction.run(consCFG, selection);
- boolean highlighted = ProjectUtil.checkHighlighting(editor);
+ boolean highlighted = Utils.hasSelection(editor);
if (!highlighted) {
String out =
NLS.bind(ConsoleTestMessages.OpenMappingFileTest_highlighted_region_for_is_empty_package,
- new Object[]{selection,
HibernateAllMappingTests.getActivePackage().getElementName()});
+ new Object[]{selection, testPackage.getElementName()});
fail(out);
}
} catch (PartInitException e) {
@@ -128,15 +147,27 @@
} catch (FileNotFoundException e) {
ex = e;
}
- if (ex == null ) ex = ProjectUtil.getExceptionIfItOccured(editor);
+ if (ex == null ) ex = Utils.getExceptionIfItOccured(editor);
if (ex != null) {
String out =
NLS.bind(ConsoleTestMessages.OpenMappingFileTest_mapping_file_for_not_opened_package,
- new Object[]{selection,
HibernateAllMappingTests.getActivePackage().getElementName(), ex.getMessage()});
+ new Object[]{selection, testPackage.getElementName(), ex.getMessage()});
fail(out);
}
}
+ public String getConsoleConfigName() {
+ return consoleConfigName;
+ }
+ public void setConsoleConfigName(String consoleConfigName) {
+ this.consoleConfigName = consoleConfigName;
+ }
+ public IPackageFragment getTestPackage() {
+ return testPackage;
+ }
+ public void setTestPackage(IPackageFragment testPackage) {
+ this.testPackage = testPackage;
+ }
}
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-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -14,6 +14,7 @@
import junit.framework.TestCase;
+import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IEditorPart;
@@ -24,8 +25,7 @@
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.console.actions.OpenSourceAction;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
-import org.hibernate.eclipse.console.test.utils.ConsoleConfigUtils;
-import org.hibernate.eclipse.console.test.utils.ProjectUtil;
+import org.hibernate.eclipse.console.test.utils.Utils;
import org.hibernate.eclipse.console.workbench.ConfigurationWorkbenchAdapter;
import org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter;
import org.hibernate.eclipse.console.workbench.PersistentClassWorkbenchAdapter;
@@ -40,10 +40,29 @@
*/
public class OpenSourceFileTest extends TestCase {
+ protected String consoleConfigName = null;
+
+ protected IPackageFragment testPackage = null;
+
+ public OpenSourceFileTest() {
+ }
+
+ public OpenSourceFileTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ consoleConfigName = null;
+ testPackage = null;
+ }
+
public void testOpenSourceFileTest() {
//fail("test fail");
KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
- final ConsoleConfiguration consCFG =
knownConfigurations.find(ConsoleConfigUtils.ConsoleCFGName);
+ final ConsoleConfiguration consCFG = knownConfigurations.find(consoleConfigName);
assertNotNull(consCFG);
consCFG.reset();
Object[] configs = null;
@@ -53,12 +72,12 @@
configs = new ConsoleConfigurationWorkbenchAdapter().getChildren(consCFG);
assertTrue(configs[0] instanceof Configuration);
persClasses = new ConfigurationWorkbenchAdapter().getChildren(configs[0]);
- } catch (InvalidMappingException ex){
+ } catch (InvalidMappingException ex) {
String out =
NLS.bind(ConsoleTestMessages.OpenSourceFileTest_source_files_for_package_cannot_be_opened,
- HibernateAllMappingTests.getActivePackage().getElementName(), ex.getMessage());
+ testPackage.getElementName(), ex.getMessage());
fail(out);
}
- if (persClasses.length > 0){
+ if (persClasses.length > 0) {
for (int i = 0; i < persClasses.length; i++) {
assertTrue(persClasses[0] instanceof PersistentClass);
PersistentClass persClass = (PersistentClass) persClasses[i];
@@ -67,7 +86,9 @@
openTest(persClass, consCFG, fullyQualifiedName);
fields = new PersistentClassWorkbenchAdapter().getChildren(persClass);
for (int j = 0; j < fields.length; j++) {
- if (fields[j].getClass() != Property.class) continue;
+ if (fields[j].getClass() != Property.class) {
+ continue;
+ }
fullyQualifiedName = persClass.getClassName();
// test Properties
openTest(fields[j], consCFG, fullyQualifiedName);
@@ -77,7 +98,9 @@
Object[] compProperties = new PropertyWorkbenchAdapter().getChildren(fields[j]);
for (int k = 0; k < compProperties.length; k++) {
- if (compProperties[k].getClass() != Property.class) continue;
+ if (compProperties[k].getClass() != Property.class) {
+ continue;
+ }
//test Composite properties
openTest(compProperties[k], consCFG, fullyQualifiedName);
}
@@ -94,7 +117,7 @@
Throwable ex = null;
try {
editor = OpenSourceAction.run(consCFG, selection, fullyQualifiedName);
- boolean highlighted = ProjectUtil.checkHighlighting(editor);
+ boolean highlighted = Utils.hasSelection(editor);
if (!highlighted) {
String out =
NLS.bind(ConsoleTestMessages.OpenSourceFileTest_highlighted_region_for_is_empty,
selection);
fail(out);
@@ -106,7 +129,7 @@
} catch (FileNotFoundException e) {
ex = e;
}
- if (ex == null ) ex = ProjectUtil.getExceptionIfItOccured(editor);
+ if (ex == null ) ex = Utils.getExceptionIfItOccured(editor);
if (ex != null) {
String out =
NLS.bind(ConsoleTestMessages.OpenSourceFileTest_mapping_file_for_not_opened,
fullyQualifiedName/*.getClassName()*/, ex.getMessage());
@@ -114,6 +137,19 @@
}
}
+ public String getConsoleConfigName() {
+ return consoleConfigName;
+ }
+ public void setConsoleConfigName(String consoleConfigName) {
+ this.consoleConfigName = consoleConfigName;
+ }
+ public IPackageFragment getTestPackage() {
+ return testPackage;
+ }
+
+ public void setTestPackage(IPackageFragment testPackage) {
+ this.testPackage = testPackage;
+ }
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSet.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSet.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSet.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -10,7 +10,9 @@
******************************************************************************/
package org.hibernate.eclipse.console.test.mappingproject;
+import org.eclipse.jdt.core.IPackageFragment;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+import org.hibernate.eclipse.console.test.project.ConfigurableTestProject;
import junit.framework.TestSuite;
@@ -18,22 +20,33 @@
* @author Dmitry Geraskov
*
*/
-public class TestSet{
-
+public class TestSet {
+
/**
* use only addTestSuit to prevent errors!!!
* @return
*/
- public static TestSuite getTests() {
+ public static TestSuite createTestSuite(String consoleConfigName,
+ IPackageFragment testPackage, ConfigurableTestProject testProject) {
TestSuite suite = new
TestSuite(ConsoleTestMessages.TestSet_test_for_mappingtestproject);
- addPackTests(suite);
+ HbmExportExceptionTest test1 = new
HbmExportExceptionTest("testHbmExportExceptionTest"); //$NON-NLS-1$
+ test1.setConsoleConfigName(consoleConfigName);
+ test1.setTestPackage(testPackage);
+ test1.setTestProject(testProject);
+ OpenSourceFileTest test2 = new OpenSourceFileTest("testOpenSourceFileTest");
//$NON-NLS-1$
+ test2.setConsoleConfigName(consoleConfigName);
+ test2.setTestPackage(testPackage);
+ OpenMappingFileTest test3 = new
OpenMappingFileTest("testOpenMappingFileTest"); //$NON-NLS-1$
+ test3.setConsoleConfigName(consoleConfigName);
+ test3.setTestPackage(testPackage);
+ OpenMappingDiagramTest test4 = new
OpenMappingDiagramTest("testOpenMappingDiagram"); //$NON-NLS-1$
+ test4.setConsoleConfigName(consoleConfigName);
+ test4.setTestPackage(testPackage);
+ //
+ suite.addTest(test1);
+ suite.addTest(test2);
+ suite.addTest(test3);
+ suite.addTest(test4);
return suite;
}
-
- private static void addPackTests(TestSuite suite) {
- suite.addTestSuite(HbmExportExceptionTest.class);
- //suite.addTestSuite(OpenSourceFileTest.class);
- //suite.addTestSuite(OpenMappingFileTest.class);
- //suite.addTestSuite(OpenMappingDiagramTest.class);
- }
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/ConfigurableTestProject.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/ConfigurableTestProject.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/ConfigurableTestProject.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -16,14 +16,12 @@
import java.util.List;
import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.osgi.util.NLS;
@@ -31,64 +29,22 @@
import org.hibernate.eclipse.console.test.HibernateConsoleTestPlugin;
import org.hibernate.eclipse.console.test.mappingproject.Customization;
import org.hibernate.eclipse.console.test.utils.FilesTransfer;
-import org.hibernate.eclipse.console.test.utils.TestUtilsCommon;
-
/**
*
- *
* @author Dmitry Geraskov
+ * @author Vitali Yemialyanchyk
*/
-public class ConfigurableTestProject {
+public class ConfigurableTestProject extends TestProject {
- private static ConfigurableTestProject singleton = null;
-
- public static final String PROJECT_NAME = "ConfigurableTestProject";
//$NON-NLS-1$
public static final String RESOURCE_PATH = "res/project/"; //$NON-NLS-1$
- private IProject project;
- private IJavaProject javaProject;
-
- public static ConfigurableTestProject getTestProject(){
- if (singleton == null){
- singleton = new ConfigurableTestProject();
- }
- return singleton;
+ public ConfigurableTestProject(String projectName) {
+ super(projectName);
}
- private ConfigurableTestProject() {
- initialize();
- }
-
- private void initialize(){
- try{
- buildBigTestProject();
- }catch(Exception e){
- throw new RuntimeException(e);
- }
- }
-
- public IProject getIProject(){
- return this.project;
- }
-
- public IJavaProject getIJavaProject(){
- return this.javaProject;
- }
-
- public void deleteIProject(boolean deleteContent) {
- try {
- project.delete(deleteContent, true, null);
- } catch (CoreException ce) {
- throw new RuntimeException(ce);
- }
- }
-
- private void buildBigTestProject() throws JavaModelException, CoreException, IOException
{
- TestUtilsCommon commonUtil = new TestUtilsCommon();
- project = commonUtil.buildNewProject(PROJECT_NAME);
- javaProject = commonUtil.buildJavaProject(project);
-
+ protected void buildProject() throws JavaModelException, CoreException, IOException {
+ super.buildProject();
IPath resourcePath = new Path(RESOURCE_PATH);
File resourceFolder = resourcePath.toFile();
URL entry =
HibernateConsoleTestPlugin.getDefault().getBundle().getEntry(RESOURCE_PATH);
@@ -100,14 +56,13 @@
RESOURCE_PATH);
throw new RuntimeException(out);
}
-
long startCopyFiles = System.currentTimeMillis();
- IPackageFragmentRoot sourceFolder = commonUtil.createSourceFolder(project,
javaProject);
+ IPackageFragmentRoot sourceFolder = createSourceFolder();
FilesTransfer.copyFolder(resourceFolder, (IFolder) sourceFolder.getResource());
long startCopyLibs = System.currentTimeMillis();
- List<IPath> libs = commonUtil.copyLibs(project, javaProject, resourceFolder);
+ List<IPath> libs = copyLibs(resourceFolder);
long startBuild = System.currentTimeMillis();
- commonUtil.generateClassPath(javaProject, libs, sourceFolder);
+ generateClassPath(libs, sourceFolder);
project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
long stopBuild = System.currentTimeMillis();
if (Customization.USE_CONSOLE_OUTPUT){
@@ -117,5 +72,4 @@
System.out.println("build: " + ( ( stopBuild - startBuild ) / 1000 ));
//$NON-NLS-1$
}
}
-
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/SimpleTestProject.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/SimpleTestProject.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/SimpleTestProject.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -4,10 +4,6 @@
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -19,44 +15,20 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
-public class SimpleTestProject {
-
- IProject project;
- IJavaProject javaProject;
+public class SimpleTestProject extends TestProject {
- final private String projectName;
-
public static final String PACKAGE_NAME = "test"; //$NON-NLS-1$
public static final String TYPE_NAME = "TestClass"; //$NON-NLS-1$
public static final String FILE_NAME = "TestClass.java"; //$NON-NLS-1$
-
- public SimpleTestProject(String projectName) {
- this.projectName=projectName;
- initialize();
- }
-
public SimpleTestProject() {
- projectName = "HibernateToolsTestProject"; //$NON-NLS-1$
- initialize();
+ super("HibernateToolsTestProject"); //$NON-NLS-1$
}
- void initialize(){
- try{
- buildSimpleTestProject();
- }catch(Exception e){
- throw new RuntimeException(e);
- }
+ public SimpleTestProject(String projectName) {
+ super(projectName);
}
-
- public IProject getIProject(){
- return this.project;
- }
- public IJavaProject getIJavaProject(){
- return this.javaProject;
- }
-
public String getFullyQualifiedTestClassName(){
return PACKAGE_NAME + "." + TYPE_NAME; //$NON-NLS-1$
}
@@ -76,84 +48,14 @@
return getTestClassType().getField("testField"); //$NON-NLS-1$
}
- public void deleteIProject() {
- try {
- project.delete(true, true, null);
- } catch (CoreException ce) {
- throw new RuntimeException(ce);
- }
-
- }
-
- public void deleteIProject(boolean deleteContent) {
- try {
- project.delete(deleteContent, true, null);
- } catch (CoreException ce) {
- throw new RuntimeException(ce);
- }
-
- }
-
- protected void buildSimpleTestProject() throws JavaModelException, CoreException,
IOException {
- project = buildNewProject(projectName);
- javaProject = buildJavaProject(project);
-
+ protected void buildProject() throws JavaModelException, CoreException, IOException {
+ super.buildProject();
buildType(buildPackage(PACKAGE_NAME, project, javaProject), FILE_NAME);
-
}
- private IProject buildNewProject(String projectName) {
-
- // get a project handle
- final IProject newProjectHandle = ResourcesPlugin.getWorkspace()
- .getRoot().getProject(projectName);
-
- // get a project descriptor
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- final IProjectDescription description = workspace
- .newProjectDescription(newProjectHandle.getName());
-
- try {
- createAndOpenProject(description, newProjectHandle);
- } catch (CoreException ce) {
- throw new RuntimeException(ce);
- }
-
- return newProjectHandle;
- }
-
- private void createAndOpenProject(IProjectDescription description,
- IProject projectHandle) throws CoreException {
-
- projectHandle.create(description, null);
- projectHandle.open(IResource.BACKGROUND_REFRESH, null);
- }
-
- private IJavaProject buildJavaProject(IProject project) {
-
- IJavaProject javaProject = JavaCore.create(project);
- try {
- setJavaNature(project);
- } catch (CoreException ce) {
- throw new RuntimeException(ce);
- }
-
- javaProject.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
- javaProject.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM,
JavaCore.VERSION_1_5);
- javaProject.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
- return javaProject;
- }
-
- private void setJavaNature(IProject project) throws CoreException {
- IProjectDescription description = project.getDescription();
- description.setNatureIds(new String[] { JavaCore.NATURE_ID });
- project.setDescription(description, null);
- }
-
-
private IPackageFragmentRoot buildSourceFolder(IProject project,
IJavaProject javaProject) throws CoreException {
- IFolder folder = project.getFolder("src"); //$NON-NLS-1$
+ IFolder folder = project.getFolder(SRC_FOLDER);
folder.create(false, true, null);
IPackageFragmentRoot root = javaProject.getPackageFragmentRoot(folder);
IClasspathEntry[] newEntries = { JavaCore
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -46,8 +46,6 @@
public static final String CFG_FILE_NAME = "hibernate.cfg.xml"; //$NON-NLS-1$
- public static final String ConsoleCFGName = "testConfigName"; //$NON-NLS-1$
-
/**
* Create hibernate.cfg.xml file content for the particular test package content.
* @param pack
@@ -126,6 +124,10 @@
wdialog.close();
}
+ /**
+ * Delete console configuration with given name.
+ * @param name
+ */
public static void deleteConsoleConfig(String name) {
final KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
final ConsoleConfiguration consoleConfig = knownConfigurations.find(name);
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/FilesTransfer.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/FilesTransfer.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/FilesTransfer.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -23,9 +23,6 @@
private FilesTransfer() {}
- public static final String SRC_FOLDER = "src"; //$NON-NLS-1$
- public static final String LIB_FOLDER = "lib"; //$NON-NLS-1$
-
public static final FileFilter filterFiles = new FileFilter() {
public boolean accept(File pathname) {
return !pathname.isDirectory();
@@ -34,21 +31,17 @@
public static final FileFilter filterFolders = new FileFilter() {
public boolean accept(File pathname) {
- // exclude ".svn" and other unnecessary folders
- if (pathname.getName().charAt(0) == '.') {
+ // exclude hidden files/folders
+ if (pathname.isHidden()) {
return false;
}
- if (LIB_FOLDER.equals(pathname.getName())) {
- return false;
- }
return pathname.isDirectory();
}
};
public static final FileFilter filterJars = new FileFilter() {
public boolean accept(File pathname) {
- return !pathname.isDirectory()
- || pathname.getName().endsWith(".jar"); //$NON-NLS-1$
+ return pathname.isFile() && pathname.getName().endsWith(".jar");
//$NON-NLS-1$
}
};
@@ -124,4 +117,51 @@
}
}
}
+
+ /**
+ * Delete the whole directory
+ * @param path
+ */
+ public static void delete(File path) {
+ if (path.exists()) {
+ File[] files = path.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].isDirectory()) {
+ delete(files[i]);
+ } else {
+ deleteFile(files[i]);
+ }
+ }
+ }
+ deleteFile(path);
+
+ }
+
+ /**
+ * Delete single file
+ * @param file
+ */
+ public static void deleteFile(File file) {
+ try {
+ if (!file.delete()) {
+ throw new RuntimeException(getMessage(file));
+ }
+ } catch (Throwable e) {
+ throw new RuntimeException(getMessage(file) ,e);
+ }
+ }
+
+
+ private static String getMessage(File file) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Cannot remove the "); //$NON-NLS-1$
+ buffer.append(file.getAbsolutePath());
+ buffer.append(" file. "); //$NON-NLS-1$
+ if (file.exists() && file.isDirectory()) {
+ String[] files = file.list();
+ buffer.append("List="); //$NON-NLS-1$
+ buffer.append(files.toString());
+ }
+ return buffer.toString();
+ }
}
Deleted:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ProjectUtil.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ProjectUtil.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ProjectUtil.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.hibernate.eclipse.console.test.utils;
-
-import java.lang.reflect.Field;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.internal.ErrorEditorPart;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.hibernate.eclipse.console.test.ConsoleTestMessages;
-import org.hibernate.eclipse.console.utils.OpenMappingUtils;
-import org.hibernate.mapping.PersistentClass;
-
-/**
- * @author Dmitry Geraskov
- *
- */
-@SuppressWarnings("restriction")
-public class ProjectUtil {
-
-
- public static String getPersistentClassName(PersistentClass persClass) {
- if (persClass == null) {
- return ""; //$NON-NLS-1$
- }
- return persClass.getEntityName() != null ? persClass.getEntityName() :
persClass.getClassName();
- }
-
- /**
- * Sometimes we have exceptions while opening editors.
- * IDE catches this exceptions and opens ErrorEditorPart instead of
- * our editor. To be sure that editor opened without exception use this method.
- * It gets occurred exception from the editor if it was and passes it up.
- *
- * @param editor
- * @return
- * @throws Throwable
- */
- public static Throwable getExceptionIfItOccured(IEditorPart editor){
- if (editor instanceof ErrorEditorPart){
- Class<ErrorEditorPart> clazz = ErrorEditorPart.class;
- Field field;
- try {
- field = clazz.getDeclaredField("error"); //$NON-NLS-1$
-
- field.setAccessible(true);
-
- Object error = field.get(editor);
- if (error instanceof IStatus) {
- IStatus err_status = (IStatus) error;
- if (err_status.getSeverity() == Status.ERROR){
- return err_status.getException();
- }
- }
- // catch close means that exception occurred but we can't get it
- } catch (SecurityException e) {
- return new
RuntimeException(ConsoleTestMessages.ProjectUtil_cannot_get_exception_from_erroreditorpart
+ e.getMessage());
- } catch (NoSuchFieldException e) {
- return new
RuntimeException(ConsoleTestMessages.ProjectUtil_cannot_get_error_field_from_erroreditorpart
+ e.getMessage());
- } catch (IllegalArgumentException e) {
- return new
RuntimeException(ConsoleTestMessages.ProjectUtil_cannot_get_error_field_from_erroreditorpart
+ e.getMessage());
- } catch (IllegalAccessException e) {
- return new
RuntimeException(ConsoleTestMessages.ProjectUtil_cannot_get_error_field_from_erroreditorpart
+ e.getMessage());
- }
- }
- return null;
- }
-
- public static boolean checkHighlighting(IEditorPart editor){
- ITextEditor[] tEditors = OpenMappingUtils.getTextEditors(editor);
- boolean highlighted = false;
- for (int i = 0; i < tEditors.length && !highlighted; i++) {
- ITextEditor textEditor = tEditors[i];
- ISelection selection = textEditor.getSelectionProvider().getSelection();
- if (selection instanceof TextSelection){
- TextSelection tSelection = (TextSelection)selection;
- highlighted = tSelection.getLength() > 0;
- }
- }
- return highlighted;
- }
-}
Deleted:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/TestUtilsCommon.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/TestUtilsCommon.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/TestUtilsCommon.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.hibernate.eclipse.console.test.utils;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.internal.resources.ResourceException;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.osgi.util.NLS;
-import org.hibernate.eclipse.console.test.ConsoleTestMessages;
-
-/**
- *
- */
-public class TestUtilsCommon {
-
- public static final Path JRE_CONTAINER = new Path(
- "org.eclipse.jdt.launching.JRE_CONTAINER"); //$NON-NLS-1$
-
-
- public IProject buildNewProject(String projectName) {
- // get a project handle
- final IProject newProjectHandle = ResourcesPlugin.getWorkspace()
- .getRoot().getProject(projectName);
-
- // get a project descriptor
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- final IProjectDescription description = workspace
- .newProjectDescription(newProjectHandle.getName());
-
- try {
- createAndOpenProject(description, newProjectHandle);
- } catch (CoreException ce) {
- throw new RuntimeException(ce);
- }
-
- return newProjectHandle;
- }
-
- public void createAndOpenProject(IProjectDescription description,
- IProject projectHandle) throws CoreException {
-
- try {
- projectHandle.create(description, null);
- } catch (ResourceException re) {
- // if the project exist - ignore exception
- if (re.getStatus().getCode() != 374 || re.getStatus().getSeverity() != IStatus.ERROR
||
- !"org.eclipse.core.resources".equals(re.getStatus().getPlugin())) {
//$NON-NLS-1$
- throw re;
- }
- }
- projectHandle.open(IResource.BACKGROUND_REFRESH, null);
- }
-
- public IJavaProject buildJavaProject(IProject project) {
- IJavaProject javaProject = JavaCore.create(project);
- try {
- setJavaNature(project);
- } catch (CoreException ce) {
- throw new RuntimeException(ce);
- }
-
- javaProject.setOption(JavaCore.COMPILER_COMPLIANCE,
- JavaCore.VERSION_1_5);
- javaProject.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM,
- JavaCore.VERSION_1_5);
- javaProject.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
- return javaProject;
- }
-
- public void setJavaNature(IProject project) throws CoreException {
- IProjectDescription description = project.getDescription();
- description.setNatureIds(new String[] { JavaCore.NATURE_ID });
- project.setDescription(description, null);
- }
-
- public IPackageFragmentRoot createFolder(IProject project,
- IJavaProject javaProject, String strFolder) throws CoreException {
- IFolder folder = project.getFolder(strFolder);
- if (!folder.exists()) {
- folder.create(true, true, null);
- IPackageFragmentRoot root = javaProject
- .getPackageFragmentRoot(folder);
- /*
- * IClasspathEntry[] newEntries = { JavaCore
- * .newSourceEntry(root.getPath()) , JavaCore
- * .newContainerEntry(JRE_CONTAINER)};
- * javaProject.setRawClasspath(newEntries, null);
- */
- return root;
- }
- return javaProject.getPackageFragmentRoot(folder);
- }
-
- public IPackageFragmentRoot createSourceFolder(IProject project,
- IJavaProject javaProject) throws CoreException {
- return createFolder(project, javaProject, FilesTransfer.SRC_FOLDER);
- }
-
- public List<IPath> copyLibs(IProject project, IJavaProject javaProject,
- File res) throws CoreException {
- return copyLibs2(project, javaProject,
- res.getAbsolutePath() + File.separator + FilesTransfer.LIB_FOLDER);
- }
-
- public List<IPath> copyLibs2(IProject project, IJavaProject javaProject,
- String absolutePath) throws CoreException {
- IFolder dst = project.getFolder(FilesTransfer.LIB_FOLDER);
- if (!dst.exists()) {
- dst.create(true, true, null);
- javaProject.getPackageFragmentRoot(dst);
- }
- File libFolder = new File(absolutePath);
- if (!libFolder.exists()) {
- String out = NLS.bind(
- ConsoleTestMessages.MappingTestProject_folder_not_found,
- absolutePath);
- throw new RuntimeException(out);
- }
- List<IPath> libs = new ArrayList<IPath>();
- FilesTransfer.copyFolder(libFolder, dst, FilesTransfer.filterJars,
- FilesTransfer.filterFolders, libs);
- return libs;
- }
-
- public void generateClassPath(IJavaProject javaProject, List<IPath> libs,
- IPackageFragmentRoot sourceFolder) throws JavaModelException {
- List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
- // entries.addAll(Arrays.asList(javaProject.getRawClasspath()));
- for (IPath lib_path : libs) {
- entries.add(JavaCore.newLibraryEntry(lib_path, null, null));
- }
- entries.add(JavaCore.newSourceEntry(sourceFolder.getPath()));
- entries.add(JavaCore.newContainerEntry(JRE_CONTAINER));
- javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[0]),
- null);
- }
-}
Copied:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/Utils.java
(from rev 15639,
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ProjectUtil.java)
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/Utils.java
(rev 0)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/Utils.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.eclipse.console.test.utils;
+
+import java.lang.reflect.Field;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.internal.ErrorEditorPart;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+import org.hibernate.eclipse.console.utils.OpenMappingUtils;
+import org.hibernate.mapping.PersistentClass;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+@SuppressWarnings("restriction")
+public class Utils {
+
+
+ public static String getPersistentClassName(PersistentClass persClass) {
+ if (persClass == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return persClass.getEntityName() != null ? persClass.getEntityName() :
persClass.getClassName();
+ }
+
+ /**
+ * Sometimes we have exceptions while opening editors.
+ * IDE catches this exceptions and opens ErrorEditorPart instead of
+ * our editor. To be sure that editor opened without exception use this method.
+ * It gets occurred exception from the editor if it was and passes it up.
+ *
+ * @param editor
+ * @return
+ * @throws Throwable
+ */
+ public static Throwable getExceptionIfItOccured(IEditorPart editor){
+ if (!(editor instanceof ErrorEditorPart)) {
+ return null;
+ }
+ String ex = null;
+ try {
+ Class<ErrorEditorPart> clazz = ErrorEditorPart.class;
+ Field field = clazz.getDeclaredField("error"); //$NON-NLS-1$
+ field.setAccessible(true);
+ Object error = field.get(editor);
+ if (error instanceof IStatus) {
+ IStatus err_status = (IStatus) error;
+ if (err_status.getSeverity() == Status.ERROR) {
+ return err_status.getException();
+ }
+ }
+ // catch close means that exception occurred but we can't get it
+ } catch (SecurityException e) {
+ ex = ConsoleTestMessages.ProjectUtil_cannot_get_exception_from_erroreditorpart +
e.getMessage();
+ } catch (NoSuchFieldException e) {
+ ex = ConsoleTestMessages.ProjectUtil_cannot_get_error_field_from_erroreditorpart +
e.getMessage();
+ } catch (IllegalArgumentException e) {
+ ex = ConsoleTestMessages.ProjectUtil_cannot_get_error_field_from_erroreditorpart +
e.getMessage();
+ } catch (IllegalAccessException e) {
+ ex = ConsoleTestMessages.ProjectUtil_cannot_get_error_field_from_erroreditorpart +
e.getMessage();
+ }
+ if (ex == null) {
+ return null;
+ }
+ return new RuntimeException(ex);
+ }
+
+ /**
+ * Checks has the editor selection or not
+ * @param editor
+ * @return
+ */
+ public static boolean hasSelection(IEditorPart editor){
+ ITextEditor[] tEditors = OpenMappingUtils.getTextEditors(editor);
+ boolean res = false;
+ for (int i = 0; i < tEditors.length && !res; i++) {
+ ITextEditor textEditor = tEditors[i];
+ ISelection selection = textEditor.getSelectionProvider().getSelection();
+ if (selection instanceof TextSelection){
+ TextSelection tSelection = (TextSelection)selection;
+ res = tSelection.getLength() > 0;
+ }
+ }
+ return res;
+ }
+}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/mapper/HBMInfoExtractorTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/mapper/HBMInfoExtractorTest.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/mapper/HBMInfoExtractorTest.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -23,10 +23,19 @@
*/
public class HBMInfoExtractorTest extends TestCase {
private HBMInfoExtractorStub sourceLocator = new HBMInfoExtractorStub();
+ private ConfigurableTestProject testProj = null;
+ protected void setUp() throws Exception {
+ testProj = new ConfigurableTestProject("HBMInfoProj"); //$NON-NLS-1$
+ }
+
+ protected void tearDown() throws Exception {
+ testProj.deleteIProject();
+ testProj = null;
+ }
+
public void executeJavaTypeHandlerTest(String start, String attributeName) {
sourceLocator.setPackageName("org"); //$NON-NLS-1$
- ConfigurableTestProject testProj = ConfigurableTestProject.getTestProject();
IJavaProject project = testProj.getIJavaProject();
JavaTypeHandler javaTypeHandler = new JavaTypeHandler(sourceLocator);
ICompletionProposal[] res =
@@ -54,7 +63,6 @@
public void executePackageHandlerTest(String start, String attributeName) {
sourceLocator.setPackageName("org"); //$NON-NLS-1$
- ConfigurableTestProject testProj = ConfigurableTestProject.getTestProject();
IJavaProject project = testProj.getIJavaProject();
PackageHandler packageHandler = new PackageHandler(sourceLocator);
ICompletionProposal[] res =
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -1,6 +1,5 @@
package org.hibernate.eclipse.jdt.ui.test;
-
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
@@ -30,7 +29,7 @@
import org.hibernate.eclipse.console.EclipseConsoleConfigurationPreferences;
import org.hibernate.eclipse.console.test.HibernateConsoleTest;
import org.hibernate.eclipse.console.test.project.SimpleTestProject;
-import org.hibernate.eclipse.console.test.xpl.JavaProjectHelper;
+import org.hibernate.eclipse.console.test.project.xpl.JavaProjectHelper;
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.eclipse.jdt.ui.internal.HQLDetector;
import org.hibernate.eclipse.jdt.ui.internal.HQLProblem;
@@ -50,9 +49,9 @@
return new SimpleTestProject("hqlquerytest-" + System.currentTimeMillis()) {
//$NON-NLS-1$
@Override
- protected void buildSimpleTestProject() throws JavaModelException,
+ protected void buildProject() throws JavaModelException,
CoreException, IOException {
- super.buildSimpleTestProject();
+ super.buildProject();
//set up project #3: file system structure with project as source folder
@@ -63,6 +62,7 @@
JavaProjectHelper.addToClasspath(getIJavaProject(),
JavaRuntime.getDefaultJREContainerEntry());
IPackageFragmentRoot addLibraryWithImport =
JavaProjectHelper.addLibraryWithImport(getIJavaProject(),
Path.fromOSString(ejb3lib.getPath()), null, null);
+ addLibraryWithImport.hasChildren();
assertEquals(3,getIJavaProject().getRawClasspath().length);
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -9,7 +9,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
@@ -20,7 +19,8 @@
import org.eclipse.ui.PlatformUI;
import org.hibernate.eclipse.console.test.HibernateConsoleTest;
import org.hibernate.eclipse.console.test.project.SimpleTestProject;
-import org.hibernate.eclipse.console.test.xpl.JavaProjectHelper;
+import org.hibernate.eclipse.console.test.project.xpl.JavaProjectHelper;
+import org.hibernate.eclipse.console.test.utils.FilesTransfer;
public class HibernateErrorsTest extends HibernateConsoleTest {
@@ -39,9 +39,9 @@
// see JBIDE-1012
@Override
- protected void buildSimpleTestProject() throws JavaModelException,
+ protected void buildProject() throws JavaModelException,
CoreException, IOException {
- super.buildSimpleTestProject();
+ super.buildProject();
// set up project #3: file system structure with project as
// source folder
@@ -58,6 +58,7 @@
IPackageFragmentRoot addLibraryWithImport = JavaProjectHelper
.addLibraryWithImport(getIJavaProject(), Path
.fromOSString(ejb3lib.getPath()), null, null);
+ addLibraryWithImport.hasChildren();
assertEquals(3, getIJavaProject().getRawClasspath().length);
@@ -152,33 +153,9 @@
getProject().getIProject().delete(false, true, null);
waitForJobs();
- delete(file);
+ FilesTransfer.delete(file);
}
- private void delete(File path) {
- if (path.exists()) {
- File[] files = path.listFiles();
- for (int i = 0; i < files.length; i++) {
- if (files[i].isDirectory()) {
- delete(files[i]);
- } else {
- deleteFile(files[i]);
- }
- }
- }
- deleteFile(path);
-
- }
-
- private void deleteFile(File file) {
- try {
- if (!file.delete())
- throw new RuntimeException("Cannot remove the " + file.getAbsolutePath() +
" file."); //$NON-NLS-1$//$NON-NLS-2$
- } catch (Throwable e) {
- throw new RuntimeException("Cannot remove the " + file.getAbsolutePath() +
" file.",e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
public void testDummy() throws JavaModelException {
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest2.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest2.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest2.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -28,7 +28,8 @@
import org.hibernate.eclipse.console.EclipseConsoleConfigurationPreferences;
import org.hibernate.eclipse.console.test.HibernateConsoleTest;
import org.hibernate.eclipse.console.test.project.SimpleTestProject;
-import org.hibernate.eclipse.console.test.xpl.JavaProjectHelper;
+import org.hibernate.eclipse.console.test.project.xpl.JavaProjectHelper;
+import org.hibernate.eclipse.console.test.utils.FilesTransfer;
import org.hibernate.eclipse.console.utils.ProjectUtils;
public class HibernateErrorsTest2 extends HibernateConsoleTest {
@@ -49,9 +50,9 @@
return new SimpleTestProject("hqlquerytest-" + System.currentTimeMillis()) {
//$NON-NLS-1$
@Override
- protected void buildSimpleTestProject() throws JavaModelException,
+ protected void buildProject() throws JavaModelException,
CoreException, IOException {
- super.buildSimpleTestProject();
+ super.buildProject();
//set up project #3: file system structure with project as source folder
@@ -62,6 +63,7 @@
JavaProjectHelper.addToClasspath(getIJavaProject(),
JavaRuntime.getDefaultJREContainerEntry());
IPackageFragmentRoot addLibraryWithImport =
JavaProjectHelper.addLibraryWithImport(getIJavaProject(),
Path.fromOSString(ejb3lib.getPath()), null, null);
+ addLibraryWithImport.hasChildren();
assertEquals(3,getIJavaProject().getRawClasspath().length);
@@ -166,50 +168,12 @@
}, new NullProgressMonitor());
}
waitForJobs();
- delete(file);
+ FilesTransfer.delete(file);
}
public void testDummy() throws JavaModelException {
}
- private void delete(File path) {
- if (path.exists()) {
- File[] files = path.listFiles();
- for (int i = 0; i < files.length; i++) {
- if (files[i].isDirectory()) {
- delete(files[i]);
- } else {
- deleteFile(files[i]);
- }
- }
- }
- deleteFile(path);
-
- }
-
- private void deleteFile(File file) {
- try {
- if (!file.delete()) {
- throw new RuntimeException(getMessage(file));
- }
- } catch (Throwable e) {
- throw new RuntimeException(getMessage(file),e);
- }
- }
-
- private String getMessage(File file) {
- StringBuffer buffer = new StringBuffer();
- buffer.append("Cannot remove the "); //$NON-NLS-1$
- buffer.append(file.getAbsolutePath());
- buffer.append(" file. "); //$NON-NLS-1$
- if (file.exists() && file.isDirectory()) {
- String[] files = file.list();
- buffer.append("List="); //$NON-NLS-1$
- buffer.append(files.toString());
- }
- return buffer.toString();
- }
-
protected SimpleTestProject getProject() {
return this.project;
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapTest.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapTest.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -18,7 +18,6 @@
import java.util.List;
import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
@@ -32,8 +31,8 @@
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.osgi.util.NLS;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+import org.hibernate.eclipse.console.test.project.TestProject;
import org.hibernate.eclipse.console.test.utils.FilesTransfer;
-import org.hibernate.eclipse.console.test.utils.TestUtilsCommon;
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.eclipse.jdt.ui.internal.jpa.collect.AllEntitiesInfoCollector;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.Utils;
@@ -59,23 +58,16 @@
protected AllEntitiesInfoCollector collector = new AllEntitiesInfoCollector();
protected AllEntitiesProcessor processor = new AllEntitiesProcessor();
- protected IProject project;
- protected IJavaProject javaProject;
+ protected TestProject project = null;
protected String testSelection;
protected void setUp() throws Exception {
}
protected void tearDown() throws Exception {
- try {
- project.delete(true, true, null);
- project = null;
- javaProject = null;
- } catch (CoreException e) {
- fail(e.getMessage());
- }
- assertNull(project);
- assertNull(javaProject);
+ assertNotNull(project);
+ project.deleteIProject();
+ project = null;
}
public void testTransformerFields() {
@@ -102,9 +94,8 @@
fail(e1.getMessage());
}
assertNotNull(project);
- assertNotNull(javaProject);
//
- javaProject = ProjectUtils.findJavaProject(PROJECT_NAME);
+ IJavaProject javaProject = ProjectUtils.findJavaProject(PROJECT_NAME);
assertNotNull(javaProject);
try {
javaProject.getProject().open(null);
@@ -172,7 +163,7 @@
}
protected ASTNode getGenerated(String strName) {
- ICompilationUnit icu = Utils.findCompilationUnit(javaProject,
+ ICompilationUnit icu = Utils.findCompilationUnit(project.getIJavaProject(),
"test.annotated." + testSelection + //$NON-NLS-1$
"." + strName); //$NON-NLS-1$
ASTParser parser = ASTParser.newParser(AST.JLS3);
@@ -221,9 +212,7 @@
protected void createTestProject() throws JavaModelException,
CoreException, IOException {
- TestUtilsCommon commonUtil = new TestUtilsCommon();
- project = commonUtil.buildNewProject(PROJECT_NAME);
- javaProject = commonUtil.buildJavaProject(project);
+ project = new TestProject(PROJECT_NAME);
File resourceFolder = getResourceItem(RESOURCE_PATH);
if (!resourceFolder.exists()) {
String out = NLS.bind(
@@ -231,8 +220,7 @@
RESOURCE_PATH);
throw new RuntimeException(out);
}
- IPackageFragmentRoot sourceFolder = commonUtil.createSourceFolder(
- project, javaProject);
+ IPackageFragmentRoot sourceFolder = project.createSourceFolder();
FilesTransfer.copyFolder(resourceFolder, (IFolder) sourceFolder
.getResource());
File resourceFolderLib = getResourceItem(TESTRESOURCE_PATH);
@@ -242,9 +230,8 @@
RESOURCE_PATH);
throw new RuntimeException(out);
}
- List<IPath> libs = commonUtil.copyLibs2(project, javaProject,
- resourceFolderLib.getAbsolutePath());
- commonUtil.generateClassPath(javaProject, libs, sourceFolder);
+ List<IPath> libs = project.copyLibs2(resourceFolderLib.getAbsolutePath());
+ project.generateClassPath(libs, sourceFolder);
}
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/hbmexporter/HbmExporterTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/hbmexporter/HbmExporterTest.java 2009-06-03
15:35:02 UTC (rev 15680)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/hbmexporter/HbmExporterTest.java 2009-06-03
15:35:39 UTC (rev 15681)
@@ -11,7 +11,6 @@
import junit.framework.TestCase;
import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
@@ -23,8 +22,8 @@
import org.eclipse.osgi.util.NLS;
import org.hibernate.cfg.Configuration;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+import org.hibernate.eclipse.console.test.project.TestProject;
import org.hibernate.eclipse.console.test.utils.FilesTransfer;
-import org.hibernate.eclipse.console.test.utils.TestUtilsCommon;
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.eclipse.jdt.ui.internal.jpa.collect.AllEntitiesInfoCollector;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.Utils;
@@ -49,8 +48,7 @@
protected AllEntitiesInfoCollector collector = new AllEntitiesInfoCollector();
protected AllEntitiesProcessor processor = new AllEntitiesProcessor();
- protected IProject project;
- protected IJavaProject javaProject;
+ protected TestProject project = null;
protected void setUp() throws Exception {
try {
@@ -63,8 +61,8 @@
fail(e1.getMessage());
}
assertNotNull(project);
+ IJavaProject javaProject = ProjectUtils.findJavaProject(PROJECT_NAME);
assertNotNull(javaProject);
- assertNotNull(ProjectUtils.findJavaProject(PROJECT_NAME));
try {
javaProject.getProject().open(null);
} catch (CoreException e) {
@@ -80,7 +78,7 @@
protected Configuration getConfigurationFor(String... cuNames){
Set<ICompilationUnit> selectionCU = new HashSet<ICompilationUnit>();
for (int i = 0; i < cuNames.length; i++) {
- ICompilationUnit icu = Utils.findCompilationUnit(javaProject,
+ ICompilationUnit icu = Utils.findCompilationUnit(project.getIJavaProject(),
cuNames[i]);
assertNotNull(icu);
selectionCU.add(icu);
@@ -88,7 +86,7 @@
ConfigurationActor actor = new ConfigurationActor(selectionCU);
Map<IJavaProject, Configuration> configurations = actor.createConfigurations();
assertEquals(1, configurations.size());
- Configuration config = configurations.get(javaProject);
+ Configuration config = configurations.get(project.getIJavaProject());
assertNotNull(config);
return config;
}
@@ -100,68 +98,68 @@
}
public void testId(){
- Configuration config = getConfigurationFor("pack.A");
- checkClassesMaped(config, "A", "B");
- PersistentClass a = config.getClassMapping("A");
- PersistentClass b = config.getClassMapping("B");
+ Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ checkClassesMaped(config, "A", "B"); //$NON-NLS-1$ //$NON-NLS-2$
+ PersistentClass a = config.getClassMapping("A"); //$NON-NLS-1$
+ PersistentClass b = config.getClassMapping("B"); //$NON-NLS-1$
Property aId= a.getIdentifierProperty();
Property bId= b.getIdentifierProperty();
assertNotNull(aId);
assertNotNull(bId);
- assertEquals("id", aId.getName());
- assertEquals("id", bId.getName());
+ assertEquals("id", aId.getName()); //$NON-NLS-1$
+ assertEquals("id", bId.getName()); //$NON-NLS-1$
}
public void testProperty(){
- Configuration config = getConfigurationFor("pack.A");
- checkClassesMaped(config, "A", "B");
- PersistentClass a = config.getClassMapping("A");
+ Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ checkClassesMaped(config, "A", "B"); //$NON-NLS-1$ //$NON-NLS-2$
+ PersistentClass a = config.getClassMapping("A"); //$NON-NLS-1$
- Property prop = a.getProperty("prop");
+ Property prop = a.getProperty("prop"); //$NON-NLS-1$
Value value = prop.getValue();
assertNotNull(value);
- assertTrue("Expected to get ManyToOne-type mapping", value.getClass()==
ManyToOne.class);
+ assertTrue("Expected to get ManyToOne-type mapping", value.getClass()==
ManyToOne.class); //$NON-NLS-1$
ManyToOne mto = (ManyToOne)value;
- assertEquals("pack.B", mto.getTypeName());
+ assertEquals("pack.B", mto.getTypeName()); //$NON-NLS-1$
}
public void testArray(){
- Configuration config = getConfigurationFor("pack.A");
- checkClassesMaped(config, "A", "B");
- PersistentClass a = config.getClassMapping("A");
- PersistentClass b = config.getClassMapping("B");
+ Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ checkClassesMaped(config, "A", "B"); //$NON-NLS-1$ //$NON-NLS-2$
+ PersistentClass a = config.getClassMapping("A"); //$NON-NLS-1$
+ PersistentClass b = config.getClassMapping("B"); //$NON-NLS-1$
- Property bs = a.getProperty("bs");
+ Property bs = a.getProperty("bs"); //$NON-NLS-1$
Value value = bs.getValue();
assertNotNull(value);
- assertTrue("Expected to get Array-type mapping",
value.getClass()==Array.class);
+ assertTrue("Expected to get Array-type mapping",
value.getClass()==Array.class); //$NON-NLS-1$
Array ar = (Array)value;
- assertEquals("pack.B", ar.getElementClassName());
- assertTrue("Expected to get one-to-many array's element type",
+ assertEquals("pack.B", ar.getElementClassName()); //$NON-NLS-1$
+ assertTrue("Expected to get one-to-many array's element type",
//$NON-NLS-1$
ar.getElement().getClass() == OneToMany.class);
- Property testIntArray = b.getProperty("testIntArray");
+ Property testIntArray = b.getProperty("testIntArray"); //$NON-NLS-1$
assertNotNull(testIntArray);
value = testIntArray.getValue();
assertNotNull(value);
- assertTrue("Expected to get PrimitiveArray-type mapping",
+ assertTrue("Expected to get PrimitiveArray-type mapping", //$NON-NLS-1$
value.getClass()==PrimitiveArray.class);
PrimitiveArray pAr = (PrimitiveArray) value;
assertNotNull(pAr.getElement());
- assertTrue("Expected to get int-type primitive array",
pAr.getElement().getType().getClass()==IntegerType.class);
+ assertTrue("Expected to get int-type primitive array",
pAr.getElement().getType().getClass()==IntegerType.class); //$NON-NLS-1$
}
public void testList(){
- Configuration config = getConfigurationFor("pack.A");
- checkClassesMaped(config, "A", "B");
- PersistentClass a = config.getClassMapping("A");
- PersistentClass b = config.getClassMapping("B");
+ Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ checkClassesMaped(config, "A", "B"); //$NON-NLS-1$ //$NON-NLS-2$
+ PersistentClass a = config.getClassMapping("A"); //$NON-NLS-1$
+ PersistentClass b = config.getClassMapping("B"); //$NON-NLS-1$
- Property listProp = a.getProperty("list");
+ Property listProp = a.getProperty("list"); //$NON-NLS-1$
Value value = listProp.getValue();
assertNotNull(value);
- assertTrue("Expected to get List-type mapping",
+ assertTrue("Expected to get List-type mapping", //$NON-NLS-1$
value.getClass()==org.hibernate.mapping.List.class);
org.hibernate.mapping.List list = (org.hibernate.mapping.List)value;
assertTrue(list.getElement() instanceof OneToMany);
@@ -171,15 +169,15 @@
}
public void testSet(){
- Configuration config = getConfigurationFor("pack.A");
- checkClassesMaped(config, "A", "B");
- PersistentClass a = config.getClassMapping("A");
- PersistentClass b = config.getClassMapping("B");
+ Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ checkClassesMaped(config, "A", "B"); //$NON-NLS-1$ //$NON-NLS-2$
+ PersistentClass a = config.getClassMapping("A"); //$NON-NLS-1$
+ PersistentClass b = config.getClassMapping("B"); //$NON-NLS-1$
- Property setProp = a.getProperty("set");
+ Property setProp = a.getProperty("set"); //$NON-NLS-1$
Value value = setProp.getValue();
assertNotNull(value);
- assertTrue("Expected to get Set-type mapping",
+ assertTrue("Expected to get Set-type mapping", //$NON-NLS-1$
value.getClass()==org.hibernate.mapping.Set.class);
org.hibernate.mapping.Set set = (org.hibernate.mapping.Set)value;
assertTrue(set.getElement() instanceof OneToMany);
@@ -188,29 +186,27 @@
}
public void testMap(){
- Configuration config = getConfigurationFor("pack.A");
- checkClassesMaped(config, "A", "B");
- PersistentClass a = config.getClassMapping("A");
- PersistentClass b = config.getClassMapping("B");
+ Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ checkClassesMaped(config, "A", "B"); //$NON-NLS-1$ //$NON-NLS-2$
+ PersistentClass a = config.getClassMapping("A"); //$NON-NLS-1$
+ PersistentClass b = config.getClassMapping("B"); //$NON-NLS-1$
- Property mapValue = a.getProperty("mapValue");
+ Property mapValue = a.getProperty("mapValue"); //$NON-NLS-1$
Value value = mapValue.getValue();
assertNotNull(value);
- assertTrue("Expected to get Map-type mapping",
+ assertTrue("Expected to get Map-type mapping", //$NON-NLS-1$
value.getClass()==org.hibernate.mapping.Map.class);
org.hibernate.mapping.Map map = (org.hibernate.mapping.Map)value;
assertTrue(map.getElement() instanceof OneToMany);
assertTrue(map.getCollectionTable().equals(b.getTable()));
assertNotNull(map.getKey());
- assertEquals("string", map.getKey().getType().getName());
+ assertEquals("string", map.getKey().getType().getName()); //$NON-NLS-1$
}
protected void createTestProject() throws JavaModelException,
CoreException, IOException {
- TestUtilsCommon commonUtil = new TestUtilsCommon();
- project = commonUtil.buildNewProject(PROJECT_NAME);
- javaProject = commonUtil.buildJavaProject(project);
+ project = new TestProject(PROJECT_NAME);
File resourceFolder = getResourceItem(RESOURCE_PATH);
if (!resourceFolder.exists()) {
String out = NLS.bind(
@@ -218,8 +214,7 @@
RESOURCE_PATH);
throw new RuntimeException(out);
}
- IPackageFragmentRoot sourceFolder = commonUtil.createSourceFolder(
- project, javaProject);
+ IPackageFragmentRoot sourceFolder = project.createSourceFolder();
FilesTransfer.copyFolder(resourceFolder, (IFolder) sourceFolder
.getResource());
File resourceFolderLib = getResourceItem(TESTRESOURCE_PATH);
@@ -229,9 +224,8 @@
RESOURCE_PATH);
throw new RuntimeException(out);
}
- List<IPath> libs = commonUtil.copyLibs2(project, javaProject,
- resourceFolderLib.getAbsolutePath());
- commonUtil.generateClassPath(javaProject, libs, sourceFolder);
+ List<IPath> libs = project.copyLibs2(resourceFolderLib.getAbsolutePath());
+ project.generateClassPath(libs, sourceFolder);
}
protected File getResourceItem(String strResPath) throws IOException {
@@ -246,15 +240,9 @@
}
protected void tearDown() throws Exception {
- try {
- project.delete(true, true, null);
- project = null;
- javaProject = null;
- } catch (CoreException e) {
- fail(e.getMessage());
- }
- assertNull(project);
- assertNull(javaProject);
+ assertNotNull(project);
+ project.deleteIProject();
+ project = null;
}
}