You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2006/12/06 06:31:02 UTC
svn commit: r482907 - in /ant/core/trunk/src:
main/org/apache/tools/ant/ProjectComponent.java
main/org/apache/tools/ant/Task.java
tests/junit/org/apache/tools/ant/ProjectComponentTest.java
Author: bodewig
Date: Tue Dec 5 21:31:01 2006
New Revision: 482907
URL: http://svn.apache.org/viewvc?view=rev&rev=482907
Log:
Move description attribute from Task to ProjectComponent
Added:
ant/core/trunk/src/tests/junit/org/apache/tools/ant/ProjectComponentTest.java (with props)
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java
ant/core/trunk/src/main/org/apache/tools/ant/Task.java
Modified: ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java?view=diff&rev=482907&r1=482906&r2=482907
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java Tue Dec 5 21:31:01 2006
@@ -45,6 +45,13 @@
protected Location location = Location.UNKNOWN_LOCATION;
// CheckStyle:VisibilityModifier ON
+ /**
+ * Description of this component, if any.
+ * @deprecated since 1.6.x.
+ * You should not be accessing this variable directly.
+ */
+ protected String description;
+
/** Sole constructor. */
public ProjectComponent() {
}
@@ -95,6 +102,29 @@
*/
public void setLocation(Location location) {
this.location = location;
+ }
+
+ /**
+ * Sets a description of the current action. This may be used for logging
+ * purposes.
+ *
+ * @param desc Description of the current action.
+ * May be <code>null</code>, indicating that no description is
+ * available.
+ *
+ */
+ public void setDescription(String desc) {
+ description = desc;
+ }
+
+ /**
+ * Returns the description of the current action.
+ *
+ * @return the description of the current action, or <code>null</code> if
+ * no description is available.
+ */
+ public String getDescription() {
+ return description;
}
/**
Modified: ant/core/trunk/src/main/org/apache/tools/ant/Task.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/Task.java?view=diff&rev=482907&r1=482906&r2=482907
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/Task.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/Task.java Tue Dec 5 21:31:01 2006
@@ -42,13 +42,6 @@
protected Target target;
/**
- * Description of this task, if any.
- * @deprecated since 1.6.x.
- * You should not be accessing this variable directly.
- */
- protected String description;
-
- /**
* Name of this task to be used for logging purposes.
* This defaults to the same as the type, but may be
* overridden by the user. For instance, the name "java"
@@ -139,29 +132,6 @@
*/
public void setTaskType(String type) {
this.taskType = type;
- }
-
- /**
- * Sets a description of the current action. This may be used for logging
- * purposes.
- *
- * @param desc Description of the current action.
- * May be <code>null</code>, indicating that no description is
- * available.
- *
- */
- public void setDescription(String desc) {
- description = desc;
- }
-
- /**
- * Returns the description of the current action.
- *
- * @return the description of the current action, or <code>null</code> if
- * no description is available.
- */
- public String getDescription() {
- return description;
}
/**
Added: ant/core/trunk/src/tests/junit/org/apache/tools/ant/ProjectComponentTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/ProjectComponentTest.java?view=auto&rev=482907
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/ProjectComponentTest.java (added)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/ProjectComponentTest.java Tue Dec 5 21:31:01 2006
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant;
+
+import junit.framework.TestCase;
+
+public class ProjectComponentTest extends TestCase {
+
+ public ProjectComponentTest(String name) {
+ super(name);
+ }
+
+ public void testClone() throws CloneNotSupportedException {
+ Project expectedProject = new Project();
+ Location expectedLocation = new Location("foo");
+ String expectedDescription = "bar";
+
+ // use an anonymous subclass since ProjectComponent is abstract
+ ProjectComponent pc = new ProjectComponent() {
+ };
+ pc.setProject(expectedProject);
+ pc.setLocation(expectedLocation);
+ pc.setDescription(expectedDescription);
+
+ ProjectComponent cloned = (ProjectComponent) pc.clone();
+ assertNotSame(pc, cloned);
+ assertSame(cloned.getProject(), expectedProject);
+ assertSame(cloned.getLocation(), expectedLocation);
+ assertSame(cloned.getDescription(), expectedDescription);
+ }
+}
\ No newline at end of file
Propchange: ant/core/trunk/src/tests/junit/org/apache/tools/ant/ProjectComponentTest.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org