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

COVERAGE SUMMARY FOR SOURCE FILE [CheckOutTaskExecutor.java]

nameclass, %method, %block, %line, %
CheckOutTaskExecutor.java100% (1/1)100% (3/3)100% (74/74)100% (23/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CheckOutTaskExecutor100% (1/1)100% (3/3)100% (74/74)100% (23/23)
<static initializer> 100% (1/1)100% (4/4)100% (1/1)
CheckOutTaskExecutor (): void 100% (1/1)100% (3/3)100% (1/1)
executeTask (Task): void 100% (1/1)100% (67/67)100% (21/21)

1package org.apache.maven.continuum.scm.queue;
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.HashMap;
23import java.util.Map;
24 
25import org.apache.continuum.dao.ProjectDao;
26import org.apache.continuum.taskqueue.CheckOutTask;
27import org.apache.maven.continuum.core.action.AbstractContinuumAction;
28import org.apache.maven.continuum.core.action.CheckoutProjectContinuumAction;
29import org.apache.maven.continuum.model.project.Project;
30import org.apache.maven.continuum.store.ContinuumStoreException;
31import org.codehaus.plexus.action.ActionManager;
32import org.codehaus.plexus.taskqueue.Task;
33import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
34import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
35import org.slf4j.Logger;
36import org.slf4j.LoggerFactory;
37 
38/**
39 * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
40 * @version $Id: CheckOutTaskExecutor.java 771177 2009-05-04 05:02:26Z evenisse $
41 * @plexus.component role="org.codehaus.plexus.taskqueue.execution.TaskExecutor"
42 * role-hint="check-out-project" instantiation-strategy="per-lookup"
43 */
44public class CheckOutTaskExecutor
45    implements TaskExecutor
46{
47    private static final Logger log = LoggerFactory.getLogger( CheckOutTaskExecutor.class );
48 
49    /**
50     * @plexus.requirement
51     */
52    private ActionManager actionManager;
53 
54    /**
55     * @plexus.requirement
56     */
57    private ProjectDao projectDao;
58 
59    // ----------------------------------------------------------------------
60    // TaskExecutor Implementation
61    // ----------------------------------------------------------------------
62 
63    public void executeTask( Task t )
64        throws TaskExecutionException
65    {
66        log.info( "Checkout task executor.." );
67 
68        CheckOutTask task = (CheckOutTask) t;
69 
70        int projectId = task.getProjectId();
71 
72        Project project;
73 
74        try
75        {
76            project = projectDao.getProjectWithBuildDetails( projectId );
77        }
78        catch ( ContinuumStoreException ex )
79        {
80            log.error( "Internal error while getting the project.", ex );
81 
82            return;
83        }
84 
85        String workingDirectory = task.getWorkingDirectory().getAbsolutePath();
86 
87        Map<String, Object> context = new HashMap<String, Object>();
88 
89        AbstractContinuumAction.setProjectId( context, projectId );
90 
91        AbstractContinuumAction.setProject( context, project );
92 
93        AbstractContinuumAction.setWorkingDirectory( context, workingDirectory );
94 
95        CheckoutProjectContinuumAction.setScmUsername( context, task.getScmUserName() );
96 
97        CheckoutProjectContinuumAction.setScmPassword( context, task.getScmPassword() );
98 
99        try
100        {
101            actionManager.lookup( "checkout-project" ).execute( context );
102 
103            actionManager.lookup( "store-checkout-scm-result" ).execute( context );
104        }
105        catch ( Exception e )
106        {
107            throw new TaskExecutionException( "Error checking out project.", e );
108        }
109    }
110}

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