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

nameclass, %method, %block, %line, %
ValidateProject.java100% (1/1)100% (2/2)30%  (23/76)61%  (5.5/9)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ValidateProject100% (1/1)100% (2/2)30%  (23/76)61%  (5.5/9)
execute (Map): void 100% (1/1)27%  (20/73)56%  (4.5/8)
ValidateProject (): 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
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 java.util.List;
23import java.util.Map;
24 
25import org.apache.continuum.dao.ProjectDao;
26import org.apache.maven.continuum.ContinuumException;
27import org.apache.maven.continuum.execution.manager.BuildExecutorManager;
28import org.apache.maven.continuum.model.project.Project;
29import org.codehaus.plexus.util.StringUtils;
30 
31/**
32 * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
33 * @version $Id: ValidateProject.java 771177 2009-05-04 05:02:26Z evenisse $
34 * @plexus.component role="org.codehaus.plexus.action.Action"
35 * role-hint="validate-project"
36 */
37public class ValidateProject
38    extends AbstractValidationContinuumAction
39{
40    /**
41     * @plexus.requirement
42     */
43    private BuildExecutorManager buildExecutorManager;
44 
45    /**
46     * @plexus.requirement
47     */
48    private ProjectDao projectDao;
49 
50    public void execute( Map context )
51        throws Exception
52    {
53        Project project = getUnvalidatedProject( context );
54 
55        // ----------------------------------------------------------------------
56        // Make sure that the builder id is correct before starting to check
57        // stuff out
58        // ----------------------------------------------------------------------
59 
60        if ( !buildExecutorManager.hasBuildExecutor( project.getExecutorId() ) )
61        {
62            throw new ContinuumException( "No such executor with id '" + project.getExecutorId() + "'." );
63        }
64 
65        List<Project> projects = projectDao.getAllProjectsByName();
66 
67        for ( Project storedProject : projects )
68        {
69            // CONTINUUM-1445
70            if ( StringUtils.equalsIgnoreCase( project.getName(), storedProject.getName() ) &&
71                StringUtils.equalsIgnoreCase( project.getVersion(), storedProject.getVersion() ) &&
72                StringUtils.equalsIgnoreCase( project.getScmUrl(), storedProject.getScmUrl() ) )
73            {
74                throw new ContinuumException( "A duplicate project already exist '" + storedProject.getName() + "'." );
75            }
76        }
77        /*
78        if ( store.getProjectByName( project.getName() ) != null )
79        {
80            throw new ContinuumException( "A project with the name '" + project.getName() + "' already exist." );
81        }
82        */
83 
84//        if ( getProjectByScmUrl( scmUrl ) != null )
85//        {
86//            throw new ContinuumStoreException( "A project with the scm url '" + scmUrl + "' already exist." );
87//        }
88 
89        // TODO: Enable
90//        assertStringNotEmpty( project.getPath(), "path" );
91//        assertStringNotEmpty( project.getGroupId(), "group id" );
92//        assertStringNotEmpty( project.getArtifactId(), "artifact id" );
93 
94//        if ( project.getProjectGroup() == null )
95//        {
96//            throw new ContinuumException( "A project has to belong to a project group." );
97//        }
98 
99        // TODO: validate that the SCM provider id
100    }
101}

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