View Javadoc
1   package org.apache.maven.it;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.it.util.ResourceExtractor;
23  
24  import java.io.File;
25  
26  /**
27   * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-6084">MNG-6084</a>.
28   */
29  public class MavenITmng6084Jsr250PluginTest
30      extends AbstractMavenIntegrationTestCase
31  {
32  
33      private File testDir;
34  
35      public MavenITmng6084Jsr250PluginTest()
36      {
37          super( "[3.5.1,)" );
38      }
39  
40      public void setUp()
41          throws Exception
42      {
43          super.setUp();
44  
45          testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6084-jsr250-support" );
46  
47      }
48  
49      protected void tearDown()
50          throws Exception
51      {
52  
53          super.tearDown();
54      }
55  
56      public void testJsr250PluginExecution()
57          throws Exception
58      {
59          //
60          // Build a plugin that uses JSR 250 annotations
61          //
62          Verifier v0 = newVerifier( testDir.getAbsolutePath(), "remote" );
63          v0.setAutoclean( false );
64          v0.deleteDirectory( "target" );
65          v0.deleteArtifacts( "org.apache.maven.its.mng6084" );
66          v0.executeGoal( "install" );
67          v0.verifyErrorFreeLog();
68          v0.resetStreams();
69  
70          //
71          // Execute the JSR 250 plugin
72          //
73          Verifier v1 = newVerifier( testDir.getAbsolutePath(), "remote" );
74          v1.setAutoclean( false );
75          v1.executeGoal( "org.apache.maven.its.mng6084:jsr250-maven-plugin:0.0.1-SNAPSHOT:hello" );
76          v1.verifyErrorFreeLog();
77          v1.resetStreams();
78          v1.verifyTextInLog( "Hello! I am a component using JSR 250 with @PostConstruct support" );
79  
80      }
81  
82  }