Author: dgolovin
Date: 2007-09-21 21:17:08 -0400 (Fri, 21 Sep 2007)
New Revision: 3765
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-906
test project is created for WAR and EAR seam deployment configurations
The bas sequence look like this for both deployment types:
1. Create Seam WEB Project
2. Create Action or Form
3. Open test-src folder in test project
4. Find test class or test xml file.
5. In context menu on navigator select Run AS/Test NG Test for test class Run As/Test NG
test suite for xml
6. test NG should show Test NG View with green bar on top, that means all test passed
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java 2007-09-21
20:45:09 UTC (rev 3764)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java 2007-09-22
01:17:08 UTC (rev 3765)
@@ -118,14 +118,8 @@
return null;
}
- public static IEclipsePreferences getSeamFacetPreferences(IProject project) {
- FacetedProject facetedProject = (FacetedProject)
project.getAdapter(IFacetedProject.class);
- IProjectFacet facet =
ProjectFacetsManager.getProjectFacet(ISeamCoreConstants.SEAM_CORE_FACET_ID);
- if(facetedProject.hasProjectFacet(facet)) {
- IScopeContext projectScope = new ProjectScope(project);
- return projectScope.getNode(PLUGIN_ID);
- }
-
- return null;
+ public static IEclipsePreferences getSeamPreferences(IProject project) {
+ IScopeContext projectScope = new ProjectScope(project);
+ return projectScope.getNode(PLUGIN_ID);
}
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-09-21
20:45:09 UTC (rev 3764)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-09-22
01:17:08 UTC (rev 3765)
@@ -57,6 +57,8 @@
public static String DEV_WAR_PROFILE = "dev-war";
public static String DEV_EAR_PROFILE = "dev";
+ public static String TEST_WAR_PROFILE = "test-war";
+ public static String TEST_EAR_PROFILE = "test";
public static AntCopyUtils.FileSet TOMCAT_WAR_LIB_FILESET = new AntCopyUtils.FileSet()
.include("activation\\.jar")
@@ -284,7 +286,7 @@
hibernateDialectFilterSet.addFilterSet(projectFilterSet);
hibernateDialectFilterSet.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
- createComponentsProperties(srcFolder, project.getName(), Boolean.FALSE);
+ createComponentsProperties(srcFolder,
isWarConfiguration(model)?"":project.getName()+"-ear", false);
createTestProject(model,project,selectedRuntime);
//
********************************************************************************************
@@ -312,6 +314,8 @@
// WtpUtils.createSourceFolder(project, new Path("src/test"),new
Path("src"));
// WtpUtils.createSourceFolder(project, new Path("src/action"),new
Path("src"));
// WtpUtils.createSourceFolder(project, new Path("src/model"),new
Path("src"));
+
+
// Copy sources to src
AntCopyUtils.copyFileToFile(
@@ -567,14 +571,16 @@
File testLibDir = new File(testProjectDir,"lib");
File embededEjbDir = new File(testProjectDir,"embedded-ejb");
File testSrcDir = new File(testProjectDir,"test-src");
+ String seamGenResFolder = seamRuntime.getHomeDir()+"/seam-gen/resources";
+ File persistenceFile = new File(seamGenResFolder ,"META-INF/persistence-" +
(isWarConfiguration(model)?TEST_WAR_PROFILE:TEST_EAR_PROFILE) + ".xml");
+ File jbossBeansFile = new File(seamGenResFolder
,"META-INF/jboss-beans.xml");
FilterSet filterSet = new FilterSet();
filterSet.addFilter("projectName", projectName);
filterSet.addFilter("runtimeName",
WtpUtils.getServerRuntimeName(seamWebProject));
-
+
final SeamRuntime selectedRuntime =
SeamRuntimeManager.getInstance().findRuntimeByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
final String seamHomePath = selectedRuntime.getHomeDir();
- final File seamGenResFolder = new File(selectedRuntime.getHomeDir());
AntCopyUtils.FileSet includeLibs
= new AntCopyUtils.FileSet(JBOSS_TEST_LIB_FILESET)
@@ -617,23 +623,32 @@
embededEjbDir,
new AntCopyUtils.FileSetFileFilter(excludeCvsSvn));
+ AntCopyUtils.copyFileToFile(
+ persistenceFile,
+ new File(testProjectDir,"test-src/META-INF/persistence.xml"),
+ new FilterSetCollection(filterSet), true);
+ AntCopyUtils.copyFileToFolder(
+ jbossBeansFile,
+ new File(testProjectDir,"test-src/META-INF"),
+ new FilterSetCollection(filterSet), true);
+
AntCopyUtils.copyFiles(
new File(seamRuntime.getHomeDir(),"lib"),
testLibDir,
new AntCopyUtils.FileSetFileFilter(includeLibs));
- createComponentsProperties(testSrcDir, seamWebProject.getName(), Boolean.TRUE);
-
+ createComponentsProperties(testSrcDir, "", Boolean.TRUE);
}
/**
* @param seamGenResFolder
*/
- private void createComponentsProperties(final File seamGenResFolder, String
seamWebProjectName, Boolean embedded) {
+ private void createComponentsProperties(final File seamGenResFolder, String projectName,
Boolean embedded) {
Properties components = new Properties();
+ String prefix =
"".equals(projectName)?"":projectName+"/";
components.put("embeddedEjb", embedded.toString());
- components.put("jndiPattern", "/#{ejbName}/local");
+ components.put("jndiPattern", prefix+"#{ejbName}/local");
File componentsProps = new File(seamGenResFolder,"components.properties");
try {
componentsProps.createNewFile();
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java 2007-09-21
20:45:09 UTC (rev 3764)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java 2007-09-22
01:17:08 UTC (rev 3765)
@@ -47,7 +47,7 @@
*/
public void execute(final IProject project, IProjectFacetVersion fv,
Object config, IProgressMonitor monitor) throws CoreException {
- IEclipsePreferences prefs = SeamCorePlugin.getSeamFacetPreferences(project);
+ IEclipsePreferences prefs = SeamCorePlugin.getSeamPreferences(project);
final IDataModel model = (IDataModel)config;
prefs.put(JBOSS_AS_DEPLOY_AS, model.getProperty(JBOSS_AS_DEPLOY_AS).toString());