utils/mapitest/mapitest_common.c File Reference

Support functions for mapitest modules. More...

Functions

void mapitest_common_cleanup (struct mapitest *mt)
 Convenience function to clean up after logging into the server.
bool mapitest_common_create_filled_test_folder (struct mapitest *mt)
 Create a test folder, and fill with 10 sample messages.
bool mapitest_common_find_folder (struct mapitest *mt, mapi_object_t *obj_parent, mapi_object_t *obj_child, const char *name)
 Find a folder within a container.
bool mapitest_common_folder_open (struct mapitest *mt, mapi_object_t *obj_parent, mapi_object_t *obj_child, uint32_t olNum)
 Opens a default folder.
char * mapitest_common_genblob (TALLOC_CTX *mem_ctx, size_t len)
 Generate a random blob of readable data.
bool mapitest_common_message_create (struct mapitest *mt, mapi_object_t *obj_folder, mapi_object_t *obj_message, const char *subject)
 Create a message ready to submit.
bool mapitest_common_message_delete_by_subject (struct mapitest *mt, mapi_object_t *obj_folder, const char *subject)
 This function deletes messages in a folder, based on matching the subject name.
bool mapitest_common_message_fill (struct mapitest *mt, mapi_object_t *obj_message, const char *subject)
 Create a message ready to submit.
bool mapitest_common_setup (struct mapitest *mt, mapi_object_t *obj_htable, uint32_t *count)
 Convenience function to login to the server.

Detailed Description

Support functions for mapitest modules.

These functions implement commonly needed functionality that would otherwise be copied into each module implementation


Function Documentation

bool mapitest_common_create_filled_test_folder ( struct mapitest mt  ) 

Create a test folder, and fill with 10 sample messages.

This function creates a test folder (name set by the MT_DIRNAME_TEST define), and fills it with 5 messages with the same subject and 5 messages with the same sender.

Parameters:
mt pointer to the mapitest context

References mapitest_common_message_create(), mapitest_print(), mapitest_print_retval(), mapitest::mem_ctx, MT_DIRNAME_TEST, MT_MAIL_SUBJECT, mt_common_tf_ctx::obj_test_folder, mt_common_tf_ctx::obj_test_msg, mt_common_tf_ctx::obj_top_folder, and mapitest::priv.

Referenced by mapitest_common_setup().

bool mapitest_common_find_folder ( struct mapitest mt,
mapi_object_t *  obj_parent,
mapi_object_t *  obj_child,
const char *  name 
)

Find a folder within a container.

References mapitest::mem_ctx.

Referenced by mapitest_oxcfold_CopyFolder(), and mapitest_oxcfold_MoveFolder().

bool mapitest_common_folder_open ( struct mapitest mt,
mapi_object_t *  obj_parent,
mapi_object_t *  obj_child,
uint32_t  olNum 
)

Opens a default folder.

This function opens one of the default (standard) folders, returning the folder as obj_child. olNum may be one of:

  • olFolderTopInformationStore
  • olFolderDeletedItems
  • olFolderOutbox
  • olFolderSentMail
  • olFolderInbox
  • olFolderCalendar
  • olFolderContacts
  • olFolderJournal
  • olFolderNotes
  • olFolderTasks
  • olFolderDrafts
Parameters:
mt pointer to the top level mapitest structure
obj_parent parent folder (usually the message store, must be opened)
obj_child the folder that has been opened
olNum the folder identifier (see list above)
Returns:
true on success, false on failure

References mapitest_print().

Referenced by mapitest_common_setup(), mapitest_oxcfold_CopyFolder(), mapitest_oxcfold_MoveFolder(), mapitest_oxcmsg_CreateMessage(), mapitest_oxcmsg_GetValidAttachments(), mapitest_oxcmsg_OpenEmbeddedMessage(), mapitest_oxcmsg_SetMessageReadFlag(), mapitest_oxcnotif_RegisterNotification(), mapitest_oxomsg_SpoolerLockMessage(), mapitest_oxomsg_TransportSend(), and mapitest_oxorule_GetRulesTable().

char* mapitest_common_genblob ( TALLOC_CTX *  mem_ctx,
size_t  len 
)

Generate a random blob of readable data.

Parameters:
mem_ctx the talloc memory context to create the blob in
len the length of the blob to create
Returns:
random blob of readable data, of length len bytes, with a null terminator.
Note:
the data is from 0..len, and the null terminator is at position len+1. So the returned array is actually len+1 bytes in total.

Referenced by mapitest_oxcprpt_CopyToStream(), mapitest_oxcprpt_Stream(), and mapitest_oxcprpt_WriteAndCommitStream().

bool mapitest_common_message_delete_by_subject ( struct mapitest mt,
mapi_object_t *  obj_folder,
const char *  subject 
)

This function deletes messages in a folder, based on matching the subject name.

This is meant to clean up a folder after a test has been run.

Parameters:
mt pointer to the top level mapitest structure
obj_folder the folder to search through
subject the message subject to match

References mapitest_print(), mapitest_print_retval(), and mapitest::mem_ctx.

Referenced by mapitest_oxomsg_AbortSubmit(), mapitest_oxomsg_SubmitMessage(), and mapitest_oxomsg_TransportSend().

bool mapitest_common_message_fill ( struct mapitest mt,
mapi_object_t *  obj_message,
const char *  subject 
)

Create a message ready to submit.

References mapitest::info, mapitest_print(), and mapitest::mem_ctx.

Referenced by mapitest_common_message_create(), and mapitest_oxcmsg_OpenEmbeddedMessage().

bool mapitest_common_setup ( struct mapitest mt,
mapi_object_t *  obj_htable,
uint32_t *  count 
)

Convenience function to login to the server.

This functions logs into the server, gets the top level store, and gets the hierarchy table for the top level store (which is returned as obj_htable). It also creates a test folder with 10 test messages.

Parameters:
mt pointer to the top-level mapitest structure
obj_htable the hierarchy table for the top level store
count the number of rows in the top level hierarchy table
Returns:
true on success, otherwise false

References mapitest_common_create_filled_test_folder(), mapitest_common_folder_open(), mapitest_print_retval(), mapitest::mem_ctx, mt_common_tf_ctx::obj_store, mt_common_tf_ctx::obj_top_folder, mapitest::priv, and mapitest::session.

Referenced by mapitest_oxcfold_HardDeleteMessagesAndSubfolders(), mapitest_oxcmsg_SetReadFlags(), mapitest_oxctable_Category(), mapitest_oxctable_CreateBookmark(), mapitest_oxctable_GetStatus(), mapitest_oxctable_QueryColumns(), mapitest_oxctable_QueryRows(), mapitest_oxctable_Restrict(), mapitest_oxctable_SeekRow(), mapitest_oxctable_SeekRowApprox(), mapitest_oxctable_SeekRowBookmark(), mapitest_oxctable_SetColumns(), and mapitest_oxomsg_TransportNewMail().


Creative Commons License
Creative Commons Attribution icon Creative Commons Share Alike icon
This content is licensed under the Creative Commons
Attribution ShareAlike License v. 3.0:
http://creativecommons.org/licenses/by-sa/3.0/