Skip to content

Commit 2aeffb9

Browse files
committed
[test] Tests require exact XML document sizes
1 parent 66402ee commit 2aeffb9

File tree

6 files changed

+108
-0
lines changed

6 files changed

+108
-0
lines changed

extensions/webdav/src/test/java/org/exist/webdav/CDataIntergationTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import org.apache.http.impl.client.AbstractHttpClient;
3131
import org.exist.TestUtils;
3232
import org.exist.test.ExistWebServer;
33+
import org.junit.AfterClass;
34+
import org.junit.BeforeClass;
3335
import org.junit.ClassRule;
3436
import org.junit.Test;
3537
import org.junit.rules.TemporaryFolder;
@@ -52,6 +54,22 @@ public class CDataIntergationTest {
5254
@ClassRule
5355
public static final TemporaryFolder TEMP_FOLDER = new TemporaryFolder();
5456

57+
private static String PREV_PROPFIND_METHOD_XML_SIZE = null;
58+
59+
@BeforeClass
60+
public static void setup() {
61+
PREV_PROPFIND_METHOD_XML_SIZE = System.setProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE, "exact");
62+
}
63+
64+
@AfterClass
65+
public static void cleanup() {
66+
if (PREV_PROPFIND_METHOD_XML_SIZE == null) {
67+
System.clearProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE);
68+
} else {
69+
System.setProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE, PREV_PROPFIND_METHOD_XML_SIZE);
70+
}
71+
}
72+
5573
private static final String CDATA_CONTENT = "Hello there, \"Bob?\"";
5674
private static final String CDATA_XML = "<elem1><![CDATA[" + CDATA_CONTENT + "]]></elem1>";
5775

