Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2009-11-20 17:04:20 -0500
committerkmoore2009-11-20 17:04:20 -0500
commit6fb7c7657ba5945a8562bec29d6b9cb3958c02e8 (patch)
tree8c46fc8ff2b996e0702869239e45ebba195dcc4b
parentda59995953ad834aeed44aba97adc34898866fd8 (diff)
downloadwebtools.dali-6fb7c7657ba5945a8562bec29d6b9cb3958c02e8.tar.gz
webtools.dali-6fb7c7657ba5945a8562bec29d6b9cb3958c02e8.tar.xz
webtools.dali-6fb7c7657ba5945a8562bec29d6b9cb3958c02e8.zip
295730 - orm.xml file creation default is now false
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProvider.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaProjectTests.java26
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java20
3 files changed, 37 insertions, 13 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProvider.java
index 0bcf306a0c..2832f2fdc3 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProvider.java
@@ -31,7 +31,7 @@ public class JpaFacetInstallDataModelProvider
@Override
public Set<String> getPropertyNames() {
- @SuppressWarnings("unchecked") Set<String> propertyNames = super.getPropertyNames();
+ Set<String> propertyNames = super.getPropertyNames();
propertyNames.add(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH);
propertyNames.add(DB_DRIVER_NAME);
propertyNames.add(CREATE_ORM_XML);
@@ -76,7 +76,7 @@ public class JpaFacetInstallDataModelProvider
return this.getDefaultDriverName();
}
if (propertyName.equals(CREATE_ORM_XML)) {
- return Boolean.TRUE;
+ return Boolean.FALSE;
}
return super.getDefaultProperty(propertyName);
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaProjectTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaProjectTests.java
index 901eafbf8c..583b0a323e 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaProjectTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaProjectTests.java
@@ -12,12 +12,16 @@ package org.eclipse.jpt.core.tests.internal.context;
import junit.framework.TestCase;
import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
+import org.eclipse.jpt.core.internal.GenericJpaPlatformProvider;
+import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProperties;
+import org.eclipse.jpt.core.internal.facet.JpaFacetInstallDataModelProperties;
+import org.eclipse.jpt.core.internal.facet.JpaFacetInstallDataModelProvider;
+import org.eclipse.jpt.core.internal.operations.JpaFileCreationDataModelProperties;
import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProvider;
-import org.eclipse.jpt.core.internal.operations.PersistenceFileCreationDataModelProperties;
import org.eclipse.jpt.core.internal.operations.PersistenceFileCreationDataModelProvider;
import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -36,7 +40,15 @@ public class JpaProjectTests extends TestCase
@Override
protected void setUp() throws Exception {
super.setUp();
- this.jpaProject = TestJpaProject.buildJpaProject(BASE_PROJECT_NAME, false); // false = no auto-build
+ this.jpaProject = TestJpaProject.buildJpaProject(BASE_PROJECT_NAME, false, buildJpaConfigDataModel()); // false = no auto-build
+ }
+
+ protected IDataModel buildJpaConfigDataModel() {
+ IDataModel dataModel = DataModelFactory.createDataModel(new JpaFacetInstallDataModelProvider());
+ dataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, JptCorePlugin.JPA_FACET_VERSION_1_0);
+ dataModel.setProperty(JpaFacetDataModelProperties.PLATFORM_ID, GenericJpaPlatformProvider.ID);
+ dataModel.setProperty(JpaFacetInstallDataModelProperties.CREATE_ORM_XML, Boolean.TRUE);
+ return dataModel;
}
@Override
@@ -72,7 +84,7 @@ public class JpaProjectTests extends TestCase
private void createPersistenceXmlFile() throws Exception {
IDataModel config =
DataModelFactory.createDataModel(new PersistenceFileCreationDataModelProvider());
- config.setProperty(PersistenceFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
+ config.setProperty(JpaFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
config.getDefaultOperation().execute(null, null);
}
@@ -98,15 +110,15 @@ public class JpaProjectTests extends TestCase
private void createDefaultOrmXmlFile() throws Exception {
IDataModel config =
DataModelFactory.createDataModel(new OrmFileCreationDataModelProvider());
- config.setProperty(OrmFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
+ config.setProperty(JpaFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
config.getDefaultOperation().execute(null, null);
}
private void createOrmXmlFile(String filePath) throws Exception {
IDataModel config =
DataModelFactory.createDataModel(new OrmFileCreationDataModelProvider());
- config.setProperty(OrmFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
- config.setProperty(OrmFileCreationDataModelProperties.FILE_PATH, filePath);
+ config.setProperty(JpaFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
+ config.setProperty(JpaFileCreationDataModelProperties.FILE_PATH, filePath);
config.getDefaultOperation().execute(null, null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java
index 8145ff2f7a..0e15812048 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java
@@ -17,10 +17,14 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.JptCorePlugin;
+import org.eclipse.jpt.core.internal.facet.JpaFacetInstallDataModelProperties;
+import org.eclipse.jpt.core.internal.facet.JpaFacetInstallDataModelProvider;
import org.eclipse.jpt.core.tests.internal.projects.TestFacetedProject;
import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject;
import org.eclipse.jpt.core.tests.internal.projects.TestPlatformProject;
import org.eclipse.jpt.utility.internal.ClassTools;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@SuppressWarnings("nls")
public class JpaModelTests extends TestCase {
@@ -106,13 +110,21 @@ public class JpaModelTests extends TestCase {
public void testJpaModel() {
assertNotNull(JptCorePlugin.getJpaModel());
}
+
+ protected IDataModel buildJpaConfigDataModel() {
+ IDataModel dataModel = DataModelFactory.createDataModel(new JpaFacetInstallDataModelProvider());
+ dataModel.setProperty(JpaFacetInstallDataModelProperties.CREATE_ORM_XML, Boolean.TRUE);
+ return dataModel;
+ }
public void testProjectCloseReopen() throws Exception {
- this.testProject.installFacet(JptCorePlugin.FACET_ID, "1.0");
+ this.testProject.installFacet(JptCorePlugin.FACET_ID, "1.0", buildJpaConfigDataModel());
+ JpaProject jpaProject = JptCorePlugin.getJpaProject(this.testProject.getProject());
+ assertNotNull(jpaProject);
this.testProject.getProject().close(null);
assertFalse(this.testProject.getProject().isOpen());
- JpaProject jpaProject = JptCorePlugin.getJpaProject(this.testProject.getProject());
+ jpaProject = JptCorePlugin.getJpaProject(this.testProject.getProject());
assertNull(jpaProject);
this.testProject.getProject().open(null);
@@ -128,7 +140,7 @@ public class JpaModelTests extends TestCase {
}
public void testProjectDeleteReimport() throws Exception {
- this.testProject.installFacet(JptCorePlugin.FACET_ID, "1.0");
+ this.testProject.installFacet(JptCorePlugin.FACET_ID, "1.0", buildJpaConfigDataModel());
JpaProject jpaProject = JptCorePlugin.getJpaProject(this.testProject.getProject());
assertNotNull(jpaProject);
assertEquals(1, JptCorePlugin.getJpaModel().getJpaProjectsSize());
@@ -158,7 +170,7 @@ public class JpaModelTests extends TestCase {
public void testFacetInstallUninstall() throws Exception {
assertNull(JptCorePlugin.getJpaProject(this.testProject.getProject()));
- this.testProject.installFacet(JptCorePlugin.FACET_ID, "1.0");
+ this.testProject.installFacet(JptCorePlugin.FACET_ID, "1.0", buildJpaConfigDataModel());
assertEquals(1, JptCorePlugin.getJpaModel().getJpaProjectsSize());
JpaProject jpaProject = JptCorePlugin.getJpaProject(this.testProject.getProject());
assertNotNull(jpaProject);

Back to the top