mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Added fix for testing equality of ByteBlobs
This commit is contained in:
parent
1f239d7118
commit
794a0e29e6
3 changed files with 20 additions and 1 deletions
|
@ -3,6 +3,8 @@ package uk.ac.ic.wlgitbridge.writelatex.filestore.blob;
|
|||
import uk.ac.ic.wlgitbridge.writelatex.filestore.node.AttachmentNode;
|
||||
import uk.ac.ic.wlgitbridge.writelatex.model.db.PersistentStoreAPI;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Created by Winston on 14/11/14.
|
||||
*/
|
||||
|
@ -19,6 +21,15 @@ public class ByteBlob extends Blob {
|
|||
return contents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof ByteBlob)) {
|
||||
return false;
|
||||
}
|
||||
ByteBlob that = (ByteBlob) obj;
|
||||
return Arrays.equals(contents, that.contents);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePersistentStore(PersistentStoreAPI persistentStore, AttachmentNode node) {
|
||||
persistentStore.addFileNodeBlob(node.getProjectName(), node.getFilePath(), node.isChanged(), contents);
|
||||
|
|
|
@ -34,6 +34,15 @@ public class BlobNode extends FileNode {
|
|||
this.blob = new ByteBlob(blob);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof BlobNode)) {
|
||||
return false;
|
||||
}
|
||||
BlobNode that = (BlobNode) obj;
|
||||
return super.equals(that) && blob.equals(that.blob);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void indexWith(FileNodeIndexer fileNodeIndexer) {
|
||||
fileNodeIndexer.index(this);
|
||||
|
|
|
@ -92,7 +92,6 @@ public class WLDirectoryNode implements PersistentStoreSource, PersistentStoreUp
|
|||
|
||||
public WLDirectoryNode createFromRawDirectoryContents(RawDirectoryContents rawDirectoryContents, File attachmentDirectory) throws IOException, FailedConnectionException {
|
||||
Map<String, FileNode> candidateFileNodeTable = new HashMap<String, FileNode>();
|
||||
System.out.println("Attachment directory: " + attachmentDirectory + ", projectName: " + projectName);
|
||||
File projectAttDirectory = new File(attachmentDirectory, projectName);
|
||||
projectAttDirectory.mkdirs();
|
||||
WLFileStore.deleteInDirectory(projectAttDirectory);
|
||||
|
|
Loading…
Reference in a new issue