atg.junit.nucleus
Class TestUtils

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.junit.nucleus.TestUtils
All Implemented Interfaces:
atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.logging.ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, atg.nucleus.naming.ComponentNameResolver, atg.nucleus.Service, atg.nucleus.ServiceListener, java.util.EventListener

public class TestUtils
extends atg.nucleus.GenericService

This class is used to hold useful utilty methods people may need when running tests.


Field Summary
static java.lang.String APP_SERVER_BEA
           
static java.lang.String APP_SERVER_DAS
           
static java.lang.String APP_SERVER_IBM
           
static java.lang.String APP_SERVER_TOMCAT
           
static java.lang.String[] APPLICATION_PRODUCT_MODULES
          possible application product modules that may be installed
static java.lang.String ATGDYNAMO_PRODUCT_MODULE
          product module corresponding to ATG Dynamo
static java.lang.String ATGJ2EESERVER_PRODUCT_MODULE
          product module corresponding to ATG's J2EE Server
static java.lang.String DUST_USERNAME
          property to track the DUST user.
static int DUST_VERSION
          property to track the DUST version being used.
static java.io.File DYNAMO_INSTALL_DIR
          Returns the directory in which Dynamo was installed.
static java.lang.String P4SYNCTIME
          property to track the p4 sync time for tests.
static java.lang.String TSM_TESTRUN
          property to track which testrun a result is part of.
static java.lang.String UNKNOWN_INFO
           
static java.lang.String VENDOR_ATG
           
static java.lang.String VENDOR_BEA
           
static java.lang.String VENDOR_IBM
           
static java.lang.String VENDOR_JBOSS
           
 
Fields inherited from class atg.nucleus.GenericService
CLASS_VERSION, SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
TestUtils()
           
 
Method Summary
static java.lang.String accessURL(java.lang.String pUrl)
          this method returns the contents of the page specified as the URL.
static java.lang.String accessURL(java.lang.String pUrl, boolean pThrow)
          this method returns the contents of the page specified as the URL.
static java.lang.String[] convertFileArray(java.lang.String pFiles, java.lang.String pDelimiter)
          converts a delimiter separated String of file names into an array and expands all System property variables in the Strings.
static java.lang.String[] convertFileArray(java.lang.String pFiles, java.lang.String pDelimiter, java.util.Properties pPrimaryMapping)
          converts a delimiter separated String of file names into an array and expands all variables in the Strings.
static java.lang.String expand(java.lang.String pString)
          expands all System property variables specified in the supplied String using curly braces syntax {...} and returns the resulting String.
static java.lang.String expand(java.lang.String pString, java.util.Properties pPrimaryMapping)
          expands all property variables specified in the supplied String using curly braces syntax {...} and returns the resulting String.
static atg.applauncher.AppModule[] getApplicationModules()
          returns an array of AppModule items corresponding to the currently running application products.
 java.lang.String[] getApplicationProductModules()
          returns the names of possible application product modules that may be installed in Dyanmo.
static java.lang.String getAppServerBuildNumber()
          Returns the build number of the app server being used.
static java.lang.String getAppServerPatchBuildNumber()
          Returns the patch build number of the app server being used.
static java.lang.String getAppServerPatchVersion()
          Returns the patch version of the app server being used.
static java.lang.String getAppServerProductInfo()
          Returns a summary of information about the App Server product being used.
static java.lang.String getAppServerProductName()
          Returns the product name of the app server being used.
static java.lang.String getAppServerType()
          returns the name of the app server that dynamo is using
static java.lang.String getAppServerVendor()
          Returns the vendor name of the App server manufacturer.
static java.lang.String getAppServerVersion()
          Returns the version number of the app server being used.
static java.lang.String getAtgBuildNumber(atg.applauncher.AppModule pModule)
          Returns the ATG product build number ("ATG-Build") of the specified module.
static atg.applauncher.AppModule getAtgDynamoModule()
          returns an AppModule corresponding to the ATG Dynamo if that product is loaded.
static java.lang.String getAtgDynamoProductModule()
          returns the name of the ATG Dynamo product module that will be loaded if Dynamo is being used.
static java.lang.String getAtgFullVersion(atg.applauncher.AppModule pModule)
          Returns the ATG full product version ("ATG-Version-Full") of the specified module.
static java.io.File getAtgJ2eeServerInstallDir()
          returns the root install directory for the ATG J2EE Server, or null if the ATG J2EE Server is not installed.
static atg.applauncher.AppModule getAtgJ2eeServerModule()
          returns an AppModule corresponding to the ATG J2EE Server if that product is loaded.
static java.lang.String getAtgJ2eeServerProductModule()
          returns the name of the ATG J2EE Server product module that will be loaded if ATG's J2EE Server is being used.
static java.lang.String getAtgJ2eeServerProductName()
          Returns the name of the ATG J2EE Server product this is installed, or null if a separate ATG J2EE Server build is not installed.
static java.lang.String getAtgPatchBuildNumber(atg.applauncher.AppModule pModule)
          Returns the ATG patch build number ("ATG-Patch-Build") of the specified module.
static java.lang.String getAtgPatchVersion(atg.applauncher.AppModule pModule)
          Returns the ATG patch version ("ATG-Patch-Version") of the specified module.
static java.lang.String getAtgVersion(atg.applauncher.AppModule pModule)
          Returns the ATG product version ("ATG-Version") of the specified module.
static java.lang.String getBeaHomeDir()
          returns the BEA home directory if running on BEA.
static java.lang.String getBeaMyServerLogFile()
          returns the expected location of the BEA 'myserver.log' file if running on BEA.
static java.lang.String getBeaVersion()
          returns the BEA version number.
static java.lang.String getCompilerType()
          returns the type of compiler that Dynamo is using
 java.lang.String getDustUsername()
          returns the DUST user name.
 int getDustVersion()
          returns the DUST version being used.
static atg.service.dynamo.Configuration getDynamoConfiguration()
          returns the Configuration component being used by Dynamo
static java.io.File getDynamoHomeDir()
          Returns Dynamo's "home" module installation directory.
 java.io.File getDynamoInstallDir()
          Returns the directory in which Dynamo was installed.
static java.lang.String getDynamoProductInfo()
          Returns information about the ATG Dynamo product being used.
static java.lang.String getDynamoProductName()
          This method returns the name of the Dynamo product that is installed.
static java.io.File getDynamoRootDir()
          Returns the root directory for this Dynamo.
static java.lang.String getHostname()
          returns the hostname of the machine that Dynamo is running on
static java.lang.String getJavaBuildVersion()
          returns the java build version (java.version) that Dynamo is using
static java.lang.String getJavaInfo()
          returns info about the java build that Dynamo is using
static java.lang.String getJavaVersion()
          returns the java version that Dynamo is using
static java.lang.String getJavaVersionDetails()
          returns detailed version information about the jdk being used
static java.io.File getJBossHomeDir()
          Returns the JBOSS installation home directory, if Dynamo is running on JBOSS.
static java.io.File getJBossServerHomeDir()
          Returns the JBOSS server home directory, if Dynamo is running on JBOSS.
static java.lang.String getJBossServerLog()
          Returns the path to the JBOSS server log file, if it can be found.
static java.lang.String getJBossServerName()
          Returns the JBOSS server name, if Dynamo is running on JBOSS.
static java.lang.String getJBossVersion()
          Returns the version of JBOSS being used, if it can be determined.
static java.lang.String getManifestInfo(atg.applauncher.AppModule pModule, java.lang.String pEntry)
          Retrieves a piece of information from the MANIFEST of the supplied AppModule.
static java.lang.String getManifestInfo(java.util.jar.Manifest pManifest, java.lang.String pEntry)
          Retrieves a piece of information from the specified Manifest file.
static java.io.File getModuleResourceFile(java.lang.String pModuleName, java.lang.String pResourceURI)
          Retrieves a File resource from a Dynamo Module.
static java.lang.String getOperatingSystemType()
          returns the type of Operating System that Dynamo is running on
static int getSessionLimit(java.lang.String pLicense, boolean pResolve)
          returns the session limit of the specified license component
static java.lang.String getStackTrace(java.lang.Throwable pException)
          this method returns a String representation of an Exception's stacktrace
 java.lang.String getTsmTestrun()
          Returns the TSM testrun this result is part of.
static java.lang.String getWasHomeDir()
          returns the WAS home directory if running on WAS.
static java.lang.String getWasSystemErrLogFile()
          returns the expected location of the WAS 'SystemErr.log' file if running on WAS.
static java.lang.String getWasSystemOutLogFile()
          returns the expected location of the WAS 'SystemOut.log' file if running on WAS.
static java.lang.String getWasVersion()
          returns the WAS version number.
static java.lang.Object invokeMethod(java.lang.Object pObj, java.lang.String pMethodName, java.lang.Class<?>[] pSignature, java.lang.Object[] pParams, java.lang.Object pDefault)
           
static boolean isBigEar()
          Returns true if Dynamo is running as BigEar; otherwise returns false.
static boolean isBigEarStandalone()
          Returns true if Dynamo is running as BigEar in standalone mode; otherwise returns false.
static boolean isDynamoInstalled()
          Returns true if the Dynamo product is being used; false if only the ATG J2EE Server product is running.
static boolean isGenericAppServer()
          Returns true if Dynamo is running on a 'generic' (aka Tomcat) j2ee appserver; false otherwise.
static boolean isLiveconfig()
          Returns true is Dynamo is running with liveconfig enabled; otherwise returns false.
static void log(java.lang.String pMessage)
          Logs a message using Nucleus.logInfo() if Nucleus is available.
static java.io.File resolveAppModuleResourceReference(java.lang.String pReference)
          Resolves an appModuleResource reference by parsing the string into its constituent ModuleID and ResourceURI.
static boolean sendEmail(java.lang.String pAddress, java.lang.String pMsg, java.lang.String pSubject)
          This method is used to send an email message; returns true if everything went ok; otherwise, returns false
static void sendEmail(java.lang.String pAddress, java.lang.String pMsg, java.lang.String pSubject, java.util.Map<java.lang.String,java.lang.Object> pTextAttachments, java.util.Map<java.lang.String,java.lang.Object> pHTMLAttachments)
          This method is used to send an email message that contains several attachments.
static void sendEmail(java.lang.String pAddress, java.lang.String pMsg, java.lang.String pSubject, java.util.Map<java.lang.String,java.lang.Object> pTextAttachments, java.util.Map<java.lang.String,java.lang.Object> pHTMLAttachments, java.io.File[] pFiles, java.lang.String pBodyEncoding)
          This method is used to send an email message that contains several attachments.
