javapns.test
Class NotificationTest

java.lang.Object
  extended by javapns.test.NotificationTest

public class NotificationTest
extends Object

A command-line test facility for the Push Notification Service.

Example: java -cp "[required libraries]" javapns.test.NotificationTest keystore.p12 mypass 2ed202ac08ea9033665e853a3dc8bc4c5e78f7a6cf8d55910df230567037dcc4

By default, this test uses the sandbox service. To switch, add "production" as a fourth parameter:

Example: java -cp "[required libraries]" javapns.test.NotificationTest keystore.p12 mypass 2ed202ac08ea9033665e853a3dc8bc4c5e78f7a6cf8d55910df230567037dcc4 production

Also by default, this test pushes a simple alert. To send a complex payload, add "complex" as a fifth parameter:

Example: java -cp "[required libraries]" javapns.test.NotificationTest keystore.p12 mypass 2ed202ac08ea9033665e853a3dc8bc4c5e78f7a6cf8d55910df230567037dcc4 production complex

To send a simple payload to a large number of fake devices, add "threads" as a fifth parameter, the number of fake devices to construct, and the number of threads to use:

Example: java -cp "[required libraries]" javapns.test.NotificationTest keystore.p12 mypass 2ed202ac08ea9033665e853a3dc8bc4c5e78f7a6cf8d55910df230567037dcc4 sandbox threads 1000 5

Author:
Sylvain Pedneault

Field Summary
static NotificationProgressListener DEBUGGING_PROGRESS_LISTENER
          A NotificationProgressListener you can use to debug NotificationThreads.
 
Method Summary
static void configureBasicLogging()
          Enable Log4J with a basic default configuration (console only).
static void main(String[] args)
          Execute this class from the command line to run tests.
static void printPushedNotifications(List<PushedNotification> notifications)
          Print to the console a comprehensive report of all pushed notifications and results.
static void printPushedNotifications(String description, List<PushedNotification> notifications)
          Print to the console a list of pushed notifications.
static void verifyKeystore(Object keystoreReference, String password, boolean production)
          Validate a keystore reference and print the results to the console.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUGGING_PROGRESS_LISTENER

public static final NotificationProgressListener DEBUGGING_PROGRESS_LISTENER
A NotificationProgressListener you can use to debug NotificationThreads.

Method Detail

main

public static void main(String[] args)
Execute this class from the command line to run tests.

Parameters:
args -

printPushedNotifications

public static void printPushedNotifications(List<PushedNotification> notifications)
Print to the console a comprehensive report of all pushed notifications and results.

Parameters:
notifications - a raw list of pushed notifications

printPushedNotifications

public static void printPushedNotifications(String description,
                                            List<PushedNotification> notifications)
Print to the console a list of pushed notifications.

Parameters:
description - a title for this list of notifications
notifications - a list of pushed notifications to print

configureBasicLogging

public static void configureBasicLogging()
Enable Log4J with a basic default configuration (console only).


verifyKeystore

public static void verifyKeystore(Object keystoreReference,
                                  String password,
                                  boolean production)
Validate a keystore reference and print the results to the console.

Parameters:
keystoreReference - a reference to or an actual keystore
password - password for the keystore
production - service to use