Methods Summary |
---|
public void | assertTimesNearlyMatch(long timestamp, long time)assert that two times are within the current FS granularity;
long granularity= FILE_UTILS.getFileTimestampGranularity();
assertTimesNearlyMatch(timestamp, time, granularity);
|
private void | assertTimesNearlyMatch(long timestamp, long time, long range)assert that two times are within a specified range
assertTrue("Time " + timestamp + " is not within " + range + " ms of "
+ time, (Math.abs(time - timestamp) <= range));
|
public long | getTargetTime()
File file = new File(System.getProperty("root"), TOUCH_FILE);
if(!file.exists()) {
throw new BuildException("failed to touch file " + file);
}
return file.lastModified();
|
public void | setUp()
configureProject("src/etc/testcases/taskdefs/touch.xml");
|
public void | tearDown()
executeTarget("cleanup");
|
public void | test2000()verify that the millis test sets things up
touchFile("test2000", 946080000000L);
|
public void | testBadPattern()test the pattern attribute again
expectBuildExceptionContaining("testBadPattern",
"No parsing exception thrown", "Unparseable");
|
public void | testExplicitMappedFileset()test the explicit mapped file set
executeTarget("testExplicitMappedFileset");
|
public void | testFilelist()test the file list
touchFile("testFilelist", 662256000000L);
|
public void | testFileset()test the file set
touchFile("testFileset", 946080000000L);
|
public void | testGoodPattern()test the pattern attribute
executeTarget("testGoodPattern");
|
public void | testMappedFilelist()test the mapped file list
executeTarget("testMappedFilelist");
|
public void | testMappedFileset()test the mapped file set
executeTarget("testMappedFileset");
|
public void | testMillis()verify that the millis test sets things up
touchFile("testMillis", 662256000000L);
|
public void | testNoSeconds()No real test, simply checks whether the dateformat without
seconds is accepted - by erroring out otherwise.
executeTarget("noSeconds");
long time = getTargetTime();
|
public void | testNow()verify that the default value defaults to now
long now=System.currentTimeMillis();
executeTarget("testNow");
long time = getTargetTime();
assertTimesNearlyMatch(time,now,5000);
|
public void | testResourceCollection()test the resource collection
touchFile("testResourceCollection", 1662256000000L);
|
public void | testSeconds()No real test, simply checks whether the dateformat with
seconds is accepted - by erroring out otherwise.
executeTarget("seconds");
long time=getTargetTime();
|
private void | touchFile(java.lang.String targetName, long timestamp)run a target to touch the test file; verify the timestamp is as expected
executeTarget(targetName);
long time = getTargetTime();
assertTimesNearlyMatch(timestamp, time);
|