Skip to content

Commit f6eba77

Browse files
committed
Fix logging logic for multithreaded testing; fix layout tests to allow parallel execution; avoid parallel verapdf validations
DEVSIX-9032
1 parent 0ebe12b commit f6eba77

File tree

21 files changed

+567
-345
lines changed

21 files changed

+567
-345
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Enable parallelism
2+
junit.jupiter.execution.parallel.enabled=true
3+
4+
# Enable parallelism for both test methods and classes
5+
junit.jupiter.execution.parallel.mode.default = concurrent
6+
7+
# Enable parallelism for classes only
8+
#junit.jupiter.execution.parallel.mode.classes.default = concurrent
9+
10+
# Dynamic strategy
11+
#junit.jupiter.execution.parallel.config.strategy=dynamic
12+
#junit.jupiter.execution.parallel.config.dynamic.factor=1
13+
14+
# Fixed strategy
15+
junit.jupiter.execution.parallel.config.strategy=fixed
16+
junit.jupiter.execution.parallel.config.fixed.parallelism=6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Enable parallelism
2+
junit.jupiter.execution.parallel.enabled=false
3+
4+
# Enable parallelism for both test methods and classes
5+
junit.jupiter.execution.parallel.mode.default = concurrent
6+
7+
# Enable parallelism for classes only
8+
#junit.jupiter.execution.parallel.mode.classes.default = concurrent
9+
10+
# Dynamic strategy
11+
#junit.jupiter.execution.parallel.config.strategy=dynamic
12+
#junit.jupiter.execution.parallel.config.dynamic.factor=1
13+
14+
# Fixed strategy
15+
junit.jupiter.execution.parallel.config.strategy=fixed
16+
junit.jupiter.execution.parallel.config.fixed.parallelism=6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Enable parallelism
2+
junit.jupiter.execution.parallel.enabled=false
3+
4+
# Enable parallelism for both test methods and classes
5+
junit.jupiter.execution.parallel.mode.default = concurrent
6+
7+
# Enable parallelism for classes only
8+
#junit.jupiter.execution.parallel.mode.classes.default = concurrent
9+
10+
# Dynamic strategy
11+
#junit.jupiter.execution.parallel.config.strategy=dynamic
12+
#junit.jupiter.execution.parallel.config.dynamic.factor=1
13+
14+
# Fixed strategy
15+
junit.jupiter.execution.parallel.config.strategy=fixed
16+
junit.jupiter.execution.parallel.config.fixed.parallelism=6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Enable parallelism
2+
junit.jupiter.execution.parallel.enabled=false
3+
4+
# Enable parallelism for both test methods and classes
5+
junit.jupiter.execution.parallel.mode.default = concurrent
6+
7+
# Enable parallelism for classes only
8+
#junit.jupiter.execution.parallel.mode.classes.default = concurrent
9+
10+
# Dynamic strategy
11+
#junit.jupiter.execution.parallel.config.strategy=dynamic
12+
#junit.jupiter.execution.parallel.config.dynamic.factor=1
13+
14+
# Fixed strategy
15+
junit.jupiter.execution.parallel.config.strategy=fixed
16+
junit.jupiter.execution.parallel.config.fixed.parallelism=6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Enable parallelism
2+
junit.jupiter.execution.parallel.enabled=false
3+
4+
# Enable parallelism for both test methods and classes
5+
junit.jupiter.execution.parallel.mode.default = concurrent
6+
7+
# Enable parallelism for classes only
8+
#junit.jupiter.execution.parallel.mode.classes.default = concurrent
9+
10+
# Dynamic strategy
11+
#junit.jupiter.execution.parallel.config.strategy=dynamic
12+
#junit.jupiter.execution.parallel.config.dynamic.factor=1
13+
14+
# Fixed strategy
15+
junit.jupiter.execution.parallel.config.strategy=fixed
16+
junit.jupiter.execution.parallel.config.fixed.parallelism=6

layout/src/test/java/com/itextpdf/layout/BorderTest.java

