mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Rolled back CIFSComparator stuff incorrectly checked in
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@118826 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -313,9 +313,9 @@ public class CIFSContentComparator implements ContentComparator
|
||||
private class PPTContentComparator implements ContentComparator
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean isContentEqual(ContentReader existingContent, File newFile)
|
||||
{
|
||||
@Override
|
||||
public boolean isContentEqual(ContentReader existingContent, File newFile)
|
||||
{
|
||||
long fileSizesDifference = newFile.length() - existingContent.getSize();
|
||||
|
||||
if(logger.isDebugEnabled())
|
||||
@@ -352,47 +352,19 @@ public boolean isContentEqual(ContentReader existingContent, File newFile)
|
||||
|
||||
if (lastEditUsername1.equals(lastEditUsername2))
|
||||
{
|
||||
logger.debug("powerpoint files are different size and same editor name");
|
||||
logger.debug("powerpoint files are different size");
|
||||
// Different size
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//make sure that nothing has been changed except lastEditUsername
|
||||
|
||||
tpm1 = TempFileProvider.createTempFile("CIFSContentComparator1", "ppt");
|
||||
FileOutputStream os = new FileOutputStream(tpm1);
|
||||
try
|
||||
{
|
||||
slideShow1.write(os);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
os.close();
|
||||
}
|
||||
catch (IOException ie)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
tpm2 = TempFileProvider.createTempFile("CIFSContentComparator2", "ppt");
|
||||
FileOutputStream os2 = new FileOutputStream(tpm2);
|
||||
try
|
||||
{
|
||||
slideShow2.write(os2);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
os2.close();
|
||||
}
|
||||
catch (IOException ie)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
slideShow1.write(new FileOutputStream(tpm1));
|
||||
slideShow1.write(new FileOutputStream(tpm2));
|
||||
|
||||
NPOIFSFileSystem fs1 = new NPOIFSFileSystem(tpm1);
|
||||
NPOIFSFileSystem fs2 = new NPOIFSFileSystem(tpm2);
|
||||
@@ -450,9 +422,6 @@ public boolean isContentEqual(ContentReader existingContent, File newFile)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -304,19 +304,19 @@ public class CIFSContentComparatorTest extends TestCase
|
||||
ClassPathResource file5Resource = new ClassPathResource("filesys/ContentComparatorTestPowerPoint2003-5-edited-gt-3072bytes.ppt");
|
||||
assertNotNull("unable to find test resource filesys/ContentComparatorTestPowerPoint2003-5-edited-gt-3072bytes.ppt", file5Resource);
|
||||
|
||||
// /**
|
||||
// * Compare different powerpoint files, should not be ignored
|
||||
// */
|
||||
// {
|
||||
// File file0 = file0Resource.getFile();
|
||||
// File file1 = file1Resource.getFile();
|
||||
//
|
||||
// ContentReader reader = new FileContentReader(file0);
|
||||
// reader.setMimetype("application/vnd.ms-powerpoint");
|
||||
// reader.setEncoding("UTF-8");
|
||||
// boolean result = contentComparator.isContentEqual(reader, file1);
|
||||
// assertTrue("compare different powerpoint files, should not be equal", !result);
|
||||
// }
|
||||
/**
|
||||
* Compare different powerpoint files, should not be ignored
|
||||
*/
|
||||
{
|
||||
File file0 = file0Resource.getFile();
|
||||
File file1 = file1Resource.getFile();
|
||||
|
||||
ContentReader reader = new FileContentReader(file0);
|
||||
reader.setMimetype("application/vnd.ms-powerpoint");
|
||||
reader.setEncoding("UTF-8");
|
||||
boolean result = contentComparator.isContentEqual(reader, file1);
|
||||
assertTrue("compare different powerpoint files, should not be equal", !result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare trivially different powerpoint files, should ignore trivial differences and be equal
|
||||
|
Reference in New Issue
Block a user