use of com.zimbra.cs.store.file.BlobConsistencyChecker.Results in project zm-mailbox by Zimbra.
the class AbstractBlobConsistencyCheckTest method allBlobs.
@Test
public void allBlobs() throws Exception {
Mailbox mbox = MailboxManager.getInstance().getMailboxByAccountId(MockProvisioning.DEFAULT_ACCOUNT_ID);
DeliveryOptions dopt = new DeliveryOptions().setFolderId(Mailbox.ID_FOLDER_INBOX);
int msgs = 10;
for (int i = 0; i < msgs; i++) {
mbox.addMessage(null, new ParsedMessage("From: test1-1@sub1.zimbra.com".getBytes(), false), dopt, null);
}
BlobConsistencyChecker checker = getChecker();
Results results = checker.check(getVolumeIds(), mbox.getId(), true, true);
Assert.assertEquals(0, results.missingBlobs.size());
Assert.assertEquals(0, results.unexpectedBlobs.size());
Assert.assertEquals(msgs, results.usedBlobs.size());
Assert.assertEquals(0, results.incorrectSize.size());
Assert.assertEquals(0, results.incorrectModContent.size());
}
use of com.zimbra.cs.store.file.BlobConsistencyChecker.Results in project zm-mailbox by Zimbra.
the class AbstractBlobConsistencyCheckTest method wrongSize.
@Test
public void wrongSize() throws Exception {
Mailbox mbox = MailboxManager.getInstance().getMailboxByAccountId(MockProvisioning.DEFAULT_ACCOUNT_ID);
DeliveryOptions dopt = new DeliveryOptions().setFolderId(Mailbox.ID_FOLDER_INBOX);
Message msg = mbox.addMessage(null, new ParsedMessage("From: test1-1@sub1.zimbra.com".getBytes(), false), dopt, null);
MailboxBlob blob = msg.getBlob();
String text = "some garbage";
appendText(blob, text);
BlobConsistencyChecker checker = getChecker();
Results results = checker.check(getVolumeIds(), mbox.getId(), true, false);
Assert.assertEquals(0, results.missingBlobs.size());
Assert.assertEquals(0, results.unexpectedBlobs.size());
Assert.assertEquals(0, results.usedBlobs.size());
Assert.assertEquals(1, results.incorrectSize.size());
BlobInfo info = results.incorrectSize.values().iterator().next();
Assert.assertEquals(blob.size + text.length(), (long) info.fileDataSize);
Assert.assertEquals(0, results.incorrectModContent.size());
}
use of com.zimbra.cs.store.file.BlobConsistencyChecker.Results in project zm-mailbox by Zimbra.
the class AbstractBlobConsistencyCheckTest method unexpectedBlobs.
@Test
public void unexpectedBlobs() throws Exception {
Mailbox mbox = MailboxManager.getInstance().getMailboxByAccountId(MockProvisioning.DEFAULT_ACCOUNT_ID);
String path = createUnexpectedBlob(0);
BlobConsistencyChecker checker = getChecker();
Results results = checker.check(getVolumeIds(), mbox.getId(), true, false);
Assert.assertEquals(0, results.missingBlobs.size());
Assert.assertEquals(1, results.unexpectedBlobs.size());
BlobInfo info = results.unexpectedBlobs.values().iterator().next();
Assert.assertEquals(path, info.path);
Assert.assertEquals(0, results.usedBlobs.size());
Assert.assertEquals(0, results.incorrectSize.size());
Assert.assertEquals(0, results.incorrectModContent.size());
deleteAllBlobs();
DeliveryOptions dopt = new DeliveryOptions().setFolderId(Mailbox.ID_FOLDER_INBOX);
mbox.addMessage(null, new ParsedMessage("From: test1-1@sub1.zimbra.com".getBytes(), false), dopt, null);
int msgs = 10;
for (int i = 0; i < msgs; i++) {
createUnexpectedBlob(i);
}
results = checker.check(getVolumeIds(), mbox.getId(), true, false);
Assert.assertEquals(0, results.missingBlobs.size());
Assert.assertEquals(msgs, results.unexpectedBlobs.size());
Assert.assertEquals(0, results.usedBlobs.size());
Assert.assertEquals(0, results.incorrectSize.size());
Assert.assertEquals(0, results.incorrectModContent.size());
}
use of com.zimbra.cs.store.file.BlobConsistencyChecker.Results in project zm-mailbox by Zimbra.
the class AbstractBlobConsistencyCheckTest method missingBlobs.
@Test
public void missingBlobs() throws Exception {
Mailbox mbox = MailboxManager.getInstance().getMailboxByAccountId(MockProvisioning.DEFAULT_ACCOUNT_ID);
DeliveryOptions dopt = new DeliveryOptions().setFolderId(Mailbox.ID_FOLDER_INBOX);
int msgs = 10;
for (int i = 0; i < msgs; i++) {
mbox.addMessage(null, new ParsedMessage("From: test1-1@sub1.zimbra.com".getBytes(), false), dopt, null);
}
deleteAllBlobs();
BlobConsistencyChecker checker = getChecker();
Results results = checker.check(getVolumeIds(), mbox.getId(), true, false);
Assert.assertEquals(msgs, results.missingBlobs.size());
Assert.assertEquals(0, results.unexpectedBlobs.size());
Assert.assertEquals(0, results.usedBlobs.size());
Assert.assertEquals(0, results.incorrectSize.size());
Assert.assertEquals(0, results.incorrectModContent.size());
}
use of com.zimbra.cs.store.file.BlobConsistencyChecker.Results in project zm-mailbox by Zimbra.
the class AbstractBlobConsistencyCheckTest method singleBlob.
@Test
public void singleBlob() throws Exception {
Mailbox mbox = MailboxManager.getInstance().getMailboxByAccountId(MockProvisioning.DEFAULT_ACCOUNT_ID);
DeliveryOptions dopt = new DeliveryOptions().setFolderId(Mailbox.ID_FOLDER_INBOX);
mbox.addMessage(null, new ParsedMessage("From: test1-1@sub1.zimbra.com".getBytes(), false), dopt, null);
BlobConsistencyChecker checker = getChecker();
Results results = checker.check(getVolumeIds(), mbox.getId(), true, false);
Assert.assertEquals(0, results.unexpectedBlobs.size());
Assert.assertEquals(0, results.missingBlobs.size());
Assert.assertEquals(0, results.usedBlobs.size());
Assert.assertEquals(0, results.incorrectSize.size());
Assert.assertEquals(0, results.incorrectModContent.size());
}
Aggregations