View Javadoc

1   package org.apache.maven.continuum.execution.manager;
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.continuum.AbstractContinuumTest;
23  import org.apache.maven.continuum.execution.AbstractBuildExecutor;
24  import org.apache.maven.continuum.execution.ant.AntBuildExecutor;
25  import org.apache.maven.continuum.execution.maven.m1.MavenOneBuildExecutor;
26  import org.apache.maven.continuum.execution.maven.m2.MavenTwoBuildExecutor;
27  import org.apache.maven.continuum.execution.shell.ShellBuildExecutor;
28  
29  /**
30   * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
31   * @version $Id: DefaultBuildExecutorManagerTest.java 1372260 2012-08-13 04:29:09Z brett $
32   */
33  public class DefaultBuildExecutorManagerTest
34      extends AbstractContinuumTest
35  {
36      private BuildExecutorManager builderManager;
37  
38      @Override
39      protected void setUp()
40          throws Exception
41      {
42          super.setUp();
43          builderManager = (BuildExecutorManager) lookup( BuildExecutorManager.ROLE );
44      }
45  
46      public void testMavenTwoBuildExecutorDependencyInjection()
47          throws Exception
48      {
49          MavenTwoBuildExecutor executor = (MavenTwoBuildExecutor) builderManager.getBuildExecutor(
50              MavenTwoBuildExecutor.ID );
51  
52          assertCommonFields( executor );
53          assertNotNull( executor.getBuilderHelper() );
54          assertNotNull( executor.getProjectHelper() );
55          assertNotNull( executor.getConfigurationService() );
56      }
57  
58      public void testMavenOneBuildExecutorDependencyInjection()
59          throws Exception
60      {
61          MavenOneBuildExecutor executor = (MavenOneBuildExecutor) builderManager.getBuildExecutor(
62              MavenOneBuildExecutor.ID );
63  
64          assertCommonFields( executor );
65          assertNotNull( executor.getMetadataHelper() );
66      }
67  
68      public void testAntBuildExecutorDependencyInjection()
69          throws Exception
70      {
71          AntBuildExecutor executor = (AntBuildExecutor) builderManager.getBuildExecutor( AntBuildExecutor.ID );
72  
73          assertCommonFields( executor );
74      }
75  
76      public void testShellBuildExecutorDependencyInjection()
77          throws Exception
78      {
79          ShellBuildExecutor executor = (ShellBuildExecutor) builderManager.getBuildExecutor( ShellBuildExecutor.ID );
80  
81          assertCommonFields( executor );
82      }
83  
84      private void assertCommonFields( AbstractBuildExecutor executor )
85      {
86          assertNotNull( executor.getShellCommandHelper() );
87          assertNotNull( executor.getExecutableResolver() );
88          assertNotNull( executor.getWorkingDirectoryService() );
89          assertNotNull( executor.getInstallationService() );
90      }
91  }