EMMA Coverage Report (generated Fri Jun 19 09:16:10 CEST 2009)
[all classes][org.ktc.rbutils.rb.check]

COVERAGE SUMMARY FOR SOURCE FILE [RbCheckerTask.java]

nameclass, %method, %block, %line, %
RbCheckerTask.java100% (1/1)100% (4/4)100% (42/42)100% (13/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RbCheckerTask100% (1/1)100% (4/4)100% (42/42)100% (13/13)
RbCheckerTask (): void 100% (1/1)100% (6/6)100% (3/3)
execute (): void 100% (1/1)100% (16/16)100% (5/5)
setFilechecker (String): void 100% (1/1)100% (4/4)100% (2/2)
specificTaskinitilization (): void 100% (1/1)100% (16/16)100% (3/3)

1/*
2 * Copyright  2005-2006 The RbUtils Project
3 *
4 *  Licensed under the Apache License, Version 2.0 (the "License");
5 *  you may not use this file except in compliance with the License.
6 *  You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 *  Unless required by applicable law or agreed to in writing, software
11 *  distributed under the License is distributed on an "AS IS" BASIS,
12 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 *  See the License for the specific language governing permissions and
14 *  limitations under the License.
15 *
16 */
17 
18// $Id: RbCheckerTask.java,v 1.4 2007/07/06 04:52:16 moishi Exp $
19 
20package org.ktc.rbutils.rb.check;
21 
22import java.io.FileNotFoundException;
23 
24import org.apache.tools.ant.types.Path;
25import org.ktc.rbutils.rb.AbstractRbTask;
26import org.ktc.rbutils.rb.TaskType;
27 
28/**
29 * The ant task for RB Check.
30 * <p>
31 * See the task documentation for information.
32 * @since RbUtils 0.5
33 * @version $Revision: 1.4 $
34 * @author redfish
35 */
36public class RbCheckerTask extends AbstractRbTask {
37    /** Contains the classpath to be used during the check. */
38    protected Path classpath;
39 
40    // protected CommandlineJava commandline;
41    // protected ClasspathUtils.Delegate cpDelegate;
42 
43    /** Class name of the FileChecker to be used by the MainChecker. */
44    private String filechecker;
45 
46    /**
47     * Instanciates a new RbCheckerTask.
48     */
49    public RbCheckerTask() {
50        super();
51        taskType = TaskType.RBCHECKER;
52    }
53 
54    // public void init() {
55    // // this.cpDelegate = ClasspathUtils.getDelegate(this);
56    // super.init();
57    // }
58 
59    /**
60     * {@inheritDoc}
61     */
62    public void execute() {
63        final ClassLoader loader = Thread.currentThread().getContextClassLoader();
64        try {
65            doJob();
66        }
67        finally {
68            Thread.currentThread().setContextClassLoader(loader);
69        }
70    }
71 
72    /**
73     * {@inheritDoc}
74     * Sets the filechecker class name.
75     */
76    public void specificTaskinitilization() throws FileNotFoundException {
77        processor = new MainChecker(root, extension);
78        ((MainChecker) processor).setFileCheckerClassname(filechecker);
79    }
80 
81    // /**
82    // * Launches the check.
83    // */
84    // protected void doJob() {
85    // // TODO Code - validate args in order to get explicit exception (?)
86    // MainChecker checker = null;
87    // try {
88    // // Checker initialisation
89    // checker = new MainChecker(root, extension);
90    // // use specified filechecker (0.9.2)
91    // checker.setFileCheckerClassname(filechecker);
92    //
93    //
94    // // use nested element logger (0.9.1)
95    // // checker.setXmlLoggingFile(xmlLoggingFile);
96    // checker.addLoggers(getLoggers());
97    // checker.setMessagesLocale(displayLocale);
98    //
99    // // TODO RBUTILS-2
100    // // changeClassLoader();
101    //
102    // // Set the list of files to be inspected
103    // // If the user specify files with filesets, the checker does not need to look for files
104    // // in the root directory. So set the filesAlreadyAdded attribute.
105    // // Otherwise, the checker will look for files by itself.
106    // // TODO: we should tests if the filesets is empty in the getFilesMethod when the
107    // // addFiles method will be refactored
108    // if (!fileSets.isEmpty()) {
109    // checker.addFiles(getFiles());
110    // checker.setFilesAlreadyAdded(true);
111    // }
112    //
113    // // Launch the check
114    // logTaskStarts();
115    // // log("Running rbchecker " + RbUtilsHelper.getVersion(), Project.MSG_INFO);
116    // final int numErrors = checker.process();
117    // handleErrors(numErrors);
118    // }
119    // // TODO Code - Exception catching
120    // catch (final BuildException buildexception) {
121    // throw buildexception;
122    // }
123    // catch (final Exception exception) {
124    // // exception.printStackTrace();
125    // // throw new BuildException(new NestableException(exception));
126    //            throw new BuildException(exception, getLocation());
127    //        }
128    //        finally {
129    //            checker = null;
130    //        }
131    //    }
132 
133    /**
134     * Class name of the FileChecker to be used by the MainChecker.
135     * @param filechecker the filechecker class name to set.
136     */
137    public void setFilechecker(final String filechecker) {
138        this.filechecker = filechecker;
139    }
140 
141    //*****************************************
142    // CLASSPATH
143    // *****************************************
144    //
145    //
146    // private void changeClassLoader() {
147    // final int logLevel = Project.MSG_INFO;
148    //
149    // // final String classname = getClass().getName();
150    // final String classname = "java.util.ArrayList";
151    //
152    // Path classpath = cpDelegate.getClasspath();
153    //
154    // // avec le cpDelegate
155    // AntClassLoader loader = (AntClassLoader) cpDelegate.getClassLoader();
156    //
157    // log("Using classname " + classname, logLevel);
158    // log("Using CLASSPATH " + classpath, logLevel);
159    // log("Using CLASSLOADER " + loader, logLevel);
160    // log("Using CLASSLOADER.CLASSPATH " + loader.getClasspath(), logLevel);
161    //
162    // log("Updating classpath with system classpath " + classpath, logLevel);
163    // classpath = classpath.concatSystemClasspath();
164    // // TODO addJavaRuntime()
165    // log("Updated Classpath " + classpath, logLevel);
166    //
167    // cpDelegate.setClasspath(classpath);
168    // final Path newClassPath = cpDelegate.getClasspath();
169    // log("Using CLASSPATH " + newClassPath, logLevel);
170    //
171    // cpDelegate.setClassname(classname);
172    // Object o = this.cpDelegate.newInstance();
173    //
174    // }
175    //
176    // // Takent from ant.util ClasspathUtils
177    // public void setClasspathRef(Reference r) {
178    // log("entering setClasspathRef()", Project.MSG_INFO);
179    // this.cpDelegate.setClasspathref(r);
180    // }
181    //
182    // public Path createClasspath() {
183    // log("Entering CreateClasspath()", Project.MSG_INFO);
184    // final Path aPath = cpDelegate.createClasspath();
185    // log("Exiting CreateClasspath()", Project.MSG_INFO);
186    // return aPath;
187    // }
188    //
189    // /**
190    // * Set the optional classpath
191    // * @param classpath the classpath to use when loading class
192    // */
193    // public void setClasspath(Path classpath) {
194    // log("Entering setClasspath(), " + classpath, Project.MSG_INFO);
195    //        createClasspath().append(classpath);
196    //        log("Exiting setClasspath(), " + classpath, Project.MSG_INFO);
197    //    }
198 
199}

[all classes][org.ktc.rbutils.rb.check]
EMMA 2.0.5312 (C) Vladimir Roubtsov