Author: dgolovin
Date: 2008-01-03 20:54:44 -0500 (Thu, 03 Jan 2008)
New Revision: 5497
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetInstallDelegateTest.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-1544
Need add @catalogProperty@@schemaProperty@ back to persistence.xml templates file in
seam-gen.
JUnit tests also added.
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java 2008-01-04
01:54:41 UTC (rev 5496)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java 2008-01-04
01:54:44 UTC (rev 5497)
@@ -24,6 +24,7 @@
import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import
org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider;
+import org.jboss.tools.seam.internal.core.project.facet.SeamFacetPreInstallDelegate;
/**
* Base class for facet related tests; based on the facet test class found in
@@ -68,16 +69,16 @@
super.setUp();
assertSeamHomeAvailable();
File folder = getSeamHomeFolder();
-
-
-
+
SeamRuntimeManager.getInstance().addRuntime(SEAM_1_2_0, folder.getAbsolutePath(),
SeamVersion.SEAM_1_2, true);
seamRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(SEAM_1_2_0);
}
protected File getSeamHomeFolder() {
- return new File(System.getProperty("jbosstools.test.seam.1.2.1.eap.home",
"/home/max/rhdevstudio/jboss-eap/seam"));
+ return new File(
+ System.getProperty("jbosstools.test.seam.1.2.1.eap.home",
+ "C:/jbdevstudio/jboss-eap/seam"));
}
@@ -152,7 +153,7 @@
null);
installDependentFacets(fproj);
-
+// new SeamFacetPreInstallDelegate().execute(fproj.getProject(), getSeamFacetVersion(),
config, null);
fproj.installProjectFacet(getSeamFacetVersion(), config, null);
SeamProjectsSet seamProjectsSet = new SeamProjectsSet(fproj.getProject());
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetInstallDelegateTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetInstallDelegateTest.java 2008-01-04
01:54:41 UTC (rev 5496)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetInstallDelegateTest.java 2008-01-04
01:54:44 UTC (rev 5497)
@@ -12,10 +12,14 @@
import java.io.IOException;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.internal.core.project.facet.SeamFacetPreInstallDelegate;
+import org.jboss.tools.test.util.ResourcesUtils;
public class SeamFacetInstallDelegateTest extends AbstractSeamFacetTest {
@@ -46,4 +50,73 @@
}
+ public void testJiraJbide1544() throws CoreException, IOException {
+
+ final String catalogName = "catalog1";
+ final String schemaName = "schema1";
+
+ IDataModel createSeamDataModel = createSeamDataModel("war");
+ createSeamDataModel.setProperty(ISeamFacetDataModelProperties.DB_DEFAULT_CATALOG_NAME,
catalogName);
+ createSeamDataModel.setProperty(ISeamFacetDataModelProperties.DB_DEFAULT_SCHEMA_NAME,
schemaName);
+ IFacetedProject fproj =
createSeamProject("customSchemaAndCatalog",createSeamDataModel);
+ IFile persistence =
(IFile)fproj.getProject().findMember("src/model/META-INF/persistence.xml");
+ assertTrue(persistence.exists());
+ boolean schemaExists = ResourcesUtils.findLineInFile(persistence, ".*" +
+ NLS.bind(
+ SeamFacetPreInstallDelegate.PROP_DECL,
+ new String[]{
+ ISeamFacetDataModelProperties.DB_DEFAULT_SCHEMA_NAME.replace(".","\\."),
+ schemaName}));
+ boolean catalogExists = ResourcesUtils.findLineInFile(persistence, ".*" +
+ NLS.bind(
+ SeamFacetPreInstallDelegate.PROP_DECL,
+ new String[]{
+ ISeamFacetDataModelProperties.DB_DEFAULT_CATALOG_NAME.replace(".","\\."),
+ catalogName}));
+ assertTrue(
+ NLS.bind(
+ "Cannot find ''{0}'' property in persistence.xml file",
+ new String[]{
+ ISeamFacetDataModelProperties.DB_DEFAULT_SCHEMA_NAME})
+ , schemaExists);
+
+ assertTrue(
+ NLS.bind(
+ "Cannot find ''{0}'' property in persistence.xml file",
+ new String[]{
+ ISeamFacetDataModelProperties.DB_DEFAULT_CATALOG_NAME})
+ , catalogExists);
+
+ createSeamDataModel = createSeamDataModel("war");
+ fproj = createSeamProject("noSchemaAndCatalog",createSeamDataModel);
+ persistence =
(IFile)fproj.getProject().findMember("src/model/META-INF/persistence.xml");
+ assertTrue(persistence.exists());
+ schemaExists = ResourcesUtils.findLineInFile(persistence, ".*" +
+ NLS.bind(
+ SeamFacetPreInstallDelegate.PROP_DECL,
+ new String[]{
+ ISeamFacetDataModelProperties.DB_DEFAULT_SCHEMA_NAME.replace(".","\\."),
+ ".*"}));
+ catalogExists = ResourcesUtils.findLineInFile(persistence, ".*" +
+ NLS.bind(
+ SeamFacetPreInstallDelegate.PROP_DECL,
+ new String[]{
+ ISeamFacetDataModelProperties.DB_DEFAULT_CATALOG_NAME.replace(".","\\."),
+ ".*"}));
+ assertTrue(
+ NLS.bind(
+ "''{0}'' property mustn't be in persistence.xml
file",
+ new String[]{
+ ISeamFacetDataModelProperties.DB_DEFAULT_SCHEMA_NAME})
+ , !schemaExists);
+
+ assertTrue(
+ NLS.bind(
+ "''{0}'' property mustn't be in persistence.xml
file",
+ new String[]{
+ ISeamFacetDataModelProperties.DB_DEFAULT_CATALOG_NAME})
+ , !catalogExists);
+
+ }
+
}