Line | Hits | Source |
---|---|---|
1 | /* | |
2 | * Copyright (C) 2006 TopCoder Inc., All Rights Reserved. | |
3 | */ | |
4 | package com.topcoder.testframework; | |
5 | ||
6 | import org.apache.tools.ant.Location; | |
7 | import org.apache.tools.ant.Project; | |
8 | import org.apache.tools.ant.Target; | |
9 | ||
10 | ||
11 | /** | |
12 | * This class simply stores some data about the Ant project. It is passed with current data to ServerElement class | |
13 | * instance and then to AbstractServer derived classes instances. It is currently used to provide information to the | |
14 | * Cactus testing back-end. | |
15 | * <p/> | |
16 | * This class is immutable, i.e. thread-safe. | |
17 | * | |
18 | * @author real_vg, TCSDEVELOPER | |
19 | * @version 1.0 | |
20 | */ | |
21 | public class AntTaskInfo { | |
22 | ||
23 | /** | |
24 | * This field represents the current Ant project. It is initialized in constructor. | |
25 | */ | |
26 | private final Project project; | |
27 | ||
28 | /** | |
29 | * This field represents the current Ant task name. It is initialized in constructor. | |
30 | */ | |
31 | private final String taskName; | |
32 | ||
33 | /** | |
34 | * This field represents the current Ant task location. It is initialized in constructor. | |
35 | */ | |
36 | private final Location location; | |
37 | ||
38 | /** | |
39 | * This field represents the current Ant target being executed. It is initialized in constructor and then never | |
40 | * changed. | |
41 | */ | |
42 | private final Target target; | |
43 | ||
44 | /** | |
45 | * Creates an AntTaskInfo instance and initializes its fields with the values of like-named parameters. | |
46 | * | |
47 | * @param project the current Ant project | |
48 | * @param taskName the current Ant task name | |
49 | * @param location the current Ant task location | |
50 | * @param target the current Ant target being executed | |
51 | * | |
52 | * @throws IllegalArgumentException if any arg is <tt>null</tt> or taskName is an empty (trim'd) String | |
53 | */ | |
54 | 118 | public AntTaskInfo(final Project project, final String taskName, final Location location, final Target target) { |
55 | 118 | if (project == null) { |
56 | 1 | throw new IllegalArgumentException("The parameter named [project] was null."); |
57 | } | |
58 | 117 | if (taskName == null) { |
59 | 1 | throw new IllegalArgumentException("The parameter named [taskName] was null."); |
60 | } | |
61 | 116 | if (taskName.trim().length() == 0) { |
62 | 1 | throw new IllegalArgumentException("The parameter named [taskName] was an empty String."); |
63 | } | |
64 | 115 | if (location == null) { |
65 | 1 | throw new IllegalArgumentException("The parameter named [location] was null."); |
66 | } | |
67 | 114 | if (target == null) { |
68 | 1 | throw new IllegalArgumentException("The parameter named [target] was null."); |
69 | } | |
70 | // argument checking added as of | |
71 | // https://software.topcoder.com/forum/c_forum_message.jsp?f=20015788&r=21551214 | |
72 | ||
73 | 113 | this.project = project; |
74 | 113 | this.taskName = taskName; |
75 | 113 | this.location = location; |
76 | 113 | this.target = target; |
77 | 113 | } |
78 | ||
79 | /** | |
80 | * This method returns the current Ant project. | |
81 | * | |
82 | * @return the project of this AntTaskInfo | |
83 | */ | |
84 | public Project getProject() { | |
85 | 6 | return project; |
86 | } | |
87 | ||
88 | /** | |
89 | * This method returns the Ant task name. | |
90 | * | |
91 | * @return the ant task name of this AntTaskInfo | |
92 | */ | |
93 | public String getTaskName() { | |
94 | 6 | return taskName; |
95 | } | |
96 | ||
97 | /** | |
98 | * This method returns the Ant task location. | |
99 | * | |
100 | * @return the location of this AntTaskInfo | |
101 | */ | |
102 | public Location getLocation() { | |
103 | 6 | return location; |
104 | } | |
105 | ||
106 | /** | |
107 | * This method returns the Ant target being executed. | |
108 | * | |
109 | * @return the target of this AntTaskInfo | |
110 | */ | |
111 | public Target getTarget() { | |
112 | 6 | return target; |
113 | } | |
114 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |