@@ -49,15 +49,13 @@ This file is part of the iText (R) project.
4949import com .itextpdf .test .annotations .type .IntegrationTest ;
5050import org .junit .Assert ;
5151import org .junit .BeforeClass ;
52- import org .junit .Ignore ;
5352import org .junit .Test ;
5453import org .junit .experimental .categories .Category ;
5554
5655import java .io .File ;
5756import java .io .FileInputStream ;
5857import java .io .FileOutputStream ;
5958import java .io .IOException ;
60- import java .nio .file .Paths ;
6159
6260@ Category (IntegrationTest .class )
6361public class ResourceResolverTest extends ExtendedITextTest {
@@ -89,6 +87,38 @@ public void resourceResolverTest07() throws IOException, InterruptedException {
8987 Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff07_" ));
9088 }
9189
90+ @ Test
91+ @ LogMessages (messages = @ LogMessage (messageTemplate = LogMessageConstant .NO_WORKER_FOUND_FOR_TAG , count = 1 ))
92+ public void resourceResolverTest07A () throws IOException , InterruptedException {
93+ String baseUri = sourceFolder + "%23r%e%2525s@o%25urces/" ;
94+
95+ String outPdf = destinationFolder + "resourceResolverTest07A.pdf" ;
96+ String cmpPdf = sourceFolder + "cmp_resourceResolverTest07A.pdf" ;
97+ try (FileInputStream fileInputStream = new FileInputStream (sourceFolder + "resourceResolverTest07A.html" );
98+ FileOutputStream fileOutputStream = new FileOutputStream (outPdf )) {
99+ HtmlConverter .convertToPdf (fileInputStream , fileOutputStream , new ConverterProperties ().setBaseUri (baseUri ));
100+ }
101+ Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff07A_" ));
102+ }
103+
104+ @ Test
105+ public void resourceResolverTest07B () throws IOException , InterruptedException {
106+ String outPdf = destinationFolder + "resourceResolverTest07B.pdf" ;
107+ String cmpPdf = sourceFolder + "cmp_resourceResolverTest07B.pdf" ;
108+ HtmlConverter .convertToPdf (new File (sourceFolder + "#r%e%25s@o%urces/resourceResolverTest07B.html" ), new File (outPdf ));
109+ Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff07B_" ));
110+ }
111+
112+ @ Test
113+ @ LogMessages (messages = @ LogMessage (messageTemplate = LogMessageConstant .NO_WORKER_FOUND_FOR_TAG , count = 1 ))
114+ public void resourceResolverTest07C () throws IOException , InterruptedException {
115+ String outPdf = destinationFolder + "resourceResolverTest07C.pdf" ;
116+ String cmpPdf = sourceFolder + "cmp_resourceResolverTest07C.pdf" ;
117+ HtmlConverter .convertToPdf (new File (sourceFolder + "#r%e%25s@o%urces/resourceResolverTest07C.html" ), new File (outPdf ),
118+ new ConverterProperties ().setBaseUri (sourceFolder + "#r%e%25s@o%urces/.." ));
119+ Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff07C_" ));
120+ }
121+
92122 @ Test
93123 public void resourceResolverTest09 () throws IOException , InterruptedException {
94124 String outPdf = destinationFolder + "resourceResolverTest09.pdf" ;
@@ -120,44 +150,101 @@ public void resourceResolverTest11() throws IOException, InterruptedException {
120150 }
121151
122152 @ Test
123- @ Ignore ( "DEVSIX-1668" )
124- public void resourceResolverTest12 () throws IOException , InterruptedException {
125- String baseUri = sourceFolder + "path with spaces" ;
153+ @ LogMessages ( messages = @ LogMessage ( messageTemplate = LogMessageConstant . NO_WORKER_FOUND_FOR_TAG , count = 1 ) )
154+ public void resourceResolverTest12A () throws IOException , InterruptedException {
155+ String baseUri = sourceFolder + "path% with% spaces/ " ;
126156
127- String outPdf = destinationFolder + "resourceResolverTest12 .pdf" ;
128- String cmpPdf = sourceFolder + "cmp_resourceResolverTest12 .pdf" ;
129- try (FileInputStream fileInputStream = new FileInputStream (sourceFolder + "resourceResolverTest12 .html" );
157+ String outPdf = destinationFolder + "resourceResolverTest12A .pdf" ;
158+ String cmpPdf = sourceFolder + "cmp_resourceResolverTest12A .pdf" ;
159+ try (FileInputStream fileInputStream = new FileInputStream (sourceFolder + "resourceResolverTest12A .html" );
130160 FileOutputStream fileOutputStream = new FileOutputStream (outPdf )) {
131161 HtmlConverter .convertToPdf (fileInputStream , fileOutputStream , new ConverterProperties ().setBaseUri (baseUri ));
132162 }
133- Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff12_ " ));
163+ Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff12A_ " ));
134164 }
135165
136166 @ Test
137- public void resourceResolverTest13 () throws IOException , InterruptedException {
138- String baseUri = sourceFolder ;
167+ @ LogMessages (messages = @ LogMessage (messageTemplate = LogMessageConstant .NO_WORKER_FOUND_FOR_TAG , count = 1 ))
168+ public void resourceResolverTest12B () throws IOException , InterruptedException {
169+ String baseUri = sourceFolder + "path%25with%25spaces/" ;
139170
140- String outPdf = destinationFolder + "resourceResolverTest13 .pdf" ;
141- String cmpPdf = sourceFolder + "cmp_resourceResolverTest13 .pdf" ;
142- try (FileInputStream fileInputStream = new FileInputStream (sourceFolder + "resourceResolverTest13 .html" );
171+ String outPdf = destinationFolder + "resourceResolverTest12B .pdf" ;
172+ String cmpPdf = sourceFolder + "cmp_resourceResolverTest12B .pdf" ;
173+ try (FileInputStream fileInputStream = new FileInputStream (sourceFolder + "resourceResolverTest12B .html" );
143174 FileOutputStream fileOutputStream = new FileOutputStream (outPdf )) {
144175 HtmlConverter .convertToPdf (fileInputStream , fileOutputStream , new ConverterProperties ().setBaseUri (baseUri ));
145176 }
146- Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff13_" ));
177+ Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff12B_" ));
178+ }
179+
180+ @ Test
181+ @ LogMessages (messages = @ LogMessage (messageTemplate = LogMessageConstant .NO_WORKER_FOUND_FOR_TAG , count = 1 ))
182+ public void resourceResolverTest12C () throws IOException , InterruptedException {
183+ String baseUri = sourceFolder + "path%2525with%2525spaces/" ;
184+
185+ String outPdf = destinationFolder + "resourceResolverTest12C.pdf" ;
186+ String cmpPdf = sourceFolder + "cmp_resourceResolverTest12C.pdf" ;
187+ try (FileInputStream fileInputStream = new FileInputStream (sourceFolder + "resourceResolverTest12C.html" );
188+ FileOutputStream fileOutputStream = new FileOutputStream (outPdf )) {
189+ HtmlConverter .convertToPdf (fileInputStream , fileOutputStream , new ConverterProperties ().setBaseUri (baseUri ));
190+ }
191+ Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff12C_" ));
192+ }
193+
194+
195+ @ Test
196+ @ LogMessages (messages = @ LogMessage (messageTemplate = LogMessageConstant .NO_WORKER_FOUND_FOR_TAG , count = 1 ))
197+ public void resourceResolverTest12D () throws IOException , InterruptedException {
198+ String baseUri = sourceFolder + "path with spaces/" ;
199+
200+ String outPdf = destinationFolder + "resourceResolverTest12D.pdf" ;
201+ String cmpPdf = sourceFolder + "cmp_resourceResolverTest12D.pdf" ;
202+ try (FileInputStream fileInputStream = new FileInputStream (sourceFolder + "resourceResolverTest12D.html" );
203+ FileOutputStream fileOutputStream = new FileOutputStream (outPdf )) {
204+ HtmlConverter .convertToPdf (fileInputStream , fileOutputStream , new ConverterProperties ().setBaseUri (baseUri ));
205+ }
206+ Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff12D_" ));
207+ }
208+
209+ @ Test
210+ @ LogMessages (messages = @ LogMessage (messageTemplate = LogMessageConstant .NO_WORKER_FOUND_FOR_TAG , count = 1 ))
211+ public void resourceResolverTest12E () throws IOException , InterruptedException {
212+ String baseUri = sourceFolder + "path%20with%20spaces/" ;
213+
214+ String outPdf = destinationFolder + "resourceResolverTest12E.pdf" ;
215+ String cmpPdf = sourceFolder + "cmp_resourceResolverTest12E.pdf" ;
216+ try (FileInputStream fileInputStream = new FileInputStream (sourceFolder + "resourceResolverTest12E.html" );
217+ FileOutputStream fileOutputStream = new FileOutputStream (outPdf )) {
218+ HtmlConverter .convertToPdf (fileInputStream , fileOutputStream , new ConverterProperties ().setBaseUri (baseUri ));
219+ }
220+ Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff12E_" ));
147221 }
148222
149223 @ Test
150- @ Ignore ( "DEVSIX-1668" )
151- public void resourceResolverTest14 () throws IOException , InterruptedException {
152- String baseUri = sourceFolder + "path%20with%20spaces " ;
224+ @ LogMessages ( messages = @ LogMessage ( messageTemplate = LogMessageConstant . NO_WORKER_FOUND_FOR_TAG , count = 1 ) )
225+ public void resourceResolverTest12F () throws IOException , InterruptedException {
226+ String baseUri = sourceFolder + "path%2520with%2520spaces/ " ;
153227
154- String outPdf = destinationFolder + "resourceResolverTest14 .pdf" ;
155- String cmpPdf = sourceFolder + "cmp_resourceResolverTest14 .pdf" ;
156- try (FileInputStream fileInputStream = new FileInputStream (sourceFolder + "resourceResolverTest12 .html" );
228+ String outPdf = destinationFolder + "resourceResolverTest12F .pdf" ;
229+ String cmpPdf = sourceFolder + "cmp_resourceResolverTest12F .pdf" ;
230+ try (FileInputStream fileInputStream = new FileInputStream (sourceFolder + "resourceResolverTest12F .html" );
157231 FileOutputStream fileOutputStream = new FileOutputStream (outPdf )) {
158232 HtmlConverter .convertToPdf (fileInputStream , fileOutputStream , new ConverterProperties ().setBaseUri (baseUri ));
159233 }
160- Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff14_" ));
234+ Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff12F_" ));
235+ }
236+
237+ @ Test
238+ public void resourceResolverTest13 () throws IOException , InterruptedException {
239+ String baseUri = sourceFolder ;
240+
241+ String outPdf = destinationFolder + "resourceResolverTest13.pdf" ;
242+ String cmpPdf = sourceFolder + "cmp_resourceResolverTest13.pdf" ;
243+ try (FileInputStream fileInputStream = new FileInputStream (sourceFolder + "resourceResolverTest13.html" );
244+ FileOutputStream fileOutputStream = new FileOutputStream (outPdf )) {
245+ HtmlConverter .convertToPdf (fileInputStream , fileOutputStream , new ConverterProperties ().setBaseUri (baseUri ));
246+ }
247+ Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff13_" ));
161248 }
162249
163250 @ Test
@@ -173,6 +260,62 @@ public void resourceResolverTest15() throws IOException, InterruptedException {
173260 Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff15_" ));
174261 }
175262
263+ @ Test
264+ @ LogMessages (messages = @ LogMessage (messageTemplate = LogMessageConstant .NO_WORKER_FOUND_FOR_TAG , count = 1 ))
265+ public void resourceResolverTest16A () throws IOException , InterruptedException {
266+ String baseUri = sourceFolder + "path/with/spaces/" ;
267+
268+ String outPdf = destinationFolder + "resourceResolverTest16A.pdf" ;
269+ String cmpPdf = sourceFolder + "cmp_resourceResolverTest16A.pdf" ;
270+ try (FileInputStream fileInputStream = new FileInputStream (sourceFolder + "resourceResolverTest16A.html" );
271+ FileOutputStream fileOutputStream = new FileOutputStream (outPdf )) {
272+ HtmlConverter .convertToPdf (fileInputStream , fileOutputStream , new ConverterProperties ().setBaseUri (baseUri ));
273+ }
274+ Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff16A_" ));
275+ }
276+
277+ @ Test
278+ @ LogMessages (messages = @ LogMessage (messageTemplate = LogMessageConstant .NO_WORKER_FOUND_FOR_TAG , count = 1 ))
279+ public void resourceResolverTest16B () throws IOException , InterruptedException {
280+ String baseUri = sourceFolder + "path%2Fwith%2Fspaces/" ;
281+
282+ String outPdf = destinationFolder + "resourceResolverTest16B.pdf" ;
283+ String cmpPdf = sourceFolder + "cmp_resourceResolverTest16B.pdf" ;
284+ try (FileInputStream fileInputStream = new FileInputStream (sourceFolder + "resourceResolverTest16B.html" );
285+ FileOutputStream fileOutputStream = new FileOutputStream (outPdf )) {
286+ HtmlConverter .convertToPdf (fileInputStream , fileOutputStream , new ConverterProperties ().setBaseUri (baseUri ));
287+ }
288+ Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff16B_" ));
289+ }
290+
291+ @ Test
292+ @ LogMessages (messages = @ LogMessage (messageTemplate = LogMessageConstant .NO_WORKER_FOUND_FOR_TAG , count = 1 ))
293+ public void resourceResolverTest16C () throws IOException , InterruptedException {
294+ String baseUri = sourceFolder + "path%252Fwith%252Fspaces/" ;
295+
296+ String outPdf = destinationFolder + "resourceResolverTest16C.pdf" ;
297+ String cmpPdf = sourceFolder + "cmp_resourceResolverTest16C.pdf" ;
298+ try (FileInputStream fileInputStream = new FileInputStream (sourceFolder + "resourceResolverTest16C.html" );
299+ FileOutputStream fileOutputStream = new FileOutputStream (outPdf )) {
300+ HtmlConverter .convertToPdf (fileInputStream , fileOutputStream , new ConverterProperties ().setBaseUri (baseUri ));
301+ }
302+ Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff16C_" ));
303+ }
304+
305+ @ Test
306+ @ LogMessages (messages = @ LogMessage (messageTemplate = LogMessageConstant .NO_WORKER_FOUND_FOR_TAG , count = 1 ))
307+ public void resourceResolverTest16D () throws IOException , InterruptedException {
308+ String baseUri = sourceFolder + "path%25252Fwith%25252Fspaces/" ;
309+
310+ String outPdf = destinationFolder + "resourceResolverTest16D.pdf" ;
311+ String cmpPdf = sourceFolder + "cmp_resourceResolverTest16D.pdf" ;
312+ try (FileInputStream fileInputStream = new FileInputStream (sourceFolder + "resourceResolverTest16D.html" );
313+ FileOutputStream fileOutputStream = new FileOutputStream (outPdf )) {
314+ HtmlConverter .convertToPdf (fileInputStream , fileOutputStream , new ConverterProperties ().setBaseUri (baseUri ));
315+ }
316+ Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff16D_" ));
317+ }
318+
176319 // TODO test with absolute http links for resources?
177320 // TODO test with http base URI?
178321}
0 commit comments