[jboss-cvs] jboss-seam-tools/src/java/org/jboss/seam/tools/test ...
Thomas Heute
theute at jboss.com
Tue Aug 29 09:05:47 EDT 2006
User: theute
Date: 06/08/29 09:05:47
Modified: src/java/org/jboss/seam/tools/test SeamWTPTest.java
Added: src/java/org/jboss/seam/tools/test AbstractTestCase.java
Log:
re-formatted with headers
Revision Changes Path
1.2 +588 -80 jboss-seam-tools/src/java/org/jboss/seam/tools/test/SeamWTPTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SeamWTPTest.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam-tools/src/java/org/jboss/seam/tools/test/SeamWTPTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- SeamWTPTest.java 14 Aug 2006 15:57:47 -0000 1.1
+++ SeamWTPTest.java 29 Aug 2006 13:05:47 -0000 1.2
@@ -28,18 +28,162 @@
import org.jboss.seam.tools.context.Context;
import org.jboss.seam.tools.context.EarContext;
import org.jboss.seam.tools.context.EjbContext;
-//import org.jboss.seam.tools.context.SharedContext;
import org.jboss.seam.tools.context.WebContext;
import org.jboss.seam.tools.exporter.wtp.WTPEarProjectExporter;
import org.jboss.seam.tools.exporter.wtp.WTPEjbProjectExporter;
import org.jboss.seam.tools.exporter.wtp.WTPSeamExporter;
import org.jboss.seam.tools.exporter.wtp.WTPWebProjectExporter;
-import junit.framework.TestCase;
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version <tt>$Revision: 1.2 $</tt>
+ */
+public class SeamWTPTest extends AbstractTestCase
+{
-public class SeamWTPTest extends TestCase {
+ public void testExporterFaceletsBasicTest()
+ {
- public void testExporter()
+ Context context = new Context();
+ context.setProjectName("myProject");
+ context.setIsolationClassLoadingName("seam.jboss.org:loader=" + "seam-booking");
+ context.setSeamLocation("/home/theute/tmp/jboss-seam-1.0.1.GA");
+ context.setEclipseSupport(true);
+ context.setBasicProject(true);
+ context.setTestSupport(true);
+ context.setSrcPackage("org.jboss.seam");
+ context.setTestPackage("org.jboss.seam.test");
+ context.setFaceletsSupport(true);
+ context.setDebug(false);
+
+ EarContext earContext = new EarContext();
+ earContext.setProjectName("myProject-ear");
+ earContext.setDisplayName("myDisplayName");
+ earContext.setFilename("myProject.ear");
+ earContext.setContentDirectory("EarContent");
+ WTPEarProjectExporter wtpEarExporter = new WTPEarProjectExporter(context);
+ wtpEarExporter.setEarContext(earContext);
+
+ EjbContext ejbContext = new EjbContext();
+ ejbContext.setFilename("myProject-web.jar");
+ ejbContext.setProjectName("myProject-ejb");
+ ejbContext.setId("myEjbId");
+ ejbContext.setContentDirectory("myEjbModule");
+ ejbContext.setJtaDataSource("bookingDatasource");
+ ejbContext.setPersistenceUnitName("bookingDatabase");
+
+ WTPEjbProjectExporter wtpEjbExporter = new WTPEjbProjectExporter(context);
+ wtpEjbExporter.setEjbContext(ejbContext);
+ List ejbExporters = new ArrayList();
+ ejbExporters.add(wtpEjbExporter);
+
+ WebContext webContext = new WebContext();
+ webContext.setProjectName("myProject-web");
+ webContext.setFilename("myProject-web.war");
+ webContext.setContextRoot("myProject");
+ webContext.setId("myWebId");
+ webContext.setContentDirectory("myWebContent");
+ webContext.setJsfExtension("xhtml");
+ WTPWebProjectExporter wtpWebExporter = new WTPWebProjectExporter(context);
+ wtpWebExporter.setWebContext(webContext);
+ List webExporters = new ArrayList();
+ webExporters.add(wtpWebExporter);
+
+ WTPSeamExporter seamWTPExporter = new WTPSeamExporter(wtpEarExporter, ejbExporters, webExporters);
+
+ String outputDirectory = "testOutput";
+ File output = new File(outputDirectory);
+
+ seamWTPExporter.setOutputDirectory(output);
+ seamWTPExporter.start();
+
+ String earProjectDirectory = outputDirectory + "/" + earContext.getProjectName();
+ assertFileExists(earProjectDirectory);
+
+ assertFileExists(earProjectDirectory + "/.project");
+ assertFileExists(earProjectDirectory + "/.settings/org.eclipse.wst.common.component");
+ assertFileExists(earProjectDirectory + "/.settings/org.eclipse.wst.common.project.facet.core.xml");
+
+ String earContentDirectory = earProjectDirectory + "/" + earContext.getContentDirectory();
+ assertFileExists(earContentDirectory);
+
+ assertFileExists(earContentDirectory + "/jboss-seam.jar");
+ assertFileExists(earContentDirectory + "/META-INF/application.xml");
+ assertFileExists(earContentDirectory + "/META-INF/jboss-app.xml");
+
+ String webProjectDirectory = outputDirectory + "/" + webContext.getProjectName();
+ assertFileExists(webProjectDirectory);
+
+ assertFileExists(webProjectDirectory + "/.classpath");
+ assertFileExists(webProjectDirectory + "/.project");
+ assertFileExists(webProjectDirectory + "/.settings/org.eclipse.jdt.core.prefs");
+ assertFileExists(webProjectDirectory + "/.settings/org.eclipse.jst.common.project.facet.core.prefs");
+ assertFileExists(webProjectDirectory + "/.settings/org.eclipse.wst.common.component");
+ assertFileExists(webProjectDirectory + "/.settings/org.eclipse.wst.common.project.facet.core.xml");
+
+ assertFileExists(webProjectDirectory + "/src");
+
+ String webContentDirectory = webProjectDirectory + "/" + webContext.getContentDirectory();
+ assertFileExists(webContentDirectory);
+
+ String webinfDirectory = webContentDirectory + "/WEB-INF";
+ assertFileExists(webinfDirectory);
+
+ assertFileExists(webinfDirectory + "/web.xml");
+ assertFileExists(webinfDirectory + "/faces-config.xml");
+ assertFileExists(webinfDirectory + "/pages.xml");
+ assertFileExists(webinfDirectory + "/components.xml");
+
+ assertFileExists(webinfDirectory + "/lib/jsf-facelets.jar");
+ assertFileExists(webinfDirectory + "/lib/el-api.jar");
+ assertFileExists(webinfDirectory + "/lib/el-ri.jar");
+ assertFileExists(webinfDirectory + "/lib/jboss-seam-debug.jar");
+ assertFileExists(webinfDirectory + "/lib/jboss-seam-ui.jar");
+
+ assertFileExists(webContentDirectory + "/index.html");
+ assertFileExists(webContentDirectory + "/register.xhtml");
+ assertFileExists(webContentDirectory + "/registered.xhtml");
+
+ String ejbProjectDirectory = outputDirectory + "/" + ejbContext.getProjectName();
+ assertFileExists(ejbProjectDirectory);
+
+ assertFileExists(ejbProjectDirectory + "/.classpath");
+ assertFileExists(ejbProjectDirectory + "/.project");
+ assertFileExists(ejbProjectDirectory + "/.settings/org.eclipse.jdt.core.prefs");
+ assertFileExists(ejbProjectDirectory + "/.settings/org.eclipse.jst.common.project.facet.core.prefs");
+ assertFileExists(ejbProjectDirectory + "/.settings/org.eclipse.wst.common.component");
+ assertFileExists(ejbProjectDirectory + "/.settings/org.eclipse.wst.common.project.facet.core.xml");
+
+ String ejbContentDirectory = ejbProjectDirectory + "/" + ejbContext.getContentDirectory();
+ assertFileExists(ejbContentDirectory);
+
+ assertFileExists(ejbContentDirectory + "/" + context.getSrcPackage().replace('.', '/') + "/Register.java");
+ assertFileExists(ejbContentDirectory + "/" + context.getSrcPackage().replace('.', '/') + "/RegisterAction.java");
+ assertFileExists(ejbContentDirectory + "/" + context.getSrcPackage().replace('.', '/') + "/User.java");
+ assertFileExists(ejbContentDirectory + "/META-INF/ejb-jar.xml");
+ assertFileExists(ejbContentDirectory + "/META-INF/persistence.xml");
+ assertFileExists(ejbContentDirectory + "/seam.properties");
+
+ assertFileExists(ejbProjectDirectory + "/lib/jboss-ejb3-all.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/hibernate-all.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/myfaces-api-1.1.3.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/myfaces-impl-1.1.3.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/testng-4.5.1-jdk15.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/servlet-api.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/thirdparty-all.jar");
+
+ assertFileExists(ejbProjectDirectory + "/conftest/components.properties");
+ assertFileExists(ejbProjectDirectory + "/conftest/components.xml");
+ assertFileExists(ejbProjectDirectory + "/conftest/default.persistence.properties");
+ assertFileExists(ejbProjectDirectory + "/conftest/ejb3-interceptors-aop.xml");
+ assertFileExists(ejbProjectDirectory + "/conftest/embedded-jboss-beans.xml");
+ assertFileExists(ejbProjectDirectory + "/conftest/jboss-jms-beans.xml");
+ assertFileExists(ejbProjectDirectory + "/conftest/jndi.properties");
+ assertFileExists(ejbProjectDirectory + "/conftest/log4j.xml");
+
+ }
+
+ public void testExporterBasicTest()
{
Context context = new Context();
@@ -53,7 +197,6 @@
context.setTestPackage("org.jboss.seam.test");
context.setFaceletsSupport(false);
-
EarContext earContext = new EarContext();
earContext.setProjectName("myProject-ear");
earContext.setDisplayName("myDisplayName");
@@ -62,6 +205,145 @@
WTPEarProjectExporter wtpEarExporter = new WTPEarProjectExporter(context);
wtpEarExporter.setEarContext(earContext);
+ EjbContext ejbContext = new EjbContext();
+ ejbContext.setFilename("myProject-web.jar");
+ ejbContext.setProjectName("myProject-ejb");
+ ejbContext.setId("myEjbId");
+ ejbContext.setContentDirectory("myEjbModule");
+ ejbContext.setJtaDataSource("bookingDatasource");
+ ejbContext.setPersistenceUnitName("bookingDatabase");
+
+ WTPEjbProjectExporter wtpEjbExporter = new WTPEjbProjectExporter(context);
+ wtpEjbExporter.setEjbContext(ejbContext);
+ List ejbExporters = new ArrayList();
+ ejbExporters.add(wtpEjbExporter);
+
+ WebContext webContext = new WebContext();
+ webContext.setProjectName("myProject-web");
+ webContext.setFilename("myProject-web.war");
+ webContext.setContextRoot("myProject");
+ webContext.setId("myWebId");
+ webContext.setContentDirectory("myWebContent");
+ webContext.setJsfExtension("jsp");
+ WTPWebProjectExporter wtpWebExporter = new WTPWebProjectExporter(context);
+ wtpWebExporter.setWebContext(webContext);
+ List webExporters = new ArrayList();
+ webExporters.add(wtpWebExporter);
+
+ WTPSeamExporter seamWTPExporter = new WTPSeamExporter(wtpEarExporter, ejbExporters, webExporters);
+
+ String outputDirectory = "testOutput";
+ File output = new File(outputDirectory);
+
+ seamWTPExporter.setOutputDirectory(output);
+ seamWTPExporter.start();
+
+ String earProjectDirectory = outputDirectory + "/" + earContext.getProjectName();
+ assertFileExists(earProjectDirectory);
+
+ assertFileExists(earProjectDirectory + "/.project");
+ assertFileExists(earProjectDirectory + "/.settings/org.eclipse.wst.common.component");
+ assertFileExists(earProjectDirectory + "/.settings/org.eclipse.wst.common.project.facet.core.xml");
+
+ String earContentDirectory = earProjectDirectory + "/" + earContext.getContentDirectory();
+ assertFileExists(earContentDirectory);
+
+ assertFileExists(earContentDirectory + "/jboss-seam.jar");
+ assertFileExists(earContentDirectory + "/META-INF/application.xml");
+ assertFileExists(earContentDirectory + "/META-INF/jboss-app.xml");
+
+ String webProjectDirectory = outputDirectory + "/" + webContext.getProjectName();
+ assertFileExists(webProjectDirectory);
+
+ assertFileExists(webProjectDirectory + "/.classpath");
+ assertFileExists(webProjectDirectory + "/.project");
+ assertFileExists(webProjectDirectory + "/.settings/org.eclipse.jdt.core.prefs");
+ assertFileExists(webProjectDirectory + "/.settings/org.eclipse.jst.common.project.facet.core.prefs");
+ assertFileExists(webProjectDirectory + "/.settings/org.eclipse.wst.common.component");
+ assertFileExists(webProjectDirectory + "/.settings/org.eclipse.wst.common.project.facet.core.xml");
+
+ assertFileExists(webProjectDirectory + "/src");
+
+ String webContentDirectory = webProjectDirectory + "/" + webContext.getContentDirectory();
+ assertFileExists(webContentDirectory);
+
+ String webinfDirectory = webContentDirectory + "/WEB-INF";
+ assertFileExists(webinfDirectory);
+
+ assertFileExists(webinfDirectory + "/web.xml");
+ assertFileExists(webinfDirectory + "/faces-config.xml");
+ assertFileExists(webinfDirectory + "/pages.xml");
+ assertFileExists(webinfDirectory + "/components.xml");
+
+ assertFileDoesntExist(webinfDirectory + "/lib/jsf-facelets.jar");
+ assertFileDoesntExist(webinfDirectory + "/lib/el-api.jar");
+ assertFileDoesntExist(webinfDirectory + "/lib/el-ri.jar");
+ assertFileExists(webinfDirectory + "/lib/jboss-seam-debug.jar");
+ assertFileExists(webinfDirectory + "/lib/jboss-seam-ui.jar");
+
+ assertFileExists(webContentDirectory + "/index.jsp");
+ assertFileExists(webContentDirectory + "/register.jsp");
+ assertFileExists(webContentDirectory + "/registered.jsp");
+
+ String ejbProjectDirectory = outputDirectory + "/" + ejbContext.getProjectName();
+ assertFileExists(ejbProjectDirectory);
+
+ assertFileExists(ejbProjectDirectory + "/.classpath");
+ assertFileExists(ejbProjectDirectory + "/.project");
+ assertFileExists(ejbProjectDirectory + "/.settings/org.eclipse.jdt.core.prefs");
+ assertFileExists(ejbProjectDirectory + "/.settings/org.eclipse.jst.common.project.facet.core.prefs");
+ assertFileExists(ejbProjectDirectory + "/.settings/org.eclipse.wst.common.component");
+ assertFileExists(ejbProjectDirectory + "/.settings/org.eclipse.wst.common.project.facet.core.xml");
+
+ String ejbContentDirectory = ejbProjectDirectory + "/" + ejbContext.getContentDirectory();
+ assertFileExists(ejbContentDirectory);
+
+ assertFileExists(ejbContentDirectory + "/" + context.getSrcPackage().replace('.', '/') + "/Register.java");
+ assertFileExists(ejbContentDirectory + "/" + context.getSrcPackage().replace('.', '/') + "/RegisterAction.java");
+ assertFileExists(ejbContentDirectory + "/" + context.getSrcPackage().replace('.', '/') + "/User.java");
+ assertFileExists(ejbContentDirectory + "/META-INF/ejb-jar.xml");
+ assertFileExists(ejbContentDirectory + "/META-INF/persistence.xml");
+ assertFileExists(ejbContentDirectory + "/seam.properties");
+
+ assertFileExists(ejbProjectDirectory + "/lib/jboss-ejb3-all.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/hibernate-all.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/myfaces-api-1.1.3.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/myfaces-impl-1.1.3.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/testng-4.5.1-jdk15.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/servlet-api.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/thirdparty-all.jar");
+
+ assertFileExists(ejbProjectDirectory + "/conftest/components.properties");
+ assertFileExists(ejbProjectDirectory + "/conftest/components.xml");
+ assertFileExists(ejbProjectDirectory + "/conftest/default.persistence.properties");
+ assertFileExists(ejbProjectDirectory + "/conftest/ejb3-interceptors-aop.xml");
+ assertFileExists(ejbProjectDirectory + "/conftest/embedded-jboss-beans.xml");
+ assertFileExists(ejbProjectDirectory + "/conftest/jboss-jms-beans.xml");
+ assertFileExists(ejbProjectDirectory + "/conftest/jndi.properties");
+ assertFileExists(ejbProjectDirectory + "/conftest/log4j.xml");
+ }
+
+ public void testExporterBasic()
+ {
+
+ Context context = new Context();
+ context.setProjectName("myProject");
+ context.setIsolationClassLoadingName("seam.jboss.org:loader=" + "seam-booking");
+ context.setSeamLocation("/home/theute/tmp/jboss-seam-1.0.1.GA");
+ context.setEclipseSupport(true);
+ context.setBasicProject(true);
+ context.setTestSupport(false);
+ context.setSrcPackage("org.jboss.seam");
+ context.setTestPackage("org.jboss.seam.test");
+ context.setFaceletsSupport(false);
+
+ EarContext earContext = new EarContext();
+ earContext.setProjectName("myProject-ear");
+ earContext.setDisplayName("myDisplayName");
+ earContext.setFilename("myProject.ear");
+ earContext.setContentDirectory("EarContent");
+ WTPEarProjectExporter wtpEarExporter = new WTPEarProjectExporter(context);
+ wtpEarExporter.setEarContext(earContext);
EjbContext ejbContext = new EjbContext();
ejbContext.setFilename("myProject-web.jar");
@@ -88,12 +370,238 @@
List webExporters = new ArrayList();
webExporters.add(wtpWebExporter);
+ WTPSeamExporter seamWTPExporter = new WTPSeamExporter(wtpEarExporter, ejbExporters, webExporters);
+
+ String outputDirectory = "testOutput";
+ File output = new File(outputDirectory);
+
+ seamWTPExporter.setOutputDirectory(output);
+ seamWTPExporter.start();
+
+ String earProjectDirectory = outputDirectory + "/" + earContext.getProjectName();
+ assertFileExists(earProjectDirectory);
+
+ assertFileExists(earProjectDirectory + "/.project");
+ assertFileExists(earProjectDirectory + "/.settings/org.eclipse.wst.common.component");
+ assertFileExists(earProjectDirectory + "/.settings/org.eclipse.wst.common.project.facet.core.xml");
+
+ String earContentDirectory = earProjectDirectory + "/" + earContext.getContentDirectory();
+ assertFileExists(earContentDirectory);
+
+ assertFileExists(earContentDirectory + "/jboss-seam.jar");
+ assertFileExists(earContentDirectory + "/META-INF/application.xml");
+ assertFileExists(earContentDirectory + "/META-INF/jboss-app.xml");
+
+ String webProjectDirectory = outputDirectory + "/" + webContext.getProjectName();
+ assertFileExists(webProjectDirectory);
+
+ assertFileExists(webProjectDirectory + "/.classpath");
+ assertFileExists(webProjectDirectory + "/.project");
+ assertFileExists(webProjectDirectory + "/.settings/org.eclipse.jdt.core.prefs");
+ assertFileExists(webProjectDirectory + "/.settings/org.eclipse.jst.common.project.facet.core.prefs");
+ assertFileExists(webProjectDirectory + "/.settings/org.eclipse.wst.common.component");
+ assertFileExists(webProjectDirectory + "/.settings/org.eclipse.wst.common.project.facet.core.xml");
+
+ assertFileExists(webProjectDirectory + "/src");
+
+ String webContentDirectory = webProjectDirectory + "/" + webContext.getContentDirectory();
+ assertFileExists(webContentDirectory);
+
+ String webinfDirectory = webContentDirectory + "/WEB-INF";
+ assertFileExists(webinfDirectory);
+
+ assertFileExists(webinfDirectory + "/web.xml");
+ assertFileExists(webinfDirectory + "/faces-config.xml");
+ assertFileExists(webinfDirectory + "/pages.xml");
+ assertFileExists(webinfDirectory + "/components.xml");
+
+ assertFileDoesntExist(webinfDirectory + "/lib/jsf-facelets.jar");
+ assertFileDoesntExist(webinfDirectory + "/lib/el-api.jar");
+ assertFileDoesntExist(webinfDirectory + "/lib/el-ri.jar");
+ assertFileExists(webinfDirectory + "/lib/jboss-seam-debug.jar");
+ assertFileExists(webinfDirectory + "/lib/jboss-seam-ui.jar");
+
+ assertFileExists(webContentDirectory + "/index.jsp");
+ assertFileExists(webContentDirectory + "/register.jsp");
+ assertFileExists(webContentDirectory + "/registered.jsp");
+
+ String ejbProjectDirectory = outputDirectory + "/" + ejbContext.getProjectName();
+ assertFileExists(ejbProjectDirectory);
+
+ assertFileExists(ejbProjectDirectory + "/.classpath");
+ assertFileExists(ejbProjectDirectory + "/.project");
+ assertFileExists(ejbProjectDirectory + "/.settings/org.eclipse.jdt.core.prefs");
+ assertFileExists(ejbProjectDirectory + "/.settings/org.eclipse.jst.common.project.facet.core.prefs");
+ assertFileExists(ejbProjectDirectory + "/.settings/org.eclipse.wst.common.component");
+ assertFileExists(ejbProjectDirectory + "/.settings/org.eclipse.wst.common.project.facet.core.xml");
+
+ String ejbContentDirectory = ejbProjectDirectory + "/" + ejbContext.getContentDirectory();
+ assertFileExists(ejbContentDirectory);
+
+ assertFileExists(ejbContentDirectory + "/" + context.getSrcPackage().replace('.', '/') + "/Register.java");
+ assertFileExists(ejbContentDirectory + "/" + context.getSrcPackage().replace('.', '/') + "/RegisterAction.java");
+ assertFileExists(ejbContentDirectory + "/" + context.getSrcPackage().replace('.', '/') + "/User.java");
+ assertFileExists(ejbContentDirectory + "/META-INF/ejb-jar.xml");
+ assertFileExists(ejbContentDirectory + "/META-INF/persistence.xml");
+ assertFileExists(ejbContentDirectory + "/seam.properties");
+
+ assertFileExists(ejbProjectDirectory + "/lib/jboss-ejb3-all.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/hibernate-all.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/myfaces-api-1.1.3.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/myfaces-impl-1.1.3.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/testng-4.5.1-jdk15.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/servlet-api.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/thirdparty-all.jar");
+
+ assertFileDoesntExist(ejbProjectDirectory + "/conftest/components.properties");
+ assertFileDoesntExist(ejbProjectDirectory + "/conftest/components.xml");
+ assertFileDoesntExist(ejbProjectDirectory + "/conftest/default.persistence.properties");
+ assertFileDoesntExist(ejbProjectDirectory + "/conftest/ejb3-interceptors-aop.xml");
+ assertFileDoesntExist(ejbProjectDirectory + "/conftest/embedded-jboss-beans.xml");
+ assertFileDoesntExist(ejbProjectDirectory + "/conftest/jboss-jms-beans.xml");
+ assertFileDoesntExist(ejbProjectDirectory + "/conftest/jndi.properties");
+ assertFileDoesntExist(ejbProjectDirectory + "/conftest/log4j.xml");
+ }
+
+ public void testExporter()
+ {
+
+ Context context = new Context();
+ context.setProjectName("myProject");
+ context.setIsolationClassLoadingName("seam.jboss.org:loader=" + "seam-booking");
+ context.setSeamLocation("/home/theute/tmp/jboss-seam-1.0.1.GA");
+ context.setEclipseSupport(true);
+ context.setBasicProject(false);
+ context.setTestSupport(false);
+ context.setSrcPackage("org.jboss.seam");
+ context.setTestPackage("org.jboss.seam.test");
+ context.setFaceletsSupport(false);
+
+ EarContext earContext = new EarContext();
+ earContext.setProjectName("myProject-ear");
+ earContext.setDisplayName("myDisplayName");
+ earContext.setFilename("myProject.ear");
+ earContext.setContentDirectory("EarContent");
+ WTPEarProjectExporter wtpEarExporter = new WTPEarProjectExporter(context);
+ wtpEarExporter.setEarContext(earContext);
+
+ EjbContext ejbContext = new EjbContext();
+ ejbContext.setFilename("myProject-web.jar");
+ ejbContext.setProjectName("myProject-ejb");
+ ejbContext.setId("myEjbId");
+ ejbContext.setContentDirectory("myEjbModule");
+ ejbContext.setJtaDataSource("bookingDatasource");
+ ejbContext.setPersistenceUnitName("bookingDatabase");
+
+ WTPEjbProjectExporter wtpEjbExporter = new WTPEjbProjectExporter(context);
+ wtpEjbExporter.setEjbContext(ejbContext);
+ List ejbExporters = new ArrayList();
+ ejbExporters.add(wtpEjbExporter);
+
+ WebContext webContext = new WebContext();
+ webContext.setProjectName("myProject-web");
+ webContext.setFilename("myProject-web.war");
+ webContext.setContextRoot("myProject");
+ webContext.setId("myWebId");
+ webContext.setContentDirectory("myWebContent");
+ webContext.setJsfExtension("jsp");
+ WTPWebProjectExporter wtpWebExporter = new WTPWebProjectExporter(context);
+ wtpWebExporter.setWebContext(webContext);
+ List webExporters = new ArrayList();
+ webExporters.add(wtpWebExporter);
WTPSeamExporter seamWTPExporter = new WTPSeamExporter(wtpEarExporter, ejbExporters, webExporters);
- File output = new File("/tmp/toto");
+ String outputDirectory = "testOutput";
+ File output = new File(outputDirectory);
seamWTPExporter.setOutputDirectory(output);
seamWTPExporter.start();
+
+ String earProjectDirectory = outputDirectory + "/" + earContext.getProjectName();
+ assertFileExists(earProjectDirectory);
+
+ assertFileExists(earProjectDirectory + "/.project");
+ assertFileExists(earProjectDirectory + "/.settings/org.eclipse.wst.common.component");
+ assertFileExists(earProjectDirectory + "/.settings/org.eclipse.wst.common.project.facet.core.xml");
+
+ String earContentDirectory = earProjectDirectory + "/" + earContext.getContentDirectory();
+ assertFileExists(earContentDirectory);
+
+ assertFileExists(earContentDirectory + "/jboss-seam.jar");
+ assertFileExists(earContentDirectory + "/META-INF/application.xml");
+ assertFileExists(earContentDirectory + "/META-INF/jboss-app.xml");
+
+ String webProjectDirectory = outputDirectory + "/" + webContext.getProjectName();
+ assertFileExists(webProjectDirectory);
+
+ assertFileExists(webProjectDirectory + "/.classpath");
+ assertFileExists(webProjectDirectory + "/.project");
+ assertFileExists(webProjectDirectory + "/.settings/org.eclipse.jdt.core.prefs");
+ assertFileExists(webProjectDirectory + "/.settings/org.eclipse.jst.common.project.facet.core.prefs");
+ assertFileExists(webProjectDirectory + "/.settings/org.eclipse.wst.common.component");
+ assertFileExists(webProjectDirectory + "/.settings/org.eclipse.wst.common.project.facet.core.xml");
+
+ assertFileExists(webProjectDirectory + "/src");
+
+ String webContentDirectory = webProjectDirectory + "/" + webContext.getContentDirectory();
+ assertFileExists(webContentDirectory);
+
+ String webinfDirectory = webContentDirectory + "/WEB-INF";
+ assertFileExists(webinfDirectory);
+
+ assertFileExists(webinfDirectory + "/web.xml");
+ assertFileExists(webinfDirectory + "/faces-config.xml");
+ assertFileExists(webinfDirectory + "/pages.xml");
+ assertFileExists(webinfDirectory + "/components.xml");
+
+ assertFileDoesntExist(webinfDirectory + "/lib/jsf-facelets.jar");
+ assertFileDoesntExist(webinfDirectory + "/lib/el-api.jar");
+ assertFileDoesntExist(webinfDirectory + "/lib/el-ri.jar");
+ assertFileExists(webinfDirectory + "/lib/jboss-seam-debug.jar");
+ assertFileExists(webinfDirectory + "/lib/jboss-seam-ui.jar");
+
+ assertFileDoesntExist(webContentDirectory + "/index.jsp");
+ assertFileDoesntExist(webContentDirectory + "/register.jsp");
+ assertFileDoesntExist(webContentDirectory + "/registered.jsp");
+
+ String ejbProjectDirectory = outputDirectory + "/" + ejbContext.getProjectName();
+ assertFileExists(ejbProjectDirectory);
+
+ assertFileExists(ejbProjectDirectory + "/.classpath");
+ assertFileExists(ejbProjectDirectory + "/.project");
+ assertFileExists(ejbProjectDirectory + "/.settings/org.eclipse.jdt.core.prefs");
+ assertFileExists(ejbProjectDirectory + "/.settings/org.eclipse.jst.common.project.facet.core.prefs");
+ assertFileExists(ejbProjectDirectory + "/.settings/org.eclipse.wst.common.component");
+ assertFileExists(ejbProjectDirectory + "/.settings/org.eclipse.wst.common.project.facet.core.xml");
+
+ String ejbContentDirectory = ejbProjectDirectory + "/" + ejbContext.getContentDirectory();
+ assertFileExists(ejbContentDirectory);
+
+ assertFileDoesntExist(ejbContentDirectory + "/" + context.getSrcPackage().replace('.', '/') + "/Register.java");
+ assertFileDoesntExist(ejbContentDirectory + "/" + context.getSrcPackage().replace('.', '/')
+ + "/RegisterAction.java");
+ assertFileDoesntExist(ejbContentDirectory + "/" + context.getSrcPackage().replace('.', '/') + "/User.java");
+ assertFileDoesntExist(ejbContentDirectory + "/META-INF/ejb-jar.xml");
+ assertFileDoesntExist(ejbContentDirectory + "/META-INF/persistence.xml");
+ assertFileDoesntExist(ejbContentDirectory + "/seam.properties");
+
+ assertFileExists(ejbProjectDirectory + "/lib/jboss-ejb3-all.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/hibernate-all.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/myfaces-api-1.1.3.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/myfaces-impl-1.1.3.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/testng-4.5.1-jdk15.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/servlet-api.jar");
+ assertFileExists(ejbProjectDirectory + "/lib/thirdparty-all.jar");
+
+ assertFileDoesntExist(ejbProjectDirectory + "/conftest/components.properties");
+ assertFileDoesntExist(ejbProjectDirectory + "/conftest/components.xml");
+ assertFileDoesntExist(ejbProjectDirectory + "/conftest/default.persistence.properties");
+ assertFileDoesntExist(ejbProjectDirectory + "/conftest/ejb3-interceptors-aop.xml");
+ assertFileDoesntExist(ejbProjectDirectory + "/conftest/embedded-jboss-beans.xml");
+ assertFileDoesntExist(ejbProjectDirectory + "/conftest/jboss-jms-beans.xml");
+ assertFileDoesntExist(ejbProjectDirectory + "/conftest/jndi.properties");
+ assertFileDoesntExist(ejbProjectDirectory + "/conftest/log4j.xml");
}
+
}
1.1 date: 2006/08/29 13:05:47; author: theute; state: Exp;jboss-seam-tools/src/java/org/jboss/seam/tools/test/AbstractTestCase.java
Index: AbstractTestCase.java
===================================================================
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.seam.tools.test;
import java.io.File;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
/**
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
* @version <tt>$Revision: 1.1 $</tt>
*/
public class AbstractTestCase extends TestCase
{
public void assertFileExists(String filename)
{
assertFileExists(new File(filename.replace('/', File.separatorChar)));
}
public void assertFileExists(File file)
{
if (!file.exists())
{
throw new AssertionFailedError("File " + file.getAbsolutePath() + " does not exist");
}
}
public void assertFileDoesntExist(String filename)
{
assertFileDoesntExist(new File(filename.replace('/', File.separatorChar)));
}
public void assertFileDoesntExist(File file)
{
if (file.exists())
{
throw new AssertionFailedError("File " + file.getAbsolutePath() + " should not exist");
}
}
}
More information about the jboss-cvs-commits
mailing list