View Javadoc
1   package org.apache.maven.plugin.ejb;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.plugin.MojoExecutionException;
23  import org.apache.maven.plugin.ejb.stub.MavenProjectResourcesStub;
24  import org.apache.maven.plugin.ejb.utils.JarContentChecker;
25  import org.apache.maven.plugin.testing.AbstractMojoTestCase;
26  import org.apache.maven.project.MavenProject;
27  import org.codehaus.plexus.util.FileUtils;
28  
29  import java.io.File;
30  import java.io.IOException;
31  import java.util.LinkedList;
32  import java.util.jar.JarFile;
33  
34  
35  /**
36   * EJB plugin Test Case
37   */
38  
39  public class EjbMojoTest
40      extends AbstractMojoTestCase
41  {
42      static final String DEFAULT_POM_PATH = "target/test-classes/unit/ejbmojotest/plugin-config.xml";
43  
44      static final String DEFAULT_JAR_NAME = "testJar";
45  
46      public void setUp()
47          throws Exception
48      {
49          super.setUp();
50      }
51  
52      public void tearDown()
53          throws Exception
54      {
55  
56      }
57  
58      /**
59       * check test environment
60       *
61       * @throws Exception if any exception occurs
62       */
63      public void testTestEnvironment()
64          throws Exception
65      {
66          // Perform lookup on the Mojo to make sure everything is ok
67          lookupMojo();
68      }
69  
70      /**
71       * Basic jar creation test.
72       *
73       * @throws Exception if any exception occurs
74       */
75      public void testDefaultWithoutClientJar()
76          throws Exception
77      {
78          final MavenProjectResourcesStub project = createTestProject( "default-noclient" );
79          final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
80  
81          setupDefaultProject( project );
82  
83          setVariableValueToObject( mojo, "generateClient", Boolean.FALSE );
84          setVariableValueToObject( mojo, "ejbVersion", "2.1" );
85  
86          mojo.execute();
87  
88          assertJarCreation( project, true, false );
89      }
90  
91      /**
92       * Classified jar creation test.
93       *
94       * @throws Exception if any exception occurs
95       */
96      public void testClassifiedJarWithoutClientJar()
97          throws Exception
98      {
99          final MavenProjectResourcesStub project = createTestProject( "classified-noclient" );
100         final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
101 
102         setupDefaultProject( project );
103 
104         setVariableValueToObject( mojo, "generateClient", Boolean.FALSE );
105         setVariableValueToObject( mojo, "ejbVersion", "2.1" );
106         setVariableValueToObject( mojo, "classifier", "classified" );
107 
108         mojo.execute();
109 
110         assertJarCreation( project, true, false, "classified" );
111     }
112 
113     /**
114      * Basic jar creation test with client jar.
115      *
116      * @throws Exception if any exception occurs
117      */
118     public void testDefaultWithClientJar()
119         throws Exception
120     {
121         final MavenProjectResourcesStub project = createTestProject( "default-client" );
122         final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
123 
124         setupDefaultProject( project );
125 
126         setVariableValueToObject( mojo, "generateClient", Boolean.TRUE );
127         setVariableValueToObject( mojo, "ejbVersion", "2.1" );
128 
129         mojo.execute();
130 
131         assertJarCreation( project, true, true );
132     }
133 
134     /**
135      * Classified jar creation test with client jar.
136      *
137      * @throws Exception if any exception occurs
138      */
139     public void testClassifiedJarWithClientJar()
140         throws Exception
141     {
142         final MavenProjectResourcesStub project = createTestProject( "classified-client" );
143         final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
144 
145         setupDefaultProject( project );
146 
147         setVariableValueToObject( mojo, "generateClient", Boolean.TRUE );
148         setVariableValueToObject( mojo, "ejbVersion", "2.1" );
149         setVariableValueToObject( mojo, "classifier", "classified" );
150 
151         mojo.execute();
152 
153         assertJarCreation( project, true, true, "classified" );
154     }
155 
156     /**
157      * Default ejb jar inclusion and exclusion test.
158      *
159      * @throws Exception if any exception occurs
160      */
161     public void testDefaultInclusionsExclusions()
162         throws Exception
163     {
164 
165         final MavenProjectResourcesStub project = createTestProject( "includes-excludes-default" );
166         final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
167 
168         // put this on the target output dir
169         project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
170         project.addFile( "org/sample/ejb/AppBean.class", MavenProjectResourcesStub.OUTPUT_FILE );
171         project.addFile( "org/sample/ejb/AppCMP.class", MavenProjectResourcesStub.OUTPUT_FILE );
172         project.addFile( "org/sample/ejb/AppSession.class", MavenProjectResourcesStub.OUTPUT_FILE );
173 
174         // put this on the root dir
175         project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
176 
177         // start creating the environment
178         project.setupBuildEnvironment();
179 
180         setVariableValueToObject( mojo, "generateClient", Boolean.FALSE );
181         setVariableValueToObject( mojo, "ejbVersion", "2.1" );
182 
183         mojo.execute();
184 
185         assertJarCreation( project, true, false );
186         assertJarContent( project, new String[]{"META-INF/MANIFEST.MF", "META-INF/ejb-jar.xml",
187             "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
188             "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties", "org/sample/ejb/AppBean.class",
189             "org/sample/ejb/AppCMP.class", "org/sample/ejb/AppSession.class"}, null );
190     }
191 
192     /**
193      * Client jar default inclusion and exclusion test.
194      *
195      * @throws Exception if any exception occurs
196      */
197     public void testClientJarDefaultInclusionsExclusions()
198         throws Exception
199     {
200 
201         final MavenProjectResourcesStub project = createTestProject( "includes-excludes-client" );
202         final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
203 
204         // put this on the target output dir
205         project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
206         project.addFile( "org/sample/ejb/AppBean.class", MavenProjectResourcesStub.OUTPUT_FILE );
207         project.addFile( "org/sample/ejb/AppCMP.class", MavenProjectResourcesStub.OUTPUT_FILE );
208         project.addFile( "org/sample/ejb/AppSession.class", MavenProjectResourcesStub.OUTPUT_FILE );
209         project.addFile( "org/sample/ejb/AppStub.class", MavenProjectResourcesStub.OUTPUT_FILE );
210 
211         // put this on the root dir
212         project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
213 
214         // start creating the environment
215         project.setupBuildEnvironment();
216 
217         setVariableValueToObject( mojo, "generateClient", Boolean.TRUE );
218         setVariableValueToObject( mojo, "ejbVersion", "2.1" );
219 
220         mojo.execute();
221 
222         assertJarCreation( project, true, true );
223         assertClientJarContent( project, new String[]{"META-INF/MANIFEST.MF",
224             "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
225             "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties", "org/sample/ejb/AppStub.class"},
226                                          new String[]{"META-INF/ejb-jar.xml", "org/sample/ejb/AppBean.class",
227                                              "org/sample/ejb/AppCMP.class", "org/sample/ejb/AppSession.class"} );
228     }
229 
230     /**
231      * Client jar inclusion test.
232      *
233      * @throws Exception if any exception occurs
234      */
235     public void testClientJarInclusions()
236         throws Exception
237     {
238         final LinkedList inclusions = new LinkedList();
239         inclusions.add( "**/*Include.class" );
240 
241         final MavenProjectResourcesStub project = createTestProject( "client-includes" );
242         final EjbMojo mojo = lookupMojoWithSettings( project, inclusions, new LinkedList(), null );
243 
244         // put this on the target output dir
245         project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
246         project.addFile( "org/sample/ejb/AppInclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
247         project.addFile( "org/sample/ejb/AppExclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
248 
249         // put this on the root dir
250         project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
251 
252         // start creating the environment
253         project.setupBuildEnvironment();
254 
255         setVariableValueToObject( mojo, "generateClient", Boolean.TRUE );
256         setVariableValueToObject( mojo, "ejbVersion", "2.1" );
257 
258         mojo.execute();
259 
260         assertJarCreation( project, true, true );
261         assertClientJarContent( project, new String[]{"META-INF/MANIFEST.MF",
262             "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
263             "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties", "org/sample/ejb/AppInclude.class"},
264                                          new String[]{"META-INF/ejb-jar.xml", "org/sample/ejb/AppExclude.class"} );
265     }
266 
267     /**
268      * Client jar exclusions test.
269      *
270      * @throws Exception if any exception occurs
271      */
272     public void testClientJarExclusions()
273         throws Exception
274     {
275 
276         final LinkedList exclusions = new LinkedList();
277         exclusions.add( "**/*Exclude.class" );
278 
279         final MavenProjectResourcesStub project = createTestProject( "client-excludes" );
280         final EjbMojo mojo = lookupMojoWithSettings( project, new LinkedList(), exclusions, null );
281 
282         // put this on the target output dir
283         project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
284         project.addFile( "org/sample/ejb/AppInclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
285         project.addFile( "org/sample/ejb/AppExclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
286 
287         // put this on the root dir
288         project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
289 
290         // start creating the environment
291         project.setupBuildEnvironment();
292 
293         setVariableValueToObject( mojo, "generateClient", Boolean.TRUE );
294         setVariableValueToObject( mojo, "ejbVersion", "2.1" );
295 
296         mojo.execute();
297 
298         assertJarCreation( project, true, true );
299         assertClientJarContent( project, new String[]{"META-INF/MANIFEST.MF",
300             "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
301             "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties", "org/sample/ejb/AppInclude.class"},
302                                          new String[]{"META-INF/ejb-jar.xml", "org/sample/ejb/AppExclude.class"} );
303 
304     }
305 
306 
307     /**
308      * Main jar exclusions test.
309      *
310      * @throws Exception if any exception occurs
311      */
312     public void testMainJarExclusions()
313         throws Exception
314     {
315         final LinkedList exclusions = new LinkedList();
316         exclusions.add( "**/*Exclude.class" );
317 
318         final MavenProjectResourcesStub project = createTestProject( "main-excludes" );
319         final EjbMojo mojo = lookupMojoWithSettings( project, new LinkedList(), new LinkedList(), exclusions );
320 
321         // put this on the target output dir
322         project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
323         project.addFile( "org/sample/ejb/AppInclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
324         project.addFile( "org/sample/ejb/AppExclude.class", MavenProjectResourcesStub.OUTPUT_FILE );
325 
326         // put this on the root dir
327         project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
328 
329         // start creating the environment
330         project.setupBuildEnvironment();
331 
332         setVariableValueToObject( mojo, "generateClient", Boolean.TRUE );
333         setVariableValueToObject( mojo, "ejbVersion", "2.1" );
334 
335         mojo.execute();
336 
337         assertJarCreation( project, true, true );
338         assertJarContent( project, new String[]{"META-INF/MANIFEST.MF",
339             "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
340             "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties", "org/sample/ejb/AppInclude.class"},
341                           new String[]{"META-INF/ejb-jar.xml", "org/sample/ejb/AppExclude.class"} );
342 
343     }
344 
345 
346     /**
347      * Client jar inclusion test with a sub-package.
348      *
349      * @throws Exception if any exception occurs
350      */
351     public void testClientJarInclusionsWithSubPackage()
352         throws Exception
353     {
354         final LinkedList inclusions = new LinkedList();
355         inclusions.add( "org/sample/ejb/*.class" );
356 
357         final MavenProjectResourcesStub project = createTestProject( "client-includes-subpackage" );
358         final EjbMojo mojo = lookupMojoWithSettings( project, inclusions, new LinkedList(), null );
359 
360         // put this on the target output dir
361         project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
362         project.addFile( "org/sample/ejb/App.class", MavenProjectResourcesStub.OUTPUT_FILE );
363         project.addFile( "org/sample/ejb/impl/AppImpl.class", MavenProjectResourcesStub.OUTPUT_FILE );
364 
365         // put this on the root dir
366         project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
367 
368         // start creating the environment
369         project.setupBuildEnvironment();
370 
371         setVariableValueToObject( mojo, "generateClient", Boolean.TRUE );
372         setVariableValueToObject( mojo, "ejbVersion", "2.1" );
373 
374         mojo.execute();
375 
376         assertJarCreation( project, true, true );
377         assertClientJarContent( project, new String[]{"META-INF/MANIFEST.MF",
378             "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
379             "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties", "org/sample/ejb/App.class"},
380                                          new String[]{"META-INF/ejb-jar.xml", "org/sample/ejb/impl/AppImpl.class",
381                                              "org/sample/ejb/impl"} );
382     }
383 
384 
385     /**
386      * Client jar exclusions test that leaves an empty package.
387      *
388      * @throws Exception if any exception occurs
389      */
390     public void testClientJarExclusionsWithEmptyPackage()
391         throws Exception
392     {
393 
394         final LinkedList exclusions = new LinkedList();
395         exclusions.add( "org/sample/ejb/**" );
396 
397         final MavenProjectResourcesStub project = createTestProject( "client-excludes-emptypackage" );
398         final EjbMojo mojo = lookupMojoWithSettings( project, new LinkedList(), exclusions, null );
399 
400         // put this on the target output dir
401         project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
402         project.addFile( "org/sample/ejb/AppOne.class", MavenProjectResourcesStub.OUTPUT_FILE );
403         project.addFile( "org/sample/ejb2/AppTwo.class", MavenProjectResourcesStub.OUTPUT_FILE );
404 
405         // put this on the root dir
406         project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
407 
408         // start creating the environment
409         project.setupBuildEnvironment();
410 
411         setVariableValueToObject( mojo, "generateClient", Boolean.TRUE );
412         setVariableValueToObject( mojo, "ejbVersion", "2.1" );
413 
414         mojo.execute();
415 
416         assertJarCreation( project, true, true );
417 
418         // We check that the created jar does not contain the org/sample/ejb package empty
419         assertClientJarContent( project, new String[]{"META-INF/MANIFEST.MF",
420             "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.xml",
421             "META-INF/maven/org.apache.maven.test/maven-test-plugin/pom.properties", "org/sample/ejb2/AppTwo.class"},
422                                          new String[]{"META-INF/ejb-jar.xml", "org/sample/ejb/AppOne.class",
423                                              "org/sample/ejb"} );
424 
425     }
426 
427     /**
428      * Tests if the mojo throws an exception when the EJB version is < 3.0
429      * and no deployment descriptor is present. The case with deployment descriptor
430      * present is covered by previous tests.
431      *
432      * @throws Exception if any exception occurs
433      */
434     public void testEjbComplianceVersionTwoDotOneWithoutDescriptor()
435         throws Exception
436     {
437         final MavenProjectResourcesStub project = createTestProject( "compliance-nodescriptor-2.1" );
438         final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
439 
440         // put this on the root dir
441         project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
442 
443         // start creating the environment
444         project.setupBuildEnvironment();
445 
446         setVariableValueToObject( mojo, "generateClient", Boolean.FALSE );
447         setVariableValueToObject( mojo, "ejbVersion", "2.1" );
448 
449         try
450         {
451             mojo.execute();
452             fail( "Exception should be thrown: No deployment descriptor present." );
453         }
454         catch ( MojoExecutionException e )
455         {
456             // OK
457         }
458     }
459 
460     /**
461      * Tests if the jar is created under EJB version 3.0 with
462      * deployment descriptor present.
463      *
464      * @throws Exception if any exception occurs
465      */
466     public void testEjbComplianceVersionThreeWithDescriptor()
467         throws Exception
468     {
469 
470         final MavenProjectResourcesStub project = createTestProject( "compliance-descriptor-3" );
471         final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
472 
473         // put this on the target dir
474         project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
475 
476         // put this on the root dir
477         project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
478 
479         // start creating the environment
480         project.setupBuildEnvironment();
481 
482         setVariableValueToObject( mojo, "generateClient", Boolean.FALSE );
483         setVariableValueToObject( mojo, "ejbVersion", "3.0" );
484 
485         mojo.execute();
486 
487         assertJarCreation( project, true, false );
488 
489     }
490 
491     /**
492      * Tests if the jar is created under EJB version 3.0 without
493      * deployment descriptor present.
494      *
495      * @throws Exception if any exception occurs
496      */
497     public void testEjbCompliance_3_0_WithoutDescriptor()
498         throws Exception
499     {
500         final MavenProjectResourcesStub project = createTestProject( "compliance-nodescriptor-3" );
501         final EjbMojo mojo = lookupMojoWithDefaultSettings( project );
502 
503         // put this on the root dir
504         project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
505 
506         // start creating the environment
507         project.setupBuildEnvironment();
508 
509         setVariableValueToObject( mojo, "generateClient", Boolean.FALSE );
510         setVariableValueToObject( mojo, "ejbVersion", "3.0" );
511 
512         mojo.execute();
513 
514         assertJarCreation( project, true, false );
515     }
516 
517 
518     protected EjbMojo lookupMojo()
519         throws Exception
520     {
521         File pomFile = new File( getBasedir(), DEFAULT_POM_PATH );
522         EjbMojo mojo = (EjbMojo) lookupMojo( "ejb", pomFile );
523 
524         assertNotNull( mojo );
525 
526         return mojo;
527     }
528 
529     protected MavenProjectResourcesStub createTestProject( final String testName )
530         throws Exception
531     {
532         // this will automatically create the isolated
533         // test environment
534         return new MavenProjectResourcesStub( testName );
535     }
536 
537     protected void setupDefaultProject( final MavenProjectResourcesStub project )
538         throws Exception
539     {
540         // put this on the target dir
541         project.addFile( "META-INF/ejb-jar.xml", MavenProjectResourcesStub.OUTPUT_FILE );
542         // put this on the root dir
543         project.addFile( "pom.xml", MavenProjectResourcesStub.ROOT_FILE );
544         // start creating the environment
545         project.setupBuildEnvironment();
546 
547     }
548 
549     protected EjbMojo lookupMojoWithSettings( final MavenProject project, LinkedList clientIncludes,
550                                               LinkedList clientExcludes, LinkedList excludes )
551         throws Exception
552     {
553         final EjbMojo mojo = lookupMojo();
554         setVariableValueToObject( mojo, "project", project );
555         setVariableValueToObject( mojo, "basedir", new File( project.getBuild().getDirectory() ) );
556         setVariableValueToObject( mojo, "outputDirectory", new File( project.getBuild().getOutputDirectory() ) );
557         setVariableValueToObject( mojo, "jarName", DEFAULT_JAR_NAME );
558         setVariableValueToObject( mojo, "clientExcludes", clientExcludes );
559         setVariableValueToObject( mojo, "clientIncludes", clientIncludes );
560         setVariableValueToObject( mojo, "excludes", excludes );
561 
562         return mojo;
563     }
564 
565     protected EjbMojo lookupMojoWithDefaultSettings( final MavenProject project )
566         throws Exception
567     {
568         return lookupMojoWithSettings( project, new LinkedList(), new LinkedList(), null );
569     }
570 
571 
572     protected void assertJarCreation( final MavenProject project, boolean ejbJarCreated, boolean ejbClientJarCreated,
573                                       String classifier )
574     {
575         String checkedJarFile;
576         String checkedClientJarFile;
577 
578         if ( classifier == null )
579         {
580             checkedJarFile = project.getBuild().getDirectory() + "/" + DEFAULT_JAR_NAME + ".jar";
581             checkedClientJarFile = project.getBuild().getDirectory() + "/" + DEFAULT_JAR_NAME + "-client.jar";
582         }
583         else
584         {
585             checkedJarFile = project.getBuild().getDirectory() + "/" + DEFAULT_JAR_NAME + "-" + classifier + ".jar";
586             checkedClientJarFile = project.getBuild().getDirectory() + "/" + DEFAULT_JAR_NAME + "-" + classifier + "-client.jar";
587         }
588 
589         assertEquals( "Invalid value for ejb-jar creation", ejbJarCreated, FileUtils.fileExists( checkedJarFile ) );
590         assertEquals( "Invalid value for ejb-jar client creation", ejbClientJarCreated,
591                       FileUtils.fileExists( checkedClientJarFile ) );
592 
593     }
594 
595     protected void assertJarCreation( final MavenProject project, boolean ejbJarCreated, boolean ejbClientJarCreated )
596     {
597         assertJarCreation( project, ejbJarCreated, ejbClientJarCreated, null );
598 
599     }
600 
601     private void doAssertJarContent( final MavenProject project, final String fileName, final String[] expectedFiles,
602                                      final String[] unexpectedFiles )
603         throws IOException
604     {
605         String checkedJarFile = project.getBuild().getDirectory() + "/" + fileName;
606         if ( expectedFiles != null )
607         {
608             final JarContentChecker inclusionChecker = new JarContentChecker();
609 
610             // set expected jar contents
611             for (String expectedFile : expectedFiles) {
612                 inclusionChecker.addFile(new File(expectedFile));
613             }
614             assertTrue( inclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
615         }
616         if ( unexpectedFiles != null )
617         {
618             final JarContentChecker exclusionChecker = new JarContentChecker();
619             for (String unexpectedFile : unexpectedFiles) {
620                 exclusionChecker.addFile(new File(unexpectedFile));
621             }
622             assertFalse( exclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
623         }
624 
625 
626     }
627 
628     protected void assertJarContent( final MavenProject project, final String[] expectedFiles,
629                                      final String[] unexpectedFiles )
630         throws IOException
631     {
632 
633         doAssertJarContent( project, DEFAULT_JAR_NAME + ".jar", expectedFiles, unexpectedFiles );
634     }
635 
636     protected void assertClientJarContent( final MavenProject project, final String[] expectedFiles,
637                                            final String[] unexpectedFiles )
638         throws IOException
639     {
640 
641         doAssertJarContent( project, DEFAULT_JAR_NAME + "-client.jar", expectedFiles, unexpectedFiles );
642 
643     }
644 }