static void sendEmail(java.lang.String pAddress, java.lang.String pMsg, java.lang.String pSubject, java.util.Map<java.lang.String,java.lang.Object> pTextAttachments, java.util.Map<java.lang.String,java.lang.Object> pHTMLAttachments, java.lang.String pBodyEncoding)
          This method is used to send an email message that contains several attachments.
static boolean sendEmail(java.lang.String pAddress, java.lang.String pMsg, java.lang.String pSubject, java.lang.String pBodyEncoding)
          This method is used to send an email message; returns true if everything went ok; otherwise, returns false
static void sendEmails(java.util.List<java.lang.String> pAddresses, java.lang.String pMsg, java.lang.String pSubject)
          This method is used to send the same email message to a vector of recipients.
static void sendEmails(java.util.List<java.lang.String> pAddresses, java.lang.String pMsg, java.lang.String pSubject, java.util.Map<java.lang.String,java.lang.Object> pTextAttachments, java.util.Map<java.lang.String,java.lang.Object> pHTMLAttachments)
          This method is used to send an email message that contains several attachments to multiple recipients.
static void sendEmails(java.util.List<java.lang.String> pAddresses, java.lang.String pMsg, java.lang.String pSubject, java.util.Map<java.lang.String,java.lang.Object> pTextAttachments, java.util.Map<java.lang.String,java.lang.Object> pHTMLAttachments, java.io.File[] pFiles, java.lang.String pBodyEncoding)
          This method is used to send an email message that contains several attachments.
static void sendEmails(java.util.List<java.lang.String> pAddresses, java.lang.String pMsg, java.lang.String pSubject, java.util.Map<java.lang.String,java.lang.Object> pTextAttachments, java.util.Map<java.lang.String,java.lang.Object> pHTMLAttachments, java.lang.String pBodyEncoding)
          This method is used to send an email message that contains several attachments to multiple recipients.
static void sendEmails(java.util.List<java.lang.String> pAddresses, java.lang.String pMsg, java.lang.String pSubject, java.lang.String pBodyEncoding)
          This method is used to send the same email message to a vector of recipients
static boolean sendEmailWithReturn(java.lang.String pAddress, java.lang.String pMsg, java.lang.String pSubject, java.lang.String pBodyEncoding, java.lang.String pReturnAddress)
          This method is used to send an email message and allows the user to specify the return address.
 void setApplicationProductModules(java.lang.String[] pModules)
          specifies the names of possible application product modules that may be installed in Dyanmo.
static void setAtgDynamoProductModule(java.lang.String pModule)
          specifies the name of the ATG Dynamo product module that will be loaded if Dynamo is being used.
static void setAtgJ2eeServerProductModule(java.lang.String pModule)
          specifies the name of the ATG J2EE Server product module that will be loaded if ATG's J2EE Server is being used.
static void setBeaMyServerLogFile(java.lang.String pFile)
          Specifies the log file to return when asked for the BEA 'myserver.log' file.
 void setDustUsername(java.lang.String pUsername)
          specifies the DUST user.
 void setDustVersion(int pVersion)
          specifies the DUST version being used.
 void setDynamoInstallDir(java.io.File pDir)
          Specifies the directory in which Dynamo was installed.
 java.lang.String setP4Synctime()
          property to track the p4 sync time for tests.
 void setP4Synctime(java.lang.String pTime)
          property to track the p4 sync time for tests.
 void setTsmTestrun(java.lang.String pId)
          Specifies the TSM testrun this result is part of.
 void setWasSystemErrLogFile(java.lang.String pFile)
          Specifies the log file to return when asked for the WAS 'SystemErr.log' file.
 void setWasSystemOutLogFile(java.lang.String pFile)
          Specifies the log file to return when asked for the WAS 'SystemOut.log' file.
static void writeFileBytes(java.io.File pFile, byte[] pBytes)
          Writes the byte array into the specified file.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APP_SERVER_DAS

public static final java.lang.String APP_SERVER_DAS
See Also:
Constant Field Values

APP_SERVER_BEA

public static final java.lang.String APP_SERVER_BEA
See Also:
Constant Field Values

APP_SERVER_IBM

public static final java.lang.String APP_SERVER_IBM
See Also:
Constant Field Values

APP_SERVER_TOMCAT

public static final java.lang.String APP_SERVER_TOMCAT
See Also:
Constant Field Values

VENDOR_ATG

public static final java.lang.String VENDOR_ATG
See Also:
Constant Field Values

VENDOR_BEA

public static final java.lang.String VENDOR_BEA
See Also:
Constant Field Values

VENDOR_IBM

public static final java.lang.String VENDOR_IBM
See Also:
Constant Field Values

VENDOR_JBOSS

public static final java.lang.String VENDOR_JBOSS
See Also:
Constant Field Values

UNKNOWN_INFO

public static final java.lang.String UNKNOWN_INFO
See Also:
Constant Field Values

DUST_VERSION

public static int DUST_VERSION
property to track the DUST version being used. utilized by ATGXMLFileTestResultReported so we can tag XML result files for compatibility validation when passed to the XML file logger


DUST_USERNAME

public static java.lang.String DUST_USERNAME
property to track the DUST user. utilized when results are logged to the database to correlate the result with a user account in the test management system.


