Author: max.andersen(a)jboss.com
Date: 2007-10-21 06:03:00 -0400 (Sun, 21 Oct 2007)
New Revision: 4398
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/templates/test-seam2/
trunk/seam/plugins/org.jboss.tools.seam.core/templates/test-seam2/.classpath
trunk/seam/plugins/org.jboss.tools.seam.core/templates/test-seam2/.project
trunk/seam/plugins/org.jboss.tools.seam.core/templates/test-seam2/.settings/
trunk/seam/plugins/org.jboss.tools.seam.core/templates/test-seam2/.settings/org.jboss.tools.seam.core.prefs
trunk/seam/plugins/org.jboss.tools.seam.core/templates/test-seam2/bootstrap/
trunk/seam/plugins/org.jboss.tools.seam.core/templates/test-seam2/lib/
trunk/seam/plugins/org.jboss.tools.seam.core/templates/test-seam2/test-src/
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
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/Seam2FacetInstallDelegateTest.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-1107 Seam 2 support
better test project, but still no greenlight
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2007-10-21
06:34:40 UTC (rev 4397)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2007-10-21
10:03:00 UTC (rev 4398)
@@ -97,15 +97,16 @@
.include("jboss-el.jar"); //$NON-NLS-1$
public static AntCopyUtils.FileSet JBOSS_TEST_LIB_FILESET = new AntCopyUtils.FileSet()
- .include("testng-.*-jdk15\\.jar") //$NON-NLS-1$
+ .include("testng\\.jar") //$NON-NLS-1$
+ .include("test/jboss-deployers.jar") //$NON-NLS-1$
+ .include("test/jboss-embedded-all.jar") //$NON-NLS-1$
.include("myfaces-api-.*\\.jar") //$NON-NLS-1$
.include("myfaces-impl-.*\\.jar") //$NON-NLS-1$
.include("servlet-api\\.jar") //$NON-NLS-1$
- .include("hibernate-all\\.jar") //$NON-NLS-1$
- .include("jboss-ejb3-all\\.jar") //$NON-NLS-1$
- .include("thirdparty-all\\.jar") //$NON-NLS-1$
- .include("el-api\\.jar") //$NON-NLS-1$
- .include("el-ri\\.jar") //$NON-NLS-1$
+ .include("test/hibernate-all\\.jar") //$NON-NLS-1$
+ .include("test/thirdparty-all\\.jar") //$NON-NLS-1$
+ //.include("el-api\\.jar") //$NON-NLS-1$
+ //.include("el-ri\\.jar") //$NON-NLS-1$
.exclude(".*/CVS") //$NON-NLS-1$
.exclude(".*/\\.svn"); //$NON-NLS-1$
@@ -136,8 +137,8 @@
.include("security\\.drl"); //$NON-NLS-1$
public static AntCopyUtils.FileSet JBOSS_EAR_CONTENT_META_INF = new
AntCopyUtils.FileSet()
- .include("META-INF/application\\.xml") //$NON-NLS-1$
- .include("META-INF/jboss-app\\.xml"); //$NON-NLS-1$
+ .include("META-INF/application\\.xml"); //$NON-NLS-1$
+ //.include("META-INF/jboss-app\\.xml"); //$NON-NLS-1$
public static AntCopyUtils.FileSet VIEW_FILESET = new AntCopyUtils.FileSet()
.include("home\\.xhtml") //$NON-NLS-1$
@@ -180,10 +181,7 @@
.include("import\\.sql") //$NON-NLS-1$
.include("seam\\.properties")
.exclude(".*/WEB-INF"); //$NON-NLS-1$
-
- public static AntCopyUtils.FileSet JBOSS_EAR_META_INF_SET = new AntCopyUtils.FileSet()
- .include("META-INF/jboss-app\\.xml"); //$NON-NLS-1$
-
+
public static String DROOLS_LIB_SEAM_RELATED_PATH = "lib"; //$NON-NLS-1$
public static String SEAM_LIB_RELATED_PATH = "lib"; //$NON-NLS-1$
@@ -581,24 +579,35 @@
File testSrcDir = new File(testProjectDir,"test-src"); //$NON-NLS-1$
String seamGenResFolder = seamRuntime.getResourceTemplatesDir();
File persistenceFile = new File(seamGenResFolder ,"META-INF/persistence-" +
(isWarConfiguration(model)?TEST_WAR_PROFILE:TEST_EAR_PROFILE) + ".xml");
//$NON-NLS-1$ //$NON-NLS-2$
- File jbossBeansFile = new File(seamGenResFolder
,"META-INF/jboss-beans.xml"); //$NON-NLS-1$
+ //File jbossBeansFile = new File(seamGenResFolder
,"META-INF/jboss-beans.xml"); //$NON-NLS-1$
FilterSet filterSet = new FilterSet();
filterSet.addFilter("projectName", projectName); //$NON-NLS-1$
filterSet.addFilter("runtimeName",
WtpUtils.getServerRuntimeName(seamWebProject)); //$NON-NLS-1$
filterSet.addFilter("webRootFolder",webRootVirtFolder.getUnderlyingFolder().getLocation().lastSegment());
//$NON-NLS-1$
-
+ // TODO: why are these filters not shared!?
+ filterSet.addConfiguredFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
+
final SeamRuntime selectedRuntime =
SeamRuntimeManager.getInstance().findRuntimeByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
final String seamHomePath = selectedRuntime.getHomeDir();
AntCopyUtils.FileSet includeLibs
= new AntCopyUtils.FileSet(JBOSS_TEST_LIB_FILESET)
.dir(new File(seamRuntime.getHomeDir(),"lib")); //$NON-NLS-1$
- File[] libs = includeLibs.getDir().listFiles(new
AntCopyUtils.FileSetFileFilter(includeLibs));
+ AntCopyUtils.FileSet secondSetincludeLibs
+ = new AntCopyUtils.FileSet(JBOSS_TEST_LIB_FILESET)
+ .dir(new File(seamRuntime.getHomeDir(),"lib/test")); //$NON-NLS-1$
+
+ File[] firstlibs = includeLibs.getDir().listFiles(new
AntCopyUtils.FileSetFileFilter(includeLibs));
+ File[] secondLibs = secondSetincludeLibs.getDir().listFiles(new
AntCopyUtils.FileSetFileFilter(secondSetincludeLibs));
+
StringBuffer testLibraries = new StringBuffer();
- for (File file : libs) {
+ for (File file : firstlibs) {
testLibraries.append("\t<classpathentry kind=\"lib\"
path=\"lib/" + file.getName() + "\"/>\n"); //$NON-NLS-1$
//$NON-NLS-2$
}
+ for (File file : secondLibs) {
+ testLibraries.append("\t<classpathentry kind=\"lib\"
path=\"lib/" + file.getName() + "\"/>\n"); //$NON-NLS-1$
//$NON-NLS-2$
+ }
StringBuffer requiredProjects = new StringBuffer();
requiredProjects.append(
@@ -611,7 +620,7 @@
filterSet.addFilter("requiredProjects",requiredProjects.toString());
//$NON-NLS-1$
File testTemplateDir = null;
try {
- testTemplateDir = new
File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"test");
//$NON-NLS-1$
+ testTemplateDir = new
File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"test-seam2");
//$NON-NLS-1$
} catch (IOException e) {
SeamCorePlugin.getPluginLog().logError(e);
return;
@@ -636,27 +645,32 @@
new File(testProjectDir,"test-src/META-INF/persistence.xml"),
//$NON-NLS-1$
new FilterSetCollection(filterSet), true);
- AntCopyUtils.copyFileToFolder(
+ /*AntCopyUtils.copyFileToFolder(
jbossBeansFile,
new File(testProjectDir,"test-src/META-INF"), //$NON-NLS-1$
- new FilterSetCollection(filterSet), true);
+ new FilterSetCollection(filterSet), true);*/
AntCopyUtils.copyFiles(
new File(seamRuntime.getHomeDir(),"lib"), //$NON-NLS-1$
testLibDir,
new AntCopyUtils.FileSetFileFilter(includeLibs));
+ //seam2 has a lib/test
+ AntCopyUtils.copyFiles(
+ new File(seamRuntime.getHomeDir(),"lib/test"), //$NON-NLS-1$
+ testLibDir,
+ new AntCopyUtils.FileSetFileFilter(includeLibs));
- createComponentsProperties(testSrcDir, "", Boolean.TRUE); //$NON-NLS-1$
+ createComponentsProperties(testSrcDir, "", true); //$NON-NLS-1$
}
/**
* @param seamGenResFolder
*/
- private void createComponentsProperties(final File seamGenResFolder, String projectName,
Boolean embedded) {
+ private void createComponentsProperties(final File seamGenResFolder, String projectName,
boolean embedded) {
Properties components = new Properties();
String prefix =
"".equals(projectName)?"":projectName+"/"; //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
- components.put("embeddedEjb", embedded.toString()); //$NON-NLS-1$
- components.put("jndiPattern", prefix+"#{ejbName}/local");
//$NON-NLS-1$ //$NON-NLS-2$
+ components.setProperty("embeddedEjb", ""+embedded); //$NON-NLS-1$
+ components.setProperty("jndiPattern", prefix+"#{ejbName}/local");
//$NON-NLS-1$ //$NON-NLS-2$
File componentsProps = new File(seamGenResFolder,"components.properties");
//$NON-NLS-1$
try {
componentsProps.createNewFile();
Added: trunk/seam/plugins/org.jboss.tools.seam.core/templates/test-seam2/.classpath
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/test-seam2/.classpath
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/templates/test-seam2/.classpath 2007-10-21
10:03:00 UTC (rev 4398)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="test-src"/>
+ <classpathentry kind="lib" path="bootstrap"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+@testLibraries@<classpathentry kind="lib"
path="/@projectName@/@webRootFolder@"/>
+@requiredProjects@
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/seam/plugins/org.jboss.tools.seam.core/templates/test-seam2/.project
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/test-seam2/.project
(rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/test-seam2/.project 2007-10-21
10:03:00 UTC (rev 4398)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>@projectName@-test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.ide.eclipse.archives.core.archivesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.tools.seam.core.seambuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.jboss.ide.eclipse.archives.core.archivesNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.jboss.tools.seam.core.seamnature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/templates/test-seam2/.settings/org.jboss.tools.seam.core.prefs
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/templates/test-seam2/.settings/org.jboss.tools.seam.core.prefs
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/templates/test-seam2/.settings/org.jboss.tools.seam.core.prefs 2007-10-21
10:03:00 UTC (rev 4398)
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+seam.parent.project=@projectName@
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 2007-10-21
06:34:40 UTC (rev 4397)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java 2007-10-21
10:03:00 UTC (rev 4398)
@@ -79,8 +79,10 @@
Exception last = null;
for (IResource r : this.resourcesToCleanup) {
try {
+ System.out.println("Deleting " + r);
r.delete(true, null);
} catch(Exception e) {
+ System.out.println("Error deleting " + r);
e.printStackTrace();
last = e;
}
@@ -154,10 +156,10 @@
assertNotNull(proj);
assertTrue(proj.exists());
- /*assertTrue(proj.getWorkspace().getRoot().getProject(proj.getName() +
"-test").exists());
+ assertTrue(proj.getWorkspace().getRoot().getProject(proj.getName() +
"-test").exists());
IProject testProject = proj.getWorkspace().getRoot().getProject(proj.getName() +
"-test");
- this.resourcesToCleanup.add(testProject);*/
- this.resourcesToCleanup.add(proj);
+ this.addResourceToCleanup(testProject);
+ this.addResourceToCleanup(proj);
return fproj;
}
@@ -168,17 +170,17 @@
final IProject proj = fproj.getProject();
assertNotNull(proj);
- //IProject testProject = proj.getWorkspace().getRoot().getProject(proj.getName() +
"-test");
+ IProject testProject = proj.getWorkspace().getRoot().getProject(proj.getName() +
"-test");
IProject ejbProject = proj.getWorkspace().getRoot().getProject(proj.getName() +
"-ejb");
IProject earProject = proj.getWorkspace().getRoot().getProject(proj.getName() +
"-ear");
this.resourcesToCleanup.add(proj);
- //this.resourcesToCleanup.add(testProject);
+ this.resourcesToCleanup.add(testProject);
this.resourcesToCleanup.add(ejbProject);
this.resourcesToCleanup.add(earProject);
assertTrue(proj.exists());
- //assertTrue(testProject.exists());
+ assertTrue(testProject.exists());
assertTrue(ejbProject.exists());
assertTrue(earProject.exists());
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/Seam2FacetInstallDelegateTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/Seam2FacetInstallDelegateTest.java 2007-10-21
06:34:40 UTC (rev 4397)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/Seam2FacetInstallDelegateTest.java 2007-10-21
10:03:00 UTC (rev 4398)
@@ -110,8 +110,26 @@
assertNotNull(testProject.findMember("bootstrap"));
assertNotNull(testProject.findMember("bootstrap/data"));
+ assertNull("embedded-ejb should not be installed for seam2",
testProject.findMember("embedded-ejb"));
+
}
+ public void testTestLibs() throws CoreException, IOException {
+
+ SeamProjectsSet warPs = new SeamProjectsSet(warProject.getProject());
+
+ IProject testProject = warPs.getTestProject();
+ assertTrue(testProject.exists());
+
+ assertNotNull(testProject.findMember("lib/testng.jar"));
+ assertNotNull(testProject.findMember("lib/hibernate-all.jar"));
+ assertNotNull(testProject.findMember("lib/jboss-deployers.jar"));
+ assertNotNull(testProject.findMember("lib/jboss-embedded-all.jar"));
+ assertNotNull(testProject.findMember("lib/thirdparty-all.jar"));
+
+
+
+ }
public void testJbpmPresent() throws CoreException, IOException {
SeamProjectsSet earPs = new SeamProjectsSet(earProject.getProject());