EMMA Coverage Report (generated Sun Sep 18 11:34:27 PHT 2011)
[all classes][org.apache.maven.continuum.execution.shell]

COVERAGE SUMMARY FOR SOURCE FILE [ShellBuildExecutor.java]

nameclass, %method, %block, %line, %
ShellBuildExecutor.java100% (1/1)25%  (1/4)7%   (5/67)12%  (2/17)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ShellBuildExecutor100% (1/1)25%  (1/4)7%   (5/67)12%  (2/17)
build (Project, BuildDefinition, File): ContinuumBuildExecutionResult 0%   (0/1)0%   (0/16)0%   (0/2)
getEnvironments (BuildDefinition): Map 0%   (0/1)0%   (0/45)0%   (0/12)
updateProjectFromCheckOut (File, Project, BuildDefinition): void 0%   (0/1)0%   (0/1)0%   (0/1)
ShellBuildExecutor (): void 100% (1/1)100% (5/5)100% (2/2)

1package org.apache.maven.continuum.execution.shell;
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 
22import org.apache.maven.continuum.execution.AbstractBuildExecutor;
23import org.apache.maven.continuum.execution.ContinuumBuildExecutionResult;
24import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
25import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
26import org.apache.maven.continuum.execution.ContinuumBuildExecutorException;
27import org.apache.maven.continuum.installation.InstallationService;
28import org.apache.maven.continuum.model.project.BuildDefinition;
29import org.apache.maven.continuum.model.project.Project;
30import org.apache.maven.continuum.model.system.Installation;
31import org.apache.maven.continuum.model.system.Profile;
32import org.codehaus.plexus.util.StringUtils;
33 
34import java.io.File;
35import java.util.Collections;
36import java.util.HashMap;
37import java.util.Map;
38 
39/**
40 * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
41 * @version $Id: ShellBuildExecutor.java 579348 2007-09-25 18:48:15Z evenisse $
42 */
43public class ShellBuildExecutor
44    extends AbstractBuildExecutor
45    implements ContinuumBuildExecutor
46{
47    // ----------------------------------------------------------------------
48    //
49    // ----------------------------------------------------------------------
50 
51    public static final String CONFIGURATION_EXECUTABLE = "executable";
52 
53    public static final String ID = ContinuumBuildExecutorConstants.SHELL_BUILD_EXECUTOR;
54 
55    // ----------------------------------------------------------------------
56    //
57    // ----------------------------------------------------------------------
58 
59    public ShellBuildExecutor()
60    {
61        super( ID, false );
62    }
63 
64    // ----------------------------------------------------------------------
65    // ContinuumBuilder implementation
66    // ----------------------------------------------------------------------
67 
68    public synchronized ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition,
69                                                             File buildOutput )
70        throws ContinuumBuildExecutorException
71    {
72        // TODO: this should be validated earlier?
73        String executable = getBuildFileForProject( project, buildDefinition );
74 
75        return executeShellCommand( project, executable, buildDefinition.getArguments(), buildOutput,
76                                    getEnvironments( buildDefinition ) );
77    }
78 
79    protected Map<String, String> getEnvironments( BuildDefinition buildDefinition )
80    {
81        Profile profile = buildDefinition.getProfile();
82        if ( profile == null )
83        {
84            return Collections.EMPTY_MAP;
85        }
86        Map<String, String> envVars = new HashMap<String, String>();
87        String javaHome = getJavaHomeValue( buildDefinition );
88        if ( !StringUtils.isEmpty( javaHome ) )
89        {
90            envVars.put( getInstallationService().getEnvVar( InstallationService.JDK_TYPE ), javaHome );
91        }
92        Installation builder = profile.getBuilder();
93        if ( builder != null )
94        {
95            envVars.put( builder.getVarName(), builder.getVarValue() );
96        }
97        envVars.putAll( getEnvironmentVariables( buildDefinition ) );
98        return envVars;
99 
100    }
101 
102    public void updateProjectFromCheckOut( File workingDirectory, Project project, BuildDefinition buildDefinition )
103        throws ContinuumBuildExecutorException
104    {
105    }
106}

[all classes][org.apache.maven.continuum.execution.shell]
EMMA 2.0.5312 (C) Vladimir Roubtsov