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

COVERAGE SUMMARY FOR SOURCE FILE [AddBuildDefinitionToProjectAction.java]

nameclass, %method, %block, %line, %
AddBuildDefinitionToProjectAction.java100% (1/1)100% (2/2)57%  (34/60)69%  (11/16)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AddBuildDefinitionToProjectAction100% (1/1)100% (2/2)57%  (34/60)69%  (11/16)
execute (Map): void 100% (1/1)54%  (31/57)67%  (10/15)
AddBuildDefinitionToProjectAction (): void 100% (1/1)100% (3/3)100% (1/1)

1package org.apache.maven.continuum.core.action;
2 
3/*
4 * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
5 * agreements. See the NOTICE file distributed with this work for additional information regarding
6 * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance with the License. You may obtain a
8 * copy of the License at
9 * 
10 * http://www.apache.org/licenses/LICENSE-2.0
11 * 
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
15 * the License.
16 */
17 
18import java.util.List;
19import java.util.Map;
20 
21import org.apache.continuum.dao.ProjectDao;
22import org.apache.maven.continuum.model.project.BuildDefinition;
23import org.apache.maven.continuum.model.project.BuildDefinitionTemplate;
24import org.apache.maven.continuum.model.project.Project;
25 
26/**
27 * AddBuildDefinitionToProjectAction:
28 *
29 * @author Jesse McConnell <jmcconnell@apache.org>
30 * @version $Id: AddBuildDefinitionToProjectAction.java 788260 2009-06-25 05:02:07Z evenisse $
31 * @plexus.component role="org.codehaus.plexus.action.Action"
32 * role-hint="add-build-definition-to-project"
33 */
34public class AddBuildDefinitionToProjectAction
35    extends AbstractBuildDefinitionContinuumAction
36{
37    /**
38     * @plexus.requirement
39     */
40    private ProjectDao projectDao;
41 
42    public void execute( Map context )
43        throws Exception
44    {
45        int projectId = getProjectId( context );
46        Project project = projectDao.getProjectWithAllDetails( projectId );
47 
48        BuildDefinitionTemplate buildDefinitionTemplate = getBuildDefinitionTemplate( context );
49 
50        if ( buildDefinitionTemplate != null )
51        {
52            for ( BuildDefinition buildDefinition : (List<BuildDefinition>) buildDefinitionTemplate.getBuildDefinitions() )
53            {
54                resolveDefaultBuildDefinitionsForProject( buildDefinition, project );
55 
56                project.addBuildDefinition( buildDefinition );
57 
58                if ( buildDefinition.isDefaultForProject() )
59                {
60                    AbstractContinuumAction.setBuildDefinition( context, buildDefinition );
61                }
62            }
63        }
64        else
65        {
66            BuildDefinition buildDefinition = getBuildDefinition( context );
67            resolveDefaultBuildDefinitionsForProject( buildDefinition, project );
68 
69            project.addBuildDefinition( buildDefinition );
70 
71            AbstractContinuumAction.setBuildDefinition( context, buildDefinition );
72        }
73 
74        // Save the project
75        projectDao.updateProject( project );
76    }
77}

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