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 java.io.File;
23  
24  import org.apache.maven.it.util.ResourceExtractor;
25  
26  public class MavenITmng5578SessionScopeTest
27      extends AbstractMavenIntegrationTestCase
28  {
29      public MavenITmng5578SessionScopeTest()
30      {
31          super( "[3.2.4,)" );
32      }
33  
34      public void testBasic()
35          throws Exception
36      {
37          File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5578-session-scope" );
38          File pluginDir = new File( testDir, "plugin" );
39          File projectDir = new File( testDir, "basic" );
40  
41          Verifier verifier;
42  
43          // install the test plugin
44          verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" );
45          verifier.executeGoal( "install" );
46          verifier.resetStreams();
47          verifier.verifyErrorFreeLog();
48  
49          // build the test project
50          verifier = newVerifier( projectDir.getAbsolutePath(), "remote" );
51          verifier.addCliOption( "-Dit-build-extensions=false" );
52          verifier.executeGoal( "package" );
53          verifier.resetStreams();
54          verifier.verifyErrorFreeLog();
55      }
56  
57      public void testBasic_multithreaded()
58          throws Exception
59      {
60          File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5578-session-scope" );
61          File pluginDir = new File( testDir, "plugin" );
62          File projectDir = new File( testDir, "basic" );
63  
64          Verifier verifier;
65  
66          // install the test plugin
67          verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" );
68          verifier.executeGoal( "install" );
69          verifier.resetStreams();
70          verifier.verifyErrorFreeLog();
71  
72          // build the test project
73          verifier = newVerifier( projectDir.getAbsolutePath(), "remote" );
74          verifier.addCliOption( "-Dit-build-extensions=false" );
75          verifier.addCliOption( "--builder multithreaded -T 1" );
76          verifier.executeGoal( "package" );
77          verifier.resetStreams();
78          verifier.verifyErrorFreeLog();
79      }
80  
81      public void testBasic_buildExtension()
82          throws Exception
83      {
84          File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5578-session-scope" );
85          File pluginDir = new File( testDir, "plugin" );
86          File projectDir = new File( testDir, "basic" );
87  
88          Verifier verifier;
89  
90          // install the test plugin
91          verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" );
92          verifier.executeGoal( "install" );
93          verifier.resetStreams();
94          verifier.verifyErrorFreeLog();
95  
96          // build the test project
97          verifier = newVerifier( projectDir.getAbsolutePath(), "remote" );
98          verifier.addCliOption( "-Dit-build-extensions=true" );
99          verifier.executeGoal( "package" );
100         verifier.resetStreams();
101         verifier.verifyErrorFreeLog();
102     }
103 
104     public void testExtension()
105         throws Exception
106     {
107         File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5578-session-scope" );
108         File extensionDir = new File( testDir, "extension" );
109         File pluginDir = new File( testDir, "extension-plugin" );
110         File projectDir = new File( testDir, "extension-project" );
111 
112         Verifier verifier;
113 
114         // install the test extension
115         verifier = newVerifier( extensionDir.getAbsolutePath(), "remote" );
116         verifier.executeGoal( "install" );
117         verifier.resetStreams();
118         verifier.verifyErrorFreeLog();
119 
120         // install the test plugin
121         verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" );
122         verifier.executeGoal( "install" );
123         verifier.resetStreams();
124         verifier.verifyErrorFreeLog();
125 
126         // build the test project
127         verifier = newVerifier( projectDir.getAbsolutePath(), "remote" );
128         verifier.addCliOption( "-Dmaven.ext.class.path=" + new File( extensionDir, "target/classes" ).getAbsolutePath() );
129         verifier.setForkJvm( true ); // verifier does not support custom realms in embedded mode
130         verifier.executeGoal( "package" );
131         verifier.resetStreams();
132         verifier.verifyErrorFreeLog();
133 
134     }
135 }