extensions/webdav/src/test/java/org/exist/webdav/CopyTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import org.apache.http.impl.client.AbstractHttpClient;
3131
import org.exist.TestUtils;
3232
import org.exist.test.ExistWebServer;
33+
import org.junit.AfterClass;
34+
import org.junit.BeforeClass;
3335
import org.junit.ClassRule;
3436
import org.junit.Test;
3537
import org.junit.rules.TemporaryFolder;
@@ -51,6 +53,22 @@ public class CopyTest {
5153
@ClassRule
5254
public static final TemporaryFolder tempFolder = new TemporaryFolder();
5355

56+
private static String PREV_PROPFIND_METHOD_XML_SIZE = null;
57+
58+
@BeforeClass
59+
public static void setup() {
60+
PREV_PROPFIND_METHOD_XML_SIZE = System.setProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE, "exact");
61+
}
62+
63+
@AfterClass
64+
public static void cleanup() {
65+
if (PREV_PROPFIND_METHOD_XML_SIZE == null) {
66+
System.clearProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE);
67+
} else {
68+
System.setProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE, PREV_PROPFIND_METHOD_XML_SIZE);
69+
}
70+
}
71+
5472
@Test
5573
public void copyXmlDocument() throws IOException, NotAuthorizedException, BadRequestException, HttpException, ConflictException, NotFoundException {
5674
final String srcDocName = "webdav-copy-test.xml";

extensions/webdav/src/test/java/org/exist/webdav/DeleteTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import org.apache.http.impl.client.AbstractHttpClient;
3131
import org.exist.TestUtils;
3232
import org.exist.test.ExistWebServer;
33+
import org.junit.AfterClass;
34+
import org.junit.BeforeClass;
3335
import org.junit.ClassRule;
3436
import org.junit.Test;
3537
import org.junit.rules.TemporaryFolder;
@@ -51,6 +53,22 @@ public class DeleteTest {
5153
@ClassRule
5254
public static final TemporaryFolder tempFolder = new TemporaryFolder();
5355

56+
private static String PREV_PROPFIND_METHOD_XML_SIZE = null;
57+
58+
@BeforeClass
59+
public static void setup() {
60+
PREV_PROPFIND_METHOD_XML_SIZE = System.setProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE, "exact");
61+
}
62+
63+
@AfterClass
64+
public static void cleanup() {
65+
if (PREV_PROPFIND_METHOD_XML_SIZE == null) {
66+
System.clearProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE);
67+
} else {
68+
System.setProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE, PREV_PROPFIND_METHOD_XML_SIZE);
69+
}
70+
}
71+
5472
@Test
5573
public void storeAndDeleteXmlDocument() throws IOException, NotAuthorizedException, BadRequestException, HttpException, ConflictException, NotFoundException {
5674
final String srcDocName = "webdav-store-and-retrieve-test.xml";

extensions/webdav/src/test/java/org/exist/webdav/RenameTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import org.apache.http.impl.client.AbstractHttpClient;
3131
import org.exist.TestUtils;
3232
import org.exist.test.ExistWebServer;
33+
import org.junit.AfterClass;
34+
import org.junit.BeforeClass;
3335
import org.junit.ClassRule;
3436
import org.junit.Test;
3537
import org.junit.rules.TemporaryFolder;
@@ -51,6 +53,22 @@ public class RenameTest {
5153
@ClassRule
5254
public static final TemporaryFolder tempFolder = new TemporaryFolder();
5355

56+
private static String PREV_PROPFIND_METHOD_XML_SIZE = null;
57+
58+
@BeforeClass
59+
public static void setup() {
60+
PREV_PROPFIND_METHOD_XML_SIZE = System.setProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE, "exact");
61+
}
62+
63+
@AfterClass
64+
public static void cleanup() {
65+
if (PREV_PROPFIND_METHOD_XML_SIZE == null) {
66+
System.clearProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE);
67+
} else {
68+
System.setProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE, PREV_PROPFIND_METHOD_XML_SIZE);
69+
}
70+
}
71+
5472
@Test
5573
public void renameXmlDocument() throws IOException, NotAuthorizedException, BadRequestException, HttpException, ConflictException, NotFoundException {
5674
final String srcDocName = "webdav-store-and-retrieve-test.xml";

extensions/webdav/src/test/java/org/exist/webdav/ReplaceTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import org.apache.http.impl.client.AbstractHttpClient;
3131
import org.exist.TestUtils;
3232
import org.exist.test.ExistWebServer;
33+
import org.junit.AfterClass;
34+
import org.junit.BeforeClass;
3335
import org.junit.ClassRule;
3436
import org.junit.Test;
3537
import org.junit.rules.TemporaryFolder;
@@ -51,6 +53,22 @@ public class ReplaceTest {
5153
@ClassRule
5254
public static final TemporaryFolder tempFolder = new TemporaryFolder();
5355

56+
private static String PREV_PROPFIND_METHOD_XML_SIZE = null;
57+
58+
@BeforeClass
59+
public static void setup() {
60+
PREV_PROPFIND_METHOD_XML_SIZE = System.setProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE, "exact");
61+
}
62+
63+
@AfterClass
64+
public static void cleanup() {
65+
if (PREV_PROPFIND_METHOD_XML_SIZE == null) {
66+
System.clearProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE);
67+
} else {
68+
System.setProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE, PREV_PROPFIND_METHOD_XML_SIZE);
69+
}
70+
}
71+
5472
@Test
5573
public void replaceXmlDocument() throws IOException, NotAuthorizedException, BadRequestException, HttpException, ConflictException, NotFoundException {
5674
final String docName = "webdav-copy-test.xml";

extensions/webdav/src/test/java/org/exist/webdav/StoreAndRetrieveTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import org.apache.http.impl.client.AbstractHttpClient;
3131
import org.exist.TestUtils;
3232
import org.exist.test.ExistWebServer;
33+
import org.junit.AfterClass;
34+
import org.junit.BeforeClass;
3335
import org.junit.ClassRule;
3436
import org.junit.Test;
3537
import org.junit.rules.TemporaryFolder;
@@ -51,6 +53,22 @@ public class StoreAndRetrieveTest {
5153
@ClassRule
5254
public static final TemporaryFolder tempFolder = new TemporaryFolder();
5355

56+
private static String PREV_PROPFIND_METHOD_XML_SIZE = null;
57+
58+
@BeforeClass
59+
public static void setup() {
60+
PREV_PROPFIND_METHOD_XML_SIZE = System.setProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE, "exact");
61+
}
62+
63+
@AfterClass
64+
public static void cleanup() {
65+
if (PREV_PROPFIND_METHOD_XML_SIZE == null) {
66+
System.clearProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE);
67+
} else {
68+
System.setProperty(MiltonDocument.PROPFIND_METHOD_XML_SIZE, PREV_PROPFIND_METHOD_XML_SIZE);
69+
}
70+
}
71+
5472
@Test
5573
public void storeAndRetrieveXmlDocument() throws IOException, NotAuthorizedException, BadRequestException, HttpException, ConflictException, NotFoundException {
5674
final String srcDocName = "webdav-store-and-retrieve-test.xml";

0 commit comments

Comments
 (0)