public class TestNFMessages
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected static ThreadServletContext |
ivTSCTX |
private static long |
serialVersionUID
The class' serialization version id.
|
Constructor and Description |
---|
TestNFMessages() |
Modifier and Type | Method and Description |
---|---|
protected static org.json.JSONArray |
getFileAttachmentsAsJSON()
Returns the collection of file attachment files as a JSON array of base
64 encoded JSON objects.
|
protected static org.json.JSONObject |
getFromAsJSON()
Returns the message from address as a JSON object.
|
protected static org.apache.velocity.VelocityContext |
getMessageContent(java.lang.String type)
Returns the Velocity Context content for message type.
|
protected static org.json.JSONArray |
getRecipientAddrsAsJSON()
Returns the collection of message recipient internet addresses as a
JSON array.
|
protected static org.json.JSONArray |
getRecipientUsersAsJSON()
Returns the collection of message recipient users as a JSON array of
contact ids.
|
protected static Customer |
getSampleBillto()
Returns a Customer object using values from the configured sample data
spreadsheet file.
|
protected static Order |
getSampleOrder()
Returns an ERP Order object using values from the configured sample data
spreadsheet file.
|
protected static RestockNotification |
getSampleRestock(java.lang.String type)
Returns a Restock Notification object using values from the configured
sample data spreadsheet file.
|
protected static Shipper |
getSampleShipper()
Returns a Shipper object using values from the configured sample data
spreadsheet file.
|
protected static boolean |
getTemplateVersions(java.lang.String tmpid,
java.lang.String dlvmeth)
Tests the getTemplateVersions API.
|
protected static org.apache.velocity.VelocityContext |
initTemplateData()
Creates, initializes and returns a Velocity Context object that can then
be used as the template data for a message.
|
static void |
main(java.lang.String[] args)
The main entry point for when the class is started from a command line.
|
protected static org.json.JSONArray |
parseContent(org.apache.velocity.VelocityContext vc)
Parses the message content when it is a Velocity Context.
|
protected static boolean |
sendMessage(java.lang.String api,
org.json.JSONObject data)
Sends a formatted message to the Notification Framework for processing.
|
protected static boolean |
sendNotification()
Tests the sendNotification API.
|
protected static boolean |
sendNotificationByAddress()
Tests the sendNotificationByAddress API.
|
protected static boolean |
sendTemplateNotification()
Tests the sendTemplateNotification API.
|
protected static boolean |
sendTemplateNotificationByAddress()
Tests the sendTemplateNotificationByAddress API.
|
protected static boolean |
sendTemplateNotificationForVersion()
Tests the sendTemplateNotificationForVersion API.
|
protected static boolean |
sendTemplateNotificationWithBody()
Tests the sendTemplateNotificationWithBody API.
|
private static final long serialVersionUID
protected static ThreadServletContext ivTSCTX
public static void main(java.lang.String[] args)
args
- (String[]) A string array of startup parameters.protected static boolean sendNotification() throws java.lang.Exception
true
if the test is successful,
otherwise false
.java.lang.Exception
- - if an error occurs during the test.protected static boolean sendNotificationByAddress() throws java.lang.Exception
true
if the test is successful,
otherwise false
.java.lang.Exception
- - if an error occurs during the test.protected static boolean sendTemplateNotification() throws java.lang.Exception
true
if the test is successful,
otherwise false
.java.lang.Exception
- - if an error occurs during the test.protected static boolean sendTemplateNotificationByAddress() throws java.lang.Exception
true
if the test is successful,
otherwise false
.java.lang.Exception
- - if an error occurs during the test.protected static boolean sendTemplateNotificationWithBody() throws java.lang.Exception
true
if the test is successful,
otherwise false
.java.lang.Exception
- - if an error occurs during the test.protected static boolean sendTemplateNotificationForVersion() throws java.lang.Exception
true
if the test is successful,
otherwise false
.java.lang.Exception
- - if an error occurs during the test.protected static org.json.JSONArray getFileAttachmentsAsJSON()
protected static org.json.JSONObject getFromAsJSON()
protected static org.apache.velocity.VelocityContext getMessageContent(java.lang.String type)
type
- (String) The type of message for the desired content.protected static org.json.JSONArray getRecipientAddrsAsJSON()
protected static org.json.JSONArray getRecipientUsersAsJSON()
protected static Customer getSampleBillto()
protected static Order getSampleOrder()
protected static RestockNotification getSampleRestock(java.lang.String type)
type
- (String) The current email type being processed. Will
either be MailMessage.LOWSTOCK or MailMessage.RESTOCK.protected static Shipper getSampleShipper()
protected static boolean getTemplateVersions(java.lang.String tmpid, java.lang.String dlvmeth) throws java.lang.Exception
tmpid
- (String) The template id to test.dlvmeth
- (String) The delivery method to test.true
if the test is successful,
otherwise false
.java.lang.Exception
- - if an error occurs during the test.protected static org.apache.velocity.VelocityContext initTemplateData()
protected static org.json.JSONArray parseContent(org.apache.velocity.VelocityContext vc)
vc
- (VelocityContext) The Velocity Context to parse.java.lang.Exception
- - if an error occurs during parsing.protected static boolean sendMessage(java.lang.String api, org.json.JSONObject data) throws java.lang.Exception
api
- (String) The name of the API to call.data
- (JSONObject) The data to be sent to the API.true
if the processing was successful,
otherwise false
.java.lang.Exception
- - if an error occurs during the send.