1 package org.apache.maven.plugins.war;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.io.IOException;
24 import java.util.Enumeration;
25 import java.util.HashMap;
26 import java.util.LinkedList;
27 import java.util.Map;
28 import java.util.jar.JarEntry;
29 import java.util.jar.JarFile;
30
31 import org.apache.maven.artifact.Artifact;
32 import org.apache.maven.artifact.handler.ArtifactHandler;
33 import org.apache.maven.plugin.MojoExecutionException;
34 import org.apache.maven.plugins.war.stub.JarArtifactStub;
35 import org.apache.maven.plugins.war.stub.MavenProject4CopyConstructor;
36 import org.apache.maven.plugins.war.stub.MavenProjectArtifactsStub;
37 import org.apache.maven.plugins.war.stub.ProjectHelperStub;
38 import org.apache.maven.plugins.war.stub.WarArtifact4CCStub;
39 import org.codehaus.plexus.util.IOUtil;
40
41
42
43
44 public class WarMojoTest
45 extends AbstractWarMojoTest
46 {
47 WarMojo mojo;
48
49 private static File pomFile = new File( getBasedir(),
50 "target/test-classes/unit/warmojotest/plugin-config-primary-artifact.xml" );
51
52 protected File getTestDirectory()
53 {
54 return new File( getBasedir(), "target/test-classes/unit/warmojotest" );
55 }
56
57 public void setUp()
58 throws Exception
59 {
60 super.setUp();
61 mojo = (WarMojo) lookupMojo( "war", pomFile );
62 }
63
64 public void testEnvironment()
65 throws Exception
66 {
67
68 }
69
70 public void testSimpleWar()
71 throws Exception
72 {
73 String testId = "SimpleWar";
74 MavenProject4CopyConstructor project = new MavenProject4CopyConstructor();
75 String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output";
76 File webAppDirectory = new File( getTestDirectory(), testId );
77 WarArtifact4CCStub warArtifact = new WarArtifact4CCStub( getBasedir() );
78 String warName = "simple";
79 File webAppSource = createWebAppSource( testId );
80 File classesDir = createClassesDir( testId, true );
81 File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } );
82
83 project.setArtifact( warArtifact );
84 this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
85 setVariableValueToObject( mojo, "outputDirectory", outputDir );
86 setVariableValueToObject( mojo, "warName", warName );
87 mojo.setWebXml( new File( xmlSource, "web.xml" ) );
88
89 mojo.execute();
90
91
92 File expectedJarFile = new File( outputDir, "simple.war" );
93 assertJarContent( expectedJarFile, new String[] { "META-INF/MANIFEST.MF", "WEB-INF/web.xml", "pansit.jsp",
94 "org/web/app/last-exile.jsp", "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.xml",
95 "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" }, new String[] { null,
96 mojo.getWebXml().toString(), null, null, null, null } );
97 }
98
99 public void testSimpleWarPackagingExcludeWithIncludesRegEx()
100 throws Exception
101 {
102 String testId = "SimpleWarPackagingExcludeWithIncludesRegEx";
103 MavenProject4CopyConstructor project = new MavenProject4CopyConstructor();
104 String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output";
105 File webAppDirectory = new File( getTestDirectory(), testId );
106 WarArtifact4CCStub warArtifact = new WarArtifact4CCStub( getBasedir() );
107 String warName = "simple";
108 File webAppSource = createWebAppSource( testId );
109 File classesDir = createClassesDir( testId, true );
110 File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } );
111
112 project.setArtifact( warArtifact );
113 this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
114 setVariableValueToObject( mojo, "outputDirectory", outputDir );
115 setVariableValueToObject( mojo, "warName", warName );
116 mojo.setWebXml( new File( xmlSource, "web.xml" ) );
117 setVariableValueToObject( mojo, "packagingIncludes", "%regex[(.(?!exile))+]" );
118
119
120 mojo.execute();
121
122
123 File expectedJarFile = new File( outputDir, "simple.war" );
124 assertJarContent( expectedJarFile, new String[] { "META-INF/MANIFEST.MF", "WEB-INF/web.xml", "pansit.jsp",
125 "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.xml",
126 "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" }, new String[] { null,
127 mojo.getWebXml().toString(), null, null, null, }, new String[] { "org/web/app/last-exile.jsp" } );
128 }
129
130 public void testClassifier()
131 throws Exception
132 {
133 String testId = "Classifier";
134 MavenProject4CopyConstructor project = new MavenProject4CopyConstructor();
135 String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output";
136 File webAppDirectory = new File( getTestDirectory(), testId );
137 WarArtifact4CCStub warArtifact = new WarArtifact4CCStub( getBasedir() );
138 ProjectHelperStub projectHelper = new ProjectHelperStub();
139 String warName = "simple";
140 File webAppSource = createWebAppSource( testId );
141 File classesDir = createClassesDir( testId, true );
142 File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } );
143
144 project.setArtifact( warArtifact );
145 this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
146 setVariableValueToObject( mojo, "projectHelper", projectHelper );
147 setVariableValueToObject( mojo, "classifier", "test-classifier" );
148 setVariableValueToObject( mojo, "outputDirectory", outputDir );
149 setVariableValueToObject( mojo, "warName", warName );
150 mojo.setWebXml( new File( xmlSource, "web.xml" ) );
151
152 mojo.execute();
153
154
155 File expectedJarFile = new File( outputDir, "simple-test-classifier.war" );
156 assertJarContent( expectedJarFile, new String[] { "META-INF/MANIFEST.MF", "WEB-INF/web.xml", "pansit.jsp",
157 "org/web/app/last-exile.jsp", "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.xml",
158 "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" }, new String[] { null,
159 mojo.getWebXml().toString(), null, null, null, null } );
160 }
161
162 public void testPrimaryArtifact()
163 throws Exception
164 {
165 String testId = "PrimaryArtifact";
166 MavenProject4CopyConstructor project = new MavenProject4CopyConstructor();
167 String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output";
168 File webAppDirectory = new File( getTestDirectory(), testId );
169 WarArtifact4CCStub warArtifact = new WarArtifact4CCStub( getBasedir() );
170 ProjectHelperStub projectHelper = new ProjectHelperStub();
171 String warName = "simple";
172 File webAppSource = createWebAppSource( testId );
173 File classesDir = createClassesDir( testId, true );
174 File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } );
175
176 warArtifact.setFile( new File( "error.war" ) );
177 project.setArtifact( warArtifact );
178 this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
179 setVariableValueToObject( mojo, "projectHelper", projectHelper );
180 setVariableValueToObject( mojo, "outputDirectory", outputDir );
181 setVariableValueToObject( mojo, "warName", warName );
182 mojo.setWebXml( new File( xmlSource, "web.xml" ) );
183
184 mojo.execute();
185
186
187 File expectedJarFile = new File( outputDir, "simple.war" );
188 assertJarContent( expectedJarFile, new String[] { "META-INF/MANIFEST.MF", "WEB-INF/web.xml", "pansit.jsp",
189 "org/web/app/last-exile.jsp", "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.xml",
190 "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" }, new String[] { null,
191 mojo.getWebXml().toString(), null, null, null, null } );
192 }
193
194 public void testNotPrimaryArtifact()
195 throws Exception
196 {
197
198 File pom = new File( getBasedir(), "target/test-classes/unit/warmojotest/not-primary-artifact.xml" );
199 mojo = (WarMojo) lookupMojo( "war", pom );
200
201 String testId = "NotPrimaryArtifact";
202 MavenProject4CopyConstructor project = new MavenProject4CopyConstructor();
203 String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output";
204 File webAppDirectory = new File( getTestDirectory(), testId );
205 WarArtifact4CCStub warArtifact = new WarArtifact4CCStub( getBasedir() );
206 ProjectHelperStub projectHelper = new ProjectHelperStub();
207 String warName = "simple";
208 File webAppSource = createWebAppSource( testId );
209 File classesDir = createClassesDir( testId, true );
210 File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } );
211
212 warArtifact.setFile( new File( "error.war" ) );
213 project.setArtifact( warArtifact );
214 this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
215 setVariableValueToObject( mojo, "projectHelper", projectHelper );
216 setVariableValueToObject( mojo, "outputDirectory", outputDir );
217 setVariableValueToObject( mojo, "warName", warName );
218 mojo.setWebXml( new File( xmlSource, "web.xml" ) );
219
220 mojo.execute();
221
222
223 File expectedJarFile = new File( outputDir, "simple.war" );
224 assertJarContent( expectedJarFile, new String[] { "META-INF/MANIFEST.MF", "WEB-INF/web.xml", "pansit.jsp",
225 "org/web/app/last-exile.jsp", "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.xml",
226 "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" }, new String[] { null,
227 mojo.getWebXml().toString(), null, null, null, null } );
228 }
229
230 public void testMetaInfContent()
231 throws Exception
232 {
233 String testId = "SimpleWarWithMetaInfContent";
234 MavenProject4CopyConstructor project = new MavenProject4CopyConstructor();
235 String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output";
236 File webAppDirectory = new File( getTestDirectory(), testId );
237 WarArtifact4CCStub warArtifact = new WarArtifact4CCStub( getBasedir() );
238 String warName = "simple";
239 File webAppSource = createWebAppSource( testId );
240 File classesDir = createClassesDir( testId, true );
241 File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } );
242
243
244 final File configFile = new File( webAppSource, "META-INF/config.xml" );
245 createFile( configFile, "<config></config>" );
246
247 project.setArtifact( warArtifact );
248 this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
249 setVariableValueToObject( mojo, "outputDirectory", outputDir );
250 setVariableValueToObject( mojo, "warName", warName );
251 mojo.setWebXml( new File( xmlSource, "web.xml" ) );
252
253 mojo.execute();
254
255
256 File expectedJarFile = new File( outputDir, "simple.war" );
257 assertJarContent( expectedJarFile, new String[] { "META-INF/MANIFEST.MF", "META-INF/config.xml",
258 "WEB-INF/web.xml", "pansit.jsp", "org/web/app/last-exile.jsp",
259 "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.xml",
260 "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" }, new String[] { null, null,
261 mojo.getWebXml().toString(), null, null, null, null } );
262 }
263
264 public void testMetaInfContentWithContainerConfig()
265 throws Exception
266 {
267 String testId = "SimpleWarWithContainerConfig";
268 MavenProject4CopyConstructor project = new MavenProject4CopyConstructor();
269 String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output";
270 File webAppDirectory = new File( getTestDirectory(), testId );
271 WarArtifact4CCStub warArtifact = new WarArtifact4CCStub( getBasedir() );
272 String warName = "simple";
273 File webAppSource = createWebAppSource( testId );
274 File classesDir = createClassesDir( testId, true );
275 File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } );
276
277
278 final File configFile = new File( webAppSource, "META-INF/config.xml" );
279 createFile( configFile, "<config></config>" );
280
281 project.setArtifact( warArtifact );
282 this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
283 setVariableValueToObject( mojo, "outputDirectory", outputDir );
284 setVariableValueToObject( mojo, "warName", warName );
285 mojo.setWebXml( new File( xmlSource, "web.xml" ) );
286 mojo.setContainerConfigXML( configFile );
287
288 mojo.execute();
289
290
291 File expectedJarFile = new File( outputDir, "simple.war" );
292 assertJarContent( expectedJarFile, new String[] { "META-INF/MANIFEST.MF", "META-INF/config.xml",
293 "WEB-INF/web.xml", "pansit.jsp", "org/web/app/last-exile.jsp",
294 "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.xml",
295 "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" }, new String[] { null, null,
296 mojo.getWebXml().toString(), null, null, null, null } );
297 }
298
299 public void testFailOnMissingWebXmlFalse()
300 throws Exception
301 {
302
303 String testId = "SimpleWarMissingWebXmlFalse";
304 MavenProject4CopyConstructor project = new MavenProject4CopyConstructor();
305 String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output";
306 File webAppDirectory = new File( getTestDirectory(), testId );
307 WarArtifact4CCStub warArtifact = new WarArtifact4CCStub( getBasedir() );
308 String warName = "simple";
309 File webAppSource = createWebAppSource( testId );
310 File classesDir = createClassesDir( testId, true );
311
312 project.setArtifact( warArtifact );
313 this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
314 setVariableValueToObject( mojo, "outputDirectory", outputDir );
315 setVariableValueToObject( mojo, "warName", warName );
316 mojo.setFailOnMissingWebXml( false );
317 mojo.execute();
318
319
320 File expectedJarFile = new File( outputDir, "simple.war" );
321 final Map<String, JarEntry> jarContent =
322 assertJarContent( expectedJarFile, new String[] { "META-INF/MANIFEST.MF", "pansit.jsp",
323 "org/web/app/last-exile.jsp", "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.xml",
324 "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" }, new String[] { null, null,
325 null, null, null } );
326
327 assertFalse( "web.xml should be missing", jarContent.containsKey( "WEB-INF/web.xml" ) );
328 }
329
330 public void testFailOnMissingWebXmlTrue()
331 throws Exception
332 {
333
334 String testId = "SimpleWarMissingWebXmlTrue";
335 MavenProject4CopyConstructor project = new MavenProject4CopyConstructor();
336 String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output";
337 File webAppDirectory = new File( getTestDirectory(), testId );
338 WarArtifact4CCStub warArtifact = new WarArtifact4CCStub( getBasedir() );
339 String warName = "simple";
340 File webAppSource = createWebAppSource( testId );
341 File classesDir = createClassesDir( testId, true );
342
343 project.setArtifact( warArtifact );
344 this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
345 setVariableValueToObject( mojo, "outputDirectory", outputDir );
346 setVariableValueToObject( mojo, "warName", warName );
347 mojo.setFailOnMissingWebXml( true );
348
349 try
350 {
351 mojo.execute();
352 fail( "Building of the war isn't possible because web.xml is missing" );
353 }
354 catch ( MojoExecutionException e )
355 {
356
357 }
358 }
359
360 public void testFailOnMissingWebXmlNotSpecifiedAndServlet30Used()
361 throws Exception
362 {
363 String testId = "SimpleWarUnderServlet30";
364 MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
365 String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output";
366 File webAppDirectory = new File( getTestDirectory(), testId );
367 WarArtifact4CCStub warArtifact = new WarArtifact4CCStub( getBasedir() );
368 String warName = "simple";
369 File webAppSource = createWebAppSource( testId );
370 File classesDir = createClassesDir( testId, true );
371
372 final ArtifactHandler artifactHandler = (ArtifactHandler) lookup( ArtifactHandler.ROLE, "jar" );
373 JarArtifactStub jarArtifactStub = new JarArtifactStub( getBasedir(), artifactHandler );
374 jarArtifactStub.setFile( new File( getBasedir(),
375 "/target/test-classes/unit/sample_wars/javax.servlet-api-3.0.1.jar" ) );
376 jarArtifactStub.setScope( Artifact.SCOPE_PROVIDED );
377 project.addArtifact( jarArtifactStub );
378
379 project.setArtifact( warArtifact );
380 project.setFile( warArtifact.getFile() );
381 this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
382 setVariableValueToObject( mojo, "outputDirectory", outputDir );
383 setVariableValueToObject( mojo, "warName", warName );
384
385 mojo.execute();
386
387
388 File expectedWarFile = new File( outputDir, "simple.war" );
389 final Map<String, JarEntry> jarContent =
390 assertJarContent( expectedWarFile,
391 new String[] { "META-INF/MANIFEST.MF", "pansit.jsp", "org/web/app/last-exile.jsp",
392 "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.xml",
393 "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" },
394 new String[] { null, null, null, null, null } );
395
396 assertFalse( "web.xml should be missing", jarContent.containsKey( "WEB-INF/web.xml" ) );
397 }
398
399 public void testFailOnMissingWebXmlNotSpecifiedAndServlet30NotUsed()
400 throws Exception
401 {
402 String testId = "SimpleWarNotUnderServlet30";
403 MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
404 String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output";
405 File webAppDirectory = new File( getTestDirectory(), testId );
406 WarArtifact4CCStub warArtifact = new WarArtifact4CCStub( getBasedir() );
407 String warName = "simple";
408 File webAppSource = createWebAppSource( testId );
409 File classesDir = createClassesDir( testId, true );
410
411 project.setArtifact( warArtifact );
412 project.setFile( warArtifact.getFile() );
413 this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
414 setVariableValueToObject( mojo, "outputDirectory", outputDir );
415 setVariableValueToObject( mojo, "warName", warName );
416
417 try
418 {
419 mojo.execute();
420 fail( "Building of the war isn't possible because no 'failOnMissingWebXml' policy was set and the project "
421 + "does not depend on Servlet 3.0" );
422 }
423 catch ( MojoExecutionException e )
424 {
425
426 }
427 }
428
429 public void testAttachClasses()
430 throws Exception
431 {
432 String testId = "AttachClasses";
433 MavenProject4CopyConstructor project = new MavenProject4CopyConstructor();
434 String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output";
435 File webAppDirectory = new File( getTestDirectory(), testId );
436 WarArtifact4CCStub warArtifact = new WarArtifact4CCStub( getBasedir() );
437 String warName = "simple";
438 File webAppSource = createWebAppSource( testId );
439 File classesDir = createClassesDir( testId, false );
440 File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } );
441
442 project.setArtifact( warArtifact );
443 this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
444 setVariableValueToObject( mojo, "outputDirectory", outputDir );
445 setVariableValueToObject( mojo, "warName", warName );
446 mojo.setWebXml( new File( xmlSource, "web.xml" ) );
447 mojo.setAttachClasses( true );
448 mojo.setClassesClassifier( "classes" );
449
450 mojo.execute();
451
452
453 File expectedJarFile = new File( outputDir, "simple-classes.jar" );
454 assertJarContent( expectedJarFile, new String[] { "META-INF/MANIFEST.MF", "sample-servlet.class" },
455 new String[] { null, null } );
456 }
457
458 public void testAttachClassesWithCustomClassifier()
459 throws Exception
460 {
461 String testId = "AttachClassesCustomClassifier";
462 MavenProject4CopyConstructor project = new MavenProject4CopyConstructor();
463 String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output";
464 File webAppDirectory = new File( getTestDirectory(), testId );
465 WarArtifact4CCStub warArtifact = new WarArtifact4CCStub( getBasedir() );
466 String warName = "simple";
467 File webAppSource = createWebAppSource( testId );
468 File classesDir = createClassesDir( testId, false );
469 File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } );
470
471 project.setArtifact( warArtifact );
472 this.configureMojo( mojo, new LinkedList<String>(), classesDir, webAppSource, webAppDirectory, project );
473 setVariableValueToObject( mojo, "outputDirectory", outputDir );
474 setVariableValueToObject( mojo, "warName", warName );
475 mojo.setWebXml( new File( xmlSource, "web.xml" ) );
476 mojo.setAttachClasses( true );
477 mojo.setClassesClassifier( "mystuff" );
478
479 mojo.execute();
480
481
482 File expectedJarFile = new File( outputDir, "simple-mystuff.jar" );
483 assertJarContent( expectedJarFile, new String[] { "META-INF/MANIFEST.MF", "sample-servlet.class" },
484 new String[] { null, null } );
485 }
486
487 protected Map<String, JarEntry> assertJarContent( final File expectedJarFile, final String[] files,
488 final String[] filesContent )
489 throws IOException
490 {
491 return assertJarContent( expectedJarFile, files, filesContent, null );
492 }
493
494 protected Map<String, JarEntry> assertJarContent( final File expectedJarFile, final String[] files,
495 final String[] filesContent, final String[] mustNotBeInJar )
496 throws IOException
497 {
498
499 assertEquals( "Could not test, files and filesContent length does not match", files.length, filesContent.length );
500
501 assertTrue( "war file not created: " + expectedJarFile.toString(), expectedJarFile.exists() );
502 final Map<String, JarEntry> jarContent = new HashMap<>();
503 try ( JarFile jarFile = new JarFile( expectedJarFile ) ) {
504 Enumeration<JarEntry> enumeration = jarFile.entries();
505 while ( enumeration.hasMoreElements() )
506 {
507 JarEntry entry = enumeration.nextElement();
508 Object previousValue = jarContent.put( entry.getName(), entry );
509 assertNull( "Duplicate Entry in Jar File: " + entry.getName(), previousValue );
510 }
511
512 for ( int i = 0; i < files.length; i++ )
513 {
514 String file = files[i];
515
516 assertTrue( "File[" + file + "] not found in archive", jarContent.containsKey( file ) );
517 if ( filesContent[i] != null )
518 {
519 assertEquals( "Content of file[" + file + "] does not match", filesContent[i],
520 IOUtil.toString( jarFile.getInputStream( jarContent.get( file ) ) ) );
521 }
522 }
523 if ( mustNotBeInJar != null )
524 {
525 for ( String file : mustNotBeInJar )
526 {
527 assertFalse( "File[" + file + "] found in archive", jarContent.containsKey( file ) );
528
529 }
530 }
531 return jarContent;
532 }
533 }
534
535 }