Package dev.galasa.zosliberty
Interface IZosLibertyServer
public interface IZosLibertyServer
Represents a zOS Liberty server
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFeature(String feature) Convenience method to add a feature to the Liberty serverserver.xmlvoidbuild()Builds the the Liberty server on the zOS UNIX file system from any objects that have been created such as the server.xmlvoidConvenience method to checkpoint the known Liberty server logs, i.e.voidClear the contents of the Liberty servers logs directoryintcreate()Create a Liberty server using theserver createcommandvoiddelete()Delete the Liberty server files and directoriesvoiddeployApplication(Class<?> testClass, String path, String targetLocation, IZosLibertyServer.ApplicationType type, String name, String contextRoot) Deploy an application to the Liberty server.voiddeployApplicationToDropins(Class<?> testClass, String path) Deploy an application to the Liberty server dropins directory.Get the Liberty server dropins directoryGet the JAVA_HOME value for this Liberty serverReturns the keystore file for this Liberty servergetLogs()Get the contents of the Liberty servers logs directoryGet the Liberty server logs directoryReturns the Liberty Server Configuration Directory${server.config.app.dir}as aIZosUNIXFileobjectReturns the Liberty Server NameReturns the Liberty Server Output Directory${server.output.dir}as aIZosUNIXFileobjectGet the server.xml object for this Liberty serverReturns the Liberty Shared Application Directory${shared.app.dir}as aIZosUNIXFileobjectReturns the Liberty Shared Configuration Directory${shared.config.dir}as aIZosUNIXFileobjectReturns the Liberty Shared Resources Directory${shared.resources.dir}as aIZosUNIXFileobjectReturns the Liberty versionReturns the Liberty Install Directory${WLP_INSTALL_DIR}as aIZosUNIXFileobjectReturns the Liberty Output Directory${WLP_OUTPUT_DIR}as aIZosUNIXFileobjectReturns the Liberty User Directory${WLP_USER_DIR}as aIZosUNIXFileobjectGet the zOS Image for this Liberty serverConvenience method to list the current features listed in thefeatureManagerelement in the Liberty serverserver.xmlLoad the content of the Liberty server.xml from the file system into the internalIZosLibertyServerXmlobjectvoidremoveApplication(String name) Remove an application from the Liberty server.voidremoveApplicationFromDropins(String fileName) Remove an application from the Liberty server dropins directory.voidremoveFeature(String feature) Convenience method remove a feature from the Liberty serverserver.xmlGet the current contents of the Liberty servermessages.logas aStringGet the current contents of the Liberty servermessages.logas aStringsince the last checkpointGet the current contents of the Liberty servertrace.logas aStringGet the current contents of the Liberty servertrace.logas aStringsince the last checkpointintrun()Run the Liberty server as a zOS batch jobvoidStore the content of the Liberty server logs and configuration to the default location in the Results Archive StorevoidsaveToResultsArchive(String rasPath) Store the content of the Liberty server logs and configuration to the Results Archive StoresecurityUtilityEncode(String password) Use the Liberty securityUtility command to encode a passwordsecurityUtilityGenerateKeystore(String password) Use the Liberty securityUtility to create a new keyStorevoidsetDefaultHttpEndpoint(String host, int httpPort, int httpsPort) Convenience method to create or replace thedefaultHttpEndpointelement in the Liberty serverserver.xmlvoidsetJavaHome(String javaHome) Set the value of JAVA_HOME for this Liberty servervoidsetServerName(String serverName) Provides the Liberty Server NamevoidsetServerXml(IZosLibertyServerXml serverXml) Set the server.xml object for this Liberty servervoidsetWlpInstallDir(String wlpInstallDir) Provides the location of the Liberty Install Directory${WLP_INSTALL_DIR}voidsetWlpOutputDir(String wlpOutputDir) Provides the location of the Liberty Output Directory${WLP_OUTPUT_DIR}voidsetWlpUserDir(String wlpUserDir) Provides the location of the Liberty User Directory${WLP_USER_DIR}intstart()Start the Liberty server using theserver startcommandintstatus()Get the Liberty sever status using theserver statuscommandintstop()Stop the Liberty serverbooleanWait for an application to start using the default timeout by looking forCWWKZ0001Imessage in messages.log.booleanwaitForApplicationStart(String name, int timeout) Wait for an application to start using the supplied timeout by looking forCWWKZ0001Imessage in messages.log.booleanwaitForApplicationStop(String name) Wait for an application to stop using the default timeout by looking forCWWKZ0009Imessage in messages.log.booleanwaitForApplicationStop(String name, int timeout) If themessages.loghas not been check-pointed, the whole file will be searched.intWait for the Liberty server to start using the default timeoutintwaitForStart(int timeout) Wait for the Liberty server to start using the supplied timeoutbooleanWait for the Liberty server to issue theCWWKF0011Imessage to themessages.logusing the default timeoutbooleanwaitForStartMessage(int timeout) Wait for the Liberty server to issue theCWWKF0011Imessage to themessages.logusing the supplied timeoutintWait for the Liberty server to stop using the default timeoutintwaitForStop(int timeout) Wait for the Liberty server to stop using the supplied timeoutbooleanWait for the Liberty server to issue theCWWKE0036Imessage to themessages.logusing the default timeoutbooleanwaitForStopMessage(int timeout) Wait for the Liberty server to issue theCWWKE0036Imessage to themessages.logusing the supplied timeout
-
Method Details
-
setServerName
Provides the Liberty Server Name- Parameters:
serverName-- Throws:
ZosLibertyServerException
-
setWlpInstallDir
Provides the location of the Liberty Install Directory${WLP_INSTALL_DIR}- Parameters:
wlpInstallDir-- Throws:
ZosLibertyServerException
-
setWlpUserDir
Provides the location of the Liberty User Directory${WLP_USER_DIR}- Parameters:
wlpUserDir-- Throws:
ZosLibertyServerException
-
setWlpOutputDir
Provides the location of the Liberty Output Directory${WLP_OUTPUT_DIR}- Parameters:
wlpOutputDir-- Throws:
ZosLibertyServerException
-
setJavaHome
Set the value of JAVA_HOME for this Liberty server- Parameters:
javaHome-- Throws:
ZosLibertyServerException
-
getVersion
Returns the Liberty version- Returns:
- Liberty version
- Throws:
ZosLibertyServerException
-
getServerName
String getServerName()Returns the Liberty Server Name- Returns:
- the Liberty Server Name
-
getWlpInstallDir
Returns the Liberty Install Directory${WLP_INSTALL_DIR}as aIZosUNIXFileobject- Returns:
- the Liberty Install Directory
- Throws:
ZosLibertyServerException
-
getWlpUserDir
Returns the Liberty User Directory${WLP_USER_DIR}as aIZosUNIXFileobject- Returns:
- the Liberty User Directory
- Throws:
ZosLibertyServerException
-
getWlpOutputDir
Returns the Liberty Output Directory${WLP_OUTPUT_DIR}as aIZosUNIXFileobject- Returns:
- the Liberty Output Directory
- Throws:
ZosLibertyServerException
-
getServerConfigDir
Returns the Liberty Server Configuration Directory${server.config.app.dir}as aIZosUNIXFileobject- Returns:
- the Liberty Server Configuration Directory
- Throws:
ZosLibertyServerException
-
getServerOutputDir
Returns the Liberty Server Output Directory${server.output.dir}as aIZosUNIXFileobject- Returns:
- the Liberty Server Output Directory
- Throws:
ZosLibertyServerException
-
getLogsDirectory
Get the Liberty server logs directory- Returns:
- the Liberty server logs directory
- Throws:
ZosLibertyServerException
-
getDropinsDir
Get the Liberty server dropins directory- Returns:
- the dropins directory
- Throws:
ZosLibertyServerException
-
getJavaHome
Get the JAVA_HOME value for this Liberty server- Returns:
- Throws:
ZosLibertyServerException
-
getZosImage
IZosImage getZosImage()Get the zOS Image for this Liberty server- Returns:
-
setServerXml
Set the server.xml object for this Liberty server- Parameters:
serverXml- theIZosLibertyServerXmlserver.xml object- Throws:
ZosLibertyServerException
-
getServerXml
Get the server.xml object for this Liberty server- Returns:
- the server.xml
- Throws:
ZosLibertyServerException
-
loadServerXmlFromFileSystem
Load the content of the Liberty server.xml from the file system into the internalIZosLibertyServerXmlobject- Returns:
- the server.xml
- Throws:
ZosLibertyServerException
-
getLogs
Get the contents of the Liberty servers logs directory- Returns:
- the Liberty server logs
- Throws:
ZosLibertyServerException
-
clearLogs
Clear the contents of the Liberty servers logs directory- Throws:
ZosLibertyServerException
-
checkpointLogs
Convenience method to checkpoint the known Liberty server logs, i.e.messages.logandtrace.log- Throws:
ZosLibertyServerException
-
retrieveMessagesLog
Get the current contents of the Liberty servermessages.logas aString- Returns:
- the content of the
messages.logornullif the file does not exist - Throws:
ZosLibertyServerException
-
retrieveTraceLog
Get the current contents of the Liberty servertrace.logas aString- Returns:
- the content of the
messages.logornullif the file does not exist - Throws:
ZosLibertyServerException
-
retrieveMessagesLogSinceCheckpoint
Get the current contents of the Liberty servermessages.logas aStringsince the last checkpoint- Returns:
- the content of the
messages.log - Throws:
ZosLibertyServerException
-
retrieveTraceLogSinceCheckpoint
Get the current contents of the Liberty servertrace.logas aStringsince the last checkpoint- Returns:
- the content of the
messages.log - Throws:
ZosLibertyServerException
-
build
Builds the the Liberty server on the zOS UNIX file system from any objects that have been created such as the server.xml- Throws:
ZosLibertyServerException
-
create
Create a Liberty server using theserver createcommand- Returns:
servercommand return code- Throws:
ZosLibertyServerException
-
start
Start the Liberty server using theserver startcommand- Returns:
servercommand return code- Throws:
ZosLibertyServerException
-
run
Run the Liberty server as a zOS batch job- Returns:
servercommand return code- Throws:
ZosLibertyServerException
-
waitForStart
Wait for the Liberty server to start using the default timeout- Returns:
- the return code from the
server statuscommand - Throws:
ZosLibertyServerException
-
waitForStart
Wait for the Liberty server to start using the supplied timeout- Parameters:
timeout- the timeout in seconds- Returns:
- the return code from the
server statuscommand - Throws:
ZosLibertyServerException
-
waitForStartMessage
Wait for the Liberty server to issue theCWWKF0011Imessage to themessages.logusing the default timeout- Returns:
- true if message was found in log
- Throws:
ZosLibertyServerException
-
waitForStartMessage
Wait for the Liberty server to issue theCWWKF0011Imessage to themessages.logusing the supplied timeout- Parameters:
timeout- the timeout in seconds- Returns:
- true if message was found in log
- Throws:
ZosLibertyServerException
-
stop
Stop the Liberty server- Returns:
- the return code from the
server statuscommand - Throws:
ZosLibertyServerException
-
waitForStop
Wait for the Liberty server to stop using the default timeout- Returns:
- the return code from the
server statuscommand - Throws:
ZosLibertyServerException
-
waitForStop
Wait for the Liberty server to stop using the supplied timeout- Parameters:
timeout- the timeout in seconds- Returns:
- the return code from the
server statuscommand - Throws:
ZosLibertyServerException
-
waitForStopMessage
Wait for the Liberty server to issue theCWWKE0036Imessage to themessages.logusing the default timeout- Returns:
- true if message was found in log
- Throws:
ZosLibertyServerException
-
waitForStopMessage
Wait for the Liberty server to issue theCWWKE0036Imessage to themessages.logusing the supplied timeout- Parameters:
timeout- the timeout in seconds- Returns:
- true if message was found in log
- Throws:
ZosLibertyServerException
-
status
Get the Liberty sever status using theserver statuscommand- Returns:
- the return code from the
server statuscommand - Throws:
ZosLibertyServerException
-
delete
Delete the Liberty server files and directories- Throws:
ZosLibertyServerException
-
setDefaultHttpEndpoint
void setDefaultHttpEndpoint(String host, int httpPort, int httpsPort) throws ZosLibertyServerException Convenience method to create or replace thedefaultHttpEndpointelement in the Liberty serverserver.xmlNOTE: This method loads the
server.xmlfrom the file system, updates the XML and stores it back on the file system- Parameters:
host- the value for thehostproperty. The property will not be set when the value is nullhttpPort- the value of thehttpPortproperty. The property will not be set when the value less than 0httpsPort- the value of thehttpPortsproperty. The property will not be set when the value less than 0- Throws:
ZosLibertyServerException
-
listFeatures
Convenience method to list the current features listed in thefeatureManagerelement in the Liberty serverserver.xmlNOTE: This method loads the
server.xmlfrom the file system- Returns:
- a list of features
- Throws:
ZosLibertyServerException
-
addFeature
Convenience method to add a feature to the Liberty serverserver.xmlNOTE: This method loads the
server.xmlfrom the file system, updates the XML and stores it back on the file system- Parameters:
feature- the feature to add- Throws:
ZosLibertyServerException
-
removeFeature
Convenience method remove a feature from the Liberty serverserver.xmlNOTE: This method loads the
server.xmlfrom the file system, updates the XML and stores it back on the file system- Parameters:
feature- the feature to remove- Throws:
ZosLibertyServerException
-
deployApplication
void deployApplication(Class<?> testClass, String path, String targetLocation, IZosLibertyServer.ApplicationType type, String name, String contextRoot) throws ZosLibertyServerException Deploy an application to the Liberty server. This method copies the application archive file to the zOS UNIX file system and creates anapplicationelement in the server.xml.- Parameters:
testClass- a class in the same bundle containing the application archive file, usethis.getClass()path- the path in the bundle to the application archive filetargetLocation- the location on the zOS UNIX file system to store the application archive file. If the value is null,${shared.app.dir}/fileNamewill be usedtype- the application typeIZosLibertyServer.ApplicationTypename- the name of the applicationcontextRoot- the application context-root. Can be null- Throws:
ZosLibertyServerException
-
deployApplicationToDropins
Deploy an application to the Liberty server dropins directory. This method copies the application archive file to the Liberty server dropins directory- Parameters:
testClass- a class in the same bundle containing the application archive file, usethis.getClass()path- the path in the bundle to the application archive file- Throws:
ZosLibertyServerException
-
removeApplication
Remove an application from the Liberty server. This method removes theapplicationfrom the server.xml and deletes the application archive file from the zOS UNIX file system. Set name tonullto remove all applications from dropins- Parameters:
name- the application name- Throws:
ZosLibertyServerException
-
removeApplicationFromDropins
Remove an application from the Liberty server dropins directory. Set fileName tonullto remove all applications from dropins- Parameters:
fileName- the name of the file in the dropins directory- Throws:
ZosLibertyServerException
-
waitForApplicationStart
Wait for an application to start using the default timeout by looking forCWWKZ0001Imessage in messages.log. If themessages.loghas not been check-pointed, the whole file will be searched.- Parameters:
name- the application name- Returns:
- true if application has started within the timeout
- Throws:
ZosLibertyServerException
-
waitForApplicationStart
Wait for an application to start using the supplied timeout by looking forCWWKZ0001Imessage in messages.log. If themessages.loghas not been check-pointed, the whole file will be searched.- Parameters:
name- the application nametimeout- the timeout in seconds- Returns:
- true if application has stopped within the timeout
- Throws:
ZosLibertyServerException
-
waitForApplicationStop
Wait for an application to stop using the default timeout by looking forCWWKZ0009Imessage in messages.log. If themessages.loghas not been check-pointed, the whole file will be searched.- Parameters:
name- the application name- Returns:
- true if application has started within the timeout
- Throws:
ZosLibertyServerException
-
waitForApplicationStop
If themessages.loghas not been check-pointed, the whole file will be searched.- Parameters:
name- the application nametimeout- the timeout in seconds- Returns:
- true if application has stopped within the timeout
- Throws:
ZosLibertyServerException
-
getKeystoreFile
Returns the keystore file for this Liberty server- Returns:
- the Liberty
key.p12orkey.jkskeystore file. Will returnnullif the file does not exist. - Throws:
ZosLibertyServerException
-
securityUtilityEncode
Use the Liberty securityUtility command to encode a password- Parameters:
password- the password to encode- Returns:
- the encoded password
- Throws:
ZosLibertyServerException
-
securityUtilityGenerateKeystore
Use the Liberty securityUtility to create a new keyStore- Parameters:
password- the password used to create the certificate/keystore- Returns:
- the new keystore file
- Throws:
ZosLibertyServerException
-
saveToResultsArchive
Store the content of the Liberty server logs and configuration to the default location in the Results Archive Store- Throws:
ZosLibertyServerException
-
saveToResultsArchive
Store the content of the Liberty server logs and configuration to the Results Archive Store- Parameters:
rasPath- path in Results Archive Store- Throws:
ZosLibertyServerException
-