Author: vyemialyanchyk
Date: 2009-04-10 07:05:09 -0400 (Fri, 10 Apr 2009)
New Revision: 14666
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/model/test/OrmDiagramTest.java
Log:
JBIDE-4148
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2009-04-10
11:00:23 UTC (rev 14665)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2009-04-10
11:05:09 UTC (rev 14666)
@@ -103,15 +103,15 @@
setDirty(false);
}
- private IPath getStoreFolderPath() {
+ public IPath getStoreFolderPath() {
return
javaProject.getProject().getLocation().append(".settings").append(HIBERNATE_MAPPING_LAYOUT_FOLDER_NAME);
//$NON-NLS-1$
}
- private IPath getStoreFilePath() {
+ public IPath getStoreFilePath() {
return getStoreFolderPath().append(getStoreFileName());
}
- private String getStoreFileName() {
+ public String getStoreFileName() {
String name = ormElements.length > 0 ? ormElements[0].getClassName() : "";
//$NON-NLS-1$
for (int i = 1; i < ormElements.length; i++) {
name += "_" + ormElements[i].getClassName(); //$NON-NLS-1$
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/model/test/OrmDiagramTest.java
===================================================================
---
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/model/test/OrmDiagramTest.java 2009-04-10
11:00:23 UTC (rev 14665)
+++
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/model/test/OrmDiagramTest.java 2009-04-10
11:05:09 UTC (rev 14666)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.veditor.editors.model.test;
+import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -103,6 +104,18 @@
});
final OrmDiagram ormDiagram = new OrmDiagram(consoleConfiguration, ioe, javaProject);
ormDiagram.save();
+ // test is the folder created
+ File folder = new File(ormDiagram.getStoreFolderPath().toOSString());
+ assertTrue(folder.exists() && folder.isDirectory());
+ // test is the file created
+ File file = new File(ormDiagram.getStoreFilePath().toOSString());
+ assertTrue(file.exists() && file.isFile());
+ //
+ boolean res = file.delete();
+ assertTrue(res);
+ //
+ res = folder.delete();
+ assertTrue(res);
// GENERAL TEST:
// check for all expectations
context.assertIsSatisfied();