On 11/20/2009 06:36 PM, tmortagne (SVN) wrote:
> Author: tmortagne
> Date: 2009-11-20 18:36:07 +0100 (Fri, 20 Nov 2009)
> New Revision: 25234
>
> Modified:
>
> enterprise/branches/xwiki-enterprise-2.0/distribution-test/misc-tests/src/test/it/com/xpn/xwiki/it/HTMLExportTest.java
> Log:
> XWIKI-4617: HTML export does support the new common "resource" folder
> * add integration test
>
> Modified:
> enterprise/branches/xwiki-enterprise-2.0/distribution-test/misc-tests/src/test/it/com/xpn/xwiki/it/HTMLExportTest.java
> ===================================================================
> ---
> enterprise/branches/xwiki-enterprise-2.0/distribution-test/misc-tests/src/test/it/com/xpn/xwiki/it/HTMLExportTest.java
> 2009-11-20 17:36:02 UTC (rev 25233)
> +++
> enterprise/branches/xwiki-enterprise-2.0/distribution-test/misc-tests/src/test/it/com/xpn/xwiki/it/HTMLExportTest.java
> 2009-11-20 17:36:07 UTC (rev 25234)
> @@ -19,19 +19,16 @@
> */
> package com.xpn.xwiki.it;
>
> -import java.io.BufferedReader;
> import java.io.InputStream;
> -import java.io.InputStreamReader;
> import java.net.HttpURLConnection;
> import java.net.URL;
> import java.util.zip.ZipEntry;
> -import java.util.zip.ZipFile;
> import java.util.zip.ZipInputStream;
>
> +import junit.framework.TestCase;
> +
> import org.apache.commons.io.IOUtils;
>
> -import junit.framework.TestCase;
> -
> public class HTMLExportTest extends TestCase
> {
> /**
> @@ -40,29 +37,39 @@
> public void testHTMLExport() throws Exception
> {
> URL url = new
> URL("http://localhost:8080/xwiki/bin/export/Main/WebHome?format=html");
> +
> HttpURLConnection connection = (HttpURLConnection)
> url.openConnection();
> +
> InputStream is = connection.getInputStream();
> ZipInputStream zis = new ZipInputStream(is);
> - ZipEntry entry;
> - boolean found = false;
> +
> + boolean foundWebHome = false;
> + boolean foundResources = false;
> +
> // We must read the full stream as otherwise if we close it before
> we've fully read it
> // then the server side will get a broken pipe since it's still
> trying to send data on it.
> - while ((entry = zis.getNextEntry()) != null) {
> - if (entry.getName().equals("xwiki.Main.WebHome.html")) {
> - String content = IOUtils.toString(zis);
> - // Verify that the content was rendered properly
> - assertTrue("Should have contained 'Welcome to your
> wiki'",
> - content.contains("Welcome to your wiki"));
> - // Ensure that the translations have been rendered
> properly
> - assertFalse("$msg should have been expanded",
> - content.contains("$msg"));
> - found = true;
> - } else {
> - IOUtils.readLines(zis);
> - }
> - zis.closeEntry();
> + for (ZipEntry entry; (entry = zis.getNextEntry()) != null;
> zis.closeEntry()) {
System.out? Leftover code?
> + System.out.println(entry.getName());
> + if (entry.getName().equals("xwiki.Main.WebHome.html")) {
> + String content = IOUtils.toString(zis);
> +
> + // Verify that the content was rendered properly
> + assertTrue("Should have contained 'Welcome to your wiki'",
> content.contains("Welcome to your wiki"));
> +
> + // Ensure that the translations have been rendered properly
> + assertFalse("$msg should have been expanded",
> content.contains("$msg"));
> +
> + foundWebHome = true;
> + } else if (entry.getName().startsWith("resources/")) {
> + foundResources = true;
> + } else {
> + IOUtils.readLines(zis);
> + }
> }
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs