com.verisign.epp.codec.suggestion.util
Class RandomHelper

java.lang.Object
  extended by com.verisign.epp.codec.suggestion.util.RandomHelper

public class RandomHelper
extends java.lang.Object

This class knows how to construct a random command or response facilitating the random unit test framework.

Author:
jcolosi

Constructor Summary
RandomHelper()
           
 
Method Summary
static double get()
          Get next random double value.
static EPPSuggestionInfoCmd getCommand()
          Create an Epp Suggestion Info command.
static EPPSuggestionInfoResp getEmptyGridResponse(java.lang.String aClientTransId)
          Create an empty grid response.
static EPPSuggestionInfoResp getEmptyRecordResponse(java.lang.String aClientTransId)
          Create an empty record response.
static EPPSuggestionInfoResp getEmptyTableResponse(java.lang.String aClientTransId)
          Create an empty table response.
static int getInt()
          Get next random int value.
static int getInt(int aMaxValue)
          Get next random int value from 0 to aMaxValue.
static int getInt(int n, int r)
           
static long getLong()
          Get next random long value.
static long getLong(long aMaxValue)
          Get next random int value from 0 to aMaxValue.
static long getLong(long n, long r)
           
static EPPSuggestionInfoResp getResponse(java.lang.String aClientTransId)
          There was an issue with empty elements.
static boolean p(double d)
          Helper method for random.
static void reset()
          Reset the random object.
static void reset(long aSeed)
          Reset the random object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomHelper

public RandomHelper()
Method Detail

get

public static double get()
Get next random double value.

Returns:
a double value

getInt

public static int getInt()
Get next random int value.

Returns:
a int value

getInt

public static int getInt(int aMaxValue)
Get next random int value from 0 to aMaxValue.

Parameters:
aMaxValue - a max int value
Returns:
a int value

getInt

public static int getInt(int n,
                         int r)

getLong

public static long getLong()
Get next random long value.

Returns:
a long value

getLong

public static long getLong(long aMaxValue)
Get next random int value from 0 to aMaxValue.

Parameters:
aMaxValue - a max int value
Returns:
a long value

getLong

public static long getLong(long n,
                           long r)

getCommand

public static EPPSuggestionInfoCmd getCommand()
                                       throws InvalidValueException
Create an Epp Suggestion Info command.

Returns:
a command
Throws:
InvalidValueException

getResponse

public static EPPSuggestionInfoResp getResponse(java.lang.String aClientTransId)
                                         throws InvalidValueException
There was an issue with empty elements. The table, grid, and record elements can occasionally be returned without any sub elements. I have added code to generate these records in the random responses.

Returns:
a response
Throws:
InvalidValueException

getEmptyTableResponse

public static EPPSuggestionInfoResp getEmptyTableResponse(java.lang.String aClientTransId)
Create an empty table response.

Parameters:
aClientTransId - a client transaction id
Returns:
a table response.

getEmptyGridResponse

public static EPPSuggestionInfoResp getEmptyGridResponse(java.lang.String aClientTransId)
Create an empty grid response.

Parameters:
aClientTransId - a client transaction id
Returns:
a grid response.

getEmptyRecordResponse

public static EPPSuggestionInfoResp getEmptyRecordResponse(java.lang.String aClientTransId)
                                                    throws InvalidValueException
Create an empty record response.

Parameters:
aClientTransId - a client transaction id
Returns:
a record response.
Throws:
InvalidValueException

reset

public static void reset()
Reset the random object.


reset

public static void reset(long aSeed)
Reset the random object.

Parameters:
aSeed - a seed

p

public static boolean p(double d)
Helper method for random.

Parameters:
d - a double value
Returns:
true or false


Copyright © VeriSign Inc. All Rights Reserved.