TSM_TESTRUN

public static java.lang.String TSM_TESTRUN
property to track which testrun a result is part of. utilized by TSM to correlate a specifid result with the testrun used to install and configure the test Dynamo.


P4SYNCTIME

public static java.lang.String P4SYNCTIME
property to track the p4 sync time for tests. utilized by TSM to inform end-users of time at which machine was last synced. must be specified by test setup before test is run.


DYNAMO_INSTALL_DIR

public static java.io.File DYNAMO_INSTALL_DIR
Returns the directory in which Dynamo was installed. If the installation directory was not specified during the DUST installation, returns null. Should only be used by System tests.


ATGDYNAMO_PRODUCT_MODULE

public static java.lang.String ATGDYNAMO_PRODUCT_MODULE
product module corresponding to ATG Dynamo


ATGJ2EESERVER_PRODUCT_MODULE

public static java.lang.String ATGJ2EESERVER_PRODUCT_MODULE
product module corresponding to ATG's J2EE Server


APPLICATION_PRODUCT_MODULES

public static java.lang.String[] APPLICATION_PRODUCT_MODULES
possible application product modules that may be installed

Constructor Detail

TestUtils

public TestUtils()
Method Detail

setDustVersion

public void setDustVersion(int pVersion)
specifies the DUST version being used. utilized by ATGXMLFileTestResultReporter so XML result files can be tagged for compatibility validation when passed to the XML file logger


getDustVersion

public int getDustVersion()
returns the DUST version being used. utilized by ATGXMLFileTestResultReporter so XML result files can be tagged for compatibility validation when passed to the XML file logger


setDustUsername

public void setDustUsername(java.lang.String pUsername)
specifies the DUST user. utilized when results are logged to the database to correlate the result with a user account in the test management system.


getDustUsername

public java.lang.String getDustUsername()
returns the DUST user name. utilized when results are logged to the database to correlate the result with a user account in the test management system.


setTsmTestrun

public void setTsmTestrun(java.lang.String pId)
Specifies the TSM testrun this result is part of. utilized by TSM to correlate a specifid result with the testrun used to install and configure the test Dynamo.


getTsmTestrun

public java.lang.String getTsmTestrun()
Returns the TSM testrun this result is part of. utilized by TSM to correlate a specifid result with the testrun used to install and configure the test Dynamo.


setP4Synctime

public void setP4Synctime(java.lang.String pTime)
property to track the p4 sync time for tests. utilized by TSM to inform end-users of time at which machine was last synced. must be specified by test setup before test is run.


setP4Synctime

public java.lang.String setP4Synctime()
property to track the p4 sync time for tests. utilized by TSM to inform end-users of time at which machine was last synced. must be specified by test setup before test is run.


getDynamoInstallDir

public java.io.File getDynamoInstallDir()
Returns the directory in which Dynamo was installed. If the installation directory can not be successfully determined returns null.
NOTE: There is no reliable System property (or other inherent mechanism) to determine the Dynamo installation directory when running as BigEar, so this value is set during the DUST build process. The SystemTests.base build step writes the file SystemTests/base/config/atg/junit/nucleus/TestUtils.properties with the proper value. Consequently, this method should only be used by System tests, not Unit tests.


setDynamoInstallDir

public void setDynamoInstallDir(java.io.File pDir)
Specifies the directory in which Dynamo was installed.


getDynamoRootDir

public static java.io.File getDynamoRootDir()
Returns the root directory for this Dynamo. If the root directory can not be successfully located returns null. Operates according to this logic:


getDynamoHomeDir

public static java.io.File getDynamoHomeDir()
Returns Dynamo's "home" module installation directory. If the directory can not be successfully located returns null.
Logic works like this:


getAtgJ2eeServerInstallDir

public static java.io.File getAtgJ2eeServerInstallDir()
returns the root install directory for the ATG J2EE Server, or null if the ATG J2EE Server is not installed.


getAppServerProductName

public static java.lang.String getAppServerProductName()
Returns the product name of the app server being used. For ATG we currently assume it's called 'ATGDAS' if it's a separate product, since there is no definitive way to figure out the product name from MANIFEST files. For all other app servers it returns the value of getAppServerType().


getAtgJ2eeServerProductName

public static java.lang.String getAtgJ2eeServerProductName()
Returns the name of the ATG J2EE Server product this is installed, or null if a separate ATG J2EE Server build is not installed.


getAppServerVersion

public static java.lang.String getAppServerVersion()
Returns the version number of the app server being used. For DAS this version comes from the J2EEServer MANIFEST file, or is UNKNOWN_INFO if the MANIFEST can't be found. Such may be the case if a person is using devtools to build their product. For 3PAS the version number is extracted from their configuration file (typically some well known XML file).


getAppServerBuildNumber

public static java.lang.String getAppServerBuildNumber()
Returns the build number of the app server being used. For DAS this version comes from the J2EEServer MANIFEST file, or is UNKNOWN_INFO if the MANIFEST can't be found. Such may be the case if a person is using devtools to build their product. For 3PAS the build number is always UNKNOWN_INFO.


getAppServerPatchVersion

