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

COVERAGE SUMMARY FOR SOURCE FILE [ReleaseProjectGoalAction.java]

nameclass, %method, %block, %line, %
ReleaseProjectGoalAction.java0%   (0/1)0%   (0/13)0%   (0/134)0%   (0/41)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ReleaseProjectGoalAction0%   (0/1)0%   (0/13)0%   (0/134)0%   (0/41)
ReleaseProjectGoalAction (): void 0%   (0/1)0%   (0/6)0%   (0/2)
execute (): String 0%   (0/1)0%   (0/78)0%   (0/21)
getPreparedReleaseId (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getPreparedReleaseName (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getProjectGroupId (): int 0%   (0/1)0%   (0/3)0%   (0/1)
getProjectGroupName (): String 0%   (0/1)0%   (0/15)0%   (0/3)
getProjectId (): int 0%   (0/1)0%   (0/3)0%   (0/1)
getProjectName (): String 0%   (0/1)0%   (0/3)0%   (0/1)
setPreparedReleaseId (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
setPreparedReleaseName (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
setProjectGroupId (int): void 0%   (0/1)0%   (0/4)0%   (0/2)
setProjectId (int): void 0%   (0/1)0%   (0/4)0%   (0/2)
setProjectName (String): void 0%   (0/1)0%   (0/4)0%   (0/2)

1package org.apache.maven.continuum.web.action;
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.continuum.release.distributed.manager.DistributedReleaseManager;
23import org.apache.maven.artifact.ArtifactUtils;
24import org.apache.maven.continuum.ContinuumException;
25import org.apache.maven.continuum.model.project.Project;
26import org.apache.maven.continuum.release.ContinuumReleaseManager;
27import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
28import org.apache.maven.shared.release.config.ReleaseDescriptor;
29import org.codehaus.plexus.util.StringUtils;
30 
31import java.util.Map;
32 
33/**
34 * @author Edwin Punzalan
35 * @version $Id: ReleaseProjectGoalAction.java 751433 2009-03-08 14:41:33Z ctan $
36 * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="releaseProjectGoal"
37 */
38public class ReleaseProjectGoalAction
39    extends ContinuumActionSupport
40{
41    private int projectId;
42 
43    private int projectGroupId;
44 
45    private String projectName;
46 
47    private String preparedReleaseName;
48 
49    private String preparedReleaseId;
50 
51    private String projectGroupName = "";
52 
53    public String execute()
54        throws Exception
55    {
56        try
57        {
58            checkBuildProjectInGroupAuthorization( getProjectGroupName() );
59        }
60        catch ( AuthorizationRequiredException e )
61        {
62            return REQUIRES_AUTHORIZATION;
63        }
64 
65        Project project = getContinuum().getProjectWithAllDetails( projectId );
66 
67        String releaseId = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
68 
69        if ( getContinuum().getConfiguration().isDistributedBuildEnabled() )
70        {
71            DistributedReleaseManager releaseManager = getContinuum().getDistributedReleaseManager();
72 
73            preparedReleaseName = releaseManager.getPreparedReleaseName( releaseId );
74 
75            if ( StringUtils.isNotBlank( preparedReleaseName ) )
76            {
77                preparedReleaseId = releaseId;
78            }
79            else
80            {
81                preparedReleaseName = null;
82            }
83        }
84        else
85        {
86            ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
87    
88            Map preparedReleases = releaseManager.getPreparedReleases();
89            if ( preparedReleases.containsKey( releaseId ) )
90            {
91                ReleaseDescriptor descriptor = (ReleaseDescriptor) preparedReleases.get( releaseId );
92    
93                preparedReleaseName = descriptor.getReleaseVersions().get( releaseId ).toString();
94    
95                preparedReleaseId = releaseId;
96            }
97        }
98 
99        projectName = project.getName();
100 
101        return SUCCESS;
102    }
103 
104    public int getProjectId()
105    {
106        return projectId;
107    }
108 
109    public void setProjectId( int projectId )
110    {
111        this.projectId = projectId;
112    }
113 
114    public int getProjectGroupId()
115    {
116        return projectGroupId;
117    }
118 
119    public void setProjectGroupId( int projectGroupId )
120    {
121        this.projectGroupId = projectGroupId;
122    }
123 
124    public String getProjectName()
125    {
126        return projectName;
127    }
128 
129    public void setProjectName( String projectName )
130    {
131        this.projectName = projectName;
132    }
133 
134    public String getPreparedReleaseName()
135    {
136        return preparedReleaseName;
137    }
138 
139    public void setPreparedReleaseName( String preparedReleaseName )
140    {
141        this.preparedReleaseName = preparedReleaseName;
142    }
143 
144    public String getPreparedReleaseId()
145    {
146        return preparedReleaseId;
147    }
148 
149    public void setPreparedReleaseId( String preparedReleaseId )
150    {
151        this.preparedReleaseId = preparedReleaseId;
152    }
153 
154    public String getProjectGroupName()
155        throws ContinuumException
156    {
157        if ( StringUtils.isEmpty( projectGroupName ) )
158        {
159            projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName();
160        }
161 
162        return projectGroupName;
163    }
164}

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