Oracle Fusion Middleware extensions for Logging and Diagnostics
11g Release 1 (11.1.2)

E22565-02

oracle.apps.fnd.appltest.diagfwk.engine
Class DiagUtil

java.lang.Object
  extended by oracle.apps.fnd.appltest.diagfwk.engine.DiagUtil
All Implemented Interfaces:
DiagConstants

public abstract class DiagUtil
extends java.lang.Object
implements DiagConstants

Some common utility APIs for the diagnostics engine

Since:
release specific (what release of product did this appear in)
Version:
$Header: atgpf/appltest/applications/Diagnostics/Engine/src/oracle/apps/fnd/appltest/diagfwk/engine/DiagUtil.java /main/19 2010/03/24 12:19:59 lwong Exp $
Author:
ppradhan

Nested Class Summary
 
Nested classes/interfaces inherited from interface oracle.apps.fnd.appltest.diagfwk.common.DiagConstants
DiagConstants.ExecutionMode, DiagConstants.Format, DiagConstants.LinkType, DiagConstants.Status
 
Field Summary
 
Fields inherited from interface oracle.apps.fnd.appltest.diagfwk.common.DiagConstants
APPS_MSG_ID_TAG_NAME, CFG_ADR_PROVIDER_CLASS, CFG_CACHE_PROVIDER_CLASS, CFG_CRED_PROVIDER_CLASS, CFG_DAO_FACTORY_CLASS, CFG_DB_CONN_INFO_PROVIDER_CLASS, CFG_DB_CONN_PROVIDER_CLASS, CFG_NLS_PROVIDER_CLASS, CFG_PLSQL_PROVIDER_CLASS, CFG_PROFILE_PROVIDER_CLASS, CFG_SECURITY_PROVIDER_CLASS, CFG_SESSION_INFO_PROVIDER_CLASS, CFG_URL_PROVIDER_FACTORY_CLASS, CFG_WLS_MBEANSRV_CONNINFO_PROVIDER_CLASS, DATA_SECURITY_PERMISSION_ALLOWED, DATA_SECURITY_PERMISSION_NOT_ALLOWED, DELIM_URL, EXEC_MODE_CLI, EXEC_MODE_ESS, EXEC_MODE_INCIDENT, EXEC_MODE_JAVA, EXEC_MODE_UI, EXECUTABLE_TYPE_JAVA, EXECUTABLE_TYPE_PLSQL, EXECUTABLE_TYPE_TESTREF, FORMAT_HTML, FORMAT_XML, GUID_ORACLE_MINUS1, GUID_ORACLE_ZERO, INPUTS_STATUS_ALL_OPT_INPUTS, INPUTS_STATUS_NO_INPUTS, INPUTS_STATUS_REQ_INPUTS_NO_DEFAULTS, INPUTS_STATUS_REQ_INPUTS_W_DEFAULTS, IO_FLAG_I, IO_FLAG_O, JMX_API_BASE_OBJECT_NAME, LINK_EXTERNAL, LINK_INTERNAL, LINK_METALINK, N, NLS_BUNDLE_JAVA_RES, NLS_BUNDLE_MSG_SVC, NLS_BUNDLE_RES_REF, NLS_BUNDLE_XLIFF, NO, NULL, ODF_MBEAN_DOMAIN_NAME, PARAM_MON_INTERVAL, PLSQL_DEBUG_ENABLED_SYSTEM_PROP, PREREQ_TYPE_TAG_VALUE, PREREQ_TYPE_TEST, SECONDS_IN_ONE_DAY, SECONDS_IN_ONE_HOUR, STATUS_CANCELED, STATUS_EXECERROR, STATUS_FAILURE, STATUS_RUNNING, STATUS_SUCCESS, STATUS_WARNING, SYS_PROP_MAX_MONITOR_INTERNVAL, SYS_PROP_MAX_NUM_THREADS, SYSPROP_APPCONNFILE, SYSPROP_DIAG_CONFIG_FILE, TAG_TYPE_DIAG, TAG_TYPE_TAXONOMY, TEST_TYPE_DECL, TEST_TYPE_JAVA, USER_NAME, WEB_APP_NAME_TAG_NAME, Y, YES
 