public static java.lang.String getAppServerPatchVersion()
Returns the patch version of the app server being used. For DAS this version comes from the J2EEServer MANIFEST file, or is UNKNOWN_INFO if the MANIFEST can't be found. Such may be the case if a person is using devtools to build their product. For 3PAS the patch version is always UNKNOWN_INFO.


getAppServerPatchBuildNumber

public static java.lang.String getAppServerPatchBuildNumber()
Returns the patch build number of the app server being used. For DAS this version comes from the J2EEServer MANIFEST file, or is UNKNOWN_INFO if the MANIFEST can't be found. Such may be the case if a person is using devtools to build their product. For 3PAS the patch build number is always UNKNOWN_INFO.


getAppServerVendor

public static java.lang.String getAppServerVendor()
Returns the vendor name of the App server manufacturer. if a vendor can not be determined it returns UNKNOWN_INFO.


isDynamoInstalled

public static boolean isDynamoInstalled()
Returns true if the Dynamo product is being used; false if only the ATG J2EE Server product is running.


getDynamoProductName

public static java.lang.String getDynamoProductName()
This method returns the name of the Dynamo product that is installed. Because there is no guaranteed way to determine the installed product this method makes a best-guess. If the version is less than 5.5 then the method skips down from DCS, to DPS, etc. until it finds a product that exists. If the version 5.5, 5.6, or 5.6.1 then this method just returns 'AppDAP' since that is the only Dynamo product we have for those versions. Likewise, if the version is NOT anything between 4 and 5.6, then we return 'ATG' since that is the only version we have for copper, etc. If the method can't determine a version it returns UNKNOWN_INFO


getDynamoProductInfo

public static java.lang.String getDynamoProductInfo()
Returns information about the ATG Dynamo product being used. does not include information about the app server that may be in use. returns null if Dynamo is not running.


getAppServerProductInfo

public static java.lang.String getAppServerProductInfo()
Returns a summary of information about the App Server product being used.


getJavaVersion

public static java.lang.String getJavaVersion()
returns the java version that Dynamo is using

Returns:
String version of java Dynamo is using

getJavaBuildVersion

public static java.lang.String getJavaBuildVersion()
returns the java build version (java.version) that Dynamo is using

Returns:
String build version of java Dynamo is using

getJavaVersionDetails

public static java.lang.String getJavaVersionDetails()
returns detailed version information about the jdk being used


getJavaInfo

public static java.lang.String getJavaInfo()
returns info about the java build that Dynamo is using

Returns:
String info about java build Dynamo is using

getCompilerType

public static java.lang.String getCompilerType()
returns the type of compiler that Dynamo is using

Returns:
String compiler Dynamo is using

getOperatingSystemType

public static java.lang.String getOperatingSystemType()
returns the type of Operating System that Dynamo is running on


getHostname

public static java.lang.String getHostname()
returns the hostname of the machine that Dynamo is running on


getAppServerType

public static java.lang.String getAppServerType()
returns the name of the app server that dynamo is using


isGenericAppServer

public static boolean isGenericAppServer()
Returns true if Dynamo is running on a 'generic' (aka Tomcat) j2ee appserver; false otherwise. ServletUtil.isGenericJ2EEServer() method call does not exist in early Dynamo versions, so use reflection to invoke it. As of ATG 7x, isGenericJ2EEServer() really means "are we running on JBOSS" - I'm not sure whether we intend to differentiate between JBOSS and other 'generic' Tomcat app servers.


getWasHomeDir

public static java.lang.String getWasHomeDir()
returns the WAS home directory if running on WAS. otherwise, returns null


getWasVersion

public static java.lang.String getWasVersion()
returns the WAS version number. if not running against WAS, or if the {WAS.install.root}/properties/version/BASE.product file can not be found, or if an error occurs parsing the file then returns UNKNOWN_INFO.


setWasSystemOutLogFile

public void setWasSystemOutLogFile(java.lang.String pFile)
Specifies the log file to return when asked for the WAS 'SystemOut.log' file. if this value is null we attempt to calculate a default location


getWasSystemOutLogFile

public static java.lang.String getWasSystemOutLogFile()
returns the expected location of the WAS 'SystemOut.log' file if running on WAS. otherwise returns null.


setWasSystemErrLogFile

public void setWasSystemErrLogFile(java.lang.String pFile)
Specifies the log file to return when asked for the WAS 'SystemErr.log' file. if this value is null we attempt to calculate a default location


getWasSystemErrLogFile

public static java.lang.String getWasSystemErrLogFile()
returns the expected location of the WAS 'SystemErr.log' file if running on WAS. otherwise returns null.


getBeaHomeDir

public static java.lang.String getBeaHomeDir()
returns the BEA home directory if running on BEA. otherwise, returns null


setBeaMyServerLogFile

public static void setBeaMyServerLogFile(java.lang.String pFile)
Specifies the log file to return when asked for the BEA 'myserver.log' file. if this value is null then a default value will be calculated.


getBeaMyServerLogFile

public static java.lang.String getBeaMyServerLogFile()
returns the expected location of the BEA 'myserver.log' file if running on BEA. otherwise returns null.


getBeaVersion

public static java.lang.String getBeaVersion()
returns the BEA version number. if not running against BEA, or if the {BEA_HOME}/registry.xml file can not be found, or if an error occurs parsing the file then returns UNKNOWN_INFO.


getJBossHomeDir

public static java.io.File getJBossHomeDir()
Returns the JBOSS installation home directory, if Dynamo is running on JBOSS. Otherwise returns null.


