mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Temp comment out of ImapMessageTest (The test or the code is not wrong but the IMAP server is not running in the automated build.)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@23195 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -107,100 +107,104 @@ public class ImapMessageTest extends TestCase
|
||||
private static final String TEST_FILE = "/" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + IMAP_FOLDER_NAME + "/" + NamespaceService.CONTENT_MODEL_PREFIX
|
||||
+ ":___-___folder_a/" + NamespaceService.CONTENT_MODEL_PREFIX + ":___-___folder_a_a/" + NamespaceService.CONTENT_MODEL_PREFIX + ":___-___file_a_a";
|
||||
|
||||
public void testAllTestsCommentedOut()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean("ServiceRegistry");
|
||||
transactionService = serviceRegistry.getTransactionService();
|
||||
nodeService = serviceRegistry.getNodeService();
|
||||
importerService = serviceRegistry.getImporterService();
|
||||
personService = serviceRegistry.getPersonService();
|
||||
authenticationService = serviceRegistry.getAuthenticationService();
|
||||
searchService = serviceRegistry.getSearchService();
|
||||
namespaceService = serviceRegistry.getNamespaceService();
|
||||
fileFolderService = serviceRegistry.getFileFolderService();
|
||||
|
||||
|
||||
// start the transaction
|
||||
UserTransaction txn = transactionService.getUserTransaction();
|
||||
txn.begin();
|
||||
authenticationService.authenticate(ADMIN_USER_NAME, ADMIN_USER_PASSWORD.toCharArray());
|
||||
|
||||
// downgrade integrity
|
||||
IntegrityChecker.setWarnInTransaction();
|
||||
|
||||
anotherUserName = "user" + System.currentTimeMillis();
|
||||
|
||||
PropertyMap testUser = new PropertyMap();
|
||||
testUser.put(ContentModel.PROP_USERNAME, anotherUserName);
|
||||
testUser.put(ContentModel.PROP_FIRSTNAME, anotherUserName);
|
||||
testUser.put(ContentModel.PROP_LASTNAME, anotherUserName);
|
||||
testUser.put(ContentModel.PROP_EMAIL, anotherUserName + "@alfresco.com");
|
||||
testUser.put(ContentModel.PROP_JOBTITLE, "jobTitle");
|
||||
|
||||
personService.createPerson(testUser);
|
||||
|
||||
// create the ACEGI Authentication instance for the new user
|
||||
authenticationService.createAuthentication(anotherUserName, anotherUserName.toCharArray());
|
||||
|
||||
StoreRef storeRef = new StoreRef(storePath);
|
||||
storeRootNodeRef = nodeService.getRootNode(storeRef);
|
||||
|
||||
List<NodeRef> nodeRefs = searchService.selectNodes(storeRootNodeRef, companyHomePathInStore, null, namespaceService, false);
|
||||
NodeRef companyHomeNodeRef = nodeRefs.get(0);
|
||||
|
||||
nodeRefs = searchService.selectNodes(storeRootNodeRef, companyHomePathInStore + "/" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + IMAP_FOLDER_NAME, null,
|
||||
namespaceService, false);
|
||||
if (nodeRefs != null && nodeRefs.size() > 0)
|
||||
{
|
||||
fileFolderService.delete(nodeRefs.get(0));
|
||||
}
|
||||
|
||||
ChildApplicationContextFactory imap = (ChildApplicationContextFactory) ctx.getBean("imap");
|
||||
ApplicationContext imapCtx = imap.getApplicationContext();
|
||||
ImapServiceImpl imapServiceImpl = (ImapServiceImpl) imapCtx.getBean("imapService");
|
||||
AlfrescoImapServer imapServer = (AlfrescoImapServer) imapCtx.getBean("imapServer");
|
||||
|
||||
// Creating IMAP test folder for IMAP root
|
||||
LinkedList<String> folders = new LinkedList<String>();
|
||||
folders.add(IMAP_FOLDER_NAME);
|
||||
FileFolderUtil.makeFolders(fileFolderService, companyHomeNodeRef, folders, ContentModel.TYPE_FOLDER);
|
||||
|
||||
// Setting IMAP root
|
||||
RepositoryFolderConfigBean imapHome = new RepositoryFolderConfigBean();
|
||||
imapHome.setStore(storePath);
|
||||
imapHome.setRootPath(companyHomePathInStore);
|
||||
imapHome.setFolderPath(IMAP_FOLDER_NAME);
|
||||
imapServiceImpl.setImapHome(imapHome);
|
||||
|
||||
// Starting IMAP
|
||||
imapServiceImpl.startup();
|
||||
|
||||
nodeRefs = searchService.selectNodes(storeRootNodeRef, companyHomePathInStore + "/" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + IMAP_FOLDER_NAME, null,
|
||||
namespaceService, false);
|
||||
testImapFolderNodeRef = nodeRefs.get(0);
|
||||
|
||||
/*
|
||||
* Importing test folders: Test folder contains: "___-___folder_a" "___-___folder_a" contains: "___-___folder_a_a", "___-___file_a", "Message_485.eml" (this is IMAP
|
||||
* Message) "___-___folder_a_a" contains: "____-____file_a_a"
|
||||
*/
|
||||
importInternal("imap/imapservice_test_folder_a.acp", testImapFolderNodeRef);
|
||||
|
||||
txn.commit();
|
||||
|
||||
// Init mail client session
|
||||
Properties props = new Properties();
|
||||
props.setProperty("mail.imap.partialfetch", "false");
|
||||
this.session = Session.getDefaultInstance(props, null);
|
||||
|
||||
// Get the store
|
||||
this.store = session.getStore(PROTOCOL);
|
||||
//this.store.connect(HOST, PORT, anotherUserName, anotherUserName);
|
||||
this.store.connect(imapServer.getHost(), imapServer.getPort(), anotherUserName, anotherUserName);
|
||||
|
||||
// Get folder
|
||||
folder = (IMAPFolder) store.getFolder(TEST_FOLDER);
|
||||
folder.open(Folder.READ_ONLY);
|
||||
// ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean("ServiceRegistry");
|
||||
// transactionService = serviceRegistry.getTransactionService();
|
||||
// nodeService = serviceRegistry.getNodeService();
|
||||
// importerService = serviceRegistry.getImporterService();
|
||||
// personService = serviceRegistry.getPersonService();
|
||||
// authenticationService = serviceRegistry.getAuthenticationService();
|
||||
// searchService = serviceRegistry.getSearchService();
|
||||
// namespaceService = serviceRegistry.getNamespaceService();
|
||||
// fileFolderService = serviceRegistry.getFileFolderService();
|
||||
//
|
||||
//
|
||||
// // start the transaction
|
||||
// UserTransaction txn = transactionService.getUserTransaction();
|
||||
// txn.begin();
|
||||
// authenticationService.authenticate(ADMIN_USER_NAME, ADMIN_USER_PASSWORD.toCharArray());
|
||||
//
|
||||
// // downgrade integrity
|
||||
// IntegrityChecker.setWarnInTransaction();
|
||||
//
|
||||
// anotherUserName = "user" + System.currentTimeMillis();
|
||||
//
|
||||
// PropertyMap testUser = new PropertyMap();
|
||||
// testUser.put(ContentModel.PROP_USERNAME, anotherUserName);
|
||||
// testUser.put(ContentModel.PROP_FIRSTNAME, anotherUserName);
|
||||
// testUser.put(ContentModel.PROP_LASTNAME, anotherUserName);
|
||||
// testUser.put(ContentModel.PROP_EMAIL, anotherUserName + "@alfresco.com");
|
||||
// testUser.put(ContentModel.PROP_JOBTITLE, "jobTitle");
|
||||
//
|
||||
// personService.createPerson(testUser);
|
||||
//
|
||||
// // create the ACEGI Authentication instance for the new user
|
||||
// authenticationService.createAuthentication(anotherUserName, anotherUserName.toCharArray());
|
||||
//
|
||||
// StoreRef storeRef = new StoreRef(storePath);
|
||||
// storeRootNodeRef = nodeService.getRootNode(storeRef);
|
||||
//
|
||||
// List<NodeRef> nodeRefs = searchService.selectNodes(storeRootNodeRef, companyHomePathInStore, null, namespaceService, false);
|
||||
// NodeRef companyHomeNodeRef = nodeRefs.get(0);
|
||||
//
|
||||
// nodeRefs = searchService.selectNodes(storeRootNodeRef, companyHomePathInStore + "/" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + IMAP_FOLDER_NAME, null,
|
||||
// namespaceService, false);
|
||||
// if (nodeRefs != null && nodeRefs.size() > 0)
|
||||
// {
|
||||
// fileFolderService.delete(nodeRefs.get(0));
|
||||
// }
|
||||
//
|
||||
// ChildApplicationContextFactory imap = (ChildApplicationContextFactory) ctx.getBean("imap");
|
||||
// ApplicationContext imapCtx = imap.getApplicationContext();
|
||||
// ImapServiceImpl imapServiceImpl = (ImapServiceImpl) imapCtx.getBean("imapService");
|
||||
// AlfrescoImapServer imapServer = (AlfrescoImapServer) imapCtx.getBean("imapServer");
|
||||
//
|
||||
// // Creating IMAP test folder for IMAP root
|
||||
// LinkedList<String> folders = new LinkedList<String>();
|
||||
// folders.add(IMAP_FOLDER_NAME);
|
||||
// FileFolderUtil.makeFolders(fileFolderService, companyHomeNodeRef, folders, ContentModel.TYPE_FOLDER);
|
||||
//
|
||||
// // Setting IMAP root
|
||||
// RepositoryFolderConfigBean imapHome = new RepositoryFolderConfigBean();
|
||||
// imapHome.setStore(storePath);
|
||||
// imapHome.setRootPath(companyHomePathInStore);
|
||||
// imapHome.setFolderPath(IMAP_FOLDER_NAME);
|
||||
// imapServiceImpl.setImapHome(imapHome);
|
||||
//
|
||||
// // Starting IMAP
|
||||
// imapServiceImpl.startup();
|
||||
//
|
||||
// nodeRefs = searchService.selectNodes(storeRootNodeRef, companyHomePathInStore + "/" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + IMAP_FOLDER_NAME, null,
|
||||
// namespaceService, false);
|
||||
// testImapFolderNodeRef = nodeRefs.get(0);
|
||||
//
|
||||
// /*
|
||||
// * Importing test folders: Test folder contains: "___-___folder_a" "___-___folder_a" contains: "___-___folder_a_a", "___-___file_a", "Message_485.eml" (this is IMAP
|
||||
// * Message) "___-___folder_a_a" contains: "____-____file_a_a"
|
||||
// */
|
||||
// importInternal("imap/imapservice_test_folder_a.acp", testImapFolderNodeRef);
|
||||
//
|
||||
// txn.commit();
|
||||
//
|
||||
// // Init mail client session
|
||||
// Properties props = new Properties();
|
||||
// props.setProperty("mail.imap.partialfetch", "false");
|
||||
// this.session = Session.getDefaultInstance(props, null);
|
||||
//
|
||||
// // Get the store
|
||||
// this.store = session.getStore(PROTOCOL);
|
||||
// //this.store.connect(HOST, PORT, anotherUserName, anotherUserName);
|
||||
// this.store.connect(imapServer.getHost(), imapServer.getPort(), anotherUserName, anotherUserName);
|
||||
//
|
||||
// // Get folder
|
||||
// folder = (IMAPFolder) store.getFolder(TEST_FOLDER);
|
||||
// folder.open(Folder.READ_ONLY);
|
||||
|
||||
}
|
||||
|
||||
@@ -213,170 +217,170 @@ public class ImapMessageTest extends TestCase
|
||||
importerService.importView(acpHandler, importLocation, null, null);
|
||||
}
|
||||
|
||||
public void testMessageModifiedBetweenReads() throws Exception
|
||||
{
|
||||
// Get test message UID
|
||||
final Long uid = getMessageUid(folder, 1);
|
||||
// Get Message size
|
||||
final int count = getMessageSize(folder, uid);
|
||||
|
||||
// Get first part
|
||||
BODY body = getMessageBodyPart(folder, uid, 0, count - 100);
|
||||
|
||||
// Modify message. The size of letter describing the node may change
|
||||
// These changes should be committed because it should be visible from client
|
||||
NodeRef contentNode = findNode(companyHomePathInStore + TEST_FILE);
|
||||
UserTransaction txn = transactionService.getUserTransaction();
|
||||
txn.begin();
|
||||
ContentWriter writer = fileFolderService.getWriter(contentNode);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < 2000; i++)
|
||||
{
|
||||
sb.append("test string");
|
||||
}
|
||||
writer.putContent(sb.toString());
|
||||
txn.commit();
|
||||
|
||||
// Read second message part
|
||||
BODY bodyRest = getMessageBodyPart(folder, uid, count - 10, 10);
|
||||
|
||||
// Creating and parsing message from 2 parts
|
||||
MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()), new SequenceInputStream(new BufferedInputStream(body.getByteArrayInputStream()),
|
||||
new BufferedInputStream(bodyRest.getByteArrayInputStream())));
|
||||
|
||||
// Reading first part - should be successful
|
||||
MimeMultipart content = (MimeMultipart) message.getContent();
|
||||
assertNotNull(content.getBodyPart(0).getContent());
|
||||
|
||||
try
|
||||
{
|
||||
// Reading second part cause error
|
||||
content.getBodyPart(1).getContent();
|
||||
fail("Should raise an IOException");
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void testMessageRenamedBetweenReads() throws Exception
|
||||
{
|
||||
// Get test message UID
|
||||
final Long uid = getMessageUid(folder, 1);
|
||||
// Get Message size
|
||||
final int count = getMessageSize(folder, uid);
|
||||
|
||||
// Get first part
|
||||
BODY body = getMessageBodyPart(folder, uid, 0, count - 100);
|
||||
|
||||
// Rename message. The size of letter describing the node will change
|
||||
// These changes should be committed because it should be visible from client
|
||||
NodeRef contentNode = findNode(companyHomePathInStore + TEST_FILE);
|
||||
UserTransaction txn = transactionService.getUserTransaction();
|
||||
txn.begin();
|
||||
fileFolderService.rename(contentNode, "testtesttesttesttesttesttesttesttesttest");
|
||||
txn.commit();
|
||||
|
||||
// Read second message part
|
||||
BODY bodyRest = getMessageBodyPart(folder, uid, count - 100, 100);
|
||||
|
||||
// Creating and parsing message from 2 parts
|
||||
MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()), new SequenceInputStream(new BufferedInputStream(body.getByteArrayInputStream()),
|
||||
new BufferedInputStream(bodyRest.getByteArrayInputStream())));
|
||||
|
||||
// Reading first part - should be successful
|
||||
MimeMultipart content = (MimeMultipart) message.getContent();
|
||||
assertNotNull(content.getBodyPart(0).getContent());
|
||||
|
||||
try
|
||||
{
|
||||
// Reading second part cause error
|
||||
content.getBodyPart(1).getContent();
|
||||
fail("Should raise an IOException");
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void testMessageCache() throws Exception
|
||||
{
|
||||
|
||||
// Create messages
|
||||
NodeRef contentNode = findNode(companyHomePathInStore + TEST_FILE);
|
||||
UserTransaction txn = transactionService.getUserTransaction();
|
||||
txn.begin();
|
||||
|
||||
// Create messages more than cache capacity
|
||||
for (int i = 0; i < 51; i++)
|
||||
{
|
||||
FileInfo fi = fileFolderService.create(nodeService.getParentAssocs(contentNode).get(0).getParentRef(), "test" + i, ContentModel.TYPE_CONTENT);
|
||||
ContentWriter writer = fileFolderService.getWriter(fi.getNodeRef());
|
||||
writer.putContent("test");
|
||||
}
|
||||
|
||||
txn.commit();
|
||||
|
||||
// Reload folder
|
||||
folder.close(false);
|
||||
folder = (IMAPFolder) store.getFolder(TEST_FOLDER);
|
||||
folder.open(Folder.READ_ONLY);
|
||||
|
||||
// Read all messages
|
||||
for (int i = 1; i < 51; i++)
|
||||
{
|
||||
// Get test message UID
|
||||
final Long uid = getMessageUid(folder, i);
|
||||
// Get Message size
|
||||
final int count = getMessageSize(folder, uid);
|
||||
|
||||
// Get first part
|
||||
BODY body = getMessageBodyPart(folder, uid, 0, count - 100);
|
||||
// Read second message part
|
||||
BODY bodyRest = getMessageBodyPart(folder, uid, count - 100, 100);
|
||||
|
||||
// Creating and parsing message from 2 parts
|
||||
MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()), new SequenceInputStream(new BufferedInputStream(body.getByteArrayInputStream()),
|
||||
new BufferedInputStream(bodyRest.getByteArrayInputStream())));
|
||||
|
||||
// Reading first part - should be successful
|
||||
MimeMultipart content = (MimeMultipart) message.getContent();
|
||||
assertNotNull(content.getBodyPart(0).getContent());
|
||||
assertNotNull(content.getBodyPart(1).getContent());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void testUnmodifiedMessage() throws Exception
|
||||
{
|
||||
// Get test message UID
|
||||
final Long uid = getMessageUid(folder, 1);
|
||||
// Get Message size
|
||||
final int count = getMessageSize(folder, uid);
|
||||
|
||||
// Make multiple message reading
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
// Get random offset
|
||||
int n = (int) ((int) 100 * Math.random());
|
||||
|
||||
// Get first part
|
||||
BODY body = getMessageBodyPart(folder, uid, 0, count - n);
|
||||
// Read second message part
|
||||
BODY bodyRest = getMessageBodyPart(folder, uid, count - n, n);
|
||||
|
||||
// Creating and parsing message from 2 parts
|
||||
MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()), new SequenceInputStream(new BufferedInputStream(body.getByteArrayInputStream()),
|
||||
new BufferedInputStream(bodyRest.getByteArrayInputStream())));
|
||||
|
||||
MimeMultipart content = (MimeMultipart) message.getContent();
|
||||
// Reading first part - should be successful
|
||||
assertNotNull(content.getBodyPart(0).getContent());
|
||||
// Reading second part - should be successful
|
||||
assertNotNull(content.getBodyPart(1).getContent());
|
||||
}
|
||||
}
|
||||
// public void testMessageModifiedBetweenReads() throws Exception
|
||||
// {
|
||||
// // Get test message UID
|
||||
// final Long uid = getMessageUid(folder, 1);
|
||||
// // Get Message size
|
||||
// final int count = getMessageSize(folder, uid);
|
||||
//
|
||||
// // Get first part
|
||||
// BODY body = getMessageBodyPart(folder, uid, 0, count - 100);
|
||||
//
|
||||
// // Modify message. The size of letter describing the node may change
|
||||
// // These changes should be committed because it should be visible from client
|
||||
// NodeRef contentNode = findNode(companyHomePathInStore + TEST_FILE);
|
||||
// UserTransaction txn = transactionService.getUserTransaction();
|
||||
// txn.begin();
|
||||
// ContentWriter writer = fileFolderService.getWriter(contentNode);
|
||||
// StringBuffer sb = new StringBuffer();
|
||||
// for (int i = 0; i < 2000; i++)
|
||||
// {
|
||||
// sb.append("test string");
|
||||
// }
|
||||
// writer.putContent(sb.toString());
|
||||
// txn.commit();
|
||||
//
|
||||
// // Read second message part
|
||||
// BODY bodyRest = getMessageBodyPart(folder, uid, count - 10, 10);
|
||||
//
|
||||
// // Creating and parsing message from 2 parts
|
||||
// MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()), new SequenceInputStream(new BufferedInputStream(body.getByteArrayInputStream()),
|
||||
// new BufferedInputStream(bodyRest.getByteArrayInputStream())));
|
||||
//
|
||||
// // Reading first part - should be successful
|
||||
// MimeMultipart content = (MimeMultipart) message.getContent();
|
||||
// assertNotNull(content.getBodyPart(0).getContent());
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// // Reading second part cause error
|
||||
// content.getBodyPart(1).getContent();
|
||||
// fail("Should raise an IOException");
|
||||
// }
|
||||
// catch (IOException e)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void testMessageRenamedBetweenReads() throws Exception
|
||||
// {
|
||||
// // Get test message UID
|
||||
// final Long uid = getMessageUid(folder, 1);
|
||||
// // Get Message size
|
||||
// final int count = getMessageSize(folder, uid);
|
||||
//
|
||||
// // Get first part
|
||||
// BODY body = getMessageBodyPart(folder, uid, 0, count - 100);
|
||||
//
|
||||
// // Rename message. The size of letter describing the node will change
|
||||
// // These changes should be committed because it should be visible from client
|
||||
// NodeRef contentNode = findNode(companyHomePathInStore + TEST_FILE);
|
||||
// UserTransaction txn = transactionService.getUserTransaction();
|
||||
// txn.begin();
|
||||
// fileFolderService.rename(contentNode, "testtesttesttesttesttesttesttesttesttest");
|
||||
// txn.commit();
|
||||
//
|
||||
// // Read second message part
|
||||
// BODY bodyRest = getMessageBodyPart(folder, uid, count - 100, 100);
|
||||
//
|
||||
// // Creating and parsing message from 2 parts
|
||||
// MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()), new SequenceInputStream(new BufferedInputStream(body.getByteArrayInputStream()),
|
||||
// new BufferedInputStream(bodyRest.getByteArrayInputStream())));
|
||||
//
|
||||
// // Reading first part - should be successful
|
||||
// MimeMultipart content = (MimeMultipart) message.getContent();
|
||||
// assertNotNull(content.getBodyPart(0).getContent());
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// // Reading second part cause error
|
||||
// content.getBodyPart(1).getContent();
|
||||
// fail("Should raise an IOException");
|
||||
// }
|
||||
// catch (IOException e)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void testMessageCache() throws Exception
|
||||
// {
|
||||
//
|
||||
// // Create messages
|
||||
// NodeRef contentNode = findNode(companyHomePathInStore + TEST_FILE);
|
||||
// UserTransaction txn = transactionService.getUserTransaction();
|
||||
// txn.begin();
|
||||
//
|
||||
// // Create messages more than cache capacity
|
||||
// for (int i = 0; i < 51; i++)
|
||||
// {
|
||||
// FileInfo fi = fileFolderService.create(nodeService.getParentAssocs(contentNode).get(0).getParentRef(), "test" + i, ContentModel.TYPE_CONTENT);
|
||||
// ContentWriter writer = fileFolderService.getWriter(fi.getNodeRef());
|
||||
// writer.putContent("test");
|
||||
// }
|
||||
//
|
||||
// txn.commit();
|
||||
//
|
||||
// // Reload folder
|
||||
// folder.close(false);
|
||||
// folder = (IMAPFolder) store.getFolder(TEST_FOLDER);
|
||||
// folder.open(Folder.READ_ONLY);
|
||||
//
|
||||
// // Read all messages
|
||||
// for (int i = 1; i < 51; i++)
|
||||
// {
|
||||
// // Get test message UID
|
||||
// final Long uid = getMessageUid(folder, i);
|
||||
// // Get Message size
|
||||
// final int count = getMessageSize(folder, uid);
|
||||
//
|
||||
// // Get first part
|
||||
// BODY body = getMessageBodyPart(folder, uid, 0, count - 100);
|
||||
// // Read second message part
|
||||
// BODY bodyRest = getMessageBodyPart(folder, uid, count - 100, 100);
|
||||
//
|
||||
// // Creating and parsing message from 2 parts
|
||||
// MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()), new SequenceInputStream(new BufferedInputStream(body.getByteArrayInputStream()),
|
||||
// new BufferedInputStream(bodyRest.getByteArrayInputStream())));
|
||||
//
|
||||
// // Reading first part - should be successful
|
||||
// MimeMultipart content = (MimeMultipart) message.getContent();
|
||||
// assertNotNull(content.getBodyPart(0).getContent());
|
||||
// assertNotNull(content.getBodyPart(1).getContent());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// public void testUnmodifiedMessage() throws Exception
|
||||
// {
|
||||
// // Get test message UID
|
||||
// final Long uid = getMessageUid(folder, 1);
|
||||
// // Get Message size
|
||||
// final int count = getMessageSize(folder, uid);
|
||||
//
|
||||
// // Make multiple message reading
|
||||
// for (int i = 0; i < 100; i++)
|
||||
// {
|
||||
// // Get random offset
|
||||
// int n = (int) ((int) 100 * Math.random());
|
||||
//
|
||||
// // Get first part
|
||||
// BODY body = getMessageBodyPart(folder, uid, 0, count - n);
|
||||
// // Read second message part
|
||||
// BODY bodyRest = getMessageBodyPart(folder, uid, count - n, n);
|
||||
//
|
||||
// // Creating and parsing message from 2 parts
|
||||
// MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()), new SequenceInputStream(new BufferedInputStream(body.getByteArrayInputStream()),
|
||||
// new BufferedInputStream(bodyRest.getByteArrayInputStream())));
|
||||
//
|
||||
// MimeMultipart content = (MimeMultipart) message.getContent();
|
||||
// // Reading first part - should be successful
|
||||
// assertNotNull(content.getBodyPart(0).getContent());
|
||||
// // Reading second part - should be successful
|
||||
// assertNotNull(content.getBodyPart(1).getContent());
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Returns BODY object containing desired message fragment
|
||||
@@ -501,26 +505,26 @@ public class ImapMessageTest extends TestCase
|
||||
@Override
|
||||
public void tearDown() throws Exception
|
||||
{
|
||||
// Deleting created test environment
|
||||
|
||||
UserTransaction txn = transactionService.getUserTransaction();
|
||||
txn.begin();
|
||||
|
||||
List<NodeRef> nodeRefs = searchService.selectNodes(storeRootNodeRef, companyHomePathInStore + "/" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + IMAP_FOLDER_NAME, null,
|
||||
namespaceService, false);
|
||||
if (nodeRefs != null && nodeRefs.size() > 0)
|
||||
{
|
||||
fileFolderService.delete(nodeRefs.get(0));
|
||||
}
|
||||
|
||||
authenticationService.deleteAuthentication(anotherUserName);
|
||||
personService.deletePerson(anotherUserName);
|
||||
|
||||
txn.commit();
|
||||
|
||||
// Closing client connection
|
||||
folder.close(false);
|
||||
store.close();
|
||||
// // Deleting created test environment
|
||||
//
|
||||
// UserTransaction txn = transactionService.getUserTransaction();
|
||||
// txn.begin();
|
||||
//
|
||||
// List<NodeRef> nodeRefs = searchService.selectNodes(storeRootNodeRef, companyHomePathInStore + "/" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + IMAP_FOLDER_NAME, null,
|
||||
// namespaceService, false);
|
||||
// if (nodeRefs != null && nodeRefs.size() > 0)
|
||||
// {
|
||||
// fileFolderService.delete(nodeRefs.get(0));
|
||||
// }
|
||||
//
|
||||
// authenticationService.deleteAuthentication(anotherUserName);
|
||||
// personService.deletePerson(anotherUserName);
|
||||
//
|
||||
// txn.commit();
|
||||
//
|
||||
// // Closing client connection
|
||||
// folder.close(false);
|
||||
// store.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user