View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.plugins.ear.it;
20  
21  import java.io.File;
22  import java.io.FileInputStream;
23  import java.nio.file.Files;
24  import java.util.jar.JarFile;
25  import java.util.jar.Manifest;
26  
27  import org.codehaus.plexus.util.FileUtils;
28  
29  /**
30   * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
31   */
32  public class EarMojoIT extends AbstractEarPluginIT {
33  
34      /**
35       * Builds an EAR with a single EJB and no configuration.
36       */
37      public void testProject001() throws Exception {
38          doTestProject("project-001", new String[] {"eartest-ejb-sample-one-1.0.jar"});
39      }
40  
41      /**
42       * Builds an EAR with a customized artifact location and a customized artifact name.
43       */
44      public void testProject002() throws Exception {
45          doTestProject("project-002", new String[] {"APP-INF/lib/eartest-ejb-sample-one-1.0.jar", "ejb-sample-two.jar"});
46      }
47  
48      /**
49       * Builds an EAR with a default bundle directory for {@code java} modules.
50       */
51      public void testProject003() throws Exception {
52          doTestProject("project-003", new String[] {
53              "eartest-ejb-sample-one-1.0.jar",
54              "APP-INF/lib/eartest-jar-sample-one-1.0.jar",
55              "APP-INF/lib/eartest-jar-sample-two-1.0.jar"
56          });
57      }
58  
59      /**
60       * Builds an EAR with a default bundle directory for _java_ modules and a custom location overriding the default.
61       */
62      public void testProject004() throws Exception {
63          doTestProject("project-004", new String[] {
64              "eartest-ejb-sample-one-1.0.jar",
65              "eartest-jar-sample-one-1.0.jar",
66              "APP-INF/lib/eartest-jar-sample-two-1.0.jar"
67          });
68      }
69  
70      /**
71       * Builds an EAR with a custom URI.
72       */
73      public void testProject005() throws Exception {
74          doTestProject("project-005", new String[] {"eartest-ejb-sample-one-1.0.jar", "libs/another-name.jar"});
75      }
76  
77      /**
78       * Builds an EAR with an excluded module.
79       */
80      public void testProject006() throws Exception {
81          doTestProject("project-006", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-jar-sample-two-1.0.jar"});
82      }
83  
84      /**
85       * Builds an EAR with a classified artifact and no extra configuration.
86       */
87      public void testProject007() throws Exception {
88          doTestProject("project-007", new String[] {"eartest-ejb-sample-one-1.0-classified.jar"});
89      }
90  
91      /**
92       * Builds an EAR with deployment descriptor configuration for J2EE 1.3.
93       */
94      public void testProject008() throws Exception {
95          doTestProject("project-008", new String[] {"eartest-ejb-sample-one-1.0.jar"});
96      }
97  
98      /**
99       * Builds an EAR with deployment descriptor configuration for J2EE 1.4.
100      */
101     public void testProject009() throws Exception {
102         doTestProject("project-009", new String[] {"eartest-ejb-sample-one-1.0.jar"});
103     }
104 
105     /**
106      * Builds an EAR with deployment descriptor configuration for Java EE 5.
107      */
108     public void testProject010() throws Exception {
109         doTestProject("project-010", new String[] {"eartest-ejb-sample-one-1.0.jar"});
110     }
111 
112     /**
113      * Builds an EAR and make sure that deployment descriptor default settings are applied.
114      */
115     public void testProject011() throws Exception {
116         doTestProject("project-011", new String[] {"eartest-ejb-sample-one-1.0.jar"});
117     }
118 
119     /**
120      * Builds an EAR and make sure that EAR resources are bundled within the EAR.
121      */
122     public void testProject012() throws Exception {
123         doTestProject("project-012", new String[] {"README.txt", "LICENSE.txt", "eartest-ejb-sample-one-1.0.jar"});
124     }
125 
126     /**
127      * Builds an EAR and make sure that EAR resources in a customized resources directory are bundled within the EAR.
128      */
129     public void testProject013() throws Exception {
130         doTestProject("project-013", new String[] {"README.txt", "LICENSE.txt", "eartest-ejb-sample-one-1.0.jar"});
131     }
132 
133     /**
134      * Builds an EAR and makes sure that EAR resources are bundled within the EAR using includes and excludes.
135      */
136     public void testProject014() throws Exception {
137         doTestProject("project-014", new String[] {"LICENSE.txt", "eartest-ejb-sample-one-1.0.jar"});
138     }
139 
140     /**
141      * Builds an EAR and makes sure that default manifest is taken into account.
142      */
143     public void testProject015() throws Exception {
144         final File baseDir = doTestProject("project-015", new String[] {"eartest-ejb-sample-one-1.0.jar"});
145         final File expectedManifest = new File(baseDir, "src/main/application/META-INF/MANIFEST.MF");
146         final File actualManifest = new File(getEarDirectory(baseDir, "project-015"), "META-INF/MANIFEST.MF");
147         assertTrue("Manifest was not copied", actualManifest.exists());
148         assertTrue(FileUtils.contentEquals(expectedManifest, actualManifest));
149     }
150 
151     /**
152      * Builds an EAR and makes sure that custom manifest is taken into account.
153      */
154     public void testProject016() throws Exception {
155         final File baseDir = doTestProject("project-016", new String[] {"eartest-ejb-sample-one-1.0.jar"});
156 
157         final File createdEarFile = getEarArchive(baseDir, "project-016");
158 
159         final File sourceManifestFile = new File(baseDir, "src/main/ear/MANIFEST.MF");
160 
161         try (JarFile jarFile = new JarFile(createdEarFile);
162                 FileInputStream in = new FileInputStream(sourceManifestFile)) {
163             Manifest manifestFromCreatedEARFile = jarFile.getManifest();
164             Manifest sourceManifest = new Manifest(in);
165             assertEquals("There are differences in the manifest.", sourceManifest, manifestFromCreatedEARFile);
166         }
167     }
168 
169     /**
170      * Builds an EAR and makes sure that custom application.xml is taken into account.
171      */
172     public void testProject017() throws Exception {
173         doTestProject("project-017", new String[] {"eartest-ejb-sample-one-1.0.jar"});
174     }
175 
176     /**
177      * Builds an EAR with a custom final name.
178      */
179     public void testProject018() throws Exception {
180         final File baseDir = executeMojo("project-018");
181         final File expectedFile = new File(baseDir, "target/my-custom-file.ear");
182         assertTrue("EAR archive not found", expectedFile.exists());
183     }
184 
185     /**
186      * Builds an EAR with unpacked archives using the unpackTypes.
187      */
188     public void testProject019() throws Exception {
189         doTestProject(
190                 "project-019",
191                 new String[] {
192                     "eartest-ejb-sample-one-1.0.jar", "eartest-sar-sample-one-1.0.sar", "eartest-jar-sample-one-1.0.jar"
193                 },
194                 new boolean[] {false, true, true});
195     }
196 
197     /**
198      * Builds an EAR with unpacked archives using the unpack module attribute.
199      */
200     public void testProject020() throws Exception {
201         doTestProject(
202                 "project-020",
203                 new String[] {
204                     "eartest-ejb-sample-one-1.0.jar", "eartest-sar-sample-one-1.0.sar", "eartest-jar-sample-one-1.0.jar"
205                 },
206                 new boolean[] {true, false, false});
207     }
208 
209     /**
210      * Builds an EAR with unpacked archives using both unpackTypes and the unpack module attribute.
211      */
212     public void testProject021() throws Exception {
213         doTestProject(
214                 "project-021",
215                 new String[] {
216                     "eartest-ejb-sample-one-1.0.jar",
217                     "eartest-ejb-sample-two-1.0.jar",
218                     "eartest-sar-sample-one-1.0.sar",
219                     "eartest-jar-sample-one-1.0.jar",
220                     "eartest-jar-sample-two-1.0.jar"
221                 },
222                 new boolean[] {false, true, false, false, true});
223     }
224 
225     /**
226      * Builds an EAR with a classifier.
227      */
228     public void testProject022() throws Exception {
229         final File baseDir = executeMojo("project-022");
230         final File expectedFile = new File(baseDir, "target/maven-ear-plugin-test-project-022-99.0-myclassifier.ear");
231         assertTrue("EAR archive not found", expectedFile.exists());
232     }
233 
234     /**
235      * Builds an EAR and make sure that a single classified dependency is detected without specifying the classifier.
236      */
237     public void testProject023() throws Exception {
238         doTestProject(
239                 "project-023",
240                 new String[] {"eartest-ejb-sample-one-1.0-classified.jar", "eartest-ejb-sample-two-1.0.jar"},
241                 new boolean[] {true, false});
242     }
243 
244     /**
245      * Builds an EAR and make sure that a single classified dependency is detected when specifying the classifier.
246      */
247     public void testProject024() throws Exception {
248         doTestProject(
249                 "project-024",
250                 new String[] {"eartest-ejb-sample-one-1.0-classified.jar", "eartest-ejb-sample-two-1.0.jar"},
251                 new boolean[] {true, false});
252     }
253 
254     /**
255      * Builds an EAR and make sure that a classified dependency with multiple candidates is detected when specifying the
256      * classifier.
257      */
258     public void testProject025() throws Exception {
259         doTestProject(
260                 "project-025",
261                 new String[] {"eartest-ejb-sample-one-1.0-classified.jar", "eartest-ejb-sample-one-1.0.jar"},
262                 new boolean[] {true, false});
263     }
264 
265     /**
266      * Builds an EAR and make sure that the build fails if a unclassifed module configuration with multiple candidates is
267      * specified.
268      */
269     public void testProject026() throws Exception {
270         final File baseDir = executeMojo("project-026", false, true);
271         // Stupido, checks that the ear archive is not there
272         assertFalse(
273                 "Execution should have failed",
274                 getEarArchive(baseDir, "project-026").exists());
275     }
276 
277     /**
278      * Builds an EAR and make sure that provided dependencies are not included in the EAR.
279      */
280     public void testProject027() throws Exception {
281         doTestProject("project-027", new String[] {"eartest-ejb-sample-one-1.0.jar"});
282     }
283 
284     /**
285      * Builds an EAR and make sure that test dependencies are not included in the EAR.
286      */
287     public void testProject028() throws Exception {
288         doTestProject("project-028", new String[] {"eartest-ejb-sample-one-1.0.jar"});
289     }
290 
291     /**
292      * Builds an EAR and make sure that system dependencies are not included in the EAR.
293      */
294     public void testProject029() throws Exception {
295         doTestProject("project-029", new String[] {"eartest-ejb-sample-one-1.0.jar"});
296     }
297 
298     /**
299      * Builds an EAR and make sure that ejb-client dependencies are detected and not added by default in the generated
300      * application.xml.
301      */
302     public void testProject030() throws Exception {
303         doTestProject(
304                 "project-030",
305                 new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0-client.jar"});
306     }
307 
308     /**
309      * Builds an EAR with a JBoss 4 configuration specifying the security domain and the unauthenticated-principal to
310      * use.
311      */
312     public void testProject031() throws Exception {
313         doTestProject("project-031", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
314     }
315 
316     /**
317      * Builds an EAR with a JBoss 3.2 configuration specifying the jmx-name to use.
318      */
319     public void testProject032() throws Exception {
320         doTestProject("project-032", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
321     }
322 
323     /**
324      * Builds an EAR with a JBoss 4 configuration and JBoss specific modules.
325      */
326     public void testProject033() throws Exception {
327         doTestProject("project-033", new String[] {
328             "eartest-ejb-sample-one-1.0.jar",
329             "eartest-ejb-sample-two-1.0.jar",
330             "eartest-sar-sample-one-1.0.sar",
331             "eartest-har-sample-one-1.0.har"
332         });
333     }
334 
335     /**
336      * Builds an EAR with custom security settings.
337      */
338     public void testProject034() throws Exception {
339         doTestProject("project-034", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
340     }
341 
342     /**
343      * Builds an EAR with a full filename mapping and make sure that custom locations are not overridden.
344      */
345     public void testProject035() throws Exception {
346         doTestProject("project-035", new String[] {
347             "foo/eartest-ejb-sample-one-1.0.jar",
348             "eartest-ejb-sample-two-1.0.jar",
349             "libs/eartest-jar-sample-one-1.0.jar",
350             "libs/eartest-jar-sample-two-1.0.jar",
351             "sar-sample-one.sar"
352         });
353     }
354 
355     /**
356      * Builds an EAR with a full filename mapping and make sure that groupIds with dots are replaced by dashes in
357      * filenames.
358      */
359     public void testProject036() throws Exception {
360         doTestProject("project-036", new String[] {
361             "foo/eartest-ejb-sample-one-1.0.jar",
362             "eartest-ejb-sample-two-1.0.jar",
363             "com.foo.bar-ejb-sample-one-1.0.jar",
364             "com.foo.bar-ejb-sample-two-1.0.jar",
365             "libs/eartest-jar-sample-one-1.0.jar",
366             "libs/eartest-jar-sample-two-1.0.jar",
367             "sar-sample-one.sar"
368         });
369     }
370 
371     /**
372      * Builds an EAR and make sure that ejb-client dependencies are detected and added in the generated application.xml
373      * if includeInApplicationXml is set.
374      */
375     public void testProject037() throws Exception {
376         doTestProject(
377                 "project-037",
378                 new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0-client.jar"});
379     }
380 
381     /**
382      * Builds an EAR and make sure that a non-classified dependency with multiple candidates is detected when specifying
383      * the mainArtifactId as classifier.
384      */
385     public void testProject038() throws Exception {
386         doTestProject(
387                 "project-038",
388                 new String[] {"eartest-ejb-sample-one-1.0-classified.jar", "eartest-ejb-sample-one-1.0.jar"},
389                 new boolean[] {false, true});
390     }
391 
392     /**
393      * Builds an EAR with a JBoss 4 configuration specifying specifying the loader repository to use.
394      */
395     public void testProject039() throws Exception {
396         doTestProject("project-039", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
397     }
398 
399     /**
400      * Builds an EAR with deployment descriptor configuration for Java EE 5 and an alternative deployment descriptor.
401      */
402     public void testProject040() throws Exception {
403         doTestProject("project-040", new String[] {"eartest-ejb-sample-one-1.0.jar"});
404     }
405 
406     /**
407      * Builds an EAR with a JBoss 4.2 configuration specifying the module order to use.
408      */
409     public void testProject041() throws Exception {
410         doTestProject("project-041", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
411     }
412 
413     /**
414      * Builds an EAR with a JBoss 4.2 configuration specifying a datasource to add.
415      */
416     public void testProject042() throws Exception {
417         doTestProject("project-042", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
418     }
419 
420     /**
421      * Builds an EAR with a custom descriptor location (generatedDescriptorLocation setting).
422      */
423     public void testProject043() throws Exception {
424         final File baseDir = doTestProject("project-043", new String[] {"eartest-ejb-sample-one-1.0.jar"});
425         final File expectedApplicationXml = new File(baseDir, "target/custom-descriptor-dir/application.xml");
426         assertTrue("Application.xml file not found", expectedApplicationXml.exists());
427         assertFalse("Application.xml file should not be empty", expectedApplicationXml.length() == 0);
428     }
429 
430     /**
431      * Builds an EAR with a custom library-directory.
432      */
433     public void testProject044() throws Exception {
434         doTestProject(
435                 "project-044",
436                 new String[] {"eartest-ejb-sample-one-1.0.jar", "myLibs/eartest-jar-sample-one-1.0.jar"});
437     }
438 
439     /**
440      * Builds an EAR and filter the content of the sources directory.
441      */
442     public void testProject045() throws Exception {
443         final File baseDir =
444                 doTestProject("project-045", new String[] {"README.txt", "eartest-ejb-sample-one-1.0.jar"});
445         final File actualReadme = new File(getEarDirectory(baseDir, "project-045"), "README.txt");
446         final String content = new String(Files.readAllBytes(actualReadme.toPath()), "UTF-8");
447         assertTrue("application name and version was not filtered properly", content.contains("my-app 99.0"));
448         assertTrue("Escaping did not work properly", content.contains("will not be filtered ${application.name}."));
449     }
450 
451     /**
452      * Builds an EAR and filter the content of the sources directory using a custom filter file.
453      */
454     public void testProject046() throws Exception {
455         final File baseDir =
456                 doTestProject("project-046", new String[] {"README.txt", "eartest-ejb-sample-one-1.0.jar"});
457         final File actualReadme = new File(getEarDirectory(baseDir, "project-046"), "README.txt");
458         final String content = new String(Files.readAllBytes(actualReadme.toPath()), "UTF-8");
459         assertTrue("application name and version was not filtered properly", content.contains("my-app 99.0"));
460         assertTrue("application build was not filtered properly", content.contains("(Build 2)"));
461         assertTrue(
462                 "Unknown property should not have been filtered",
463                 content.contains("will not be filtered ${application.unknown}."));
464     }
465 
466     /**
467      * Builds an EAR and filter the content with a list of extensions.
468      */
469     public void testProject047() throws Exception {
470         final File baseDir =
471                 doTestProject("project-047", new String[] {"README.txt", "eartest-ejb-sample-one-1.0.jar"});
472         final File actualReadme = new File(getEarDirectory(baseDir, "project-047"), "README.txt");
473         final String content = new String(Files.readAllBytes(actualReadme.toPath()), "UTF-8");
474         assertTrue("application name and version should not have been filtered", !content.contains("my-app 99.0"));
475         assertTrue("original properties not found", content.contains("${application.name} ${project.version}"));
476     }
477 
478     /**
479      * Builds an EAR with a JBoss 5 configuration containing library directory.
480      */
481     public void testProject048() throws Exception {
482         doTestProject("project-048", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
483     }
484 
485     /**
486      * Builds an EAR with a JBoss 4.2 configuration containing a library directory.
487      */
488     public void testProject049() throws Exception {
489         doTestProject("project-049", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
490     }
491 
492     /**
493      * Builds an EAR with a JBoss 5 configuration containing a loader repository configuration definition.
494      */
495     public void testProject050() throws Exception {
496         doTestProject("project-050", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
497     }
498 
499     /**
500      * Builds an EAR with a JBoss 5 configuration containing a loader repository class definition.
501      */
502     public void testProject051() throws Exception {
503         doTestProject("project-051", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
504     }
505 
506     /**
507      * Builds an EAR with a JBoss 5 configuration containing a configuration parser class definition.
508      */
509     public void testProject052() throws Exception {
510         doTestProject("project-052", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
511     }
512 
513     /**
514      * Builds an EAR with a JBoss 5 configuration containing only the loader repo configuration
515      */
516     public void testProject053() throws Exception {
517         doTestProject("project-053", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
518     }
519 
520     /**
521      * Builds an EAR with deployment descriptor configuration for Java EE 5 and no application.xml
522      */
523     public void testProject054() throws Exception {
524         doTestProject("project-054", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
525     }
526 
527     /**
528      * Builds an EAR with jar dependencies added in application.xml.
529      */
530     public void testProject055() throws Exception {
531         doTestProject("project-055", new String[] {
532             "eartest-jar-sample-one-1.0.jar",
533             "eartest-jar-sample-two-1.0.jar",
534             "eartest-jar-sample-three-with-deps-1.0.jar"
535         });
536     }
537 
538     /**
539      * Builds an EAR with deployment descriptor configuration for J2EE 1.4 and an alternative deployment descriptor.
540      */
541     public void testProject056() throws Exception {
542         doTestProject("project-056", new String[] {"eartest-ejb-sample-one-1.0.jar"});
543     }
544 
545     /**
546      * Builds an EAR with a complete JBoss 4.2 configuration and validate it matches the DTD (MEAR-104).
547      */
548     public void testProject057() throws Exception {
549         doTestProject("project-057", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
550     }
551 
552     /**
553      * Builds an EAR with deployment descriptor configuration for Java EE 6.
554      */
555     public void testProject058() throws Exception {
556         doTestProject("project-058", new String[] {"eartest-ejb-sample-one-1.0.jar"});
557     }
558 
559     /**
560      * Builds an EAR with no display name entry at all.
561      */
562     public void testProject059() throws Exception {
563         doTestProject("project-059", new String[] {"eartest-ejb-sample-one-1.0.jar"});
564     }
565 
566     /**
567      * Builds an EAR with ejb-client packaged for J2EE 1.3 (MEAR-85)
568      */
569     public void testProject060() throws Exception {
570         doTestProject(
571                 "project-060",
572                 new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0-client.jar"});
573     }
574 
575     /**
576      * Builds an EAR with ejb-client packaged for J2EE 1.4 (MEAR-85)
577      */
578     public void testProject061() throws Exception {
579         doTestProject(
580                 "project-061",
581                 new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0-client.jar"});
582     }
583 
584     /**
585      * Builds an EAR with ejb-client packaged for JavaEE 5 (MEAR-85)
586      */
587     public void testProject062() throws Exception {
588         doTestProject(
589                 "project-062",
590                 new String[] {"eartest-ejb-sample-one-1.0.jar", "lib/eartest-ejb-sample-two-1.0-client.jar"});
591     }
592 
593     /**
594      * Builds an EAR with ejb-client packaged for JavaEE 6 (MEAR-85)
595      */
596     public void testProject063() throws Exception {
597         doTestProject("project-063", new String[] {"lib/eartest-ejb-sample-two-1.0-client.jar"});
598     }
599 
600     /**
601      * Builds an EAR with ejb-client packaged for JavaEE 5 and still put it in the root (MEAR-85)
602      */
603     public void testProject064() throws Exception {
604         doTestProject(
605                 "project-064",
606                 new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0-client.jar"});
607     }
608 
609     /**
610      * Builds an EAR with a custom moduleId.
611      */
612     public void testProject065() throws Exception {
613         doTestProject("project-065", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
614     }
615 
616     /**
617      * Builds an EAR with generateModuleId enabled.
618      */
619     public void testProject066() throws Exception {
620         doTestProject("project-066", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
621     }
622 
623     /**
624      * Builds an EAR with generateModuleId enabled and a custom module.
625      */
626     public void testProject067() throws Exception {
627         doTestProject("project-067", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
628     }
629 
630     /**
631      * Builds an EAR with the no-version file name mapping.
632      */
633     public void testProject068() throws Exception {
634         doTestProject("project-068", new String[] {"eartest-ejb-sample-one.jar", "eartest-ejb-sample-two.jar"});
635     }
636 
637     /**
638      * Builds an EAR with a custom library-directory and JavaEE 6.
639      */
640     public void testProject069() throws Exception {
641         doTestProject(
642                 "project-069",
643                 new String[] {"eartest-ejb-sample-one-1.0.jar", "myLibs/eartest-jar-sample-one-1.0.jar"});
644     }
645 
646     /**
647      * Builds an EAR with application-name and initialize-in-order tags.
648      */
649     public void testProject070() throws Exception {
650         doTestProject("project-070", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-jar-sample-one-1.0.jar"});
651     }
652 
653     /**
654      * Builds an EAR with application-name and initialize-in-order tags for unsupported version.
655      */
656     public void testProject071() throws Exception {
657         doTestProject("project-071", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-jar-sample-one-1.0.jar"});
658     }
659 
660     /**
661      * Builds an EAR with an application client module (app-client).
662      */
663     public void testProject072() throws Exception {
664         doTestProject(
665                 "project-072",
666                 new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-app-client-sample-one-1.0.jar"});
667     }
668 
669     /**
670      * Builds an EAR with an application client module (app-client) and a default bundle directory for _java_ modules.
671      */
672     public void testProject073() throws Exception {
673         doTestProject("project-073", new String[] {
674             "eartest-ejb-sample-one-1.0.jar",
675             "eartest-app-client-sample-one-1.0.jar",
676             "APP-INF/lib/eartest-jar-sample-one-1.0.jar",
677             "APP-INF/lib/eartest-jar-sample-two-1.0.jar"
678         });
679     }
680 
681     /**
682      * Builds an EAR with custom env entries settings and J2EE 1.3. Not supported by the specification so this should be
683      * ignored.
684      */
685     public void testProject074() throws Exception {
686         doTestProject("project-074", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
687     }
688 
689     /**
690      * Builds an EAR with custom env entries settings and J2EE 1.4. Not supported by the specification so this should be
691      * ignored.
692      */
693     public void testProject075() throws Exception {
694         doTestProject("project-075", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
695     }
696 
697     /**
698      * Builds an EAR with custom env entries settings and JavaEE 5. Not supported by the specification so this should be
699      * ignored.
700      */
701     public void testProject076() throws Exception {
702         doTestProject("project-076", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
703     }
704 
705     /**
706      * Builds an EAR with custom env entries settings and JavaEE 6.
707      */
708     public void testProject077() throws Exception {
709         doTestProject("project-077", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
710     }
711 
712     /**
713      * Builds an EAR with the no version for ejb file name mapping.
714      */
715     public void testProject078() throws Exception {
716         doTestProject("project-078", new String[] {"ejb-sample-one.jar", "war-sample-one.war", "jar-sample-two.jar"});
717     }
718 
719     /**
720      * Builds an EAR with the 'default' library directory mode. Uses the value of the defaultLibBundleDir.
721      */
722     public void testProject079() throws Exception {
723         doTestProject(
724                 "project-079",
725                 new String[] {"eartest-ejb-sample-one-1.0.jar", "myLibs/eartest-jar-sample-one-1.0.jar"});
726     }
727 
728     /**
729      * Builds an EAR with the 'empty' library directory mode. Generate an empty library-directory element.
730      */
731     public void testProject080() throws Exception {
732         doTestProject(
733                 "project-080",
734                 new String[] {"eartest-ejb-sample-one-1.0.jar", "myLibs/eartest-jar-sample-one-1.0.jar"});
735     }
736 
737     /**
738      * Builds an EAR with the 'none' library directory mode. Does not generate an library-directory element.
739      */
740     public void testProject081() throws Exception {
741         doTestProject(
742                 "project-081",
743                 new String[] {"eartest-ejb-sample-one-1.0.jar", "myLibs/eartest-jar-sample-one-1.0.jar"});
744     }
745 
746     /**
747      * Builds an EAR with deployment descriptor configuration for JavaEE 7.
748      */
749     public void testProject082() throws Exception {
750         doTestProject("project-082", new String[] {"eartest-ejb-sample-one-1.0.jar"});
751     }
752 
753     /**
754      * Builds an EAR with a library directory and custom env entries. The library-directory element must come first
755      * (MEAR-158).
756      */
757     public void testProject083() throws Exception {
758         doTestProject("project-083", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
759     }
760 
761     /**
762      * Support of an application id (MEAR-174).
763      */
764     public void testProject084() throws Exception {
765         doTestProject("project-084", new String[] {"eartest-ejb-sample-one-1.0.jar"});
766     }
767 
768     /**
769      * Builds an EAR with custom ejbRef entries settings and JavaEE 6.
770      */
771     public void testProject085() throws Exception {
772         doTestProject("project-085", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
773     }
774 
775     /**
776      * Builds an EAR with custom ejbRef entries plus lookup-name entry.
777      */
778     public void testProject086() throws Exception {
779         doTestProject("project-086", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
780     }
781 
782     /**
783      * Builds an EAR with resource-ref entries.
784      */
785     public void testProject087() throws Exception {
786         doTestProject("project-087", new String[] {"eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar"});
787     }
788 
789     /**
790      * Builds WAR and EAR as part of multi-module project twice so that the 2nd build is guaranteed to be performed when
791      * target directories and files exist.
792      */
793     public void testProject088() throws Exception {
794         final String warModule = "eartest-war-sample-two-1.0.war";
795         final String ejbModule = "eartest-ejb-sample-one-1.0.jar";
796         final String jarSampleTwoLibrary = "lib/eartest-jar-sample-two-1.0.jar";
797         final String[] expectedArtifacts = {warModule, ejbModule, jarSampleTwoLibrary};
798         final boolean[] artifactsDirectory = {false, true, false};
799         final String[] artifactsToValidateManifest = {warModule, ejbModule};
800         final boolean[] artifactsToValidateManifestDirectory = {false, true};
801         final String[][] expectedClassPathElements = {{jarSampleTwoLibrary}, {jarSampleTwoLibrary}};
802 
803         // "Clean" build - target directories and files do not exist
804         // Pass cleanBeforeExecute parameter to ensure that target location is cleaned before Mojo execution
805         doTestProject(
806                 "project-088",
807                 "ear",
808                 expectedArtifacts,
809                 artifactsDirectory,
810                 artifactsToValidateManifest,
811                 artifactsToValidateManifestDirectory,
812                 expectedClassPathElements,
813                 true);
814         // "Dirty" build - target directories and files exist
815         doTestProject(
816                 "project-088",
817                 "ear",
818                 expectedArtifacts,
819                 artifactsDirectory,
820                 artifactsToValidateManifest,
821                 artifactsToValidateManifestDirectory,
822                 expectedClassPathElements,
823                 false);
824     }
825 
826     /**
827      * Validates modification of Class-Path entry of EAR modules manifest when
828      * <ul>
829      * <li>skinnyWars option is turned on</li>
830      * <li>skipClassPathModification option is turned off</li>
831      * </ul>
832      */
833     public void testProject089() throws Exception {
834         final String warModule = "eartest-war-sample-three-1.0.war";
835         final String ejbModule = "eartest-ejb-sample-three-1.0.jar";
836         final String jarSampleTwoLibrary = "lib/eartest-jar-sample-two-1.0.jar";
837         final String jarSampleThreeLibrary = "lib/eartest-jar-sample-three-with-deps-1.0.jar";
838         doTestProject(
839                 "project-089",
840                 "ear",
841                 new String[] {warModule, ejbModule, jarSampleTwoLibrary, jarSampleThreeLibrary},
842                 new boolean[] {false, false, false, false},
843                 new String[] {warModule, ejbModule},
844                 new boolean[] {false, false},
845                 new String[][] {
846                     {jarSampleTwoLibrary, jarSampleThreeLibrary}, {jarSampleThreeLibrary, jarSampleTwoLibrary}
847                 },
848                 true);
849     }
850 
851     /**
852      * Validates modification of Class-Path entry of EAR modules manifest when
853      * <ul>
854      * <li>skinnyWars option is turned on</li>
855      * <li>skipClassPathModification option is turned on</li>
856      * </ul>
857      */
858     public void testProject090() throws Exception {
859         final String warModule = "eartest-war-sample-three-1.0.war";
860         final String ejbModule = "eartest-ejb-sample-three-1.0.jar";
861         final String jarSampleTwoLibrary = "lib/eartest-jar-sample-two-1.0.jar";
862         final String jarSampleThreeLibrary = "lib/eartest-jar-sample-three-with-deps-1.0.jar";
863         doTestProject(
864                 "project-090",
865                 "ear",
866                 new String[] {warModule, ejbModule, jarSampleTwoLibrary, jarSampleThreeLibrary},
867                 new boolean[] {false, false, false, false},
868                 new String[] {warModule, ejbModule},
869                 new boolean[] {false, false},
870                 new String[][] {{jarSampleTwoLibrary}, {jarSampleThreeLibrary, jarSampleTwoLibrary}},
871                 true);
872     }
873 
874     /**
875      * Validates modification of Class-Path entry of EAR modules manifest when
876      * <ul>
877      * <li>skinnyWars option is turned off</li>
878      * <li>skipClassPathModification option is turned off</li>
879      * <li>unpacking of EJB JARs is turned on</li>
880      * </ul>
881      */
882     public void testProject091() throws Exception {
883         final String warModule = "eartest-war-sample-three-1.0.war";
884         final String ejbModule = "eartest-ejb-sample-three-1.0.jar";
885         final String jarSampleTwoLibrary = "eartest-jar-sample-two-1.0.jar";
886         final String jarSampleThreeLibrary = "eartest-jar-sample-three-with-deps-1.0.jar";
887         doTestProject(
888                 "project-091",
889                 "ear",
890                 new String[] {warModule, ejbModule, jarSampleTwoLibrary, jarSampleThreeLibrary},
891                 new boolean[] {false, true, false, false},
892                 new String[] {warModule, ejbModule},
893                 new boolean[] {false, true},
894                 new String[][] {{"jar-sample-two-1.0.jar"}, {jarSampleThreeLibrary, jarSampleTwoLibrary}},
895                 true);
896     }
897 
898     /**
899      * Ensures that when
900      * <ul>
901      * <li>skinnyWars option is turned off (has default value)</li>
902      * <li>skinnyModules options is turned on</li>
903      * </ul>
904      * then movement of JARs and modification of manifest Class-Path entry is performed for WAR, SAR, HAR and RAR
905      * modules. Additionally this test ensures that
906      * <ul>
907      * <li>movement of JARs is not performed for modules whose libDirectory property doesn't point to the correct module
908      * entry containing JAR libraries packaged into the module</li>
909      * <li>JAR with provided scope is removed from modules and from Class-Path entries</li>
910      * </ul>
911      */
912     public void testProject092() throws Exception {
913         final String projectName = "project-092";
914         final String earModuleName = "ear";
915         final String jarSampleOneLibrary = "jar-sample-one-1.0.jar";
916         final String jarSampleTwoLibrary = "jar-sample-two-1.0.jar";
917         final String jarSampleThreeLibrary = "jar-sample-three-with-deps-1.0.jar";
918         final String jarSampleOneEarLibrary = "libs/eartest-" + jarSampleOneLibrary;
919         final String jarSampleTwoEarLibrary = "libs/eartest-" + jarSampleTwoLibrary;
920         final String jarSampleThreeEarLibrary = "libs/eartest-" + jarSampleThreeLibrary;
921         final String warModule = "eartest-war-sample-three-1.0.war";
922         final String sarModuleTwo = "eartest-sar-sample-two-1.0.sar";
923         final String sarModuleThree = "eartest-sar-sample-three-1.0.sar";
924         final String sarModuleFour = "eartest-sar-sample-four-1.0.sar";
925         final String harModule = "eartest-har-sample-two-1.0.har";
926         final String rarModule = "eartest-rar-sample-one-1.0.rar";
927         final String[] earModules = {warModule, sarModuleTwo, sarModuleThree, sarModuleFour, harModule, rarModule};
928         final boolean[] earModuleDirectory = {false, false, false, false, false, false};
929         final String warModuleLibDir = "WEB-INF/lib/";
930         final String sarModuleTwoLibDir = "libraries/";
931         final String sarModuleThreeLibDir = "";
932         final String sarModuleFourLibDir = "lib/";
933         final String harModuleLibDir = "lib/";
934         final String rarModuleLibDir = "";
935 
936         final File baseDir = doTestProject(
937                 projectName,
938                 earModuleName,
939                 new String[] {
940                     warModule,
941                     sarModuleTwo,
942                     sarModuleThree,
943                     sarModuleFour,
944                     harModule,
945                     rarModule,
946                     jarSampleOneEarLibrary,
947                     jarSampleTwoEarLibrary,
948                     jarSampleThreeEarLibrary
949                 },
950                 new boolean[] {false, false, false, false, false, false, false, false, false},
951                 earModules,
952                 earModuleDirectory,
953                 new String[][] {
954                     {jarSampleTwoEarLibrary, jarSampleOneEarLibrary, jarSampleThreeEarLibrary},
955                     {jarSampleThreeEarLibrary, jarSampleTwoEarLibrary, jarSampleOneEarLibrary},
956                     {jarSampleThreeEarLibrary, jarSampleTwoEarLibrary, jarSampleOneEarLibrary},
957                     {jarSampleOneEarLibrary, jarSampleTwoEarLibrary, jarSampleThreeEarLibrary},
958                     {jarSampleOneEarLibrary, jarSampleThreeEarLibrary, jarSampleTwoEarLibrary},
959                     {jarSampleThreeEarLibrary, jarSampleTwoEarLibrary, jarSampleOneEarLibrary}
960                 },
961                 true);
962 
963         assertEarModulesContent(
964                 baseDir,
965                 projectName,
966                 earModuleName,
967                 earModules,
968                 earModuleDirectory,
969                 new String[][] {
970                     {warModuleLibDir},
971                     {sarModuleTwoLibDir},
972                     {sarModuleThreeLibDir},
973                     {sarModuleFourLibDir + jarSampleOneLibrary},
974                     {harModuleLibDir},
975                     {rarModuleLibDir}
976                 },
977                 new String[][] {
978                     {warModuleLibDir + jarSampleTwoLibrary},
979                     {sarModuleTwoLibDir + jarSampleTwoLibrary, sarModuleTwoLibDir + jarSampleThreeLibrary},
980                     {sarModuleThreeLibDir + jarSampleTwoLibrary, sarModuleThreeLibDir + jarSampleThreeLibrary},
981                     {},
982                     {
983                         harModuleLibDir + jarSampleOneLibrary,
984                         harModuleLibDir + jarSampleTwoLibrary,
985                         harModuleLibDir + jarSampleThreeLibrary
986                     },
987                     {rarModuleLibDir + jarSampleTwoLibrary, rarModuleLibDir + jarSampleThreeLibrary}
988                 });
989     }
990 
991     /**
992      * Ensures that when
993      * <ul>
994      * <li>skinnyWars option is turned on</li>
995      * <li>skinnyModules options is turned off (has default value)</li>
996      * </ul>
997      * then movement of JARs and modification of manifest Class-Path entry is performed only for WAR module and not for
998      * SAR, HAR and RAR modules.
999      */
1000     public void testProject093() throws Exception {
1001         final String projectName = "project-093";
1002         final String earModuleName = "ear";
1003         final String jarSampleOneLibrary = "jar-sample-one-1.0.jar";
1004         final String jarSampleTwoLibrary = "jar-sample-two-1.0.jar";
1005         final String jarSampleThreeLibrary = "jar-sample-three-with-deps-1.0.jar";
1006         final String jarSampleTwoEarLibrary = "lib/eartest-" + jarSampleTwoLibrary;
1007         final String jarSampleThreeEarLibrary = "lib/eartest-" + jarSampleThreeLibrary;
1008         final String warModule = "eartest-war-sample-three-1.0.war";
1009         final String sarModule = "eartest-sar-sample-two-1.0.sar";
1010         final String harModule = "eartest-har-sample-two-1.0.har";
1011         final String rarModule = "eartest-rar-sample-one-1.0.rar";
1012         final String[] earModules = {warModule, sarModule, harModule, rarModule};
1013         final boolean[] earModuleDirectory = {false, false, false, false};
1014         final String warModuleLibDir = "WEB-INF/lib/";
1015         final String sarModuleLibDir = "lib/";
1016         final String harModuleLibDir = "lib/";
1017         final String rarModuleLibDir = "";
1018 
1019         final File baseDir = doTestProject(
1020                 projectName,
1021                 earModuleName,
1022                 new String[] {
1023                     warModule, sarModule, harModule, rarModule, jarSampleTwoEarLibrary, jarSampleThreeEarLibrary
1024                 },
1025                 new boolean[] {false, false, false, false, false, false},
1026                 earModules,
1027                 earModuleDirectory,
1028                 new String[][] {
1029                     {jarSampleThreeEarLibrary, jarSampleTwoEarLibrary},
1030                     {jarSampleThreeLibrary, jarSampleTwoLibrary, jarSampleOneLibrary},
1031                     null,
1032                     {jarSampleOneLibrary, jarSampleThreeLibrary, jarSampleTwoLibrary}
1033                 },
1034                 true);
1035 
1036         assertEarModulesContent(
1037                 baseDir,
1038                 projectName,
1039                 earModuleName,
1040                 earModules,
1041                 earModuleDirectory,
1042                 new String[][] {
1043                     {warModuleLibDir},
1044                     {
1045                         sarModuleLibDir + jarSampleOneLibrary,
1046                         sarModuleLibDir + jarSampleTwoLibrary,
1047                         sarModuleLibDir + jarSampleThreeLibrary
1048                     },
1049                     {
1050                         harModuleLibDir + jarSampleOneLibrary,
1051                         harModuleLibDir + jarSampleTwoLibrary,
1052                         harModuleLibDir + jarSampleThreeLibrary
1053                     },
1054                     {
1055                         rarModuleLibDir + jarSampleOneLibrary,
1056                         rarModuleLibDir + jarSampleTwoLibrary,
1057                         rarModuleLibDir + jarSampleThreeLibrary
1058                     }
1059                 },
1060                 new String[][] {
1061                     {warModuleLibDir + jarSampleTwoLibrary, warModuleLibDir + jarSampleThreeLibrary},
1062                     {},
1063                     {},
1064                     {}
1065                 });
1066     }
1067 
1068     /**
1069      * Ensures that when
1070      * <ul>
1071      * <li>skinnyWars option is turned off (has default value)</li>
1072      * <li>skinnyModules options is turned off (has default value)</li>
1073      * </ul>
1074      * then
1075      * <ul>
1076      * <li>movement of JARs and modification of the manifest Class-Path entry is not performed for WAR, SAR, HAR and
1077      * RAR modules</li>
1078      * <li>modification of the manifest Class-Path entry is performed for EJB module</li>
1079      * <li>provided JAR is removed from the manifest Class-Path entry of EJB module</li>
1080      * </ul>
1081      */
1082     public void testProject094() throws Exception {
1083         final String projectName = "project-094";
1084         final String earModuleName = "ear";
1085         final String jarSampleOneLibrary = "jar-sample-one-1.0.jar";
1086         final String jarSampleTwoLibrary = "jar-sample-two-1.0.jar";
1087         final String jarSampleThreeLibrary = "jar-sample-three-with-deps-1.0.jar";
1088         final String jarSampleTwoEarLibrary = "lib/eartest-" + jarSampleTwoLibrary;
1089         final String jarSampleThreeEarLibrary = "lib/eartest-" + jarSampleThreeLibrary;
1090         final String warModule = "eartest-war-sample-three-1.0.war";
1091         final String sarModule = "eartest-sar-sample-two-1.0.sar";
1092         final String harModule = "eartest-har-sample-two-1.0.har";
1093         final String rarModule = "eartest-rar-sample-one-1.0.rar";
1094         final String ejbModule = "eartest-ejb-sample-three-1.0.jar";
1095         final String[] earModules = {warModule, sarModule, harModule, rarModule, ejbModule};
1096         final boolean[] earModuleDirectory = {false, false, false, false, false};
1097         final String warModuleLibDir = "WEB-INF/lib/";
1098         final String sarModuleLibDir = "lib/";
1099         final String harModuleLibDir = "lib/";
1100         final String rarModuleLibDir = "";
1101 
1102         final File baseDir = doTestProject(
1103                 projectName,
1104                 earModuleName,
1105                 new String[] {
1106                     warModule,
1107                     sarModule,
1108                     harModule,
1109                     rarModule,
1110                     ejbModule,
1111                     jarSampleTwoEarLibrary,
1112                     jarSampleThreeEarLibrary
1113                 },
1114                 new boolean[] {false, false, false, false, false, false, false},
1115                 earModules,
1116                 earModuleDirectory,
1117                 new String[][] {null, null, null, null, new String[] {jarSampleThreeEarLibrary, jarSampleTwoEarLibrary}
1118                 },
1119                 true);
1120 
1121         assertEarModulesContent(
1122                 baseDir,
1123                 projectName,
1124                 earModuleName,
1125                 earModules,
1126                 earModuleDirectory,
1127                 new String[][] {
1128                     {warModuleLibDir + jarSampleTwoLibrary, warModuleLibDir + jarSampleThreeLibrary},
1129                     {
1130                         sarModuleLibDir + jarSampleOneLibrary,
1131                         sarModuleLibDir + jarSampleTwoLibrary,
1132                         sarModuleLibDir + jarSampleThreeLibrary
1133                     },
1134                     {
1135                         harModuleLibDir + jarSampleOneLibrary,
1136                         harModuleLibDir + jarSampleTwoLibrary,
1137                         harModuleLibDir + jarSampleThreeLibrary
1138                     },
1139                     {
1140                         rarModuleLibDir + jarSampleOneLibrary,
1141                         rarModuleLibDir + jarSampleTwoLibrary,
1142                         rarModuleLibDir + jarSampleThreeLibrary
1143                     },
1144                     null
1145                 },
1146                 null);
1147     }
1148 
1149     /**
1150      * Ensures that test JAR dependency of WAR is handled as regular JAR in terms of packaging and manifest modification
1151      * when skinnyWars option is turned on.
1152      */
1153     public void testProject095() throws Exception {
1154         final String warModule = "eartest-war-sample-two-1.0.war";
1155         final String jarSampleTwoLibrary = "lib/eartest-jar-sample-two-1.0.jar";
1156         final String jarSampleThreeLibrary = "lib/eartest-jar-sample-three-with-deps-1.0.jar";
1157         final String jarSampleFourTestLibrary = "lib/eartest-jar-sample-four-1.0-tests.jar";
1158         doTestProject(
1159                 "project-095",
1160                 "ear",
1161                 new String[] {warModule, jarSampleTwoLibrary, jarSampleThreeLibrary, jarSampleFourTestLibrary},
1162                 new boolean[] {false, false, false, false},
1163                 new String[] {warModule},
1164                 new boolean[] {false},
1165                 new String[][] {{jarSampleFourTestLibrary, jarSampleThreeLibrary, jarSampleTwoLibrary}},
1166                 true);
1167     }
1168 
1169     /**
1170      * Ensures that test JAR dependency representing Java module is described in deployment descriptor
1171      * if includeInApplicationXml property of module is {@code true}.
1172      */
1173     public void testProject096() throws Exception {
1174         final String warModule = "eartest-war-sample-two-1.0.war";
1175         final String jarSampleTwoLibrary = "eartest-jar-sample-two-1.0.jar";
1176         final String jarSampleThreeLibrary = "eartest-jar-sample-three-with-deps-1.0.jar";
1177         final String jarSampleFourTestLibrary = "eartest-jar-sample-four-1.0-tests.jar";
1178         final String jarSampleFiveLibrary = "eartest-jar-sample-five-1.0.jar";
1179         doTestProject(
1180                 "project-096",
1181                 "ear",
1182                 new String[] {
1183                     warModule,
1184                     jarSampleTwoLibrary,
1185                     jarSampleThreeLibrary,
1186                     jarSampleFourTestLibrary,
1187                     jarSampleFiveLibrary
1188                 },
1189                 new boolean[] {false, false, false, false, false},
1190                 new String[] {warModule},
1191                 new boolean[] {false},
1192                 new String[][] {
1193                     {jarSampleFourTestLibrary, jarSampleFiveLibrary, jarSampleThreeLibrary, jarSampleTwoLibrary}
1194                 },
1195                 true);
1196     }
1197 
1198     /**
1199      * Ensures that artifacts with JBoss-sar, JBoss-har and JBoss-par types are packaged in EAR and
1200      * described in deployment descriptor when respective types are configured for EAR modules.
1201      */
1202     public void testProject097() throws Exception {
1203         final String warModule = "eartest-war-sample-three-1.0.war";
1204         final String sarSampleTwo = "eartest-sar-sample-two-1.0.sar";
1205         final String harSampleTwo = "eartest-har-sample-two-1.0.har";
1206         final String parSampleTwo = "eartest-par-sample-one-1.0.par";
1207         final String[] artifacts = {warModule, sarSampleTwo, harSampleTwo, parSampleTwo};
1208         final boolean[] artifactsDirectory = {false, false, false, false};
1209         doTestProject("project-097", "ear", artifacts, artifactsDirectory, null, null, null, true);
1210     }
1211 
1212     /**
1213      * Ensures that when skinnyModules option is turned on then
1214      * <ul>
1215      * <li>EAR module whose classPathItem property is {@code false} is removed from the Class-Path entry of
1216      * MANIFEST.mf of other modules</li>
1217      * <li>EAR module whose classPathItem property is {@code true} is added into the Class-Path entry of MANIFEST.mf
1218      * or existing reference is updated to match location of the module</li>
1219      * <li>EAR module is removed from WARs and RARs (from modules which include their dependencies)</li>
1220      * </ul>
1221      */
1222     public void testProject098() throws Exception {
1223         final String projectName = "project-098";
1224         final String earModuleName = "ear";
1225         final String jarSampleOneLibrary = "jar-sample-one-1.0.jar";
1226         final String jarSampleTwoLibrary = "jar-sample-two-1.0.jar";
1227         final String jarSampleThreeLibrary = "jar-sample-three-with-deps-1.0.jar";
1228         final String ejbFourClientLibrary = "ejb-sample-four-1.0-client.jar";
1229         final String jarSampleOneEarLibrary = "lib/eartest-" + jarSampleOneLibrary;
1230         final String jarSampleTwoEarLibrary = "lib/eartest-" + jarSampleTwoLibrary;
1231         final String jarSampleThreeEarLibrary = "lib/eartest-" + jarSampleThreeLibrary;
1232         final String ejbFourClientEarLibrary = "lib/eartest-" + ejbFourClientLibrary;
1233         final String ejbThreeLibrary = "ejb-sample-three-1.0.jar";
1234         final String ejbFourLibrary = "ejb-sample-four-1.0.jar";
1235         final String ejbThreeModule = "eartest-" + ejbThreeLibrary;
1236         final String ejbFourModule = "eartest-" + ejbFourLibrary;
1237         final String rarLibrary = "rar-sample-one-1.0.rar";
1238         final String rarModule = "eartest-" + rarLibrary;
1239         final String warModule = "eartest-war-sample-three-1.0.war";
1240         final String[] earModules = {ejbThreeModule, ejbFourModule, rarModule, warModule};
1241         final boolean[] earModuleDirectory = {false, false, false, false};
1242         final String warModuleLibDir = "WEB-INF/lib/";
1243         final String rarModuleLibDir = "";
1244 
1245         final File baseDir = doTestProject(
1246                 projectName,
1247                 earModuleName,
1248                 new String[] {
1249                     ejbThreeModule,
1250                     ejbFourModule,
1251                     rarModule,
1252                     warModule,
1253                     jarSampleOneEarLibrary,
1254                     jarSampleTwoEarLibrary,
1255                     jarSampleThreeEarLibrary,
1256                     ejbFourClientEarLibrary
1257                 },
1258                 new boolean[] {false, false, false, false, false, false, false, false},
1259                 earModules,
1260                 earModuleDirectory,
1261                 new String[][] {
1262                     {jarSampleThreeEarLibrary, jarSampleTwoEarLibrary, ejbFourClientEarLibrary, jarSampleOneEarLibrary},
1263                     {jarSampleOneEarLibrary, jarSampleTwoEarLibrary, jarSampleThreeEarLibrary, ejbFourClientEarLibrary},
1264                     {jarSampleThreeEarLibrary, jarSampleTwoEarLibrary, jarSampleOneEarLibrary, ejbFourClientEarLibrary},
1265                     {jarSampleOneEarLibrary, jarSampleThreeEarLibrary, jarSampleTwoEarLibrary, ejbFourClientEarLibrary}
1266                 },
1267                 true);
1268 
1269         assertEarModulesContent(
1270                 baseDir,
1271                 projectName,
1272                 earModuleName,
1273                 earModules,
1274                 earModuleDirectory,
1275                 new String[][] {null, null, null, {warModuleLibDir}},
1276                 new String[][] {
1277                     null,
1278                     null,
1279                     {
1280                         rarModuleLibDir + jarSampleTwoLibrary,
1281                         rarModuleLibDir + jarSampleThreeLibrary,
1282                         rarModuleLibDir + ejbFourLibrary,
1283                         rarModuleLibDir + ejbFourClientLibrary,
1284                     },
1285                     {
1286                         warModuleLibDir + jarSampleOneLibrary,
1287                         rarModuleLibDir + jarSampleThreeLibrary,
1288                         rarModuleLibDir + jarSampleTwoLibrary,
1289                         warModuleLibDir + ejbThreeLibrary,
1290                         warModuleLibDir + ejbFourLibrary,
1291                         warModuleLibDir + ejbFourClientLibrary,
1292                         warModuleLibDir + rarLibrary,
1293                         warModuleLibDir + rarLibrary
1294                     }
1295                 });
1296     }
1297 
1298     /**
1299      * Builds an EAR with deployment descriptor configuration for JakartaEE 9.
1300      */
1301     public void testProject099() throws Exception {
1302         doTestProject("project-099", new String[] {"eartest-ejb-sample-one-1.0.jar"});
1303     }
1304 
1305     /**
1306      * Builds an EAR with deployment descriptor configuration for JakartaEE 10.
1307      */
1308     public void testProject100() throws Exception {
1309         doTestProject("project-100", new String[] {"eartest-ejb-sample-one-1.0.jar"});
1310     }
1311 
1312     /**
1313      * Ensure that {@code defaultLibBundleDir} with dot at beginning don't remove artifacts during second execution.
1314      */
1315     public void testProject101() throws Exception {
1316         String[] expectedArtifacts = new String[] {
1317             "eartest-jar-sample-one-1.0.jar",
1318             "eartest-jar-sample-two-1.0.jar",
1319             "eartest-jar-sample-three-with-deps-1.0.jar"
1320         };
1321 
1322         doTestProject("project-101", expectedArtifacts, true);
1323         doTestProject("project-101", expectedArtifacts, false);
1324     }
1325 
1326     /**
1327      * Builds an EAR with deployment descriptor configuration for JakartaEE 11.
1328      */
1329     public void testProject102() throws Exception {
1330         doTestProject("project-102", new String[] {"eartest-ejb-sample-one-1.0.jar"});
1331     }
1332 }