getJBossServerHomeDir

public static java.io.File getJBossServerHomeDir()
Returns the JBOSS server home directory, if Dynamo is running on JBOSS. Otherwise returns null.


getJBossServerName

public static java.lang.String getJBossServerName()
Returns the JBOSS server name, if Dynamo is running on JBOSS. Otherwise returns null.


getJBossServerLog

public static java.lang.String getJBossServerLog()
Returns the path to the JBOSS server log file, if it can be found. Otherwise returns null


getJBossVersion

public static java.lang.String getJBossVersion()
Returns the version of JBOSS being used, if it can be determined. Otherwise returns UNKNOWN_INFO. This method expects to find a 'jar-versions.xml' file in the JBoss home directory. It searches for the <jar> element whose 'name' attribute is "jboss.jar", and determines the version based on the value of the 'implVersion' attribute.


getDynamoConfiguration

public static atg.service.dynamo.Configuration getDynamoConfiguration()
returns the Configuration component being used by Dynamo


getSessionLimit

public static int getSessionLimit(java.lang.String pLicense,
                                  boolean pResolve)
returns the session limit of the specified license component

Parameters:
String - the component name of the license in question
boolean - true if Nucleus should attempt to create the license component if it does not exist
Returns:
int the session limit for the license. 0 if the license does not resolve.

sendEmailWithReturn

public static boolean sendEmailWithReturn(java.lang.String pAddress,
                                          java.lang.String pMsg,
                                          java.lang.String pSubject,
                                          java.lang.String pBodyEncoding,
                                          java.lang.String pReturnAddress)
This method is used to send an email message and allows the user to specify the return address.

Returns:
boolean true if the mail was sent successfully; otherwise false.

sendEmail

public static boolean sendEmail(java.lang.String pAddress,
                                java.lang.String pMsg,
                                java.lang.String pSubject,
                                java.lang.String pBodyEncoding)
This method is used to send an email message; returns true if everything went ok; otherwise, returns false


sendEmail

public static boolean sendEmail(java.lang.String pAddress,
                                java.lang.String pMsg,
                                java.lang.String pSubject)
This method is used to send an email message; returns true if everything went ok; otherwise, returns false


sendEmails

public static void sendEmails(java.util.List<java.lang.String> pAddresses,
                              java.lang.String pMsg,
                              java.lang.String pSubject,
                              java.lang.String pBodyEncoding)
This method is used to send the same email message to a vector of recipients


sendEmails

public static void sendEmails(java.util.List<java.lang.String> pAddresses,
                              java.lang.String pMsg,
                              java.lang.String pSubject)
This method is used to send the same email message to a vector of recipients. It encodes the message body as "text/plain".


sendEmail

public static void sendEmail(java.lang.String pAddress,
                             java.lang.String pMsg,
                             java.lang.String pSubject,
                             java.util.Map<java.lang.String,java.lang.Object> pTextAttachments,
                             java.util.Map<java.lang.String,java.lang.Object> pHTMLAttachments,
                             java.io.File[] pFiles,
                             java.lang.String pBodyEncoding)
This method is used to send an email message that contains several attachments. This method is specifically designed to accept a map of java.lang.Strings as content parts instead of java.io.Files. The key in the Map should be a String representing the name that you would like to show for the attached file. The value in the Map should be a String representing the contents of the attachment.


sendEmail

public static void sendEmail(java.lang.String pAddress,
                             java.lang.String pMsg,
                             java.lang.String pSubject,
                             java.util.Map<java.lang.String,java.lang.Object> pTextAttachments,
                             java.util.Map<java.lang.String,java.lang.Object> pHTMLAttachments,
                             java.lang.String pBodyEncoding)
This method is used to send an email message that contains several attachments. This method is specifically designed to accept a map of java.lang.Strings as content parts instead of java.io.Files. The key in the Map should be a String representing the name that you would like to show for the attached file. The value in the Map should be a String representing the contents of the attachment. If you wish to attach java.io.Files, use the static methods found in atg.service.email.MimeMessageUtils.


sendEmail

public static void sendEmail(java.lang.String pAddress,
                             java.lang.String pMsg,
                             java.lang.String pSubject,
                             java.util.Map<java.lang.String,java.lang.Object> pTextAttachments,
                             java.util.Map<java.lang.String,java.lang.Object> pHTMLAttachments)
This method is used to send an email message that contains several attachments. This method is specifically designed to accept a map of java.lang.Strings as content parts instead of java.io.Files. The key in the Map should be a String representing the name that you would like to show for the attached file. The value in the Map should be a String representing the contents of the attachment. If you wish to attach java.io.Files, use the static methods found in atg.service.email.MimeMessageUtils.


sendEmails

public static void sendEmails(java.util.List<java.lang.String> pAddresses,
                              java.lang.String pMsg,
                              java.lang.String pSubject,
                              java.util.Map<java.lang.String,java.lang.Object> pTextAttachments,
                              java.util.Map<java.lang.String,java.lang.Object> pHTMLAttachments,
                              java.io.File[] pFiles,
                              java.lang.String pBodyEncoding)
This method is used to send an email message that contains several attachments. This method is specifically designed to accept a map of java.lang.Strings as content parts instead of java.io.Files. The key in the Map should be a String representing the name that you would like to show for the attached file. The value in the Map should be a String representing the contents of the attachment.


