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 [AbstractBuildAction.java]

nameclass, %method, %block, %line, %
AbstractBuildAction.java100% (1/1)67%  (4/6)44%  (31/71)56%  (9.6/17)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractBuildAction100% (1/1)67%  (4/6)44%  (31/71)56%  (9.6/17)
isCanDelete (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)
setProjectId (int): void 0%   (0/1)0%   (0/4)0%   (0/2)
canRemoveBuildResult (BuildResult): boolean 100% (1/1)35%  (18/51)51%  (4.6/9)
AbstractBuildAction (): void 100% (1/1)100% (6/6)100% (2/2)
getProjectId (): int 100% (1/1)100% (3/3)100% (1/1)
setCanDelete (boolean): void 100% (1/1)100% (4/4)100% (2/2)

1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  You may obtain a 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,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.apache.maven.continuum.web.action;
20 
21import java.util.Map;
22import java.util.Set;
23 
24import org.apache.continuum.buildmanager.BuildManagerException;
25import org.apache.continuum.buildmanager.BuildsManager;
26import org.apache.continuum.taskqueue.BuildProjectTask;
27import org.apache.maven.continuum.model.project.BuildResult;
28import org.apache.maven.continuum.project.ContinuumProjectState;
29 
30/**
31 * @author <a href="mailto:olamy@apache.org">olamy</a>
32 * @version $Id: AbstractBuildAction.java 822971 2009-10-08 00:34:21Z ctan $
33 * @since 5 oct. 07
34 */
35public abstract class AbstractBuildAction
36    extends ContinuumConfirmAction
37{
38    private int projectId;
39 
40    private boolean canDelete = true;
41 
42    protected boolean canRemoveBuildResult( BuildResult buildResult )
43        throws BuildManagerException
44    {
45        BuildsManager buildsManager = getContinuum().getBuildsManager();
46 
47        Map<String, BuildProjectTask> currentBuilds = buildsManager.getCurrentBuilds();
48        Set<String> keySet = currentBuilds.keySet();
49        for ( String key : keySet )
50        {
51            BuildProjectTask buildProjectTask = currentBuilds.get( key );
52            if ( buildProjectTask != null && buildResult != null )
53            {
54                return !( buildResult.getState() == ContinuumProjectState.BUILDING &&
55                    ( buildProjectTask.getBuildDefinitionId() == buildResult.getBuildDefinition().getId() &&
56                        buildProjectTask.getProjectId() == this.getProjectId() ) );
57            }
58        }
59        return true;
60    }
61 
62    public int getProjectId()
63    {
64        return projectId;
65    }
66 
67    public void setProjectId( int projectId )
68    {
69        this.projectId = projectId;
70    }
71 
72    public boolean isCanDelete()
73    {
74        return canDelete;
75    }
76 
77    public void setCanDelete( boolean canDelete )
78    {
79        this.canDelete = canDelete;
80    }
81}

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