Constructor Summary
DiagUtil()
           
 
Method Summary
static void addNew(java.util.List<java.lang.String> pTarget, java.util.List<java.lang.String> pSource)
          Adds the element of the source list to the target list if those elements don't already exist in the target list.
static void addNewAtIndex(java.util.List<java.lang.String> pTarget, java.util.List<java.lang.String> pSource, int pTargetIndex)
          Adds the element of the source list to the target list if those elements don't already exist in the target list.
static void checkExactlyOneReqParam(java.lang.String[] pReqParamNames, NameValueList pAllParams)
          Validates that exactly one of the given required parameters have been specified.
static java.lang.String computeInputsStatus(TestParamList pInputParams, java.util.Map<java.lang.String,java.lang.Object> pInputValues)
          Computes the inputs status for the given list of input parameters based on the metadata about the parameters along any values provided for those parameters.
static java.lang.String computeTimeDiff(java.util.Date pStart, java.util.Date pEnd)
          Computes the difference between the given start date and end date in HH:MM:SS format.
static java.lang.String computeTimeDiff(java.util.Date pStart, java.util.Date pEnd, boolean pUseSystemDateIfEndDateNull)
          Computes the difference between the given start date and end date in HH:MM:SS format.
static java.lang.String convertBooleanToYNFlag(boolean pFlag)
          If the given boolean flag is true, returns "Y".
static java.lang.RuntimeException convertToSerializableException(java.lang.Throwable e)
          Utility to convert a non serializable exception to something that the mx bean framework can serialize.
static boolean convertYNFlag(java.lang.String pYNFlag)
          Returns true if the given flag is "Y" or "YES" (ignoring case).
static java.lang.Object getAttributeValue(java.lang.Object pSource, java.lang.String pAttrName)
          Introspects the given object to retrieve the value of the given attribute.
static int indexOf(java.util.List<java.lang.String> pList, java.lang.String pVal)
          Gets the first index of the given value in the list of values.
static boolean isDone(java.lang.String pStatusCode)
          Returns true if the status code is not running Otherwise returns false.
static boolean isFileOfType(java.lang.String pFilePath, java.lang.String pType)
          Checks to see if the given file name is for ".java" file
static boolean isJava(java.lang.String pFilePath)
          Checks to see if the given file name is for ".java" file
static boolean isRunning(java.lang.String pStatusCode)
          Returns true if the given status code is the "running" status.
static boolean isValidYNFlag(java.lang.String pYNFlag)
          Checks the value of the given flag to see if it equals "Y","N", "YES",or "NO" (ignores case).
static boolean isXML(java.lang.String pFilePath)
          Checks to see if the given file name is for ".xml" file
static java.util.Date querySysDate()
          Queries the current system date
static java.util.List<java.lang.String> shallowCopy(java.util.List<java.lang.String> pOrgList)
          Makes a shallow copy of the given list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiagUtil

public DiagUtil()
Method Detail

isJava

public static boolean isJava(java.lang.String pFilePath)
Checks to see if the given file name is for ".java" file


isXML

public static boolean isXML(java.lang.String pFilePath)
Checks to see if the given file name is for ".xml" file


isFileOfType

public static boolean isFileOfType(java.lang.String pFilePath,
                                   java.lang.String pType)
Checks to see if the given file name is for ".java" file


convertYNFlag

public static boolean convertYNFlag(java.lang.String pYNFlag)
Returns true if the given flag is "Y" or "YES" (ignoring case). Otherwise returns false.

Parameters:
pYNFlag - Y/N flag
Returns:
a boolean corresponding to the Y/N flag

convertBooleanToYNFlag

public static java.lang.String convertBooleanToYNFlag(boolean pFlag)
If the given boolean flag is true, returns "Y". Otherwise returns "N".

Parameters:
pFlag - boolean flag to convert
Returns:
returns "Y" if flag is true, otherwise returns "N"

isValidYNFlag

public static boolean isValidYNFlag(java.lang.String pYNFlag)
Checks the value of the given flag to see if it equals "Y","N", "YES",or "NO" (ignores case). If yes, returns true. Otherwise returns false.

Parameters:
pYNFlag - flag to check if it is a valid yes/no value
Returns:
true if the flag is a valid yes/no value. false otherwise.

indexOf

