Author: danielc.roth
Date: 2008-10-23 11:28:46 -0400 (Thu, 23 Oct 2008)
New Revision: 9393
Added:
trunk/examples/excel/src/org/jboss/seam/excel/test/RenderTest.java
trunk/examples/excel/view/simple.xhtml
Modified:
trunk/examples/excel/build.xml
trunk/examples/excel/src/org/jboss/seam/excel/test/testng.xml
trunk/src/main/org/jboss/seam/mock/MockApplication.java
Log:
JBSEAM-3214
Modified: trunk/examples/excel/build.xml
===================================================================
--- trunk/examples/excel/build.xml 2008-10-23 14:28:08 UTC (rev 9392)
+++ trunk/examples/excel/build.xml 2008-10-23 15:28:46 UTC (rev 9393)
@@ -15,14 +15,25 @@
<import file="../build.xml"/>
+ <patternset id="test.view.files">
+ <include name="*.*" />
+ </patternset>
+
+ <patternset id="test.src.files">
+ <include name="**/*.xml" />
+ <include name="**/*.xhtml" />
+ </patternset>
+
+
<path id="test.classpath.extras">
- <fileset refid="seam.excel.jar" />
+ <path location="${lib.dir}/jboss-seam-ui.jar" />
</path>
<path id="build.classpath.extras">
- <fileset refid="seam.excel.jar" />
+ <path location="${lib.dir}/jboss-seam-excel.jar" />
+ <path location="${lib.dir}/jboss-seam-pdf.jar" />
</path>
-
+
</project>
Added: trunk/examples/excel/src/org/jboss/seam/excel/test/RenderTest.java
===================================================================
--- trunk/examples/excel/src/org/jboss/seam/excel/test/RenderTest.java
(rev 0)
+++ trunk/examples/excel/src/org/jboss/seam/excel/test/RenderTest.java 2008-10-23 15:28:46
UTC (rev 9393)
@@ -0,0 +1,62 @@
+package org.jboss.seam.excel.test;
+
+import java.io.ByteArrayInputStream;
+import java.util.List;
+
+import jxl.Cell;
+import jxl.Sheet;
+import jxl.Workbook;
+
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.document.DocumentData;
+import org.jboss.seam.excel.ExcelTest.Person;
+import org.jboss.seam.faces.Renderer;
+import org.jboss.seam.mock.SeamTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author Daniel Roth
+ *
+ * Really small test. Renders an jxl excel file from jsf tags and
+ * verifies the content.
+ *
+ */
+public class RenderTest extends SeamTest {
+
+ @Test
+ public void testSimple() throws Exception {
+
+ new FacesRequest() {
+
+ @Override
+ protected void updateModelValues() throws Exception {
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception {
+
+ Renderer.instance().render("/simple.xhtml");
+
+ DocumentData data = (DocumentData)
Contexts.getEventContext().get("testExport");
+ Workbook workbook = Workbook.getWorkbook(new
ByteArrayInputStream(data.getData()));
+ Sheet sheet = workbook.getSheet("Developers");
+
+ assert sheet != null;
+
+ assert "Daniel Roth".equals(sheet.getCell(0,
0).getContents());
+ assert "Nicklas Karlsson".equals(sheet.getCell(0,
1).getContents());
+
+ }
+ }.run();
+ }
+
+ public static void main(String[] args) {
+ RenderTest t = new RenderTest();
+ try {
+ t.testSimple();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
Modified: trunk/examples/excel/src/org/jboss/seam/excel/test/testng.xml
===================================================================
--- trunk/examples/excel/src/org/jboss/seam/excel/test/testng.xml 2008-10-23 14:28:08 UTC
(rev 9392)
+++ trunk/examples/excel/src/org/jboss/seam/excel/test/testng.xml 2008-10-23 15:28:46 UTC
(rev 9393)
@@ -4,6 +4,7 @@
<test name="Excel Tests">
<classes>
+ <class name="org.jboss.seam.excel.test.RenderTest"/>
</classes>
</test>
Added: trunk/examples/excel/view/simple.xhtml
===================================================================
--- trunk/examples/excel/view/simple.xhtml (rev 0)
+++ trunk/examples/excel/view/simple.xhtml 2008-10-23 15:28:46 UTC (rev 9393)
@@ -0,0 +1,8 @@
+<e:workbook exportKey="testExport"
+
xmlns:e="http://jboss.com/products/seam/excel"
+
xmlns:f="http://java.sun.com/jsf/core">
+ <e:worksheet name="Developers">
+ <e:cell column="0" row="0" value="Daniel Roth" />
+ <e:cell column="0" row="1" value="Nicklas Karlsson"
/>
+ </e:worksheet>
+</e:workbook>
Modified: trunk/src/main/org/jboss/seam/mock/MockApplication.java
===================================================================
--- trunk/src/main/org/jboss/seam/mock/MockApplication.java 2008-10-23 14:28:08 UTC (rev
9392)
+++ trunk/src/main/org/jboss/seam/mock/MockApplication.java 2008-10-23 15:28:46 UTC (rev
9393)
@@ -250,7 +250,7 @@
public UIComponent createComponent(String name) throws FacesException
{
// Best guess component creation with a dummy component if it can't be found
- if (name.startsWith("org.jboss.seam.mail.ui"))
+ if (name.startsWith("org.jboss.seam.mail.ui") ||
name.startsWith("org.jboss.seam.excel.ui"))
{
try
{