Author: vyemialyanchyk
Date: 2011-01-14 14:19:34 -0500 (Fri, 14 Jan 2011)
New Revision: 28249
Added:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/mapping/cut/Atypes.hbm.xml
Removed:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/mapping/cut/types.hbm.xml
Modified:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java
Log:
https://issues.jboss.org/browse/JBIDE-8117 - fixed
Copied:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/mapping/cut/Atypes.hbm.xml
(from rev 28245,
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/mapping/cut/types.hbm.xml)
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/mapping/cut/Atypes.hbm.xml
(rev 0)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/mapping/cut/Atypes.hbm.xml 2011-01-14
19:19:34 UTC (rev 28249)
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="mapping.cut">
+ <typedef name="money"
class="org.hibernate.test.cut.MonetoryAmountUserType"/>
+</hibernate-mapping>
\ No newline at end of file
Deleted:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/mapping/cut/types.hbm.xml
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/mapping/cut/types.hbm.xml 2011-01-14
19:18:57 UTC (rev 28248)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/res/project/src/mapping/cut/types.hbm.xml 2011-01-14
19:19:34 UTC (rev 28249)
@@ -1,8 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="mapping.cut">
- <typedef name="money"
class="org.hibernate.test.cut.MonetoryAmountUserType"/>
-</hibernate-mapping>
\ No newline at end of file
Modified:
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java 2011-01-14
19:18:57 UTC (rev 28248)
+++
branches/jbosstools-3.2.0.CR1/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/utils/ConsoleConfigUtils.java 2011-01-14
19:19:34 UTC (rev 28249)
@@ -2,6 +2,8 @@
import java.io.IOException;
import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collections;
import org.apache.tools.ant.filters.StringInputStream;
import org.eclipse.core.resources.IFile;
@@ -49,6 +51,8 @@
/**
* Create hibernate.cfg.xml file content for the particular test package content.
+ * Use alphabetic order to resources in cfg.xml
+ *
* @param pack
* @return a string, which is hibernate.cfg.xml content
* @throws CoreException
@@ -57,21 +61,28 @@
StringBuilder str = new StringBuilder();
str.append(XML_HEADER);
str.append(XML_CFG_START);
- if (pack.getNonJavaResources().length > 0){
+ if (pack.getNonJavaResources().length > 0) {
+ ArrayList<String> collect = new ArrayList<String>();
Object[] ress = pack.getNonJavaResources();
for (int i = 0; i < ress.length; i++) {
if (!(ress[i] instanceof IFile)) {
continue;
}
IFile file = (IFile)ress[i];
- if (file.getName().endsWith(".hbm.xml")){ //$NON-NLS-1$
- str.append("<mapping resource=\"");//$NON-NLS-1$
- str.append(pack.getElementName().replace('.', '/'));
- str.append('/');
- str.append(file.getName());
- str.append("\"/>\n"); //$NON-NLS-1$
+ if (file.getName().endsWith(".hbm.xml")) { //$NON-NLS-1$
+ collect.add(file.getName());
}
}
+ // use alphabetic order to resources in cfg.xml
+ Collections.sort(collect);
+ final String packElementName = pack.getElementName().replace('.',
'/');
+ for (int i = 0; i < collect.size(); i++) {
+ str.append("<mapping resource=\"");//$NON-NLS-1$
+ str.append(packElementName);
+ str.append('/');
+ str.append(collect.get(i));
+ str.append("\"/>\n"); //$NON-NLS-1$
+ }
}
str.append(XML_CFG_END);
return str.toString();