sendEmails

public static void sendEmails(java.util.List<java.lang.String> pAddresses,
                              java.lang.String pMsg,
                              java.lang.String pSubject,
                              java.util.Map<java.lang.String,java.lang.Object> pTextAttachments,
                              java.util.Map<java.lang.String,java.lang.Object> pHTMLAttachments,
                              java.lang.String pBodyEncoding)
This method is used to send an email message that contains several attachments to multiple recipients. This method is specifically designed to accept a map of java.lang.Strings as content parts instead of java.io.Files. The key in the Map should be a String representing the name that you would like to show for the attached file. The value in the Map should be a String representing the contents of the attachment.


sendEmails

public static void sendEmails(java.util.List<java.lang.String> pAddresses,
                              java.lang.String pMsg,
                              java.lang.String pSubject,
                              java.util.Map<java.lang.String,java.lang.Object> pTextAttachments,
                              java.util.Map<java.lang.String,java.lang.Object> pHTMLAttachments)
This method is used to send an email message that contains several attachments to multiple recipients. The message will have it's main body part encoded as "text/plain".
This method is specifically designed to accept a map of java.lang.Strings as content parts instead of java.io.Files. The key in the Map should be a String representing the name that you would like to show for the attached file. The value in the Map should be a String representing the contents of the attachment. If you wish to attach java.io.Files, use the static methods found in atg.service.email.MimeMessageUtils.


getStackTrace

public static java.lang.String getStackTrace(java.lang.Throwable pException)
this method returns a String representation of an Exception's stacktrace


accessURL

public static java.lang.String accessURL(java.lang.String pUrl,
                                         boolean pThrow)
                                  throws java.net.MalformedURLException,
                                         java.io.IOException
this method returns the contents of the page specified as the URL. the URL should be a fully qualified request string. for example, http://rygar.atg.com:8880/some/directory/page.jhtml If the boolean parameter is set to true then this method will throw an Exception if an error occurs; otherwise it will simply return the contents of the exception.

Throws:
java.net.MalformedURLException - if URL is malformed & pThrow is true
java.io.IOException - if error happens while reading and pThrow is true

accessURL

public static java.lang.String accessURL(java.lang.String pUrl)
this method returns the contents of the page specified as the URL. the URL should be a fully qualified request string. for example, http://rygar.atg.com:8880/some/directory/page.jhtml Unlike it's sister method with the boolean parameter, this method will not throw an exception.


writeFileBytes

public static void writeFileBytes(java.io.File pFile,
                                  byte[] pBytes)
                           throws java.io.IOException
Writes the byte array into the specified file.

Parameters:
File - pFile the file to write to
byte[] - the bytes to write
Throws:
java.io.IOException - if an error occurred opening or reading the file.

convertFileArray

public static java.lang.String[] convertFileArray(java.lang.String pFiles,
                                                  java.lang.String pDelimiter)
                                           throws java.lang.Exception
converts a delimiter separated String of file names into an array and expands all System property variables in the Strings. it does not check whether resolved file paths exist.

Parameters:
String - delimited string of files to be converted to array.
String - delimiter string used to separated files
Returns:
String[] array of expanded paths
Throws:
java.lang.Exception - if files can't be resolved properly

convertFileArray

public static java.lang.String[] convertFileArray(java.lang.String pFiles,
                                                  java.lang.String pDelimiter,
                                                  java.util.Properties pPrimaryMapping)
                                           throws java.lang.Exception
converts a delimiter separated String of file names into an array and expands all variables in the Strings. it does not check whether resolved file paths exist.

Parameters:
String - delimited string of files to be converted to array.
String - delimiter string used to separated files
Properties - optional primary mapping of key/value pairs to substitute into file paths whererever the syntax {...} is found. If parameter is null, or mapping not found, then System.getProperties() is checked.
Returns:
String[] array of expanded paths
Throws:
java.lang.Exception - if files can't be resolved properly

expand

public static java.lang.String expand(java.lang.String pString)
                               throws java.lang.Exception
expands all System property variables specified in the supplied String using curly braces syntax {...} and returns the resulting String.

Parameters:
String - the string to expand.
Throws:
java.lang.Exception - if a System property resolves to null or if the enclosing braces are not properly matched.

expand

public static java.lang.String expand(java.lang.String pString,
                                      java.util.Properties pPrimaryMapping)
                               throws java.lang.Exception
expands all property variables specified in the supplied String using curly braces syntax {...} and returns the resulting String. Property names inside the curly braces can be either a simple String referring to a Java System property, such as "SystemProperty.X", or can be in AppModuleResource format, such as "appModuleResource?moduleID=MyModule&resource=my/resource/file".

Parameters:
String - the string to expand.
Properties - an optional primary key/value mapping to use for System property substitutions. If param is null, or if mapping not found, then System.getProperties().getProperty(xxx) is used.
Returns:
String the expanded string.
Throws:
java.lang.Exception - if a System or AppModuleResource property resolves to null or if the enclosing braces are not properly matched.

setAtgDynamoProductModule

public static void setAtgDynamoProductModule(java.lang.String pModule)
specifies the name of the ATG Dynamo product module that will be loaded if Dynamo is being used.


getAtgDynamoProductModule

