1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  package org.apache.maven.plugin.eclipse.it;
20  
21  import java.io.File;
22  import java.util.ArrayList;
23  import java.util.List;
24  import java.util.Properties;
25  
26  import org.apache.commons.io.FileUtils;
27  import org.apache.maven.plugin.MojoExecutionException;
28  import org.apache.maven.plugin.eclipse.TempEclipseWorkspace;
29  
30  
31  
32  
33  
34  
35  public class EclipsePluginIT
36      extends AbstractEclipsePluginIT
37  {
38      private static boolean initialized = false;
39  
40      protected void setUp()
41          throws Exception
42      {
43          super.setUp();
44  
45          if ( !initialized )
46          {
47              File tempWorkspace = new File( "target/test-classes/eclipse" );
48              FileUtils.deleteDirectory( tempWorkspace );
49              FileUtils.copyDirectoryToDirectory( new File( "src/test/resources/eclipse" ), tempWorkspace );
50              initialized = true;
51          }
52      }
53  
54      
55  
56  
57  
58      public void testDynamicWorkspaceLookup()
59          throws Exception
60      {
61          File basedir =
62              new File( TempEclipseWorkspace.getFixtureEclipseDynamicWorkspace().workspaceLocation, "project-Z" );
63          testProject( basedir );
64      }
65  
66      public void testProject01()
67          throws Exception
68      {
69          testProject( "project-01" );
70      }
71  
72      public void testProject02()
73          throws Exception
74      {
75          testProject( "project-02" );
76      }
77  
78      public void testProject03()
79          throws Exception
80      {
81          testProject( "project-03" );
82      }
83  
84      public void testProject04()
85          throws Exception
86      {
87          testProject( "project-04" );
88      }
89  
90      public void testProject05()
91          throws Exception
92      {
93          testProject( "project-05" );
94      }
95  
96      public void testProject06()
97          throws Exception
98      {
99          testProject( "project-06" );
100     }
101 
102     
103 
104 
105     public void testProject07()
106         throws Exception
107     {
108         
109         testProject( "project-07" );
110     }
111 
112     public void testProject08()
113         throws Exception
114     {
115         testProject( "project-08" );
116     }
117 
118     
119 
120 
121 
122 
123     public void testProject09()
124         throws Exception
125     {
126         testProject( "project-09" );
127     }
128 
129     public void testProject10()
130         throws Exception
131     {
132         testProject( "project-10" );
133     }
134 
135     public void testProject11()
136         throws Exception
137     {
138         testProject( "project-11" );
139     }
140 
141     
142 
143 
144 
145 
146     public void testProject12()
147         throws Exception
148     {
149         testProject( "project-12" );
150     }
151 
152     
153 
154 
155 
156 
157     public void testProject13()
158         throws Exception
159     {
160         
161         String mavenVersion = SelectorUtils.getMavenVersion( getMavenHome() );
162         if( SelectorUtils.isMavenVersion( "!3.0.4, !3.0.5, !3.1.0-alpha-1, !3.1.0", mavenVersion ) )
163         {
164             testProject( "project-13" );
165         }
166         else
167         {
168             System.out.println( "  Skipping project-13 due to Maven version" );
169         }
170     }
171 
172     
173 
174 
175 
176 
177     public void testProject14()
178         throws Exception
179     {
180         testProject( "project-14" );
181     }
182 
183     
184 
185 
186 
187 
188     public void testProject15()
189         throws Exception
190     {
191         Properties props = new Properties();
192         props.put( "outputDirectory", "bin" );
193         testProject( "project-15", props, "clean", "eclipse" );
194     }
195 
196     
197 
198 
199 
200 
201     public void testProject16()
202         throws Exception
203     {
204         
205         testProject( "project-16" );
206     }
207 
208     
209 
210 
211 
212 
213     public void testProject17()
214         throws Exception
215     {
216         
217         testProject( "project-17" );
218     }
219 
220     
221 
222 
223 
224 
225     public void testProject18()
226         throws Exception
227     {
228         testProject( "project-18" );
229     }
230 
231     
232 
233 
234 
235 
236     public void testProject19()
237         throws Exception
238     {
239         testProject( "project-19" );
240     }
241 
242     
243 
244 
245 
246 
247     public void testProject20()
248         throws Exception
249     {
250         testProject( "project-20" );
251     }
252 
253     
254 
255 
256 
257 
258     public void testProject25()
259         throws Exception
260     {
261         testProject( "project-25" );
262     }
263 
264     
265 
266 
267 
268 
269     public void testProject26()
270         throws Exception
271     {
272         testProject( "project-26" );
273     }
274 
275     
276 
277 
278 
279 
280     public void testProject27()
281         throws Exception
282     {
283         testProject( "project-27" );
284     }
285 
286     
287 
288 
289 
290 
291     public void testProject28()
292         throws Exception
293     {
294         testProject( "project-28/module-1" );
295     }
296 
297     
298 
299 
300 
301 
302     public void testProject29()
303         throws Exception
304     {
305         testProject( "project-29" );
306     }
307 
308     
309 
310 
311 
312 
313     public void testProject30()
314         throws Exception
315     {
316         testProject( "project-30" );
317     }
318 
319     
320 
321 
322 
323 
324     public void testProject31()
325         throws Exception
326     {
327         try
328         {
329             testProject( "project-31" );
330 
331             
332             
333         }
334         catch ( MojoExecutionException e )
335         {
336             
337         }
338     }
339 
340     
341 
342 
343 
344 
345     public void testProject32()
346         throws Exception
347     {
348         testProject( "project-32" );
349     }
350 
351     
352 
353 
354 
355 
356 
357     public void testProject33()
358         throws Exception
359     {
360         testProject( "project-33" );
361     }
362 
363     public void testProject34()
364         throws Exception
365     {
366         testProject( "project-34" );
367     }
368 
369     public void testProject35()
370         throws Exception
371     {
372         testProject( "project-35" );
373     }
374 
375     public void testProject36()
376         throws Exception
377     {
378         
379         File basedir = getTestFile( "target/test-classes/projects/project-36" );
380         File pom = new File( basedir, "pom.xml" );
381         List goals = new ArrayList();
382         goals.add( "install" );
383         executeMaven( pom, new Properties(), goals );
384         
385         testProject( "project-36" );
386     }
387 
388     public void testProject37()
389         throws Exception
390     {
391         testProject( "project-37" );
392     }
393 
394     
395 
396 
397     public void testMECLIPSE_56_encoding()
398         throws Exception
399     {
400         testProject( "MECLIPSE-56_encoding" );
401     }
402 
403     public void testProject38()
404         throws Exception
405     {
406         testProject( "project-38" );
407     }
408 
409     public void testProject39_a()
410         throws Exception
411     {
412         checkJRESettingsWithEclipseWorkspace( "project-39-a", TempEclipseWorkspace.getFixtureEclipseWithDefault13(),
413                                               null );
414     }
415 
416     public void testProject39_b()
417         throws Exception
418     {
419         checkJRESettingsWithEclipseWorkspace( "project-39-b", TempEclipseWorkspace.getFixtureEclipseWithDefault15(),
420                                               null );
421     }
422 
423     public void testProject39_c()
424         throws Exception
425     {
426         checkJRESettingsWithEclipseWorkspace( "project-39-c",
427                                               TempEclipseWorkspace.getFixtureEclipseWorkspaceWithRad7Default14(), null );
428     }
429 
430     public void testProject40_a()
431         throws Exception
432     {
433         TempEclipseWorkspace eclipseWorkspace = TempEclipseWorkspace.getFixtureEclipseWithDefault13();
434         String jre131 = new File( eclipseWorkspace.workspaceLocation, "../../dummyJDK/1.3.1/bin/javac" ).getCanonicalPath();
435         checkJRESettingsWithEclipseWorkspace( "project-40-a", eclipseWorkspace, jre131 );
436     }
437 
438     public void testProject40_b()
439         throws Exception
440     {
441         TempEclipseWorkspace eclipseWorkspace = TempEclipseWorkspace.getFixtureEclipseWithDefault15();
442         String jre131 = new File( eclipseWorkspace.workspaceLocation, "../../dummyJDK/1.3.1/bin/javac" ).getCanonicalPath();
443         checkJRESettingsWithEclipseWorkspace( "project-40-b", eclipseWorkspace, jre131 );
444     }
445 
446     public void testProject40_c()
447         throws Exception
448     {
449         TempEclipseWorkspace eclipseWorkspace = TempEclipseWorkspace.getFixtureEclipseWorkspaceWithRad7Default14();
450         String jre131 = new File( eclipseWorkspace.workspaceLocation, "../../dummyJDK/1.3.1/bin/javac" ).getCanonicalPath();
451         checkJRESettingsWithEclipseWorkspace( "project-40-c", eclipseWorkspace, jre131 );
452     }
453 
454     public void testProject41()
455         throws Exception
456     {
457         TempEclipseWorkspace rad7 = TempEclipseWorkspace.getFixtureEclipseWorkspaceWithRad7Default14();
458         Properties properties = new Properties();
459         properties.setProperty( "eclipse.workspace", rad7.workspaceLocation.getCanonicalPath() );
460         testProject( "project-41", properties, "clean", "eclipse" );
461 
462     }
463 
464     public void testProject42()
465         throws Exception
466     {
467         TempEclipseWorkspace rad7 = TempEclipseWorkspace.getFixtureEclipseWorkspaceWithRad7Default14();
468         Properties properties = new Properties();
469         properties.setProperty( "eclipse.workspace", rad7.workspaceLocation.getCanonicalPath() );
470         testProject( "project-42", properties, "clean", "eclipse" );
471 
472     }
473 
474     
475 
476 
477 
478 
479 
480     public void testProject43()
481         throws Exception
482     {
483         testProject( "project-43" );
484     }
485 
486     
487 
488 
489 
490 
491 
492     public void testProject45()
493         throws Exception
494     {
495         testProject( "project-45" );
496     }
497 
498     
499 
500 
501 
502 
503 
504     public void testProject46()
505         throws Exception
506     {
507         testProject( "project-46" );
508         assertNotAvailableMarkerFileExists( "biz.aQute", "bndlib", "0.0.145", null, "sources" );
509         assertNotAvailableMarkerFileExists( "biz.aQute", "bndlib", "0.0.145", null, "javadoc" );
510     }
511 
512     
513 
514 
515 
516 
517 
518     public void testProject47()
519         throws Exception
520     {
521         testProject( "project-47" );
522         assertNotAvailableMarkerFileExists( "commons-lang", "commons-lang", "1.0", null, "sources" );
523         assertNotAvailableMarkerFileDoesNotExist( "commons-lang", "commons-lang", "1.0", null, "javadoc" );
524     }
525 
526     
527 
528 
529 
530 
531 
532     public void testProject48()
533         throws Exception
534     {
535         testProject( "project-48" );
536         assertNotAvailableMarkerFileDoesNotExist( "does-not-exist", "does-not-exist", "666", null, "sources" );
537         assertNotAvailableMarkerFileDoesNotExist( "does-not-exist", "does-not-exist", "666", null, "javadoc" );
538     }
539 
540     
541 
542 
543 
544 
545     public void testProject49()
546         throws Exception
547     {
548         File notAvailableMarkerFile =
549             getNotAvailableMarkerFile( "commons-lang", "commons-lang", "2.4", null, "sources" );
550         notAvailableMarkerFile.getParentFile().mkdirs();
551         notAvailableMarkerFile.createNewFile();
552         getNotAvailableMarkerFile( "commons-lang", "commons-lang", "2.4", null, "javadoc" ).createNewFile();
553 
554         testProject( "project-49" );
555         assertNotAvailableMarkerFileDoesNotExist( "commons-lang", "commons-lang", "2.4", null, "sources" );
556         assertNotAvailableMarkerFileDoesNotExist( "commons-lang", "commons-lang", "2.4", null, "javadoc" );
557     }
558 
559     
560 
561 
562 
563 
564     public void testProject50MECLIPSE415()
565         throws Exception
566     {
567         TempEclipseWorkspace dynamicWorkspace = TempEclipseWorkspace.getFixtureEclipseDynamicWorkspace();
568         Properties props = new Properties();
569         props.setProperty( "eclipse.workspace", dynamicWorkspace.workspaceLocation.getCanonicalPath() );
570         testProject( "project-50-MECLIPSE-415", props, "clean", "eclipse" );
571     }
572 
573     
574 
575 
576 
577 
578     public void testProject51MECLIPSE415()
579         throws Exception
580     {
581         testProject( "project-51-MECLIPSE-415" );
582     }
583 
584     
585 
586 
587 
588 
589     public void testProject52MECLIPSE104()
590         throws Exception
591     {
592         testProject( "project-52-MECLIPSE-104" );
593     }
594 
595     
596 
597 
598 
599 
600     public void testProject53MECLIPSE551()
601         throws Exception
602     {
603         testProject( "project-53-MECLIPSE-551" );
604     }
605 
606     
607 
608 
609 
610 
611     public void testProject54MECLIPSE178()
612         throws Exception
613     {
614         testProject( "project-54-MECLIPSE-178" );
615     }
616 
617     
618 
619 
620 
621 
622 
623     public void testProject55MECLIPSE178()
624         throws Exception
625     {
626         testProject( "project-55-MECLIPSE-178" );
627     }
628 
629     
630 
631 
632 
633 
634     public void testProject56()
635         throws Exception
636     {
637         testProject( "project-56-MECLIPSE-603" );
638     }
639 
640     
641 
642 
643 
644 
645     public void testProject57()
646         throws Exception
647     {
648         testProject( "project-57-MECLIPSE-368" );
649     }
650 
651     
652 
653 
654 
655 
656     public void testProject58()
657         throws Exception
658     {
659         testProject( "project-58-MECLIPSE-621" );
660     }
661 
662     
663 
664 
665 
666 
667     public void testProject59()
668         throws Exception
669     {
670         testProject( "project-59-MECLIPSE-576" );
671     }
672 
673     
674 
675 
676 
677 
678     public void testProject60()
679         throws Exception
680     {
681         testProject( "project-60-MECLIPSE-652" );
682     }
683 
684     
685 
686 
687 
688 
689     public void testProject61()
690         throws Exception
691     {
692         testProject( "project-61-MECLIPSE-548" );
693     }
694 
695     
696 
697 
698 
699 
700     public void testProject62()
701         throws Exception
702     {
703         testProject( "project-62-MECLIPSE-561" );
704     }
705     
706     
707 
708 
709 
710 
711     public void testProject63()
712         throws Exception
713     {
714         testProject( "project-63-MECLIPSE-388" );
715     }
716 
717     
718 
719 
720 
721 
722     public void testProject64()
723         throws Exception
724     {
725         testProject( "project-64-MECLIPSE-388" );
726     }
727 
728     
729 
730 
731 
732 
733     public void testProject65()
734         throws Exception
735     {
736         testProject( "project-65-MECLIPSE-642" );
737     }
738     
739 
740     public void testGroovy()
741         throws Exception
742     {
743         testProject( "groovy" );
744     }
745     
746     public void testJeeSimple()
747         throws Exception
748     {
749         
750         File basedir = getTestFile( "target/test-classes/projects/j2ee-simple" );
751         File pom = new File( basedir, "pom.xml" );
752         List goals = new ArrayList();
753         goals.add( "install" );
754         executeMaven( pom, new Properties(), goals );
755         
756         testProject( "j2ee-simple" );
757     }
758 
759     private void checkJRESettingsWithEclipseWorkspace( String project, TempEclipseWorkspace workspace, String jreExec )
760         throws Exception
761     {
762         Properties properties = new Properties();
763         properties.setProperty( "eclipse.workspace", workspace.workspaceLocation.getCanonicalPath() );
764         if ( jreExec != null )
765         {
766             properties.setProperty( "maven.compiler.executable", jreExec );
767         }
768         testProject( project, properties, "clean", "eclipse" );
769     }
770 
771 }