Add a bit more 'wiggle room' to the timeout test, which missed the cutoff by 8ms, and fixed formatting

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@56009 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2013-09-26 03:30:36 +00:00
parent 6f5e0966bf
commit 0b7bceb769
2 changed files with 60 additions and 60 deletions

View File

@@ -20,7 +20,6 @@ package org.alfresco.repo.content.metadata;
import java.io.File;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -129,19 +128,20 @@ public class PoiMetadataExtracterTest extends AbstractMetadataExtracterTest
File sourceFile = AbstractContentTransformerTest.loadNamedQuickTestFile("problemFootnotes.docx");
long startTime = (new Date()).getTime();
Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
// construct a reader onto the source file
ContentReader sourceReader = new FileContentReader(sourceFile);
sourceReader.setMimetype(MimetypeMap.MIMETYPE_OPENXML_WORDPROCESSING);
long startTime = System.currentTimeMillis();
getExtracter().extract(sourceReader, properties);
long extractionTime = (new Date()).getTime() - startTime;
long extractionTime = System.currentTimeMillis() - startTime;
assertTrue("Metadata extraction took (" + extractionTime + "ms) " +
"but should have failed with a timeout at " + timeoutMs + "ms",
extractionTime < (timeoutMs + 50)); // bit of wiggle room for logging, cleanup, etc.
extractionTime < (timeoutMs + 100)); // bit of wiggle room for logging, cleanup, etc.
assertFalse("Reader was not closed", sourceReader.isChannelOpen());
}
}