+23-27
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,15 @@ public class BorderTest extends ExtendedITextTest {
6666
public static final String destinationFolder = TestUtil.getOutputPath() + "/layout/BorderTest/";
6767
public static final String cmpPrefix = "cmp_";
6868

69-
String fileName;
70-
String outFileName;
71-
String cmpFileName;
72-
7369
@BeforeAll
7470
public static void beforeClass() {
7571
createDestinationFolder(destinationFolder);
7672
}
7773

7874
@Test
7975
public void simpleBordersTest() throws IOException, InterruptedException {
80-
fileName = "simpleBordersTest.pdf";
81-
Document doc = createDocument();
76+
String fileName = "simpleBordersTest.pdf";
77+
Document doc = createDocument(fileName);
8278

8379
List list = new List();
8480

@@ -109,7 +105,7 @@ public void simpleBordersTest() throws IOException, InterruptedException {
109105

110106
doc.add(list);
111107

112-
closeDocumentAndCompareOutputs(doc);
108+
closeDocumentAndCompareOutputs(doc, fileName);
113109
}
114110

115111
@Test
@@ -137,8 +133,8 @@ public void drawBordersByRectangleTest() throws IOException, InterruptedExceptio
137133

138134
@Test
139135
public void borders3DTest() throws IOException, InterruptedException {
140-
fileName = "borders3DTest.pdf";
141-
Document doc = createDocument();
136+
String fileName = "borders3DTest.pdf";
137+
Document doc = createDocument(fileName);
142138

143139
List list = new List();
144140

@@ -213,13 +209,13 @@ public void borders3DTest() throws IOException, InterruptedException {
213209

214210
doc.add(list);
215211

216-
closeDocumentAndCompareOutputs(doc);
212+
closeDocumentAndCompareOutputs(doc, fileName);
217213
}
218214

219215
@Test
220216
public void borderSidesTest() throws IOException, InterruptedException {
221-
fileName = "borderSidesTest.pdf";
222-
Document doc = createDocument();
217+
String fileName = "borderSidesTest.pdf";
218+
Document doc = createDocument(fileName);
223219

224220
String text =
225221
"<p class=\"none\" >No border.</p>\n" +
@@ -247,13 +243,13 @@ public void borderSidesTest() throws IOException, InterruptedException {
247243
doc.add(new Paragraph(text).setBorderLeft(new DashedBorder(DeviceGray.BLACK, 5)));
248244
doc.add(new Paragraph(text).setBorder(new DottedBorder(DeviceGray.BLACK, 1)));
249245

250-
closeDocumentAndCompareOutputs(doc);
246+
closeDocumentAndCompareOutputs(doc, fileName);
251247
}
252248

253249
@Test
254250
public void borderBoxTest() throws IOException, InterruptedException {
255-
fileName = "borderBoxTest.pdf";
256-
Document doc = createDocument();
251+
String fileName = "borderBoxTest.pdf";
252+
Document doc = createDocument(fileName);
257253

258254
String textBefore = "At the mid-oceanic ridges, two tectonic plates diverge from one another as new oceanic crust is formed by the cooling and " +
259255
"solidifying of hot molten rock. Because the crust is very thin at these ridges due to the pull of the tectonic plates, the release of " +
@@ -288,13 +284,13 @@ public void borderBoxTest() throws IOException, InterruptedException {
288284

289285
doc.add(new Paragraph(textAfter).setBorder(new DottedBorder(ColorConstants.BLACK, 3)).setBorderRight(new DottedBorder(ColorConstants.BLACK, 12)));
290286

291-
closeDocumentAndCompareOutputs(doc);
287+
closeDocumentAndCompareOutputs(doc, fileName);
292288
}
293289

294290
@Test
295291
public void borderOutlineTest() throws IOException, InterruptedException {
296-
fileName = "borderOutlineTest.pdf";
297-
Document doc = createDocument();
292+
String fileName = "borderOutlineTest.pdf";
293+
Document doc = createDocument(fileName);
298294

299295
String textBefore = "At the mid-oceanic ridges, two tectonic plates diverge from one another as new oceanic crust is formed by the cooling and " +
300296
"solidifying of hot molten rock. Because the crust is very thin at these ridges due to the pull of the tectonic plates, the release of " +
@@ -320,15 +316,15 @@ public void borderOutlineTest() throws IOException, InterruptedException {
320316
p.setProperty(Property.OUTLINE, new DoubleBorder(ColorConstants.RED, 25));
321317
doc.add(p);
322318

323-
closeDocumentAndCompareOutputs(doc);
319+
closeDocumentAndCompareOutputs(doc, fileName);
324320
}
325321
@Test
326322
@LogMessages(messages = {
327323
@LogMessage(messageTemplate = LayoutLogMessageConstant.ELEMENT_DOES_NOT_FIT_AREA, count = 1)
328324
})
329325
public void rotatedBordersTest() throws IOException, InterruptedException {
330-
fileName = "rotatedBordersTest.pdf";
331-
Document doc = createDocument();
326+
String fileName = "rotatedBordersTest.pdf";
327+
Document doc = createDocument(fileName);
332328
doc.setMargins(0, 0, 0, 0);
333329

334330
Paragraph p = new Paragraph("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna.\n" +
@@ -343,19 +339,19 @@ public void rotatedBordersTest() throws IOException, InterruptedException {
343339
doc.add(img);
344340
doc.close();
345341

346-
closeDocumentAndCompareOutputs(doc);
342+
closeDocumentAndCompareOutputs(doc, fileName);
347343
}
348344

349-
private Document createDocument() throws IOException {
350-
outFileName = destinationFolder + fileName;
351-
cmpFileName = sourceFolder + cmpPrefix + fileName;
352-
345+
private static Document createDocument(String fileName) throws IOException {
346+
String outFileName = destinationFolder + fileName;
353347
PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFileName));
354348

355349
return new Document(pdfDocument);
356350
}
357351

358-
private void closeDocumentAndCompareOutputs(Document document) throws IOException, InterruptedException {
352+
private static void closeDocumentAndCompareOutputs(Document document, String fileName) throws IOException, InterruptedException {
353+
String cmpFileName = sourceFolder + cmpPrefix + fileName;
354+
String outFileName = destinationFolder + fileName;
359355
document.close();
360356
String compareResult = new CompareTool().compareByContent(outFileName, cmpFileName, destinationFolder, "diff");
361357
if (compareResult != null) {

0 commit comments

Comments
 (0)