public static int indexOf(java.util.List<java.lang.String> pList,
                          java.lang.String pVal)
Gets the first index of the given value in the list of values. Returns -1 if such a value is not found int the list.


addNew

public static void addNew(java.util.List<java.lang.String> pTarget,
                          java.util.List<java.lang.String> pSource)
Adds the element of the source list to the target list if those elements don't already exist in the target list.

Parameters:
pTarget - list where the new elements are to be added
pSource - list to be added.

shallowCopy

public static java.util.List<java.lang.String> shallowCopy(java.util.List<java.lang.String> pOrgList)
Makes a shallow copy of the given list


addNewAtIndex

public static void addNewAtIndex(java.util.List<java.lang.String> pTarget,
                                 java.util.List<java.lang.String> pSource,
                                 int pTargetIndex)
Adds the element of the source list to the target list if those elements don't already exist in the target list. If the element already exists but after the target index, it is moved to the target index.

Parameters:
pTarget - list where the new elements are to be added
pSource - list to be added.
pTargetIndex - index at which the source list should be added in the target list.

checkExactlyOneReqParam

public static void checkExactlyOneReqParam(java.lang.String[] pReqParamNames,
                                           NameValueList pAllParams)
Validates that exactly one of the given required parameters have been specified.

Parameters:
pReqParamNames - - an Array of names of required parameters of which exactly one must be specified.
pAllParams - - All available parameter name values

getAttributeValue

public static java.lang.Object getAttributeValue(java.lang.Object pSource,
                                                 java.lang.String pAttrName)
Introspects the given object to retrieve the value of the given attribute.

Parameters:
pSource - the source object. This is either a Java Bean or an instance of java.util.Map
pAttrName - name of the attribute to lookup.
Returns:
the value of the attribute if found. Otherwise returns null.

computeInputsStatus

public static java.lang.String computeInputsStatus(TestParamList pInputParams,
                                                   java.util.Map<java.lang.String,java.lang.Object> pInputValues)
Computes the inputs status for the given list of input parameters based on the metadata about the parameters along any values provided for those parameters.

Parameters:
pInputParams - List of TestParam instances that generally represents the metadata for input parameters for a test.
pInputValues - any values available for each of the input parameters (keyed by the parameter name). If no parameter values are available, this can be null.
Returns:
One of the following status codes based on whether or not a value exists for required parameters in the given list:

computeTimeDiff

public static java.lang.String computeTimeDiff(java.util.Date pStart,
                                               java.util.Date pEnd,
                                               boolean pUseSystemDateIfEndDateNull)
Computes the difference between the given start date and end date in HH:MM:SS format. Returns null if the start date is null. If pUseSystemDateIfEndDateNull is true and the end date is null, uses the current system date as the end date.

Parameters:
pStart - start date/time
pEnd - end date/time
pUseSystemDateIfEndDateNull - if true, uses the system date for end date if end date is null.
Returns:
difference between the given start date and end date in HH:MM:SS format.

computeTimeDiff

public static java.lang.String computeTimeDiff(java.util.Date pStart,
                                               java.util.Date pEnd)
Computes the difference between the given start date and end date in HH:MM:SS format. Returns null if the start date is null or if the end date is null.

Parameters:
pStart - start date/time
pEnd - end date/time
Returns:
difference between the given start date and end date in HH:MM:SS format.

querySysDate

public static java.util.Date querySysDate()
Queries the current system date


isRunning

public static boolean isRunning(java.lang.String pStatusCode)
Returns true if the given status code is the "running" status. Returns false otherwise


isDone

public static boolean isDone(java.lang.String pStatusCode)
Returns true if the status code is not running Otherwise returns false.

Parameters:
pStatusCode - status code to check
Returns:
true if the status code is not running. Otherwise returns false.

convertToSerializableException

public static java.lang.RuntimeException convertToSerializableException(java.lang.Throwable e)
Utility to convert a non serializable exception to something that the mx bean framework can serialize.

Parameters:
e - Exception to convert
Returns:
a RuntimeException with message and stack trace copied over from parameter e. Underlying cause chain is also converted.

Oracle Fusion Middleware extensions for Logging and Diagnostics
11g Release 1 (11.1.2)

E22565-02

Copyright © 2011 Oracle. All Rights Reserved.