1 package org.apache.maven.plugin.ear.it;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.it.util.IOUtil;
23 import org.codehaus.plexus.util.FileUtils;
24 import org.codehaus.plexus.util.ReaderFactory;
25
26 import java.io.File;
27 import java.util.Properties;
28
29
30
31
32
33
34 public class EarMojoIT
35 extends AbstractEarPluginIT
36 {
37
38
39
40
41 public void testProject001()
42 throws Exception
43 {
44 doTestProject( "project-001", new String[]{ "ejb-sample-one-1.0.jar" } );
45 }
46
47
48
49
50 public void testProject002()
51 throws Exception
52 {
53 doTestProject( "project-002", new String[]{ "APP-INF/lib/ejb-sample-one-1.0.jar", "ejb-sample-two.jar" } );
54 }
55
56
57
58
59 public void testProject003()
60 throws Exception
61 {
62 doTestProject( "project-003", new String[]{ "ejb-sample-one-1.0.jar", "APP-INF/lib/jar-sample-one-1.0.jar",
63 "APP-INF/lib/jar-sample-two-1.0.jar" } );
64 }
65
66
67
68
69
70 public void testProject004()
71 throws Exception
72 {
73 doTestProject( "project-004", new String[]{ "ejb-sample-one-1.0.jar", "jar-sample-one-1.0.jar",
74 "APP-INF/lib/jar-sample-two-1.0.jar" } );
75 }
76
77
78
79
80 public void testProject005()
81 throws Exception
82 {
83 doTestProject( "project-005", new String[]{ "ejb-sample-one-1.0.jar", "libs/another-name.jar" } );
84 }
85
86
87
88
89 public void testProject006()
90 throws Exception
91 {
92 doTestProject( "project-006", new String[]{ "ejb-sample-one-1.0.jar", "jar-sample-two-1.0.jar" } );
93 }
94
95
96
97
98 public void testProject007()
99 throws Exception
100 {
101 doTestProject( "project-007", new String[]{ "ejb-sample-one-1.0-classified.jar" } );
102 }
103
104
105
106
107 public void testProject008()
108 throws Exception
109 {
110 doTestProject( "project-008", new String[]{ "ejb-sample-one-1.0.jar" } );
111 }
112
113
114
115
116 public void testProject009()
117 throws Exception
118 {
119 doTestProject( "project-009", new String[]{ "ejb-sample-one-1.0.jar" } );
120 }
121
122
123
124
125 public void testProject010()
126 throws Exception
127 {
128 doTestProject( "project-010", new String[]{ "ejb-sample-one-1.0.jar" } );
129 }
130
131
132
133
134 public void testProject011()
135 throws Exception
136 {
137 doTestProject( "project-011", new String[]{ "ejb-sample-one-1.0.jar" } );
138 }
139
140
141
142
143 public void testProject012()
144 throws Exception
145 {
146 doTestProject( "project-012", new String[]{ "README.txt", "LICENSE.txt", "ejb-sample-one-1.0.jar" } );
147 }
148
149
150
151
152 public void testProject013()
153 throws Exception
154 {
155 doTestProject( "project-013", new String[]{ "README.txt", "LICENSE.txt", "ejb-sample-one-1.0.jar" } );
156 }
157
158
159
160
161 public void testProject014()
162 throws Exception
163 {
164 doTestProject( "project-014", new String[]{ "LICENSE.txt", "ejb-sample-one-1.0.jar" } );
165 }
166
167
168
169
170 public void testProject015()
171 throws Exception
172 {
173 final File baseDir = doTestProject( "project-015", new String[]{ "ejb-sample-one-1.0.jar" } );
174 final File expectedManifest = new File( baseDir, "src/main/application/META-INF/MANIFEST.MF" );
175 final File actualManifest = new File( getEarDirectory( baseDir, "project-015" ), "META-INF/MANIFEST.MF" );
176 assertTrue( "Manifest was not copied", actualManifest.exists() );
177 assertTrue( FileUtils.contentEquals( expectedManifest, actualManifest ) );
178 }
179
180
181
182
183 public void testProject016()
184 throws Exception
185 {
186 System.out.println( "Skipped project-016: need a way to extract the EAR archive" );
187
188
189
190
191
192 }
193
194
195
196
197 public void testProject017()
198 throws Exception
199 {
200 doTestProject( "project-017", new String[]{ "ejb-sample-one-1.0.jar" } );
201 }
202
203
204
205
206 public void testProject018()
207 throws Exception
208 {
209 final File baseDir = executeMojo( "project-018", new Properties() );
210 final File expectedFile = new File( baseDir, "target/my-custom-file.ear" );
211 assertTrue( "EAR archive not found", expectedFile.exists() );
212 }
213
214
215
216
217 public void testProject019()
218 throws Exception
219 {
220 doTestProject( "project-019",
221 new String[]{ "ejb-sample-one-1.0.jar", "sar-sample-one-1.0.sar", "jar-sample-one-1.0.jar" },
222 new boolean[]{ false, true, true } );
223 }
224
225
226
227
228 public void testProject020()
229 throws Exception
230 {
231 doTestProject( "project-020",
232 new String[]{ "ejb-sample-one-1.0.jar", "sar-sample-one-1.0.sar", "jar-sample-one-1.0.jar" },
233 new boolean[]{ true, false, false } );
234 }
235
236
237
238
239 public void testProject021()
240 throws Exception
241 {
242 doTestProject( "project-021",
243 new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar", "sar-sample-one-1.0.sar",
244 "jar-sample-one-1.0.jar", "jar-sample-two-1.0.jar" },
245 new boolean[]{ false, true, false, false, true } );
246 }
247
248
249
250
251 public void testProject022()
252 throws Exception
253 {
254 final File baseDir = executeMojo( "project-022", new Properties() );
255 final File expectedFile = new File( baseDir, "target/maven-ear-plugin-test-project-022-99.0-myclassifier.ear" );
256 assertTrue( "EAR archive not found", expectedFile.exists() );
257 }
258
259
260
261
262 public void testProject023()
263 throws Exception
264 {
265 doTestProject( "project-023", new String[]{ "ejb-sample-one-1.0-classified.jar", "ejb-sample-two-1.0.jar" },
266 new boolean[]{ true, false } );
267 }
268
269
270
271
272 public void testProject024()
273 throws Exception
274 {
275 doTestProject( "project-024", new String[]{ "ejb-sample-one-1.0-classified.jar", "ejb-sample-two-1.0.jar" },
276 new boolean[]{ true, false } );
277 }
278
279
280
281
282 public void testProject025()
283 throws Exception
284 {
285 doTestProject( "project-025", new String[]{ "ejb-sample-one-1.0-classified.jar", "ejb-sample-one-1.0.jar" },
286 new boolean[]{ true, false } );
287 }
288
289
290
291
292 public void testProject026()
293 throws Exception
294 {
295 final File baseDir = executeMojo( "project-026", new Properties(), false );
296
297 assertFalse( "Execution should have failed", getEarArchive( baseDir, "project-026" ).exists() );
298 }
299
300
301
302
303 public void testProject027()
304 throws Exception
305 {
306 doTestProject( "project-027", new String[]{ "ejb-sample-one-1.0.jar" } );
307 }
308
309
310
311
312 public void testProject028()
313 throws Exception
314 {
315 doTestProject( "project-028", new String[]{ "ejb-sample-one-1.0.jar" } );
316 }
317
318
319
320
321 public void testProject029()
322 throws Exception
323 {
324 doTestProject( "project-029", new String[]{ "ejb-sample-one-1.0.jar" } );
325 }
326
327
328
329
330
331 public void testProject030()
332 throws Exception
333 {
334 doTestProject( "project-030", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0-client.jar" } );
335 }
336
337
338
339
340
341 public void testProject031()
342 throws Exception
343 {
344 doTestProject( "project-031", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
345 }
346
347
348
349
350 public void testProject032()
351 throws Exception
352 {
353 doTestProject( "project-032", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
354 }
355
356
357
358
359 public void testProject033()
360 throws Exception
361 {
362 doTestProject( "project-033",
363 new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar", "sar-sample-one-1.0.sar",
364 "har-sample-one-1.0.har" } );
365 }
366
367
368
369
370 public void testProject034()
371 throws Exception
372 {
373 doTestProject( "project-034", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
374 }
375
376
377
378
379 public void testProject035()
380 throws Exception
381 {
382 doTestProject( "project-035",
383 new String[]{ "foo/eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar",
384 "libs/eartest-jar-sample-one-1.0.jar", "libs/eartest-jar-sample-two-1.0.jar",
385 "sar-sample-one.sar" } );
386 }
387
388
389
390
391 public void testProject036()
392 throws Exception
393 {
394 doTestProject( "project-036",
395 new String[]{ "foo/eartest-ejb-sample-one-1.0.jar", "eartest-ejb-sample-two-1.0.jar",
396 "com-foo-bar-ejb-sample-one-1.0.jar", "com-foo-bar-ejb-sample-two-1.0.jar",
397 "libs/eartest-jar-sample-one-1.0.jar", "libs/eartest-jar-sample-two-1.0.jar",
398 "sar-sample-one.sar" } );
399 }
400
401
402
403
404
405 public void testProject037()
406 throws Exception
407 {
408 doTestProject( "project-037", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0-client.jar" } );
409 }
410
411
412
413
414
415 public void testProject038()
416 throws Exception
417 {
418 doTestProject( "project-038", new String[]{ "ejb-sample-one-1.0-classified.jar", "ejb-sample-one-1.0.jar" },
419 new boolean[]{ false, true } );
420 }
421
422
423
424
425 public void testProject039()
426 throws Exception
427 {
428 doTestProject( "project-039", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
429 }
430
431
432
433
434
435 public void testProject040()
436 throws Exception
437 {
438 doTestProject( "project-040", new String[]{ "ejb-sample-one-1.0.jar" } );
439 }
440
441
442
443
444 public void testProject041()
445 throws Exception
446 {
447 doTestProject( "project-041", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
448 }
449
450
451
452
453 public void testProject042()
454 throws Exception
455 {
456 doTestProject( "project-042", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
457 }
458
459
460
461
462
463 public void testProject043()
464 throws Exception
465 {
466 final File baseDir = doTestProject( "project-043", new String[]{ "ejb-sample-one-1.0.jar" } );
467 final File expectedApplicationXml = new File( baseDir, "target/custom-descriptor-dir/application.xml" );
468 assertTrue( "Application.xml file not found", expectedApplicationXml.exists() );
469 assertFalse( "Application.xml file should not be empty", expectedApplicationXml.length() == 0 );
470 }
471
472
473
474
475 public void testProject044()
476 throws Exception
477 {
478 doTestProject( "project-044", new String[]{ "ejb-sample-one-1.0.jar", "myLibs/jar-sample-one-1.0.jar" } );
479 }
480
481
482
483
484 public void testProject045()
485 throws Exception
486 {
487 final File baseDir = doTestProject( "project-045", new String[]{ "README.txt", "ejb-sample-one-1.0.jar" } );
488 final File actualReadme = new File( getEarDirectory( baseDir, "project-045" ), "README.txt" );
489 final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );
490 assertTrue( "application name and version was not filtered properly", content.indexOf( "my-app 99.0" ) != -1 );
491 assertTrue( "Escaping did not work properly",
492 content.indexOf( "will not be filtered ${application.name}." ) != -1 );
493 }
494
495
496
497
498
499 public void testProject046()
500 throws Exception
501 {
502 final File baseDir = doTestProject( "project-046", new String[]{ "README.txt", "ejb-sample-one-1.0.jar" } );
503 final File actualReadme = new File( getEarDirectory( baseDir, "project-046" ), "README.txt" );
504 final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );
505 assertTrue( "application name and version was not filtered properly", content.indexOf( "my-app 99.0" ) != -1 );
506 assertTrue( "application build was not filtered properly", content.indexOf( "(Build 2)" ) != -1 );
507 assertTrue( "Unknown property should not have been filtered",
508 content.indexOf( "will not be filtered ${application.unknown}." ) != -1 );
509 }
510
511
512
513
514 public void testProject047()
515 throws Exception
516 {
517 final File baseDir = doTestProject( "project-047", new String[]{ "README.txt", "ejb-sample-one-1.0.jar" } );
518 final File actualReadme = new File( getEarDirectory( baseDir, "project-047" ), "README.txt" );
519 final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );
520 assertTrue( "application name and version should not have been filtered",
521 content.indexOf( "my-app 99.0" ) == -1 );
522 assertTrue( "original properties not found",
523 content.indexOf( "${application.name} ${project.version}" ) != -1 );
524 }
525
526
527
528
529 public void testProject048()
530 throws Exception
531 {
532 doTestProject( "project-048", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
533 }
534
535
536
537
538 public void testProject049()
539 throws Exception
540 {
541 doTestProject( "project-049", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
542 }
543
544
545
546
547 public void testProject050()
548 throws Exception
549 {
550 doTestProject( "project-050", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
551 }
552
553
554
555
556 public void testProject051()
557 throws Exception
558 {
559 doTestProject( "project-051", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
560 }
561
562
563
564
565 public void testProject052()
566 throws Exception
567 {
568 doTestProject( "project-052", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
569 }
570
571
572
573
574 public void testProject053()
575 throws Exception
576 {
577 doTestProject( "project-053", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
578 }
579
580
581
582
583 public void testProject054()
584 throws Exception
585 {
586 doTestProject( "project-054", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
587 }
588
589
590
591
592 public void testProject055()
593 throws Exception
594 {
595 doTestProject( "project-055", new String[]{ "jar-sample-one-1.0.jar", "jar-sample-two-1.0.jar",
596 "jar-sample-three-with-deps-1.0.jar" } );
597 }
598
599
600
601
602
603 public void testProject056()
604 throws Exception
605 {
606 doTestProject( "project-056", new String[]{ "ejb-sample-one-1.0.jar" } );
607 }
608
609
610
611
612
613
614 public void testProject057()
615 throws Exception
616 {
617 doTestProject( "project-057", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
618 }
619
620
621
622
623 public void testProject058()
624 throws Exception
625 {
626 doTestProject( "project-058", new String[]{ "ejb-sample-one-1.0.jar" } );
627 }
628
629
630
631
632 public void testProject059()
633 throws Exception
634 {
635 doTestProject( "project-059", new String[]{ "ejb-sample-one-1.0.jar" } );
636 }
637
638
639
640
641
642
643 public void testProject060()
644 throws Exception
645 {
646 doTestProject( "project-060", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0-client.jar" } );
647 }
648
649
650
651
652
653
654 public void testProject061()
655 throws Exception
656 {
657 doTestProject( "project-061", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0-client.jar" } );
658 }
659
660
661
662
663
664
665 public void testProject062()
666 throws Exception
667 {
668 doTestProject( "project-062", new String[]{ "ejb-sample-one-1.0.jar", "lib/ejb-sample-two-1.0-client.jar" } );
669 }
670
671
672
673
674
675
676 public void testProject063()
677 throws Exception
678 {
679 doTestProject( "project-063", new String[]{ "lib/ejb-sample-two-1.0-client.jar" } );
680 }
681
682
683
684
685
686
687 public void testProject064()
688 throws Exception
689 {
690 doTestProject( "project-064", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0-client.jar" } );
691 }
692
693
694
695
696 public void testProject065()
697 throws Exception
698 {
699 doTestProject( "project-065", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
700 }
701
702
703
704
705 public void testProject066()
706 throws Exception
707 {
708 doTestProject( "project-066", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
709 }
710
711
712
713
714 public void testProject067()
715 throws Exception
716 {
717 doTestProject( "project-067", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
718 }
719
720
721
722
723 public void testProject068()
724 throws Exception
725 {
726 doTestProject( "project-068", new String[]{ "ejb-sample-one.jar", "ejb-sample-two.jar" } );
727 }
728
729
730
731
732 public void testProject069()
733 throws Exception
734 {
735 doTestProject( "project-069", new String[]{ "ejb-sample-one-1.0.jar", "myLibs/jar-sample-one-1.0.jar" } );
736 }
737
738
739
740
741 public void testProject070()
742 throws Exception
743 {
744 doTestProject( "project-070", new String[]{ "ejb-sample-one-1.0.jar", "jar-sample-one-1.0.jar" } );
745 }
746
747
748
749
750 public void testProject071()
751 throws Exception
752 {
753 doTestProject( "project-071", new String[]{ "ejb-sample-one-1.0.jar", "jar-sample-one-1.0.jar" } );
754 }
755
756
757
758
759 public void testProject072()
760 throws Exception
761 {
762 doTestProject( "project-072", new String[]{ "ejb-sample-one-1.0.jar", "app-client-sample-one-1.0.jar" } );
763 }
764
765
766
767
768
769 public void testProject073()
770 throws Exception
771 {
772 doTestProject( "project-073", new String[]{ "ejb-sample-one-1.0.jar", "app-client-sample-one-1.0.jar",
773 "APP-INF/lib/jar-sample-one-1.0.jar", "APP-INF/lib/jar-sample-two-1.0.jar" } );
774 }
775
776
777
778
779
780 public void testProject074()
781 throws Exception
782 {
783 doTestProject( "project-074", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
784 }
785
786
787
788
789
790 public void testProject075()
791 throws Exception
792 {
793 doTestProject( "project-075", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
794 }
795
796
797
798
799
800 public void testProject076()
801 throws Exception
802 {
803 doTestProject( "project-076", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
804 }
805
806
807
808
809 public void testProject077()
810 throws Exception
811 {
812 doTestProject( "project-077", new String[]{ "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
813 }
814
815
816
817
818 public void testProject078()
819 throws Exception
820 {
821 doTestProject( "project-078",
822 new String[]{ "ejb-sample-one.jar", "war-sample-one-1.0.war", "jar-sample-two-1.0.jar" } );
823 }
824
825
826
827
828 public void testProject079()
829 throws Exception
830 {
831 doTestProject( "project-079", new String[]{ "ejb-sample-one-1.0.jar", "myLibs/jar-sample-one-1.0.jar" } );
832 }
833
834
835
836
837 public void testProject080()
838 throws Exception
839 {
840 doTestProject( "project-080", new String[]{ "ejb-sample-one-1.0.jar", "myLibs/jar-sample-one-1.0.jar" } );
841 }
842
843
844
845
846 public void testProject081()
847 throws Exception
848 {
849 doTestProject( "project-081", new String[]{ "ejb-sample-one-1.0.jar", "myLibs/jar-sample-one-1.0.jar" } );
850 }
851
852 }