public static java.lang.String getAtgDynamoProductModule()
returns the name of the ATG Dynamo product module that will be loaded if Dynamo is being used.


getAtgDynamoModule

public static atg.applauncher.AppModule getAtgDynamoModule()
returns an AppModule corresponding to the ATG Dynamo if that product is loaded. If it isn't loaded then returns null.


setAtgJ2eeServerProductModule

public static void setAtgJ2eeServerProductModule(java.lang.String pModule)
specifies the name of the ATG J2EE Server product module that will be loaded if ATG's J2EE Server is being used.


getAtgJ2eeServerProductModule

public static java.lang.String getAtgJ2eeServerProductModule()
returns the name of the ATG J2EE Server product module that will be loaded if ATG's J2EE Server is being used.


getAtgJ2eeServerModule

public static atg.applauncher.AppModule getAtgJ2eeServerModule()
returns an AppModule corresponding to the ATG J2EE Server if that product is loaded. If it isn't loaded then returns null.


setApplicationProductModules

public void setApplicationProductModules(java.lang.String[] pModules)
specifies the names of possible application product modules that may be installed in Dyanmo. used to help report on which application modules are running.


getApplicationProductModules

public java.lang.String[] getApplicationProductModules()
returns the names of possible application product modules that may be installed in Dyanmo. used to help report on which application modules are running. NOTE: This method should not be called. It is only provided so we can specify application modules in a .properties file. Java classes should call method getApplicationModules().


getApplicationModules

public static atg.applauncher.AppModule[] getApplicationModules()
returns an array of AppModule items corresponding to the currently running application products.


getModuleResourceFile

public static java.io.File getModuleResourceFile(java.lang.String pModuleName,
                                                 java.lang.String pResourceURI)
Retrieves a File resource from a Dynamo Module. Note that the module does not need to be started, it simply has to be installed in the Dynamo. Returned file is not verified to exist.

Parameters:
String - pModuleName the name of the Dynamo module to look in. e.g. "SystemTests.JSPTest"
String - pResourceURI the URI of the File to get from the module. e.g. "mite.xml"
Returns:
File the requested file.

resolveAppModuleResourceReference

public static java.io.File resolveAppModuleResourceReference(java.lang.String pReference)
Resolves an appModuleResource reference by parsing the string into its constituent ModuleID and ResourceURI.

Parameters:
String - pReference The AppModuleResource reference to resolve. Expected to be of format:
appModuleResource?moduleID=moduleID&resourceURI=some/URI
Returns:
File the referenced module resource.
Throws:
java.lang.IllegalArgumentException - if the specified reference does not have the proper structure.

getManifestInfo

public static java.lang.String getManifestInfo(atg.applauncher.AppModule pModule,
                                               java.lang.String pEntry)
Retrieves a piece of information from the MANIFEST of the supplied AppModule. Returns null if the specified information can't be found.


log

public static void log(java.lang.String pMessage)
Logs a message using Nucleus.logInfo() if Nucleus is available. Otherwise it logs using log.info()

Parameters:
pMessage -

getManifestInfo

public static java.lang.String getManifestInfo(java.util.jar.Manifest pManifest,
                                               java.lang.String pEntry)
Retrieves a piece of information from the specified Manifest file. Returns null if the specified information can't be found.


getAtgVersion

public static java.lang.String getAtgVersion(atg.applauncher.AppModule pModule)
Returns the ATG product version ("ATG-Version") of the specified module. Returns UNKNOWN_INFO if the product version can't be determined.


getAtgBuildNumber

public static java.lang.String getAtgBuildNumber(atg.applauncher.AppModule pModule)
Returns the ATG product build number ("ATG-Build") of the specified module. Returns UNKNOWN_INFO if the build number can't be determined.


getAtgPatchVersion

public static java.lang.String getAtgPatchVersion(atg.applauncher.AppModule pModule)
Returns the ATG patch version ("ATG-Patch-Version") of the specified module. Returns null if the module's version can be determined, but a patch version can't. Returns UNKNOWN_INFO if neither the product or patch version can be determined.


getAtgPatchBuildNumber

public static java.lang.String getAtgPatchBuildNumber(atg.applauncher.AppModule pModule)
Returns the ATG patch build number ("ATG-Patch-Build") of the specified module. Returns null if the module's build number can be determined, but a patch build number can't. Returns UNKNOWN_INFO if neither the product or patch build number can be determined.


getAtgFullVersion

public static java.lang.String getAtgFullVersion(atg.applauncher.AppModule pModule)
Returns the ATG full product version ("ATG-Version-Full") of the specified module. Returns UNKNOWN_INFO if the full product version can't be determined.


isBigEar

public static boolean isBigEar()
Returns true if Dynamo is running as BigEar; otherwise returns false.


isBigEarStandalone

public static boolean isBigEarStandalone()
Returns true if Dynamo is running as BigEar in standalone mode; otherwise returns false.


isLiveconfig

public static boolean isLiveconfig()
Returns true is Dynamo is running with liveconfig enabled; otherwise returns false.


invokeMethod

public static java.lang.Object invokeMethod(java.lang.Object pObj,
                                            java.lang.String pMethodName,
                                            java.lang.Class<?>[] pSignature,
                                            java.lang.Object[] pParams,
                                            java.lang.Object pDefault)


Copyright © 2009. All Rights Reserved.