|
|
@@ -67,16 +67,16 @@ import org.apache.tools.ant.types.FileSet; |
|
|
|
import org.apache.tools.ant.DirectoryScanner; |
|
|
|
|
|
|
|
/** |
|
|
|
* Testcase for the Depend optional task. |
|
|
|
* |
|
|
|
* Testcase for the Depend optional task. |
|
|
|
* |
|
|
|
* @author Conor MacNeill |
|
|
|
*/ |
|
|
|
public class DependTest extends BuildFileTest { |
|
|
|
public static final String RESULT_FILESET = "result"; |
|
|
|
|
|
|
|
|
|
|
|
public static final String TEST_BUILD_FILE |
|
|
|
= "src/etc/testcases/taskdefs/optional/depend/depend.xml"; |
|
|
|
|
|
|
|
|
|
|
|
public DependTest(String name) { |
|
|
|
super(name); |
|
|
|
} |
|
|
@@ -96,11 +96,11 @@ public class DependTest extends BuildFileTest { |
|
|
|
Project project = getProject(); |
|
|
|
executeTarget("testdirect"); |
|
|
|
Hashtable files = getResultFiles(); |
|
|
|
assertEquals("Depend did not leave correct number of files", 2, |
|
|
|
assertEquals("Depend did not leave correct number of files", 3, |
|
|
|
files.size()); |
|
|
|
assertTrue("Result did not contain A.class", |
|
|
|
assertTrue("Result did not contain A.class", |
|
|
|
files.containsKey("A.class")); |
|
|
|
assertTrue("Result did not contain D.class", |
|
|
|
assertTrue("Result did not contain D.class", |
|
|
|
files.containsKey("D.class")); |
|
|
|
} |
|
|
|
|
|
|
@@ -111,9 +111,9 @@ public class DependTest extends BuildFileTest { |
|
|
|
Project project = getProject(); |
|
|
|
executeTarget("testclosure"); |
|
|
|
Hashtable files = getResultFiles(); |
|
|
|
assertEquals("Depend did not leave correct number of files", 1, |
|
|
|
assertEquals("Depend did not leave correct number of files", 2, |
|
|
|
files.size()); |
|
|
|
assertTrue("Result did not contain D.class", |
|
|
|
assertTrue("Result did not contain D.class", |
|
|
|
files.containsKey("D.class")); |
|
|
|
} |
|
|
|
|
|
|
@@ -123,41 +123,41 @@ public class DependTest extends BuildFileTest { |
|
|
|
public void testInner() { |
|
|
|
Project project = getProject(); |
|
|
|
executeTarget("testinner"); |
|
|
|
assertEquals("Depend did not leave correct number of files", 0, |
|
|
|
assertEquals("Depend did not leave correct number of files", 0, |
|
|
|
getResultFiles().size()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Test that multi-leve inner class dependencies trigger deletion of |
|
|
|
* Test that multi-leve inner class dependencies trigger deletion of |
|
|
|
* the outer class |
|
|
|
*/ |
|
|
|
public void testInnerInner() { |
|
|
|
Project project = getProject(); |
|
|
|
executeTarget("testinnerinner"); |
|
|
|
assertEquals("Depend did not leave correct number of files", 0, |
|
|
|
assertEquals("Depend did not leave correct number of files", 0, |
|
|
|
getResultFiles().size()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Test that an exception is thrown when there is no source |
|
|
|
* Test that an exception is thrown when there is no source |
|
|
|
*/ |
|
|
|
public void testNoSource() { |
|
|
|
expectBuildExceptionContaining("testnosource", |
|
|
|
expectBuildExceptionContaining("testnosource", |
|
|
|
"No source specified", "srcdir attribute must be set"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Test that an exception is thrown when the source attribute is empty |
|
|
|
*/ |
|
|
|
public void testEmptySource() { |
|
|
|
expectBuildExceptionContaining("testemptysource", |
|
|
|
expectBuildExceptionContaining("testemptysource", |
|
|
|
"No source specified", "srcdir attribute must be non-empty"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Read the result fileset into a Hashtable |
|
|
|
* |
|
|
|
* @return a Hashtable containing the names of the files in the result |
|
|
|
* |
|
|
|
* @return a Hashtable containing the names of the files in the result |
|
|
|
* fileset |
|
|
|
*/ |
|
|
|
private Hashtable getResultFiles() { |
|
|
@@ -170,8 +170,8 @@ public class DependTest extends BuildFileTest { |
|
|
|
} |
|
|
|
return files; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Test mutual dependency between inner and outer do not cause both to be |
|
|
|
* deleted |
|
|
@@ -179,7 +179,7 @@ public class DependTest extends BuildFileTest { |
|
|
|
public void testInnerClosure() { |
|
|
|
Project project = getProject(); |
|
|
|
executeTarget("testinnerclosure"); |
|
|
|
assertEquals("Depend did not leave correct number of files", 2, |
|
|
|
assertEquals("Depend did not leave correct number of files", 2, |
|
|
|
getResultFiles().size()); |
|
|
|
} |
|
|
|
|
|
|
@@ -196,10 +196,10 @@ public class DependTest extends BuildFileTest { |
|
|
|
public void testNonPublic() { |
|
|
|
executeTarget("testnonpublic"); |
|
|
|
String log = getLog(); |
|
|
|
assertTrue("Expected warning about APrivate", |
|
|
|
assertTrue("Expected warning about APrivate", |
|
|
|
log.indexOf("The class APrivate in file") != -1); |
|
|
|
assertTrue("but has not been deleted because its source file " |
|
|
|
+ "could not be determined", |
|
|
|
assertTrue("but has not been deleted because its source file " |
|
|
|
+ "could not be determined", |
|
|
|
log.indexOf("The class APrivate in file") != -1); |
|
|
|
} |
|
|
|
|
|
|
|