Author: akazakov
Date: 2009-11-24 16:14:41 -0500 (Tue, 24 Nov 2009)
New Revision: 18814
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/SeamFacetInstallDelegate.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/Seam2FacetInstallDelegateTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5257
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 2009-11-24
20:04:59 UTC (rev 18813)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2009-11-24
21:14:41 UTC (rev 18814)
@@ -76,7 +76,9 @@
.include("mvel.*\\.jar") //$NON-NLS-1$
.include("jboss-el.jar") //$NON-NLS-1$
.include("jxl\\.jar") //$NON-NLS-1$
- .include("itext.*\\.jar"); //$NON-NLS-1$
+ .include("itext.*\\.jar") //$NON-NLS-1$
+ .include("jfreechart.*\\.jar") //$NON-NLS-1$
+ .include("jcommon.*\\.jar"); //$NON-NLS-1$
public static final AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_EAR_CONFIG = new
AntCopyUtils.FileSet()
.include("richfaces-impl\\.jar") //$NON-NLS-1$
@@ -91,6 +93,8 @@
.include("jboss-seam-excel\\.jar") //$NON-NLS-1$
.include("jxl\\.jar") //$NON-NLS-1$
.include("itext.*\\.jar") //$NON-NLS-1$
+ .include("jfreechart.*\\.jar") //$NON-NLS-1$
+ .include("jcommon.*\\.jar") //$NON-NLS-1$
.include("jsf-facelets\\.jar"); //$NON-NLS-1$
public static String DROOLS_LIB_SEAM_RELATED_PATH = "lib"; //$NON-NLS-1$
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2009-11-24
20:04:59 UTC (rev 18813)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2009-11-24
21:14:41 UTC (rev 18814)
@@ -87,9 +87,10 @@
.include("stringtemplate.*\\.jar") //$NON-NLS-1$
// el-ri needed for JBIDE-939
.include("el-ri.*\\.jar") //$NON-NLS-1$
- .include("itext.*\\.jar"); //$NON-NLS-1$
+ .include("itext.*\\.jar") //$NON-NLS-1$
+ .include("jfreechart.*\\.jar") //$NON-NLS-1$
+ .include("jcommon.*\\.jar"); //$NON-NLS-1$
-
public static final AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_EAR_CONFIG = new
AntCopyUtils.FileSet()
.include("ajax4jsf.*\\.jar") //$NON-NLS-1$
.include("richfaces.*\\.jar") //$NON-NLS-1$
@@ -104,9 +105,10 @@
.include("jboss-seam-ui\\.jar") //$NON-NLS-1$
.include("jsf-facelets\\.jar") //$NON-NLS-1$
.include("oscache.*\\.jar") //$NON-NLS-1$
- .include("itext.*\\.jar"); //$NON-NLS-1$
+ .include("itext.*\\.jar") //$NON-NLS-1$
+ .include("jfreechart.*\\.jar") //$NON-NLS-1$
+ .include("jcommon.*\\.jar"); //$NON-NLS-1$
-
private static final String ORG_AJAX4JSF_FILTER_NAME = "ajax4jsf";
private static final String ORG_AJAX4JSF_FILTER_CLASS =
"org.ajax4jsf.Filter";
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 2009-11-24
20:04:59 UTC (rev 18813)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/Seam2FacetInstallDelegateTest.java 2009-11-24
21:14:41 UTC (rev 18814)
@@ -43,12 +43,12 @@
protected static final String SEAM_2_0_0 = "Seam 2.0.0";
IFacetedProject warProject;
IFacetedProject earProject;
-
+
private IProjectFacet seam2Facet;
private IProjectFacetVersion seam2FacetVersion;
private boolean suspendAllValidation;
private boolean suspendXJobs;
-
+
public Seam2FacetInstallDelegateTest(String name) {
super(name);
}
@@ -57,45 +57,55 @@
protected void setUp() throws Exception {
suspendAllValidation = ValidationFramework.getDefault().isSuspended();
ValidationFramework.getDefault().suspendAllValidation(true);
-
- ResourcesPlugin.getWorkspace().removeResourceChangeListener( EventManager.getManager()
);
-// commented to run tests on wtp 3.0.4 build
-// ws.removeResourceChangeListener( ValManager.getDefault() );
- //EventManager.getManager().shutdown();
-
+
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(
+ EventManager.getManager());
+ // commented to run tests on wtp 3.0.4 build
+ // ws.removeResourceChangeListener( ValManager.getDefault() );
+ // EventManager.getManager().shutdown();
+
suspendXJobs = XJob.isSuspended();
XJob.setSuspended(true);
assertSeamHomeAvailable();
-
+
seam2Facet = ProjectFacetsManager.getProjectFacet("jst.seam");
seam2FacetVersion = seam2Facet.getVersion("2.0");
-
+
File folder = getSeamHomeFolder();
-
- SeamRuntimeManager.getInstance().addRuntime(SEAM_2_0_0, folder.getAbsolutePath(),
SeamVersion.SEAM_2_0, true);
+
+ SeamRuntimeManager.getInstance().addRuntime(SEAM_2_0_0,
+ folder.getAbsolutePath(), SeamVersion.SEAM_2_0, true);
SeamRuntimeManager.getInstance().findRuntimeByName(SEAM_2_0_0);
- IProject war =
(IProject)ResourcesPlugin.getWorkspace().getRoot().findMember("warprj");
- warProject = (war!=null ? ProjectFacetsManager.create(war, false,
- null): createSeamWarProject("warprj"));
- IProject ear =
(IProject)ResourcesPlugin.getWorkspace().getRoot().findMember("earprj");
- earProject = (ear!=null? ProjectFacetsManager.create(ear, false,
- null):createSeamEarProject("earprj"));
-
- //warProject.getProject().getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE,
null);
+ IProject war = (IProject) ResourcesPlugin.getWorkspace().getRoot()
+ .findMember("warprj");
+ warProject = (war != null ? ProjectFacetsManager.create(war, false,
+ null) : createSeamWarProject("warprj"));
+ IProject ear = (IProject) ResourcesPlugin.getWorkspace().getRoot()
+ .findMember("earprj");
+ earProject = (ear != null ? ProjectFacetsManager.create(ear, false,
+ null) : createSeamEarProject("earprj"));
+
+ //
warProject.getProject().getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE,
+ // null);
}
-
+
@Override
protected void tearDown() throws Exception {
super.tearDown();
- ValidationFramework.getDefault().suspendAllValidation(suspendAllValidation);
+ ValidationFramework.getDefault().suspendAllValidation(
+ suspendAllValidation);
XJob.setSuspended(suspendXJobs);
-
- ResourcesPlugin.getWorkspace().addResourceChangeListener(EventManager.getManager(),
- IResourceChangeEvent.PRE_CLOSE | IResourceChangeEvent.PRE_DELETE |
- IResourceChangeEvent.POST_BUILD | IResourceChangeEvent.PRE_BUILD |
IResourceChangeEvent.POST_CHANGE);
-// ws.addResourceChangeListener(ValOperationManager.getDefault(),
-// IResourceChangeEvent.POST_BUILD | IResourceChangeEvent.PRE_BUILD);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(
+ EventManager.getManager(),
+ IResourceChangeEvent.PRE_CLOSE
+ | IResourceChangeEvent.PRE_DELETE
+ | IResourceChangeEvent.POST_BUILD
+ | IResourceChangeEvent.PRE_BUILD
+ | IResourceChangeEvent.POST_CHANGE);
+ // ws.addResourceChangeListener(ValOperationManager.getDefault(),
+ // IResourceChangeEvent.POST_BUILD | IResourceChangeEvent.PRE_BUILD);
+
}
public static final String SEAM_201GA_HOME_PROPERY =
"jbosstools.test.seam.2.0.1.GA.home";
@@ -103,22 +113,21 @@
protected String getSystemPropertyName() {
return SEAM_201GA_HOME_PROPERY;
}
-
+
@Override
protected IDataModel createSeamDataModel(String deployType) {
-
+
IDataModel dataModel = super.createSeamDataModel(deployType);
- dataModel.setStringProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
SEAM_2_0_0);
-
+ dataModel.setStringProperty(
+ ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME, SEAM_2_0_0);
+
return dataModel;
}
-
-
+
public void testWarLibs() throws CoreException {
-
+
Set<String> seamgenlibs = new HashSet<String>();
-
seamgenlibs.add("antlr-runtime.jar");
seamgenlibs.add("commons-beanutils.jar");
seamgenlibs.add("commons-digester.jar");
@@ -140,52 +149,57 @@
seamgenlibs.add("richfaces-impl.jar");
seamgenlibs.add("richfaces-ui.jar");
seamgenlibs.add("itext.jar");
+ seamgenlibs.add("jfreechart.jar");
+ seamgenlibs.add("jcommon.jar");
- final IContainer warLibs = (IContainer)
warProject.getProject().findMember("WebContent/WEB-INF/lib").getAdapter(IContainer.class);
+ final IContainer warLibs = (IContainer) warProject.getProject()
+ .findMember("WebContent/WEB-INF/lib").getAdapter(
+ IContainer.class);
assertOnlyContainsTheseFiles(seamgenlibs, warLibs);
}
public void testMvelWarJars() {
- final IContainer warLibs = (IContainer)
warProject.getProject().findMember("WebContent/WEB-INF/lib").getAdapter(IContainer.class);
+ final IContainer warLibs = (IContainer) warProject.getProject()
+ .findMember("WebContent/WEB-INF/lib").getAdapter(
+ IContainer.class);
try {
for (IResource resource : warLibs.members()) {
- if(resource.getName().matches("mvel.*\\.jar") ) {
- return;
- }
+ if (resource.getName().matches("mvel.*\\.jar")) {
+ return;
+ }
}
fail("mvel*.jar weren't found in seam 2.0. WAR project");
} catch (CoreException e) {
fail("Error occured during search mvel libraries in lib folder");
}
-
}
public void testEarLibs() throws CoreException {
-
IProject war = earProject.getProject();
-
- SeamProjectsSet seamProjectsSet = new SeamProjectsSet(earProject.getProject());
-
+
+ SeamProjectsSet seamProjectsSet = new SeamProjectsSet(earProject
+ .getProject());
+
IProject ear = seamProjectsSet.getEarProject();
-
+
Set<String> onlyInWar = new HashSet<String>();
Set<String> onlyInEar = new HashSet<String>();
Set<String> onlyInEarSeam = new HashSet<String>();
- Set<String> onlyInEjbSrc = new HashSet<String>();
+ Set<String> onlyInEjbSrc = new HashSet<String>();
onlyInEarSeam.add("jboss-seam.jar");
onlyInEarSeam.add("lib");
onlyInEarSeam.add("META-INF");
-
+
onlyInEar.add("commons-beanutils.jar");
onlyInEar.add("antlr-runtime.jar");
onlyInEar.add("drools-compiler.jar");
onlyInEar.add("drools-core.jar");
onlyInEar.add("jboss-el.jar");
onlyInEar.add("mvel14.jar");
- onlyInEar.add("richfaces-api.jar");
+ onlyInEar.add("richfaces-api.jar");
onlyInEar.add("jbpm-jpdl.jar");
-
+
onlyInWar.add("commons-digester.jar");
onlyInWar.add("jboss-seam-debug.jar");
onlyInWar.add("jboss-seam-ioc.jar");
@@ -197,50 +211,63 @@
onlyInWar.add("richfaces-impl.jar");
onlyInWar.add("richfaces-ui.jar");
onlyInWar.add("itext.jar");
-
- final IContainer earLibsSeam = (IContainer) ear.findMember(new
Path("EarContent")).getAdapter(IContainer.class);
-
+ onlyInWar.add("jfreechart.jar");
+ onlyInWar.add("jcommon.jar");
+
+ final IContainer earLibsSeam = (IContainer) ear.findMember(
+ new Path("EarContent")).getAdapter(IContainer.class);
+
assertOnlyContainsTheseFiles(onlyInEarSeam, earLibsSeam);
-
- final IContainer earLibs = (IContainer) ear.findMember(new
Path("EarContent").append("lib")).getAdapter(IContainer.class);
-
+
+ final IContainer earLibs = (IContainer) ear.findMember(
+ new Path("EarContent").append("lib")).getAdapter(
+ IContainer.class);
+
assertOnlyContainsTheseFiles(onlyInEar, earLibs);
-
- final IContainer earMeta = (IContainer)
ear.findMember("EarContent/META-INF").getAdapter(IContainer.class);
-
+
+ final IContainer earMeta = (IContainer) ear.findMember(
+ "EarContent/META-INF").getAdapter(IContainer.class);
+
Set onlyInEarMeta = new HashSet();
-
+
onlyInEarMeta.add("jboss-app.xml");
onlyInEarMeta.add("application.xml");
-
+
assertOnlyContainsTheseFiles(onlyInEarMeta, earMeta);
-
- assertOnlyContainsTheseFiles(onlyInWar,
(IContainer)war.findMember("WebContent/WEB-INF/lib").getAdapter(IContainer.class));
+ assertOnlyContainsTheseFiles(onlyInWar, (IContainer) war.findMember(
+ "WebContent/WEB-INF/lib").getAdapter(IContainer.class));
+
IProject ejb = seamProjectsSet.getEjbProject();
onlyInEjbSrc.add("security.drl");
onlyInEjbSrc.add("seam.properties");
onlyInEjbSrc.add("import.sql");
onlyInEjbSrc.add("components.properties");
- onlyInEjbSrc.add("META-INF"); // JBIDE-2431: META-INF dir is always
created by Seam 2.0 seamgen
- onlyInEjbSrc.add("org"); // JBIDE-2431: org dir is always created by Seam
2.0 seamgen
-
- assertOnlyContainsTheseFiles(onlyInEjbSrc,
(IContainer)ejb.findMember("ejbModule").getAdapter(IContainer.class));
+ onlyInEjbSrc.add("META-INF"); // JBIDE-2431: META-INF dir is always
+ // created by Seam 2.0 seamgen
+ onlyInEjbSrc.add("org"); // JBIDE-2431: org dir is always created by
+ // Seam 2.0 seamgen
+
+ assertOnlyContainsTheseFiles(onlyInEjbSrc, (IContainer) ejb.findMember(
+ "ejbModule").getAdapter(IContainer.class));
}
public void testMvelEarJars() {
IProject war = earProject.getProject();
-
- SeamProjectsSet seamProjectsSet = new SeamProjectsSet(earProject.getProject());
-
+
+ SeamProjectsSet seamProjectsSet = new SeamProjectsSet(earProject
+ .getProject());
+
IProject ear = seamProjectsSet.getEarProject();
- final IContainer earLibs = (IContainer) ear.findMember(new
Path("EarContent").append("lib")).getAdapter(IContainer.class);
- try {
+ final IContainer earLibs = (IContainer) ear.findMember(
+ new Path("EarContent").append("lib")).getAdapter(
+ IContainer.class);
+ try {
for (IResource resource : earLibs.members()) {
- if(resource.getName().matches("mvel.*\\.jar") ) {
- return;
- }
+ if (resource.getName().matches("mvel.*\\.jar")) {
+ return;
+ }
}
fail("mvel*.jar weren't found in seam 2.0. EAR project");
} catch (CoreException e) {
@@ -249,118 +276,121 @@
}
/**
- * Fails if set of fileNames is not found in dir or some other filename is found in
dir.
- * @param fileNames set of strings
- * @param dir directory to scan
- * @throws CoreException
+ * Fails if set of fileNames is not found in dir or some other filename is
+ * found in dir.
+ *
+ * @param fileNames
+ * set of strings
+ * @param dir
+ * directory to scan
+ * @throws CoreException
*/
protected void assertOnlyContainsTheseFiles(Set<String> fileNames,
final IResource dir) throws CoreException {
-
+
final Set<String> foundFiles = new HashSet<String>();
dir.accept(new IResourceProxyVisitor() {
-
+
public boolean visit(IResourceProxy proxy) throws CoreException {
- if(dir.getName().equals(proxy.getName())) return true;
- foundFiles.add(proxy.getName());
+ if (dir.getName().equals(proxy.getName()))
+ return true;
+ foundFiles.add(proxy.getName());
return false;
}
-
+
}, IResource.DEPTH_ZERO);
-
- if(!foundFiles.containsAll(fileNames)) {
+
+ if (!foundFiles.containsAll(fileNames)) {
fileNames.removeAll(foundFiles);
fail("Did not find " + fileNames + " in " + dir);
}
-
+
foundFiles.removeAll(fileNames);
-
- assertTrue("Found additional files (" + foundFiles + " in " + dir +
" at " + dir.getLocation(), foundFiles.isEmpty());
+
+ assertTrue("Found additional files (" + foundFiles + " in " + dir
+ + " at " + dir.getLocation(), foundFiles.isEmpty());
}
public void testBootstrapDirPresent() throws CoreException, IOException {
-
SeamProjectsSet warPs = new SeamProjectsSet(warProject.getProject());
-
+
IProject testProject = warPs.getTestProject();
assertTrue(testProject.exists());
-
+
assertNotNull(testProject.findMember("bootstrap"));
- //assertNotNull(testProject.findMember("bootstrap/data"));
-
- assertNull("embedded-ejb should not be installed for seam2",
testProject.findMember("embedded-ejb"));
-
+ // 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());
-
+
Set<String> libs = new HashSet<String>();
libs.add("testng.jar");
libs.add("hibernate-all.jar");
-// libs.add("jboss-deployers.jar"); // JBIDE-2431: There is no such jar
created by Seam 2.0 seamgen
+ // libs.add("jboss-deployers.jar"); // JBIDE-2431: There is no such jar
+ // created by Seam 2.0 seamgen
libs.add("jboss-embedded-all.jar");
libs.add("thirdparty-all.jar");
libs.add("jboss-embedded-api.jar");
- libs.add("core.jar");
-
+ libs.add("core.jar");
+
assertOnlyContainsTheseFiles(libs, testProject.findMember("lib"));
-
- // JBIDE-2431: The following block is commented because it duplicates the call to
assertOnlyContainsTheseFiles()
-/*
- assertNotNull(testProject.findMember("lib/testng.jar"));
- assertNotNull(testProject.findMember("lib/hibernate-all.jar"));
-// assertNotNull(testProject.findMember("lib/jboss-deployers.jar")); //
JBIDE-2431: There is no such jar created by Seam 2.0 seamgen
- assertNotNull(testProject.findMember("lib/jboss-embedded-all.jar"));
- assertNotNull(testProject.findMember("lib/thirdparty-all.jar"));
- assertNotNull(testProject.findMember("lib/core.jar")); // JBIDE-2431:
lib/core.jar file is always created by Seam 2.0 seamgen
-*/
+
+ // JBIDE-2431: The following block is commented because it duplicates
+ // the call to assertOnlyContainsTheseFiles()
+ /*
+ * assertNotNull(testProject.findMember("lib/testng.jar"));
+ * assertNotNull(testProject.findMember("lib/hibernate-all.jar")); //
+ * assertNotNull(testProject.findMember("lib/jboss-deployers.jar")); //
+ * JBIDE-2431: There is no such jar created by Seam 2.0 seamgen
+ * assertNotNull(testProject.findMember("lib/jboss-embedded-all.jar"));
+ * assertNotNull(testProject.findMember("lib/thirdparty-all.jar"));
+ * assertNotNull(testProject.findMember("lib/core.jar")); // JBIDE-2431:
+ * lib/core.jar file is always created by Seam 2.0 seamgen
+ */
}
-
+
public void testSeamProperties() {
- SeamProjectsSet warPs = new SeamProjectsSet(warProject.getProject());
-
+ SeamProjectsSet warPs = new SeamProjectsSet(warProject.getProject());
+
IProject warProject = warPs.getWarProject();
assertTrue(warProject.exists());
-
+
assertNotNull(warProject.findMember("src/main/seam.properties"));
IResource findMember = warProject.findMember("src/hot/seam.properties");
assertNotNull(findMember);
assertTrue(findMember instanceof IFile);
-
}
-
+
public void testJbpmPresent() throws CoreException, IOException {
-
SeamProjectsSet earPs = new SeamProjectsSet(earProject.getProject());
-
+
IProject project = earPs.getEarProject();
assertTrue(project.exists());
-
- assertNotNull(project.findMember("EarContent/lib/jbpm-jpdl.jar"));
-
+
+ assertNotNull(project.findMember("EarContent/lib/jbpm-jpdl.jar"));
}
public void testDroolsPresent() throws CoreException, IOException {
-
-
IProject earRoot = earProject.getProject();
SeamProjectsSet seamProjectsSet = new SeamProjectsSet(earRoot);
-
- // JBIDE-2431: security.drl is always created in <EJBProject>/ejbModule directory
by Seam 2.0 seamgen
+
+ // JBIDE-2431: security.drl is always created in <EJBProject>/ejbModule
+ // directory by Seam 2.0 seamgen
IProject ejbProject = seamProjectsSet.getEjbProject();
- assertNotNull(ejbProject.findMember("ejbModule/security.drl"));
-
+ assertNotNull(ejbProject.findMember("ejbModule/security.drl"));
}
-
+
public void testCreateEar() throws CoreException, IOException {
-
}
-
+
@Override
protected IProjectFacetVersion getSeamFacetVersion() {
return seam2FacetVersion;