use of org.xwiki.store.serialization.xml.internal.AttachmentMetadataSerializer in project xwiki-platform by xwiki.
the class FilesystemAttachmentVersioningStoreTest method setUp.
@Before
@Override
public void setUp() throws Exception {
super.setUp();
Utils.setComponentManager(this.getComponentManager());
final File tmpDir = new File(System.getProperty("java.io.tmpdir"));
this.storageLocation = new File(tmpDir, "test-storage-location");
this.fileTools = new FilesystemStoreTools(new FileStringEntityReferenceSerializer(), storageLocation, new DummyLockProvider());
final AttachmentListMetadataSerializer serializer = new AttachmentListMetadataSerializer(new AttachmentMetadataSerializer());
this.versionStore = new FilesystemAttachmentVersioningStore();
FieldUtils.writeDeclaredField(this.versionStore, "fileTools", this.fileTools, true);
FieldUtils.writeDeclaredField(this.versionStore, "metaSerializer", serializer, true);
final XWikiDocument doc = new XWikiDocument(new DocumentReference("xwiki", "Main", "WebHome"));
final XWikiAttachment version1 = new XWikiAttachment();
version1.setVersion("1.1");
version1.setFilename("attachment.txt");
version1.setDoc(doc);
version1.setAttachment_content(new StringAttachmentContent("I am version 1.1"));
final XWikiAttachment version2 = new XWikiAttachment();
version2.setVersion("1.2");
version2.setFilename("attachment.txt");
version2.setDoc(doc);
version2.setAttachment_content(new StringAttachmentContent("I am version 1.2"));
final XWikiAttachment version3 = new XWikiAttachment();
version3.setVersion("1.3");
version3.setFilename("attachment.txt");
version3.setDoc(doc);
version3.setAttachment_content(new StringAttachmentContent("I am version 1.3"));
this.provider = this.fileTools.getAttachmentFileProvider(version1.getReference());
this.archive = new ListAttachmentArchive(new ArrayList<XWikiAttachment>() {
{
add(version1);
add(version2);
add(version3);
}
});
}
Aggregations