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

COVERAGE SUMMARY FOR SOURCE FILE [DefaultBuildQueueService.java]

nameclass, %method, %block, %line, %
DefaultBuildQueueService.java100% (1/1)9%   (1/11)3%   (3/116)3%   (1/35)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DefaultBuildQueueService100% (1/1)9%   (1/11)3%   (3/116)3%   (1/35)
addBuildQueue (BuildQueue): BuildQueue 0%   (0/1)0%   (0/11)0%   (0/3)
getAllBuildQueues (): List 0%   (0/1)0%   (0/10)0%   (0/3)
getBuildQueue (int): BuildQueue 0%   (0/1)0%   (0/11)0%   (0/3)
getBuildQueueByName (String): BuildQueue 0%   (0/1)0%   (0/11)0%   (0/3)
getBuildQueueDao (): BuildQueueDao 0%   (0/1)0%   (0/3)0%   (0/1)
getScheduleDao (): ScheduleDao 0%   (0/1)0%   (0/3)0%   (0/1)
removeBuildQueue (BuildQueue): void 0%   (0/1)0%   (0/45)0%   (0/13)
setBuildQueueDao (BuildQueueDao): void 0%   (0/1)0%   (0/4)0%   (0/2)
setScheduleDao (ScheduleDao): void 0%   (0/1)0%   (0/4)0%   (0/2)
updateBuildQueue (BuildQueue): BuildQueue 0%   (0/1)0%   (0/11)0%   (0/3)
DefaultBuildQueueService (): void 100% (1/1)100% (3/3)100% (1/1)

1package org.apache.continuum.buildqueue;
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;
23 
24import org.apache.continuum.dao.BuildQueueDao;
25import org.apache.continuum.dao.ScheduleDao;
26import org.apache.maven.continuum.model.project.BuildQueue;
27import org.apache.maven.continuum.model.project.Schedule;
28import org.apache.maven.continuum.store.ContinuumStoreException;
29 
30import javax.annotation.Resource;
31 
32/**
33 * DefaultBuildQueueService
34 * 
35 * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
36 */
37public class DefaultBuildQueueService
38    implements BuildQueueService
39{
40    @Resource
41    private BuildQueueDao buildQueueDao;
42    
43    @Resource
44    private ScheduleDao scheduleDao;
45 
46    public BuildQueue addBuildQueue( BuildQueue buildQueue )
47        throws BuildQueueServiceException
48    {        
49        try
50        {
51            return buildQueueDao.addBuildQueue( buildQueue );
52        } 
53        catch ( ContinuumStoreException e )
54        {
55            throw new BuildQueueServiceException( e );
56        }
57    }
58 
59    public List<BuildQueue> getAllBuildQueues()
60        throws BuildQueueServiceException
61    {
62        try
63        {
64            return buildQueueDao.getAllBuildQueues();
65        }
66        catch ( ContinuumStoreException e )
67        {
68            throw new BuildQueueServiceException( e );
69        }
70    }
71 
72    public BuildQueue getBuildQueue( int buildQueueId )
73        throws BuildQueueServiceException
74    {
75        try
76        {
77            return buildQueueDao.getBuildQueue( buildQueueId );
78        }
79        catch ( ContinuumStoreException e )
80        {
81            throw new BuildQueueServiceException( e );
82        }
83    }
84 
85    public BuildQueue getBuildQueueByName( String buildQueueName )
86        throws BuildQueueServiceException
87    {
88        try
89        {
90            return buildQueueDao.getBuildQueueByName( buildQueueName );
91        }
92        catch ( ContinuumStoreException e )
93        {
94            throw new BuildQueueServiceException( e );
95        }
96    }
97 
98    public void removeBuildQueue( BuildQueue buildQueue )
99        throws BuildQueueServiceException
100    {   
101        try
102        {
103            // detach from schedule(s) first
104            List<Schedule> schedules = scheduleDao.getAllSchedulesByName();
105            for( Schedule schedule : schedules )
106            {
107                List<BuildQueue> buildQueues = schedule.getBuildQueues();
108                if( buildQueues.contains( buildQueue ) )
109                {
110                    buildQueues.remove( buildQueue );
111                }
112                schedule.setBuildQueues( buildQueues );
113                
114                scheduleDao.updateSchedule( schedule );
115            }        
116        
117            buildQueueDao.removeBuildQueue( buildQueue );
118        }
119        catch ( ContinuumStoreException e )
120        {
121            throw new BuildQueueServiceException( e );
122        }
123    }
124 
125    public BuildQueue updateBuildQueue( BuildQueue buildQueue )
126        throws BuildQueueServiceException
127    {
128        try
129        {
130            return buildQueueDao.storeBuildQueue( buildQueue );
131        }
132        catch ( ContinuumStoreException e )
133        {
134            throw new BuildQueueServiceException( e );
135        }
136    }
137 
138    public BuildQueueDao getBuildQueueDao()
139    {
140        return buildQueueDao;
141    }
142 
143    public void setBuildQueueDao( BuildQueueDao buildQueueDao )
144    {
145        this.buildQueueDao = buildQueueDao;
146    }
147 
148    public ScheduleDao getScheduleDao()
149    {
150        return scheduleDao;
151    }
152 
153    public void setScheduleDao( ScheduleDao scheduleDao )
154    {
155        this.scheduleDao = scheduleDao;
156    }
157 
158}

[all classes][org.apache.continuum.buildqueue]
EMMA 2.0.5312 (C) Vladimir Roubtsov