Author: vyemialyanchyk
Date: 2011-01-14 15:00:07 -0500 (Fri, 14 Jan 2011)
New Revision: 28257
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/TestSet.java
Log:
https://issues.jboss.org/browse/JBIDE-8118 - fixed
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 2011-01-14
19:44:55 UTC (rev 28256)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HbmExportExceptionTest.java 2011-01-14
20:00:07 UTC (rev 28257)
@@ -87,6 +87,7 @@
//delete old hbm files
assertNotNull( testPackage );
+ int nDeleted = 0;
if (testPackage.getNonJavaResources().length > 0){
Object[] ress = testPackage.getNonJavaResources();
for (int i = 0; i < ress.length; i++) {
@@ -94,6 +95,7 @@
IFile res = (IFile)ress[i];
if (res.getName().endsWith(".hbm.xml")) { //$NON-NLS-1$
res.delete(true, false, null);
+ nDeleted++;
}
}
}
@@ -138,6 +140,21 @@
} catch (ExporterException e){
throw (Exception)e.getCause();
}
+ //
+ int nCreated = 0;
+ 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];
+ if (res.getName().endsWith(".hbm.xml")) { //$NON-NLS-1$
+ nCreated++;
+ }
+ }
+ }
+ }
+ //
+ assert(nDeleted <= nCreated);
} catch (Exception e){
String newMessage = "\nPackage " + testPackage.getElementName() +
":"; //$NON-NLS-1$ //$NON-NLS-2$
throw new WripperException(newMessage, e);
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 2011-01-14
19:44:55 UTC (rev 28256)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestSet.java 2011-01-14
20:00:07 UTC (rev 28257)
@@ -48,12 +48,15 @@
test4.setTestPackage(testPackage);
/**/
//
- suite.addTest(test1);
/**/
+ suite.addTest(test4);
suite.addTest(test2);
suite.addTest(test3);
- suite.addTest(test4);
/**/
+ // HbmExportExceptionTest should be a last test in the suite array,
+ // cause it clean up all hbm.xml files and could be a reason of exceptions during
+ // other test executions
+ suite.addTest(test1);
return suite;
}
}